repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
ramrod-project/database-brain
schema/brain/binary/decorators.py
_perform_chunking
def _perform_chunking(func_, *args, **kwargs): """ internal function alled only by wrap_split_big_content performs the actual chunking. :param func_: :param args: :param kwargs: :return: <dict> RethinkDB dict from insert """ obj_dict = args[0] start_point = 0 file_count...
python
def _perform_chunking(func_, *args, **kwargs): """ internal function alled only by wrap_split_big_content performs the actual chunking. :param func_: :param args: :param kwargs: :return: <dict> RethinkDB dict from insert """ obj_dict = args[0] start_point = 0 file_count...
[ "def", "_perform_chunking", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "obj_dict", "=", "args", "[", "0", "]", "start_point", "=", "0", "file_count", "=", "0", "new_dict", "=", "{", "}", "resp_dict", "=", "Counter", "(", "{", ...
internal function alled only by wrap_split_big_content performs the actual chunking. :param func_: :param args: :param kwargs: :return: <dict> RethinkDB dict from insert
[ "internal", "function", "alled", "only", "by", "wrap_split_big_content" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/decorators.py#L78-L118
ramrod-project/database-brain
schema/brain/binary/decorators.py
wrap_guess_content_type
def wrap_guess_content_type(func_, *args, **kwargs): """ guesses the content type with libmagic if available :param func_: :param args: :param kwargs: :return: """ assert isinstance(args[0], dict) if not args[0].get(CONTENTTYPE_FIELD, None): content = args[0].get(CONTENT_FIEL...
python
def wrap_guess_content_type(func_, *args, **kwargs): """ guesses the content type with libmagic if available :param func_: :param args: :param kwargs: :return: """ assert isinstance(args[0], dict) if not args[0].get(CONTENTTYPE_FIELD, None): content = args[0].get(CONTENT_FIEL...
[ "def", "wrap_guess_content_type", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "args", "[", "0", "]", ",", "dict", ")", "if", "not", "args", "[", "0", "]", ".", "get", "(", "CONTENTTYPE_FIELD", ",", ...
guesses the content type with libmagic if available :param func_: :param args: :param kwargs: :return:
[ "guesses", "the", "content", "type", "with", "libmagic", "if", "available", ":", "param", "func_", ":", ":", "param", "args", ":", ":", "param", "kwargs", ":", ":", "return", ":" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/decorators.py#L122-L137
ramrod-project/database-brain
schema/brain/binary/decorators.py
wrap_content_as_binary_if_needed
def wrap_content_as_binary_if_needed(func_, *args, **kwargs): """ destination (rethinkdb) needs the id field as primary key put the Name field into the ID field :param func_: :param args: :param kwargs: :return: """ assert isinstance(args[0], dict) try: args[0][CONTENT_FI...
python
def wrap_content_as_binary_if_needed(func_, *args, **kwargs): """ destination (rethinkdb) needs the id field as primary key put the Name field into the ID field :param func_: :param args: :param kwargs: :return: """ assert isinstance(args[0], dict) try: args[0][CONTENT_FI...
[ "def", "wrap_content_as_binary_if_needed", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "args", "[", "0", "]", ",", "dict", ")", "try", ":", "args", "[", "0", "]", "[", "CONTENT_FIELD", "]", "=", "BI...
destination (rethinkdb) needs the id field as primary key put the Name field into the ID field :param func_: :param args: :param kwargs: :return:
[ "destination", "(", "rethinkdb", ")", "needs", "the", "id", "field", "as", "primary", "key", "put", "the", "Name", "field", "into", "the", "ID", "field", ":", "param", "func_", ":", ":", "param", "args", ":", ":", "param", "kwargs", ":", ":", "return",...
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/decorators.py#L141-L155
henrysher/kotocore
kotocore/utils/import_utils.py
import_class
def import_class(import_path): """ Imports a class dynamically from a full import path. """ if not '.' in import_path: raise IncorrectImportPath( "Invalid Python-style import path provided: {0}.".format( import_path ) ) path_bits = import_path...
python
def import_class(import_path): """ Imports a class dynamically from a full import path. """ if not '.' in import_path: raise IncorrectImportPath( "Invalid Python-style import path provided: {0}.".format( import_path ) ) path_bits = import_path...
[ "def", "import_class", "(", "import_path", ")", ":", "if", "not", "'.'", "in", "import_path", ":", "raise", "IncorrectImportPath", "(", "\"Invalid Python-style import path provided: {0}.\"", ".", "format", "(", "import_path", ")", ")", "path_bits", "=", "import_path",...
Imports a class dynamically from a full import path.
[ "Imports", "a", "class", "dynamically", "from", "a", "full", "import", "path", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/utils/import_utils.py#L6-L38
spookey/photon
photon/tools/ping.py
Ping.probe
def probe(self, hosts): ''' .. seealso:: :attr:`probe` ''' def __send_probe(host): ping = self.m( '', cmdd=dict( cmd=' '.join([ self.__ping_cmd, self.__num, ...
python
def probe(self, hosts): ''' .. seealso:: :attr:`probe` ''' def __send_probe(host): ping = self.m( '', cmdd=dict( cmd=' '.join([ self.__ping_cmd, self.__num, ...
[ "def", "probe", "(", "self", ",", "hosts", ")", ":", "def", "__send_probe", "(", "host", ")", ":", "ping", "=", "self", ".", "m", "(", "''", ",", "cmdd", "=", "dict", "(", "cmd", "=", "' '", ".", "join", "(", "[", "self", ".", "__ping_cmd", ","...
.. seealso:: :attr:`probe`
[ "..", "seealso", "::", ":", "attr", ":", "probe" ]
train
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/tools/ping.py#L95-L144
spookey/photon
photon/tools/ping.py
Ping.status
def status(self): ''' :returns: A dictionary with the following: * 'num': Total number of hosts already probed * 'up': Number of hosts up * 'down': Number of hosts down * 'ratio': Ratio between 'up'/'down' as float Ratio: * ``100%`` up == `1...
python
def status(self): ''' :returns: A dictionary with the following: * 'num': Total number of hosts already probed * 'up': Number of hosts up * 'down': Number of hosts down * 'ratio': Ratio between 'up'/'down' as float Ratio: * ``100%`` up == `1...
[ "def", "status", "(", "self", ")", ":", "num", "=", "len", "(", "self", ".", "probe", ")", "up", "=", "len", "(", "[", "h", "for", "h", "in", "self", ".", "probe", "if", "self", ".", "probe", "[", "h", "]", "[", "'up'", "]", "]", ")", "rati...
:returns: A dictionary with the following: * 'num': Total number of hosts already probed * 'up': Number of hosts up * 'down': Number of hosts down * 'ratio': Ratio between 'up'/'down' as float Ratio: * ``100%`` up == `1.0` * ``10%`` up == `0.1` ...
[ ":", "returns", ":", "A", "dictionary", "with", "the", "following", ":" ]
train
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/tools/ping.py#L147-L168
uw-it-aca/uw-restclients-hfs
uw_hfs/idcard.py
get_hfs_accounts
def get_hfs_accounts(netid): """ Return a restclients.models.hfs.HfsAccounts object on the given uwnetid """ url = ACCOUNTS_URL.format(uwnetid=netid) response = get_resource(url) return _object_from_json(response)
python
def get_hfs_accounts(netid): """ Return a restclients.models.hfs.HfsAccounts object on the given uwnetid """ url = ACCOUNTS_URL.format(uwnetid=netid) response = get_resource(url) return _object_from_json(response)
[ "def", "get_hfs_accounts", "(", "netid", ")", ":", "url", "=", "ACCOUNTS_URL", ".", "format", "(", "uwnetid", "=", "netid", ")", "response", "=", "get_resource", "(", "url", ")", "return", "_object_from_json", "(", "response", ")" ]
Return a restclients.models.hfs.HfsAccounts object on the given uwnetid
[ "Return", "a", "restclients", ".", "models", ".", "hfs", ".", "HfsAccounts", "object", "on", "the", "given", "uwnetid" ]
train
https://github.com/uw-it-aca/uw-restclients-hfs/blob/685c3b16280d9e8b11b0d295c8852fa876f55ad0/uw_hfs/idcard.py#L19-L25
OldhamMade/PySO8601
PySO8601/utility.py
_timedelta_from_elements
def _timedelta_from_elements(elements): """ Return a timedelta from a dict of date elements. Accepts a dict containing any of the following: - years - months - days - hours - minutes - seconds If years and/or months are provided, it will use a naive calcuation o...
python
def _timedelta_from_elements(elements): """ Return a timedelta from a dict of date elements. Accepts a dict containing any of the following: - years - months - days - hours - minutes - seconds If years and/or months are provided, it will use a naive calcuation o...
[ "def", "_timedelta_from_elements", "(", "elements", ")", ":", "days", "=", "sum", "(", "(", "elements", "[", "'days'", "]", ",", "_months_to_days", "(", "elements", ".", "get", "(", "'months'", ",", "0", ")", ")", ",", "_years_to_days", "(", "elements", ...
Return a timedelta from a dict of date elements. Accepts a dict containing any of the following: - years - months - days - hours - minutes - seconds If years and/or months are provided, it will use a naive calcuation of 365 days in a year and 30 days in a month.
[ "Return", "a", "timedelta", "from", "a", "dict", "of", "date", "elements", "." ]
train
https://github.com/OldhamMade/PySO8601/blob/b7d3b3cb3ed3e12eb2a21caa26a3abeab3c96fe4/PySO8601/utility.py#L28-L52
OldhamMade/PySO8601
PySO8601/utility.py
_year_month_delta_from_elements
def _year_month_delta_from_elements(elements): """ Return a tuple of (years, months) from a dict of date elements. Accepts a dict containing any of the following: - years - months Example: >>> _year_month_delta_from_elements({'years': 2, 'months': 14}) (3, 2) """ return di...
python
def _year_month_delta_from_elements(elements): """ Return a tuple of (years, months) from a dict of date elements. Accepts a dict containing any of the following: - years - months Example: >>> _year_month_delta_from_elements({'years': 2, 'months': 14}) (3, 2) """ return di...
[ "def", "_year_month_delta_from_elements", "(", "elements", ")", ":", "return", "divmod", "(", "(", "int", "(", "elements", ".", "get", "(", "'years'", ",", "0", ")", ")", "*", "MONTHS_IN_YEAR", ")", "+", "elements", ".", "get", "(", "'months'", ",", "0",...
Return a tuple of (years, months) from a dict of date elements. Accepts a dict containing any of the following: - years - months Example: >>> _year_month_delta_from_elements({'years': 2, 'months': 14}) (3, 2)
[ "Return", "a", "tuple", "of", "(", "years", "months", ")", "from", "a", "dict", "of", "date", "elements", "." ]
train
https://github.com/OldhamMade/PySO8601/blob/b7d3b3cb3ed3e12eb2a21caa26a3abeab3c96fe4/PySO8601/utility.py#L55-L72
laysakura/relshell
relshell/batch.py
Batch.next
def next(self): """Return one of record in this batch in out-of-order. :raises: `StopIteration` when no more record is in this batch """ if self._records_iter >= len(self._records): raise StopIteration self._records_iter += 1 return self._records[self._record...
python
def next(self): """Return one of record in this batch in out-of-order. :raises: `StopIteration` when no more record is in this batch """ if self._records_iter >= len(self._records): raise StopIteration self._records_iter += 1 return self._records[self._record...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "_records_iter", ">=", "len", "(", "self", ".", "_records", ")", ":", "raise", "StopIteration", "self", ".", "_records_iter", "+=", "1", "return", "self", ".", "_records", "[", "self", ".", "_rec...
Return one of record in this batch in out-of-order. :raises: `StopIteration` when no more record is in this batch
[ "Return", "one", "of", "record", "in", "this", "batch", "in", "out", "-", "of", "-", "order", "." ]
train
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch.py#L39-L47
laysakura/relshell
relshell/batch.py
Batch.formatted_str
def formatted_str(self, format): """Return formatted str. :param format: one of 'json', 'csv' are supported """ assert(format in ('json', 'csv')) ret_str_list = [] for rec in self._records: if format == 'json': ret_str_list.append('{') ...
python
def formatted_str(self, format): """Return formatted str. :param format: one of 'json', 'csv' are supported """ assert(format in ('json', 'csv')) ret_str_list = [] for rec in self._records: if format == 'json': ret_str_list.append('{') ...
[ "def", "formatted_str", "(", "self", ",", "format", ")", ":", "assert", "(", "format", "in", "(", "'json'", ",", "'csv'", ")", ")", "ret_str_list", "=", "[", "]", "for", "rec", "in", "self", ".", "_records", ":", "if", "format", "==", "'json'", ":", ...
Return formatted str. :param format: one of 'json', 'csv' are supported
[ "Return", "formatted", "str", "." ]
train
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch.py#L52-L77
rochacbruno/shiftpy
shiftpy/wsgi_utils.py
envify
def envify(app=None, add_repo_to_path=True): """ This will simply activate virtualenv on openshift ans returs the app in a wsgi.py or app.py in your openshift python web app - wsgi.py from shiftpy.wsgi_utils import envify from myproject import app # wsgi expects an object named 'application...
python
def envify(app=None, add_repo_to_path=True): """ This will simply activate virtualenv on openshift ans returs the app in a wsgi.py or app.py in your openshift python web app - wsgi.py from shiftpy.wsgi_utils import envify from myproject import app # wsgi expects an object named 'application...
[ "def", "envify", "(", "app", "=", "None", ",", "add_repo_to_path", "=", "True", ")", ":", "if", "getvar", "(", "'HOMEDIR'", ")", ":", "if", "add_repo_to_path", ":", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "join", "(", "getvar"...
This will simply activate virtualenv on openshift ans returs the app in a wsgi.py or app.py in your openshift python web app - wsgi.py from shiftpy.wsgi_utils import envify from myproject import app # wsgi expects an object named 'application' application = envify(app)
[ "This", "will", "simply", "activate", "virtualenv", "on", "openshift", "ans", "returs", "the", "app" ]
train
https://github.com/rochacbruno/shiftpy/blob/6bffccf511f24b7e53dcfee9807e0e3388aa823a/shiftpy/wsgi_utils.py#L7-L38
pglass/nose-blacklist
noseblacklist/plugin.py
BlacklistPlugin._read_file
def _read_file(self, filename): """Return the lines from the given file, ignoring lines that start with comments""" result = [] with open(filename, 'r') as f: lines = f.read().split('\n') for line in lines: nocomment = line.strip().split('#')[0].st...
python
def _read_file(self, filename): """Return the lines from the given file, ignoring lines that start with comments""" result = [] with open(filename, 'r') as f: lines = f.read().split('\n') for line in lines: nocomment = line.strip().split('#')[0].st...
[ "def", "_read_file", "(", "self", ",", "filename", ")", ":", "result", "=", "[", "]", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "lines", "=", "f", ".", "read", "(", ")", ".", "split", "(", "'\\n'", ")", "for", "line", "i...
Return the lines from the given file, ignoring lines that start with comments
[ "Return", "the", "lines", "from", "the", "given", "file", "ignoring", "lines", "that", "start", "with", "comments" ]
train
https://github.com/pglass/nose-blacklist/blob/68e340ecea45d98e3a5ebf8aa9bf7975146cc20d/noseblacklist/plugin.py#L71-L81
josegomezr/pqb
pqb/queries.py
Select.from_
def from_(self, table, alias=None): """ Establece el origen de datos (y un alias opcionalmente). """ if isinstance(table, str): table = [[table, alias]] self.raw_tables = table return self
python
def from_(self, table, alias=None): """ Establece el origen de datos (y un alias opcionalmente). """ if isinstance(table, str): table = [[table, alias]] self.raw_tables = table return self
[ "def", "from_", "(", "self", ",", "table", ",", "alias", "=", "None", ")", ":", "if", "isinstance", "(", "table", ",", "str", ")", ":", "table", "=", "[", "[", "table", ",", "alias", "]", "]", "self", ".", "raw_tables", "=", "table", "return", "s...
Establece el origen de datos (y un alias opcionalmente).
[ "Establece", "el", "origen", "de", "datos", "(", "y", "un", "alias", "opcionalmente", ")", "." ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L55-L62
josegomezr/pqb
pqb/queries.py
Select.where
def where(self, field, value = None, operator = '='): """ Establece condiciones para la consulta unidas por AND """ if field is None: return self conjunction = None if value is None and isinstance(field, dict): for field, value in field.items(): ...
python
def where(self, field, value = None, operator = '='): """ Establece condiciones para la consulta unidas por AND """ if field is None: return self conjunction = None if value is None and isinstance(field, dict): for field, value in field.items(): ...
[ "def", "where", "(", "self", ",", "field", ",", "value", "=", "None", ",", "operator", "=", "'='", ")", ":", "if", "field", "is", "None", ":", "return", "self", "conjunction", "=", "None", "if", "value", "is", "None", "and", "isinstance", "(", "field...
Establece condiciones para la consulta unidas por AND
[ "Establece", "condiciones", "para", "la", "consulta", "unidas", "por", "AND" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L64-L79
josegomezr/pqb
pqb/queries.py
Select.group_by
def group_by(self, *args): """ Indica los campos para agrupación """ if len(args) == 1: self.raw_fields_group = args[0].split(',') else: self.raw_fields_group = list(args) return self
python
def group_by(self, *args): """ Indica los campos para agrupación """ if len(args) == 1: self.raw_fields_group = args[0].split(',') else: self.raw_fields_group = list(args) return self
[ "def", "group_by", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "self", ".", "raw_fields_group", "=", "args", "[", "0", "]", ".", "split", "(", "','", ")", "else", ":", "self", ".", "raw_fields_group", "...
Indica los campos para agrupación
[ "Indica", "los", "campos", "para", "agrupación" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L98-L106
josegomezr/pqb
pqb/queries.py
Select.order_by
def order_by(self, field, orientation='ASC'): """ Indica los campos y el criterio de ordenamiento """ if isinstance(field, list): self.raw_order_by.append(field) else: self.raw_order_by.append([field, orientation]) return self
python
def order_by(self, field, orientation='ASC'): """ Indica los campos y el criterio de ordenamiento """ if isinstance(field, list): self.raw_order_by.append(field) else: self.raw_order_by.append([field, orientation]) return self
[ "def", "order_by", "(", "self", ",", "field", ",", "orientation", "=", "'ASC'", ")", ":", "if", "isinstance", "(", "field", ",", "list", ")", ":", "self", ".", "raw_order_by", ".", "append", "(", "field", ")", "else", ":", "self", ".", "raw_order_by", ...
Indica los campos y el criterio de ordenamiento
[ "Indica", "los", "campos", "y", "el", "criterio", "de", "ordenamiento" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L108-L117
josegomezr/pqb
pqb/queries.py
Select.result
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) self.__prepareData__() sql = 'SELECT ' sql += ', '.join(self.fields) if len(self.tables) > 0: if prettify: sql...
python
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) self.__prepareData__() sql = 'SELECT ' sql += ', '.join(self.fields) if len(self.tables) > 0: if prettify: sql...
[ "def", "result", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prettify", "=", "kwargs", ".", "get", "(", "'pretty'", ",", "False", ")", "self", ".", "__prepareData__", "(", ")", "sql", "=", "'SELECT '", "sql", "+=", "', '", "....
Construye la consulta SQL
[ "Construye", "la", "consulta", "SQL" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L119-L161
josegomezr/pqb
pqb/queries.py
Delete.where
def where(self, field, value = None, operator = None): """ Establece condiciones para la consulta unidas por AND """ if field is None: return self conjunction = None if value is None and isinstance(field, dict): for f,v in field.items(): ...
python
def where(self, field, value = None, operator = None): """ Establece condiciones para la consulta unidas por AND """ if field is None: return self conjunction = None if value is None and isinstance(field, dict): for f,v in field.items(): ...
[ "def", "where", "(", "self", ",", "field", ",", "value", "=", "None", ",", "operator", "=", "None", ")", ":", "if", "field", "is", "None", ":", "return", "self", "conjunction", "=", "None", "if", "value", "is", "None", "and", "isinstance", "(", "fiel...
Establece condiciones para la consulta unidas por AND
[ "Establece", "condiciones", "para", "la", "consulta", "unidas", "por", "AND" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L187-L204
josegomezr/pqb
pqb/queries.py
Delete.result
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) sql = 'DELETE %s %s' % (self._type, self._class) if prettify: sql += '\n' else: sql += ' ' if self.where_criteria...
python
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) sql = 'DELETE %s %s' % (self._type, self._class) if prettify: sql += '\n' else: sql += ' ' if self.where_criteria...
[ "def", "result", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prettify", "=", "kwargs", ".", "get", "(", "'pretty'", ",", "False", ")", "sql", "=", "'DELETE %s %s'", "%", "(", "self", ".", "_type", ",", "self", ".", "_class", ...
Construye la consulta SQL
[ "Construye", "la", "consulta", "SQL" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L225-L246
josegomezr/pqb
pqb/queries.py
Create.from_
def from_(self, From): """ [Edge-only] especifica el origen del lado """ if self._type.lower() != 'edge': raise ValueError('Cannot set From/To to non-edge objects') self._from = From return self
python
def from_(self, From): """ [Edge-only] especifica el origen del lado """ if self._type.lower() != 'edge': raise ValueError('Cannot set From/To to non-edge objects') self._from = From return self
[ "def", "from_", "(", "self", ",", "From", ")", ":", "if", "self", ".", "_type", ".", "lower", "(", ")", "!=", "'edge'", ":", "raise", "ValueError", "(", "'Cannot set From/To to non-edge objects'", ")", "self", ".", "_from", "=", "From", "return", "self" ]
[Edge-only] especifica el origen del lado
[ "[", "Edge", "-", "only", "]", "especifica", "el", "origen", "del", "lado" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L278-L285
josegomezr/pqb
pqb/queries.py
Create.to
def to(self, to): """ [Edge-only] especifica el destino del lado """ if self._type.lower() != 'edge': raise ValueError('Cannot set From/To to non-edge objects') self._to = to return self
python
def to(self, to): """ [Edge-only] especifica el destino del lado """ if self._type.lower() != 'edge': raise ValueError('Cannot set From/To to non-edge objects') self._to = to return self
[ "def", "to", "(", "self", ",", "to", ")", ":", "if", "self", ".", "_type", ".", "lower", "(", ")", "!=", "'edge'", ":", "raise", "ValueError", "(", "'Cannot set From/To to non-edge objects'", ")", "self", ".", "_to", "=", "to", "return", "self" ]
[Edge-only] especifica el destino del lado
[ "[", "Edge", "-", "only", "]", "especifica", "el", "destino", "del", "lado" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L287-L294
josegomezr/pqb
pqb/queries.py
Create.set
def set(self, field, value = None): """ [Edge|Vertex] establece datos del recurso """ if value is None and isinstance(field, dict): self.content(field) if field and value: self.data[field] = value return self
python
def set(self, field, value = None): """ [Edge|Vertex] establece datos del recurso """ if value is None and isinstance(field, dict): self.content(field) if field and value: self.data[field] = value return self
[ "def", "set", "(", "self", ",", "field", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", "and", "isinstance", "(", "field", ",", "dict", ")", ":", "self", ".", "content", "(", "field", ")", "if", "field", "and", "value", ":", "s...
[Edge|Vertex] establece datos del recurso
[ "[", "Edge|Vertex", "]", "establece", "datos", "del", "recurso" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L296-L304
josegomezr/pqb
pqb/queries.py
Create.result
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) sql = 'CREATE %s %s' % (self._type, self._class) if prettify: sql += '\n' else: sql += ' ' if self._type.lower() ...
python
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) sql = 'CREATE %s %s' % (self._type, self._class) if prettify: sql += '\n' else: sql += ' ' if self._type.lower() ...
[ "def", "result", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prettify", "=", "kwargs", ".", "get", "(", "'pretty'", ",", "False", ")", "sql", "=", "'CREATE %s %s'", "%", "(", "self", ".", "_type", ",", "self", ".", "_class", ...
Construye la consulta SQL
[ "Construye", "la", "consulta", "SQL" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L313-L338
josegomezr/pqb
pqb/queries.py
Update.result
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) sql = 'UPDATE %s' % self._class if prettify: sql += '\n' else: sql += ' ' if self.data: sql +...
python
def result(self, *args, **kwargs): """ Construye la consulta SQL """ prettify = kwargs.get('pretty', False) sql = 'UPDATE %s' % self._class if prettify: sql += '\n' else: sql += ' ' if self.data: sql +...
[ "def", "result", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prettify", "=", "kwargs", ".", "get", "(", "'pretty'", ",", "False", ")", "sql", "=", "'UPDATE %s'", "%", "self", ".", "_class", "if", "prettify", ":", "sql", "+=",...
Construye la consulta SQL
[ "Construye", "la", "consulta", "SQL" ]
train
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L410-L438
vedarthk/exreporter
exreporter/stores/github.py
GithubStore.create_or_update_issue
def create_or_update_issue(self, title, body, culprit, labels, **kwargs): '''Creates or comments on existing issue in the store. :params title: title for the issue :params body: body, the content of the issue :params culprit: string used to identify the cause of the issue, a...
python
def create_or_update_issue(self, title, body, culprit, labels, **kwargs): '''Creates or comments on existing issue in the store. :params title: title for the issue :params body: body, the content of the issue :params culprit: string used to identify the cause of the issue, a...
[ "def", "create_or_update_issue", "(", "self", ",", "title", ",", "body", ",", "culprit", ",", "labels", ",", "*", "*", "kwargs", ")", ":", "issues", "=", "self", ".", "search", "(", "q", "=", "culprit", ",", "labels", "=", "labels", ")", "self", ".",...
Creates or comments on existing issue in the store. :params title: title for the issue :params body: body, the content of the issue :params culprit: string used to identify the cause of the issue, also used for aggregation :params labels: (optional) list of labels attached t...
[ "Creates", "or", "comments", "on", "existing", "issue", "in", "the", "store", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L49-L70
vedarthk/exreporter
exreporter/stores/github.py
GithubStore.search
def search(self, q, labels, state='open,closed', **kwargs): """Search for issues in Github. :param q: query string to search :param state: state of the issue :returns: list of issue objects :rtype: list """ search_result = self.github_request.search(q=q, state=s...
python
def search(self, q, labels, state='open,closed', **kwargs): """Search for issues in Github. :param q: query string to search :param state: state of the issue :returns: list of issue objects :rtype: list """ search_result = self.github_request.search(q=q, state=s...
[ "def", "search", "(", "self", ",", "q", ",", "labels", ",", "state", "=", "'open,closed'", ",", "*", "*", "kwargs", ")", ":", "search_result", "=", "self", ".", "github_request", ".", "search", "(", "q", "=", "q", ",", "state", "=", "state", ",", "...
Search for issues in Github. :param q: query string to search :param state: state of the issue :returns: list of issue objects :rtype: list
[ "Search", "for", "issues", "in", "Github", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L72-L87
vedarthk/exreporter
exreporter/stores/github.py
GithubStore.handle_issue_comment
def handle_issue_comment(self, issue, title, body, **kwargs): """Decides whether to comment or create a new issue when trying to comment. :param issue: issue on which the comment is to be added :param title: title of the issue if new one is to be created :param body: body of the issue/c...
python
def handle_issue_comment(self, issue, title, body, **kwargs): """Decides whether to comment or create a new issue when trying to comment. :param issue: issue on which the comment is to be added :param title: title of the issue if new one is to be created :param body: body of the issue/c...
[ "def", "handle_issue_comment", "(", "self", ",", "issue", ",", "title", ",", "body", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_is_time_delta_valid", "(", "issue", ".", "updated_time_delta", ")", ":", "if", "issue", ".", "comments_count", "<",...
Decides whether to comment or create a new issue when trying to comment. :param issue: issue on which the comment is to be added :param title: title of the issue if new one is to be created :param body: body of the issue/comment to be created :returns: newly created issue or the one on ...
[ "Decides", "whether", "to", "comment", "or", "create", "a", "new", "issue", "when", "trying", "to", "comment", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L89-L104
vedarthk/exreporter
exreporter/stores/github.py
GithubStore.create_issue
def create_issue(self, title, body, labels=None): """Creates a new issue in Github. :params title: title of the issue to be created :params body: body of the issue to be created :params labels: (optional) list of labels for the issue :returns: newly created issue :rtype:...
python
def create_issue(self, title, body, labels=None): """Creates a new issue in Github. :params title: title of the issue to be created :params body: body of the issue to be created :params labels: (optional) list of labels for the issue :returns: newly created issue :rtype:...
[ "def", "create_issue", "(", "self", ",", "title", ",", "body", ",", "labels", "=", "None", ")", ":", "kwargs", "=", "self", ".", "github_request", ".", "create", "(", "title", "=", "title", ",", "body", "=", "body", ",", "labels", "=", "labels", ")",...
Creates a new issue in Github. :params title: title of the issue to be created :params body: body of the issue to be created :params labels: (optional) list of labels for the issue :returns: newly created issue :rtype: :class:`exreporter.stores.github.GithubIssue`
[ "Creates", "a", "new", "issue", "in", "Github", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L109-L120
vedarthk/exreporter
exreporter/stores/github.py
GithubIssue.updated_time_delta
def updated_time_delta(self): """Returns the number of seconds ago the issue was updated from current time. """ local_timezone = tzlocal() update_at = datetime.datetime.strptime(self.updated_at, '%Y-%m-%dT%XZ') update_at_utc = pytz.utc.localize(update_at) update_at_local ...
python
def updated_time_delta(self): """Returns the number of seconds ago the issue was updated from current time. """ local_timezone = tzlocal() update_at = datetime.datetime.strptime(self.updated_at, '%Y-%m-%dT%XZ') update_at_utc = pytz.utc.localize(update_at) update_at_local ...
[ "def", "updated_time_delta", "(", "self", ")", ":", "local_timezone", "=", "tzlocal", "(", ")", "update_at", "=", "datetime", ".", "datetime", ".", "strptime", "(", "self", ".", "updated_at", ",", "'%Y-%m-%dT%XZ'", ")", "update_at_utc", "=", "pytz", ".", "ut...
Returns the number of seconds ago the issue was updated from current time.
[ "Returns", "the", "number", "of", "seconds", "ago", "the", "issue", "was", "updated", "from", "current", "time", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L145-L153
vedarthk/exreporter
exreporter/stores/github.py
GithubIssue.open_issue
def open_issue(self): """Changes the state of issue to 'open'. """ self.github_request.update(issue=self, state='open') self.state = 'open'
python
def open_issue(self): """Changes the state of issue to 'open'. """ self.github_request.update(issue=self, state='open') self.state = 'open'
[ "def", "open_issue", "(", "self", ")", ":", "self", ".", "github_request", ".", "update", "(", "issue", "=", "self", ",", "state", "=", "'open'", ")", "self", ".", "state", "=", "'open'" ]
Changes the state of issue to 'open'.
[ "Changes", "the", "state", "of", "issue", "to", "open", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L155-L159
vedarthk/exreporter
exreporter/stores/github.py
GithubIssue.comment
def comment(self, body): """Adds a comment to the issue. :params body: body, content of the comment :returns: issue object :rtype: :class:`exreporter.stores.github.GithubIssue` """ self.github_request.comment(issue=self, body=body) if self.state == 'closed': ...
python
def comment(self, body): """Adds a comment to the issue. :params body: body, content of the comment :returns: issue object :rtype: :class:`exreporter.stores.github.GithubIssue` """ self.github_request.comment(issue=self, body=body) if self.state == 'closed': ...
[ "def", "comment", "(", "self", ",", "body", ")", ":", "self", ".", "github_request", ".", "comment", "(", "issue", "=", "self", ",", "body", "=", "body", ")", "if", "self", ".", "state", "==", "'closed'", ":", "self", ".", "open_issue", "(", ")", "...
Adds a comment to the issue. :params body: body, content of the comment :returns: issue object :rtype: :class:`exreporter.stores.github.GithubIssue`
[ "Adds", "a", "comment", "to", "the", "issue", "." ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L161-L172
vedarthk/exreporter
exreporter/stores/github.py
GithubRequest.create
def create(self, title, body, labels): """Create an issue in Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/#create-an-issue :param title: title of the issue :param body: body of the issue :param labels: list of labels for the issu...
python
def create(self, title, body, labels): """Create an issue in Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/#create-an-issue :param title: title of the issue :param body: body of the issue :param labels: list of labels for the issu...
[ "def", "create", "(", "self", ",", "title", ",", "body", ",", "labels", ")", ":", "url", "=", "\"https://api.github.com/repos/{}/{}/issues\"", ".", "format", "(", "self", ".", "user", ",", "self", ".", "repo", ")", "data", "=", "{", "'title'", ":", "titl...
Create an issue in Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/#create-an-issue :param title: title of the issue :param body: body of the issue :param labels: list of labels for the issue :returns: dict of JSON data returned by ...
[ "Create", "an", "issue", "in", "Github", ".", "For", "JSON", "data", "returned", "by", "Github", "refer", ":", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "issues", "/", "#create", "-", "an", "-", "issue" ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L194-L220
vedarthk/exreporter
exreporter/stores/github.py
GithubRequest.comment
def comment(self, issue, body): """Comment on existing issue on Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/comments/#create-a-comment :param issue: object of exisiting issue :param body: body of the comment :returns: dict of JS...
python
def comment(self, issue, body): """Comment on existing issue on Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/comments/#create-a-comment :param issue: object of exisiting issue :param body: body of the comment :returns: dict of JS...
[ "def", "comment", "(", "self", ",", "issue", ",", "body", ")", ":", "url", "=", "issue", ".", "comments_url", "data", "=", "{", "'body'", ":", "body", "}", "response", "=", "self", ".", "session", ".", "post", "(", "url", ",", "json", ".", "dumps",...
Comment on existing issue on Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/comments/#create-a-comment :param issue: object of exisiting issue :param body: body of the comment :returns: dict of JSON data returned by Github of the new comme...
[ "Comment", "on", "existing", "issue", "on", "Github", ".", "For", "JSON", "data", "returned", "by", "Github", "refer", ":", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "issues", "/", "comments", "/", "#create", "-", "a",...
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L222-L239
vedarthk/exreporter
exreporter/stores/github.py
GithubRequest.update
def update(self, issue, **kwargs): """Update an existing issue on Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/#edit-an-issue :param issue: object existing issue :returns: dict of JSON data returned by Github. :rtype: `dict` ...
python
def update(self, issue, **kwargs): """Update an existing issue on Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/#edit-an-issue :param issue: object existing issue :returns: dict of JSON data returned by Github. :rtype: `dict` ...
[ "def", "update", "(", "self", ",", "issue", ",", "*", "*", "kwargs", ")", ":", "url", "=", "issue", ".", "url", "response", "=", "self", ".", "session", ".", "patch", "(", "url", ",", "json", ".", "dumps", "(", "kwargs", ")", ")", "assert", "resp...
Update an existing issue on Github. For JSON data returned by Github refer: https://developer.github.com/v3/issues/#edit-an-issue :param issue: object existing issue :returns: dict of JSON data returned by Github. :rtype: `dict`
[ "Update", "an", "existing", "issue", "on", "Github", ".", "For", "JSON", "data", "returned", "by", "Github", "refer", ":", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "issues", "/", "#edit", "-", "an", "-", "issue" ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L241-L256
vedarthk/exreporter
exreporter/stores/github.py
GithubRequest.search
def search(self, q, state, labels): """Search for issues in Github. For JSON data returned by Github refer: https://developer.github.com/v3/search/#search-issues :param q: query string for search :param state: the states of the issue :param labels: labels of the issue ...
python
def search(self, q, state, labels): """Search for issues in Github. For JSON data returned by Github refer: https://developer.github.com/v3/search/#search-issues :param q: query string for search :param state: the states of the issue :param labels: labels of the issue ...
[ "def", "search", "(", "self", ",", "q", ",", "state", ",", "labels", ")", ":", "# TODO: add support for search with labels", "labels", "=", "[", "'\"{}\"'", ".", "format", "(", "label", ")", "for", "label", "in", "labels", "]", "q", "=", "\"'{}'+state:{}+lab...
Search for issues in Github. For JSON data returned by Github refer: https://developer.github.com/v3/search/#search-issues :param q: query string for search :param state: the states of the issue :param labels: labels of the issue :returns: dictionary of JSON data returne...
[ "Search", "for", "issues", "in", "Github", ".", "For", "JSON", "data", "returned", "by", "Github", "refer", ":", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "search", "/", "#search", "-", "issues" ]
train
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L258-L282
jmgilman/Neolib
neolib/pyamf/alias.py
ClassAlias.compile
def compile(self): """ This compiles the alias into a form that can be of most benefit to the en/decoder. """ if self._compiled: return self.decodable_properties = set() self.encodable_properties = set() self.inherited_dynamic = None s...
python
def compile(self): """ This compiles the alias into a form that can be of most benefit to the en/decoder. """ if self._compiled: return self.decodable_properties = set() self.encodable_properties = set() self.inherited_dynamic = None s...
[ "def", "compile", "(", "self", ")", ":", "if", "self", ".", "_compiled", ":", "return", "self", ".", "decodable_properties", "=", "set", "(", ")", "self", ".", "encodable_properties", "=", "set", "(", ")", "self", ".", "inherited_dynamic", "=", "None", "...
This compiles the alias into a form that can be of most benefit to the en/decoder.
[ "This", "compiles", "the", "alias", "into", "a", "form", "that", "can", "be", "of", "most", "benefit", "to", "the", "en", "/", "decoder", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L89-L141
jmgilman/Neolib
neolib/pyamf/alias.py
ClassAlias.checkClass
def checkClass(self, klass): """ This function is used to check if the class being aliased fits certain criteria. The default is to check that C{__new__} is available or the C{__init__} constructor does not need additional arguments. If this is the case then L{TypeError} will be ...
python
def checkClass(self, klass): """ This function is used to check if the class being aliased fits certain criteria. The default is to check that C{__new__} is available or the C{__init__} constructor does not need additional arguments. If this is the case then L{TypeError} will be ...
[ "def", "checkClass", "(", "self", ",", "klass", ")", ":", "# Check for __new__ support.", "if", "hasattr", "(", "klass", ",", "'__new__'", ")", "and", "hasattr", "(", "klass", ".", "__new__", ",", "'__call__'", ")", ":", "# Should be good to go.", "return", "#...
This function is used to check if the class being aliased fits certain criteria. The default is to check that C{__new__} is available or the C{__init__} constructor does not need additional arguments. If this is the case then L{TypeError} will be raised. @since: 0.4
[ "This", "function", "is", "used", "to", "check", "if", "the", "class", "being", "aliased", "fits", "certain", "criteria", ".", "The", "default", "is", "to", "check", "that", "C", "{", "__new__", "}", "is", "available", "or", "the", "C", "{", "__init__", ...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L312-L351
jmgilman/Neolib
neolib/pyamf/alias.py
ClassAlias.getEncodableAttributes
def getEncodableAttributes(self, obj, codec=None): """ Must return a C{dict} of attributes to be encoded, even if its empty. @param codec: An optional argument that will contain the encoder instance calling this function. @since: 0.5 """ if not self._compiled...
python
def getEncodableAttributes(self, obj, codec=None): """ Must return a C{dict} of attributes to be encoded, even if its empty. @param codec: An optional argument that will contain the encoder instance calling this function. @since: 0.5 """ if not self._compiled...
[ "def", "getEncodableAttributes", "(", "self", ",", "obj", ",", "codec", "=", "None", ")", ":", "if", "not", "self", ".", "_compiled", ":", "self", ".", "compile", "(", ")", "if", "self", ".", "is_dict", ":", "return", "dict", "(", "obj", ")", "if", ...
Must return a C{dict} of attributes to be encoded, even if its empty. @param codec: An optional argument that will contain the encoder instance calling this function. @since: 0.5
[ "Must", "return", "a", "C", "{", "dict", "}", "of", "attributes", "to", "be", "encoded", "even", "if", "its", "empty", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L353-L418
jmgilman/Neolib
neolib/pyamf/alias.py
ClassAlias.getDecodableAttributes
def getDecodableAttributes(self, obj, attrs, codec=None): """ Returns a dictionary of attributes for C{obj} that has been filtered, based on the supplied C{attrs}. This allows for fine grain control over what will finally end up on the object or not. @param obj: The object that ...
python
def getDecodableAttributes(self, obj, attrs, codec=None): """ Returns a dictionary of attributes for C{obj} that has been filtered, based on the supplied C{attrs}. This allows for fine grain control over what will finally end up on the object or not. @param obj: The object that ...
[ "def", "getDecodableAttributes", "(", "self", ",", "obj", ",", "attrs", ",", "codec", "=", "None", ")", ":", "if", "not", "self", ".", "_compiled", ":", "self", ".", "compile", "(", ")", "changed", "=", "False", "props", "=", "set", "(", "attrs", "."...
Returns a dictionary of attributes for C{obj} that has been filtered, based on the supplied C{attrs}. This allows for fine grain control over what will finally end up on the object or not. @param obj: The object that will recieve the attributes. @param attrs: The C{attrs} dictionary tha...
[ "Returns", "a", "dictionary", "of", "attributes", "for", "C", "{", "obj", "}", "that", "has", "been", "filtered", "based", "on", "the", "supplied", "C", "{", "attrs", "}", ".", "This", "allows", "for", "fine", "grain", "control", "over", "what", "will", ...
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L420-L497
jmgilman/Neolib
neolib/pyamf/alias.py
ClassAlias.applyAttributes
def applyAttributes(self, obj, attrs, codec=None): """ Applies the collection of attributes C{attrs} to aliased object C{obj}. Called when decoding reading aliased objects from an AMF byte stream. Override this to provide fine grain control of application of attributes to C{obj}...
python
def applyAttributes(self, obj, attrs, codec=None): """ Applies the collection of attributes C{attrs} to aliased object C{obj}. Called when decoding reading aliased objects from an AMF byte stream. Override this to provide fine grain control of application of attributes to C{obj}...
[ "def", "applyAttributes", "(", "self", ",", "obj", ",", "attrs", ",", "codec", "=", "None", ")", ":", "if", "not", "self", ".", "_compiled", ":", "self", ".", "compile", "(", ")", "if", "self", ".", "shortcut_decode", ":", "if", "self", ".", "is_dict...
Applies the collection of attributes C{attrs} to aliased object C{obj}. Called when decoding reading aliased objects from an AMF byte stream. Override this to provide fine grain control of application of attributes to C{obj}. @param codec: An optional argument that will contain the en/...
[ "Applies", "the", "collection", "of", "attributes", "C", "{", "attrs", "}", "to", "aliased", "object", "C", "{", "obj", "}", ".", "Called", "when", "decoding", "reading", "aliased", "objects", "from", "an", "AMF", "byte", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L499-L527
jmgilman/Neolib
neolib/pyamf/alias.py
ClassAlias.createInstance
def createInstance(self, codec=None): """ Creates an instance of the klass. @return: Instance of C{self.klass}. """ if type(self.klass) is type: return self.klass.__new__(self.klass) return self.klass()
python
def createInstance(self, codec=None): """ Creates an instance of the klass. @return: Instance of C{self.klass}. """ if type(self.klass) is type: return self.klass.__new__(self.klass) return self.klass()
[ "def", "createInstance", "(", "self", ",", "codec", "=", "None", ")", ":", "if", "type", "(", "self", ".", "klass", ")", "is", "type", ":", "return", "self", ".", "klass", ".", "__new__", "(", "self", ".", "klass", ")", "return", "self", ".", "klas...
Creates an instance of the klass. @return: Instance of C{self.klass}.
[ "Creates", "an", "instance", "of", "the", "klass", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L537-L546
seibert-media/pyxelletter
pyxelletter/pyxelletter.py
Pyxelletter.send_letter
def send_letter(self, file_list, destination='DE', duplex=True, color=False, user_transaction=None, gogreen=False,test_environment=False): """ Send pdf-File :param file_list: list of files :param destination: country code of the destination country :param dupl...
python
def send_letter(self, file_list, destination='DE', duplex=True, color=False, user_transaction=None, gogreen=False,test_environment=False): """ Send pdf-File :param file_list: list of files :param destination: country code of the destination country :param dupl...
[ "def", "send_letter", "(", "self", ",", "file_list", ",", "destination", "=", "'DE'", ",", "duplex", "=", "True", ",", "color", "=", "False", ",", "user_transaction", "=", "None", ",", "gogreen", "=", "False", ",", "test_environment", "=", "False", ")", ...
Send pdf-File :param file_list: list of files :param destination: country code of the destination country :param duplex: send letter in duplex :param color: send letter with color or black/white :param user_transaction: custom transaction id :param test_environment: Enabl...
[ "Send", "pdf", "-", "File", ":", "param", "file_list", ":", "list", "of", "files", ":", "param", "destination", ":", "country", "code", "of", "the", "destination", "country", ":", "param", "duplex", ":", "send", "letter", "in", "duplex", ":", "param", "c...
train
https://github.com/seibert-media/pyxelletter/blob/33fbd5f77d23ad24fbd23e00ef14d13e3d788db6/pyxelletter/pyxelletter.py#L52-L98
seibert-media/pyxelletter
pyxelletter/pyxelletter.py
Pyxelletter.get_letter_status
def get_letter_status(self, pixelletter_id): """ :param pixelletter_id: ID of the letter :return: dict containing status of the requested letter """ letter_status = self._make_get_request('letters/{}'.format(pixelletter_id)) if letter_status: return json.load...
python
def get_letter_status(self, pixelletter_id): """ :param pixelletter_id: ID of the letter :return: dict containing status of the requested letter """ letter_status = self._make_get_request('letters/{}'.format(pixelletter_id)) if letter_status: return json.load...
[ "def", "get_letter_status", "(", "self", ",", "pixelletter_id", ")", ":", "letter_status", "=", "self", ".", "_make_get_request", "(", "'letters/{}'", ".", "format", "(", "pixelletter_id", ")", ")", "if", "letter_status", ":", "return", "json", ".", "loads", "...
:param pixelletter_id: ID of the letter :return: dict containing status of the requested letter
[ ":", "param", "pixelletter_id", ":", "ID", "of", "the", "letter", ":", "return", ":", "dict", "containing", "status", "of", "the", "requested", "letter" ]
train
https://github.com/seibert-media/pyxelletter/blob/33fbd5f77d23ad24fbd23e00ef14d13e3d788db6/pyxelletter/pyxelletter.py#L112-L122
seibert-media/pyxelletter
pyxelletter/pyxelletter.py
Pyxelletter.get_letter_as_pdf
def get_letter_as_pdf(self, pixelletter_id): """ Get specified letter by letter ID :param pixelleter_id: ID of the letter :return: PDF-Letter-Unicode-String if successful else None """ pdf_letter = self._make_get_request('letters/{}.pdf'.format(pixelletter_id)) i...
python
def get_letter_as_pdf(self, pixelletter_id): """ Get specified letter by letter ID :param pixelleter_id: ID of the letter :return: PDF-Letter-Unicode-String if successful else None """ pdf_letter = self._make_get_request('letters/{}.pdf'.format(pixelletter_id)) i...
[ "def", "get_letter_as_pdf", "(", "self", ",", "pixelletter_id", ")", ":", "pdf_letter", "=", "self", ".", "_make_get_request", "(", "'letters/{}.pdf'", ".", "format", "(", "pixelletter_id", ")", ")", "if", "pdf_letter", ":", "return", "pdf_letter", "return", "No...
Get specified letter by letter ID :param pixelleter_id: ID of the letter :return: PDF-Letter-Unicode-String if successful else None
[ "Get", "specified", "letter", "by", "letter", "ID", ":", "param", "pixelleter_id", ":", "ID", "of", "the", "letter", ":", "return", ":", "PDF", "-", "Letter", "-", "Unicode", "-", "String", "if", "successful", "else", "None" ]
train
https://github.com/seibert-media/pyxelletter/blob/33fbd5f77d23ad24fbd23e00ef14d13e3d788db6/pyxelletter/pyxelletter.py#L124-L135
seibert-media/pyxelletter
pyxelletter/pyxelletter.py
Pyxelletter.get_letter_as_image
def get_letter_as_image(self, pixelletter_id): """ Get specified letter as image :param pixelletter_id: ID of the letter :return: JPG-Letter-Unicode-String if successful else None """ image_letter = self._make_get_request('letters/previews/{}_1.jpg'.format(pixelletter_id)...
python
def get_letter_as_image(self, pixelletter_id): """ Get specified letter as image :param pixelletter_id: ID of the letter :return: JPG-Letter-Unicode-String if successful else None """ image_letter = self._make_get_request('letters/previews/{}_1.jpg'.format(pixelletter_id)...
[ "def", "get_letter_as_image", "(", "self", ",", "pixelletter_id", ")", ":", "image_letter", "=", "self", ".", "_make_get_request", "(", "'letters/previews/{}_1.jpg'", ".", "format", "(", "pixelletter_id", ")", ")", "if", "image_letter", ":", "return", "image_letter"...
Get specified letter as image :param pixelletter_id: ID of the letter :return: JPG-Letter-Unicode-String if successful else None
[ "Get", "specified", "letter", "as", "image", ":", "param", "pixelletter_id", ":", "ID", "of", "the", "letter", ":", "return", ":", "JPG", "-", "Letter", "-", "Unicode", "-", "String", "if", "successful", "else", "None" ]
train
https://github.com/seibert-media/pyxelletter/blob/33fbd5f77d23ad24fbd23e00ef14d13e3d788db6/pyxelletter/pyxelletter.py#L137-L148
seibert-media/pyxelletter
pyxelletter/pyxelletter.py
Pyxelletter.cancel_letter
def cancel_letter(self, pixelletter_id): """ Cancel specified letter :param pixelletter_id: ID of the letter :return: True if canceled, else False """ cancel_request = self._make_delete_request('letters/{}'.format(pixelletter_id)) status = json.loads(cancel_reques...
python
def cancel_letter(self, pixelletter_id): """ Cancel specified letter :param pixelletter_id: ID of the letter :return: True if canceled, else False """ cancel_request = self._make_delete_request('letters/{}'.format(pixelletter_id)) status = json.loads(cancel_reques...
[ "def", "cancel_letter", "(", "self", ",", "pixelletter_id", ")", ":", "cancel_request", "=", "self", ".", "_make_delete_request", "(", "'letters/{}'", ".", "format", "(", "pixelletter_id", ")", ")", "status", "=", "json", ".", "loads", "(", "cancel_request", "...
Cancel specified letter :param pixelletter_id: ID of the letter :return: True if canceled, else False
[ "Cancel", "specified", "letter", ":", "param", "pixelletter_id", ":", "ID", "of", "the", "letter", ":", "return", ":", "True", "if", "canceled", "else", "False" ]
train
https://github.com/seibert-media/pyxelletter/blob/33fbd5f77d23ad24fbd23e00ef14d13e3d788db6/pyxelletter/pyxelletter.py#L150-L162
amadev/doan
doan/graph.py
plot_date
def plot_date(datasets, **kwargs): """Plot points with dates. datasets can be Dataset object or list of Dataset. """ defaults = { 'grid': True, 'xlabel': '', 'ylabel': '', 'title': '', 'output': None, 'figsize': (8, 6), } plot_params = { ...
python
def plot_date(datasets, **kwargs): """Plot points with dates. datasets can be Dataset object or list of Dataset. """ defaults = { 'grid': True, 'xlabel': '', 'ylabel': '', 'title': '', 'output': None, 'figsize': (8, 6), } plot_params = { ...
[ "def", "plot_date", "(", "datasets", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'grid'", ":", "True", ",", "'xlabel'", ":", "''", ",", "'ylabel'", ":", "''", ",", "'title'", ":", "''", ",", "'output'", ":", "None", ",", "'figsize'", ...
Plot points with dates. datasets can be Dataset object or list of Dataset.
[ "Plot", "points", "with", "dates", "." ]
train
https://github.com/amadev/doan/blob/5adfa983ac547007a688fe7517291a432919aa3e/doan/graph.py#L28-L85
exekias/droplet
droplet/web/tables.py
Table.actions
def actions(self): """ List of :class:`TableAction` elements defined for this table """ actions = [] for a in dir(self): a = getattr(self, a) if isinstance(a, TableAction): actions.append(a) # We are not caching this because array ...
python
def actions(self): """ List of :class:`TableAction` elements defined for this table """ actions = [] for a in dir(self): a = getattr(self, a) if isinstance(a, TableAction): actions.append(a) # We are not caching this because array ...
[ "def", "actions", "(", "self", ")", ":", "actions", "=", "[", "]", "for", "a", "in", "dir", "(", "self", ")", ":", "a", "=", "getattr", "(", "self", ",", "a", ")", "if", "isinstance", "(", "a", ",", "TableAction", ")", ":", "actions", ".", "app...
List of :class:`TableAction` elements defined for this table
[ "List", "of", ":", "class", ":", "TableAction", "elements", "defined", "for", "this", "table" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/web/tables.py#L190-L202
tbreitenfeldt/invisible_ui
invisible_ui/events/handler.py
Handler.call_actions
def call_actions(self, event, *args, **kwargs): """Call each function in self._actions after setting self._event.""" self._event = event for func in self._actions: func(event, *args, **kwargs)
python
def call_actions(self, event, *args, **kwargs): """Call each function in self._actions after setting self._event.""" self._event = event for func in self._actions: func(event, *args, **kwargs)
[ "def", "call_actions", "(", "self", ",", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_event", "=", "event", "for", "func", "in", "self", ".", "_actions", ":", "func", "(", "event", ",", "*", "args", ",", "*", "*", ...
Call each function in self._actions after setting self._event.
[ "Call", "each", "function", "in", "self", ".", "_actions", "after", "setting", "self", ".", "_event", "." ]
train
https://github.com/tbreitenfeldt/invisible_ui/blob/1a6907bfa61bded13fa9fb83ec7778c0df84487f/invisible_ui/events/handler.py#L53-L58
MaT1g3R/option
option/result.py
Result.ok
def ok(self) -> Option[T]: """ Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [T]. Returns: :class:`Option` containing the success value if `self` is :meth:`Result.Ok`, otherwise :data:`option.option_.NONE`. Examples: >>> Ok(1...
python
def ok(self) -> Option[T]: """ Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [T]. Returns: :class:`Option` containing the success value if `self` is :meth:`Result.Ok`, otherwise :data:`option.option_.NONE`. Examples: >>> Ok(1...
[ "def", "ok", "(", "self", ")", "->", "Option", "[", "T", "]", ":", "return", "Option", ".", "Some", "(", "cast", "(", "T", ",", "self", ".", "_val", ")", ")", "if", "self", ".", "_is_ok", "else", "cast", "(", "Option", "[", "T", "]", ",", "NO...
Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [T]. Returns: :class:`Option` containing the success value if `self` is :meth:`Result.Ok`, otherwise :data:`option.option_.NONE`. Examples: >>> Ok(1).ok() Some(1) >>> Err(...
[ "Converts", "from", ":", "class", ":", "Result", "[", "T", "E", "]", "to", ":", "class", ":", "option", ".", "option_", ".", "Option", "[", "T", "]", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L128-L142
MaT1g3R/option
option/result.py
Result.err
def err(self) -> Option[E]: """ Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [E]. Returns: :class:`Option` containing the error value if `self` is :meth:`Result.Err`, otherwise :data:`option.option_.NONE`. Examples: >>> Ok(1...
python
def err(self) -> Option[E]: """ Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [E]. Returns: :class:`Option` containing the error value if `self` is :meth:`Result.Err`, otherwise :data:`option.option_.NONE`. Examples: >>> Ok(1...
[ "def", "err", "(", "self", ")", "->", "Option", "[", "E", "]", ":", "return", "cast", "(", "Option", "[", "E", "]", ",", "NONE", ")", "if", "self", ".", "_is_ok", "else", "Option", ".", "Some", "(", "cast", "(", "E", ",", "self", ".", "_val", ...
Converts from :class:`Result` [T, E] to :class:`option.option_.Option` [E]. Returns: :class:`Option` containing the error value if `self` is :meth:`Result.Err`, otherwise :data:`option.option_.NONE`. Examples: >>> Ok(1).err() NONE >>> Err(1)....
[ "Converts", "from", ":", "class", ":", "Result", "[", "T", "E", "]", "to", ":", "class", ":", "option", ".", "option_", ".", "Option", "[", "E", "]", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L144-L158
MaT1g3R/option
option/result.py
Result.map
def map(self, op: Callable[[T], U]) -> 'Union[Result[U, E], Result[T, E]]': """ Applies a function to the contained :meth:`Result.Ok` value. Args: op: The function to apply to the :meth:`Result.Ok` value. Returns: A :class:`Result` with its success value as the ...
python
def map(self, op: Callable[[T], U]) -> 'Union[Result[U, E], Result[T, E]]': """ Applies a function to the contained :meth:`Result.Ok` value. Args: op: The function to apply to the :meth:`Result.Ok` value. Returns: A :class:`Result` with its success value as the ...
[ "def", "map", "(", "self", ",", "op", ":", "Callable", "[", "[", "T", "]", ",", "U", "]", ")", "->", "'Union[Result[U, E], Result[T, E]]'", ":", "return", "self", ".", "_type", ".", "Ok", "(", "op", "(", "cast", "(", "T", ",", "self", ".", "_val", ...
Applies a function to the contained :meth:`Result.Ok` value. Args: op: The function to apply to the :meth:`Result.Ok` value. Returns: A :class:`Result` with its success value as the function result if `self` is an :meth:`Result.Ok` value, otherwise returns ...
[ "Applies", "a", "function", "to", "the", "contained", ":", "meth", ":", "Result", ".", "Ok", "value", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L160-L178
MaT1g3R/option
option/result.py
Result.flatmap
def flatmap(self, op: 'Callable[[T], Result[U, E]]') -> 'Result[U, E]': """ Applies a function to the contained :meth:`Result.Ok` value. This is different than :meth:`Result.map` because the function result is not wrapped in a new :class:`Result`. Args: op: The func...
python
def flatmap(self, op: 'Callable[[T], Result[U, E]]') -> 'Result[U, E]': """ Applies a function to the contained :meth:`Result.Ok` value. This is different than :meth:`Result.map` because the function result is not wrapped in a new :class:`Result`. Args: op: The func...
[ "def", "flatmap", "(", "self", ",", "op", ":", "'Callable[[T], Result[U, E]]'", ")", "->", "'Result[U, E]'", ":", "return", "op", "(", "cast", "(", "T", ",", "self", ".", "_val", ")", ")", "if", "self", ".", "_is_ok", "else", "cast", "(", "'Result[U, E]'...
Applies a function to the contained :meth:`Result.Ok` value. This is different than :meth:`Result.map` because the function result is not wrapped in a new :class:`Result`. Args: op: The function to apply to the contained :meth:`Result.Ok` value. Returns: The re...
[ "Applies", "a", "function", "to", "the", "contained", ":", "meth", ":", "Result", ".", "Ok", "value", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L180-L206
MaT1g3R/option
option/result.py
Result.map_err
def map_err(self, op: Callable[[E], F]) -> 'Union[Result[T, F], Result[T, E]]': """ Applies a function to the contained :meth:`Result.Err` value. Args: op: The function to apply to the :meth:`Result.Err` value. Returns: A :class:`Result` with its error value as ...
python
def map_err(self, op: Callable[[E], F]) -> 'Union[Result[T, F], Result[T, E]]': """ Applies a function to the contained :meth:`Result.Err` value. Args: op: The function to apply to the :meth:`Result.Err` value. Returns: A :class:`Result` with its error value as ...
[ "def", "map_err", "(", "self", ",", "op", ":", "Callable", "[", "[", "E", "]", ",", "F", "]", ")", "->", "'Union[Result[T, F], Result[T, E]]'", ":", "return", "self", "if", "self", ".", "_is_ok", "else", "cast", "(", "'Result[T, F]'", ",", "self", ".", ...
Applies a function to the contained :meth:`Result.Err` value. Args: op: The function to apply to the :meth:`Result.Err` value. Returns: A :class:`Result` with its error value as the function result if `self` is a :meth:`Result.Err` value, otherwise returns ...
[ "Applies", "a", "function", "to", "the", "contained", ":", "meth", ":", "Result", ".", "Err", "value", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L208-L229
MaT1g3R/option
option/result.py
Result.unwrap
def unwrap(self) -> T: """ Returns the success value in the :class:`Result`. Returns: The success value in the :class:`Result`. Raises: ``ValueError`` with the message provided by the error value if the :class:`Result` is a :meth:`Result.Err` value....
python
def unwrap(self) -> T: """ Returns the success value in the :class:`Result`. Returns: The success value in the :class:`Result`. Raises: ``ValueError`` with the message provided by the error value if the :class:`Result` is a :meth:`Result.Err` value....
[ "def", "unwrap", "(", "self", ")", "->", "T", ":", "if", "self", ".", "_is_ok", ":", "return", "cast", "(", "T", ",", "self", ".", "_val", ")", "raise", "ValueError", "(", "self", ".", "_val", ")" ]
Returns the success value in the :class:`Result`. Returns: The success value in the :class:`Result`. Raises: ``ValueError`` with the message provided by the error value if the :class:`Result` is a :meth:`Result.Err` value. Examples: >>> Ok(1).u...
[ "Returns", "the", "success", "value", "in", "the", ":", "class", ":", "Result", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L231-L253
MaT1g3R/option
option/result.py
Result.unwrap_or
def unwrap_or(self, optb: T) -> T: """ Returns the success value in the :class:`Result` or ``optb``. Args: optb: The default return value. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value, otherwise ``optb``. ...
python
def unwrap_or(self, optb: T) -> T: """ Returns the success value in the :class:`Result` or ``optb``. Args: optb: The default return value. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value, otherwise ``optb``. ...
[ "def", "unwrap_or", "(", "self", ",", "optb", ":", "T", ")", "->", "T", ":", "return", "cast", "(", "T", ",", "self", ".", "_val", ")", "if", "self", ".", "_is_ok", "else", "optb" ]
Returns the success value in the :class:`Result` or ``optb``. Args: optb: The default return value. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value, otherwise ``optb``. Notes: If you wish to use a result of a...
[ "Returns", "the", "success", "value", "in", "the", ":", "class", ":", "Result", "or", "optb", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L255-L276
MaT1g3R/option
option/result.py
Result.unwrap_or_else
def unwrap_or_else(self, op: Callable[[E], U]) -> Union[T, U]: """ Returns the sucess value in the :class:`Result` or computes a default from the error value. Args: op: The function to computes default with. Returns: The success value in the :class:`Resu...
python
def unwrap_or_else(self, op: Callable[[E], U]) -> Union[T, U]: """ Returns the sucess value in the :class:`Result` or computes a default from the error value. Args: op: The function to computes default with. Returns: The success value in the :class:`Resu...
[ "def", "unwrap_or_else", "(", "self", ",", "op", ":", "Callable", "[", "[", "E", "]", ",", "U", "]", ")", "->", "Union", "[", "T", ",", "U", "]", ":", "return", "cast", "(", "T", ",", "self", ".", "_val", ")", "if", "self", ".", "_is_ok", "el...
Returns the sucess value in the :class:`Result` or computes a default from the error value. Args: op: The function to computes default with. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value, otherwise ``op(E)``. ...
[ "Returns", "the", "sucess", "value", "in", "the", ":", "class", ":", "Result", "or", "computes", "a", "default", "from", "the", "error", "value", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L278-L296
MaT1g3R/option
option/result.py
Result.expect
def expect(self, msg) -> T: """ Returns the success value in the :class:`Result` or raises a ``ValueError`` with a provided message. Args: msg: The error message. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` ...
python
def expect(self, msg) -> T: """ Returns the success value in the :class:`Result` or raises a ``ValueError`` with a provided message. Args: msg: The error message. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` ...
[ "def", "expect", "(", "self", ",", "msg", ")", "->", "T", ":", "if", "self", ".", "_is_ok", ":", "return", "cast", "(", "T", ",", "self", ".", "_val", ")", "raise", "ValueError", "(", "msg", ")" ]
Returns the success value in the :class:`Result` or raises a ``ValueError`` with a provided message. Args: msg: The error message. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value. Raises: ``ValueError...
[ "Returns", "the", "success", "value", "in", "the", ":", "class", ":", "Result", "or", "raises", "a", "ValueError", "with", "a", "provided", "message", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L298-L325
MaT1g3R/option
option/result.py
Result.unwrap_err
def unwrap_err(self) -> E: """ Returns the error value in a :class:`Result`. Returns: The error value in the :class:`Result` if it is a :meth:`Result.Err` value. Raises: ``ValueError`` with the message provided by the success value if th...
python
def unwrap_err(self) -> E: """ Returns the error value in a :class:`Result`. Returns: The error value in the :class:`Result` if it is a :meth:`Result.Err` value. Raises: ``ValueError`` with the message provided by the success value if th...
[ "def", "unwrap_err", "(", "self", ")", "->", "E", ":", "if", "self", ".", "_is_ok", ":", "raise", "ValueError", "(", "self", ".", "_val", ")", "return", "cast", "(", "E", ",", "self", ".", "_val", ")" ]
Returns the error value in a :class:`Result`. Returns: The error value in the :class:`Result` if it is a :meth:`Result.Err` value. Raises: ``ValueError`` with the message provided by the success value if the :class:`Result` is a :meth:`Result.Ok` value....
[ "Returns", "the", "error", "value", "in", "a", ":", "class", ":", "Result", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L327-L350
MaT1g3R/option
option/result.py
Result.expect_err
def expect_err(self, msg) -> E: """ Returns the error value in a :class:`Result`, or raises a ``ValueError`` with the provided message. Args: msg: The error message. Returns: The error value in the :class:`Result` if it is a :meth:`Result.Err...
python
def expect_err(self, msg) -> E: """ Returns the error value in a :class:`Result`, or raises a ``ValueError`` with the provided message. Args: msg: The error message. Returns: The error value in the :class:`Result` if it is a :meth:`Result.Err...
[ "def", "expect_err", "(", "self", ",", "msg", ")", "->", "E", ":", "if", "self", ".", "_is_ok", ":", "raise", "ValueError", "(", "msg", ")", "return", "cast", "(", "E", ",", "self", ".", "_val", ")" ]
Returns the error value in a :class:`Result`, or raises a ``ValueError`` with the provided message. Args: msg: The error message. Returns: The error value in the :class:`Result` if it is a :meth:`Result.Err` value. Raises: ``ValueError``...
[ "Returns", "the", "error", "value", "in", "a", ":", "class", ":", "Result", "or", "raises", "a", "ValueError", "with", "the", "provided", "message", "." ]
train
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L352-L379
KnowledgeLinks/rdfframework
rdfframework/sparql/__init__.py
read_query_notes
def read_query_notes(query_str, first_line=False): """ Returns the Comments from a query string that are in the header """ lines = query_str.split("\n") started = False parts = [] for line in lines: line = line.strip() if line.startswith("#"): parts.append(line) ...
python
def read_query_notes(query_str, first_line=False): """ Returns the Comments from a query string that are in the header """ lines = query_str.split("\n") started = False parts = [] for line in lines: line = line.strip() if line.startswith("#"): parts.append(line) ...
[ "def", "read_query_notes", "(", "query_str", ",", "first_line", "=", "False", ")", ":", "lines", "=", "query_str", ".", "split", "(", "\"\\n\"", ")", "started", "=", "False", "parts", "=", "[", "]", "for", "line", "in", "lines", ":", "line", "=", "line...
Returns the Comments from a query string that are in the header
[ "Returns", "the", "Comments", "from", "a", "query", "string", "that", "are", "in", "the", "header" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/sparql/__init__.py#L4-L20
bluec0re/python-helperlib
helperlib/binary.py
hexdump
def hexdump(data, cols=8, folded=False, stream=False, offset=0, header=False): """ yields the rows of the hex dump Arguments: data -- data to dump cols -- number of octets per row folded -- fold long ranges of equal bytes stream -- dont use len on data >>> from string i...
python
def hexdump(data, cols=8, folded=False, stream=False, offset=0, header=False): """ yields the rows of the hex dump Arguments: data -- data to dump cols -- number of octets per row folded -- fold long ranges of equal bytes stream -- dont use len on data >>> from string i...
[ "def", "hexdump", "(", "data", ",", "cols", "=", "8", ",", "folded", "=", "False", ",", "stream", "=", "False", ",", "offset", "=", "0", ",", "header", "=", "False", ")", ":", "last_byte", "=", "None", "fold", "=", "False", "# determine index width", ...
yields the rows of the hex dump Arguments: data -- data to dump cols -- number of octets per row folded -- fold long ranges of equal bytes stream -- dont use len on data >>> from string import ascii_uppercase >>> print('\\n'.join(hexdump("".join(chr(i) for i in range(256)))...
[ "yields", "the", "rows", "of", "the", "hex", "dump" ]
train
https://github.com/bluec0re/python-helperlib/blob/a2ac429668a6b86d3dc5e686978965c938f07d2c/helperlib/binary.py#L13-L176
bluec0re/python-helperlib
helperlib/binary.py
print_struct
def print_struct(struct, ident=0): """ >>> from ctypes import * >>> class Test(Structure): ... _fields_ = [('foo', c_int)] ... >>> class Test2(Structure): ... _fields_ = [('foo', Test), ('bar', c_int)] ... >>> t = Test2() >>> t.foo.foo = 2 >>> t.bar = 1 >>> prin...
python
def print_struct(struct, ident=0): """ >>> from ctypes import * >>> class Test(Structure): ... _fields_ = [('foo', c_int)] ... >>> class Test2(Structure): ... _fields_ = [('foo', Test), ('bar', c_int)] ... >>> t = Test2() >>> t.foo.foo = 2 >>> t.bar = 1 >>> prin...
[ "def", "print_struct", "(", "struct", ",", "ident", "=", "0", ")", ":", "if", "not", "isinstance", "(", "struct", ",", "(", "str", ",", "bytes", ",", "list", ",", "tuple", ")", ")", "and", "hasattr", "(", "struct", ",", "'__getitem__'", ")", ":", "...
>>> from ctypes import * >>> class Test(Structure): ... _fields_ = [('foo', c_int)] ... >>> class Test2(Structure): ... _fields_ = [('foo', Test), ('bar', c_int)] ... >>> t = Test2() >>> t.foo.foo = 2 >>> t.bar = 1 >>> print_struct(t) foo: foo: 2 bar: 1
[ ">>>", "from", "ctypes", "import", "*", ">>>", "class", "Test", "(", "Structure", ")", ":", "...", "_fields_", "=", "[", "(", "foo", "c_int", ")", "]", "...", ">>>", "class", "Test2", "(", "Structure", ")", ":", "...", "_fields_", "=", "[", "(", "f...
train
https://github.com/bluec0re/python-helperlib/blob/a2ac429668a6b86d3dc5e686978965c938f07d2c/helperlib/binary.py#L418-L449
rcook/pyprelude
pyprelude/url.py
make_url
def make_url(*args, **kwargs): """ >>> make_url("https://host/api", "users", "user-name", "projects", token="api_token") 'https://host/api/users/user-name/projects?token=api_token' >>> make_url("https://host/api", "users", "user-name", "projects/", token="api_token") 'https://host/api/users/user-nam...
python
def make_url(*args, **kwargs): """ >>> make_url("https://host/api", "users", "user-name", "projects", token="api_token") 'https://host/api/users/user-name/projects?token=api_token' >>> make_url("https://host/api", "users", "user-name", "projects/", token="api_token") 'https://host/api/users/user-nam...
[ "def", "make_url", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", "and", "len", "(", "kwargs", ")", "==", "0", ":", "# Return a single string unaltered", "return", "args", "[", "0", "]", "temp_args", "=...
>>> make_url("https://host/api", "users", "user-name", "projects", token="api_token") 'https://host/api/users/user-name/projects?token=api_token' >>> make_url("https://host/api", "users", "user-name", "projects/", token="api_token") 'https://host/api/users/user-name/projects/?token=api_token' >>> make_u...
[ ">>>", "make_url", "(", "https", ":", "//", "host", "/", "api", "users", "user", "-", "name", "projects", "token", "=", "api_token", ")", "https", ":", "//", "host", "/", "api", "/", "users", "/", "user", "-", "name", "/", "projects?token", "=", "api...
train
https://github.com/rcook/pyprelude/blob/a473b34db8045e8715154b8840291d4facc8f94c/pyprelude/url.py#L19-L76
PSU-OIT-ARC/django-cloak
cloak/__init__.py
can_cloak_as
def can_cloak_as(user, other_user): """ Returns true if `user` can cloak as `other_user` """ # check to see if the user is allowed to do this can_cloak = False try: can_cloak = user.can_cloak_as(other_user) except AttributeError as e: try: can_cloak = user.is_staf...
python
def can_cloak_as(user, other_user): """ Returns true if `user` can cloak as `other_user` """ # check to see if the user is allowed to do this can_cloak = False try: can_cloak = user.can_cloak_as(other_user) except AttributeError as e: try: can_cloak = user.is_staf...
[ "def", "can_cloak_as", "(", "user", ",", "other_user", ")", ":", "# check to see if the user is allowed to do this", "can_cloak", "=", "False", "try", ":", "can_cloak", "=", "user", ".", "can_cloak_as", "(", "other_user", ")", "except", "AttributeError", "as", "e", ...
Returns true if `user` can cloak as `other_user`
[ "Returns", "true", "if", "user", "can", "cloak", "as", "other_user" ]
train
https://github.com/PSU-OIT-ARC/django-cloak/blob/3f09711837f4fe7b1813692daa064e536135ffa3/cloak/__init__.py#L5-L19
jmvrbanac/lplight
lplight/client.py
LaunchpadClient.get_project
def get_project(self, name): """ Retrives project information by name :param name: The formal project name in string form. """ uri = '{base}/{project}'.format(base=self.BASE_URI, project=name) resp = self._client.get(uri, model=models.Project) return resp
python
def get_project(self, name): """ Retrives project information by name :param name: The formal project name in string form. """ uri = '{base}/{project}'.format(base=self.BASE_URI, project=name) resp = self._client.get(uri, model=models.Project) return resp
[ "def", "get_project", "(", "self", ",", "name", ")", ":", "uri", "=", "'{base}/{project}'", ".", "format", "(", "base", "=", "self", ".", "BASE_URI", ",", "project", "=", "name", ")", "resp", "=", "self", ".", "_client", ".", "get", "(", "uri", ",", ...
Retrives project information by name :param name: The formal project name in string form.
[ "Retrives", "project", "information", "by", "name" ]
train
https://github.com/jmvrbanac/lplight/blob/4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7/lplight/client.py#L57-L65
jmvrbanac/lplight
lplight/client.py
LaunchpadClient.get_bugs
def get_bugs(self, project, status=None): """ Retrives a List of bugs for a given project. By default, this will only return activate bugs. If you wish to retrieve a non-active bug then specify the status through the status parameter. :param project: The formal project name. ...
python
def get_bugs(self, project, status=None): """ Retrives a List of bugs for a given project. By default, this will only return activate bugs. If you wish to retrieve a non-active bug then specify the status through the status parameter. :param project: The formal project name. ...
[ "def", "get_bugs", "(", "self", ",", "project", ",", "status", "=", "None", ")", ":", "uri", "=", "'{base}/{project}'", ".", "format", "(", "base", "=", "self", ".", "BASE_URI", ",", "project", "=", "project", ")", "parameters", "=", "{", "'ws.op'", ":...
Retrives a List of bugs for a given project. By default, this will only return activate bugs. If you wish to retrieve a non-active bug then specify the status through the status parameter. :param project: The formal project name. :param status: Allows filtering of bugs by curren...
[ "Retrives", "a", "List", "of", "bugs", "for", "a", "given", "project", ".", "By", "default", "this", "will", "only", "return", "activate", "bugs", ".", "If", "you", "wish", "to", "retrieve", "a", "non", "-", "active", "bug", "then", "specify", "the", "...
train
https://github.com/jmvrbanac/lplight/blob/4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7/lplight/client.py#L67-L85
jmvrbanac/lplight
lplight/client.py
LaunchpadClient.get_bug_by_id
def get_bug_by_id(self, bug_id): """ Retrieves a single bug by it's Launchpad bug_id :param bug_id: The Launchpad id for the bug. """ uri = '{base}/bugs/{bug_id}'.format(base=self.BASE_URI, bug_id=bug_id) resp = self._client.get(uri, model=models.Bug) return resp
python
def get_bug_by_id(self, bug_id): """ Retrieves a single bug by it's Launchpad bug_id :param bug_id: The Launchpad id for the bug. """ uri = '{base}/bugs/{bug_id}'.format(base=self.BASE_URI, bug_id=bug_id) resp = self._client.get(uri, model=models.Bug) return resp
[ "def", "get_bug_by_id", "(", "self", ",", "bug_id", ")", ":", "uri", "=", "'{base}/bugs/{bug_id}'", ".", "format", "(", "base", "=", "self", ".", "BASE_URI", ",", "bug_id", "=", "bug_id", ")", "resp", "=", "self", ".", "_client", ".", "get", "(", "uri"...
Retrieves a single bug by it's Launchpad bug_id :param bug_id: The Launchpad id for the bug.
[ "Retrieves", "a", "single", "bug", "by", "it", "s", "Launchpad", "bug_id" ]
train
https://github.com/jmvrbanac/lplight/blob/4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7/lplight/client.py#L87-L95
jfilter/mw-category-members
category_members/retrieve.py
retrieve
def retrieve(cat_name, mw_instance='https://en.wikipedia.org', types=['page', 'subcat', 'file'], clean_subcat_names=False): """Retrieve pages that belong to a given category. Args: cat_name: Category name e.g. 'Category:Presidents_of_the_United_States'. mw_instance: Which MediaWiki i...
python
def retrieve(cat_name, mw_instance='https://en.wikipedia.org', types=['page', 'subcat', 'file'], clean_subcat_names=False): """Retrieve pages that belong to a given category. Args: cat_name: Category name e.g. 'Category:Presidents_of_the_United_States'. mw_instance: Which MediaWiki i...
[ "def", "retrieve", "(", "cat_name", ",", "mw_instance", "=", "'https://en.wikipedia.org'", ",", "types", "=", "[", "'page'", ",", "'subcat'", ",", "'file'", "]", ",", "clean_subcat_names", "=", "False", ")", ":", "cmtype", "=", "f'&cmtype={\"|\".join(types)}'", ...
Retrieve pages that belong to a given category. Args: cat_name: Category name e.g. 'Category:Presidents_of_the_United_States'. mw_instance: Which MediaWiki instance to use (the URL 'origin'). Defaults to 'https://en.wikipedia.org'. types: Which types of pages to retrieve. Def...
[ "Retrieve", "pages", "that", "belong", "to", "a", "given", "category", ".", "Args", ":", "cat_name", ":", "Category", "name", "e", ".", "g", ".", "Category", ":", "Presidents_of_the_United_States", ".", "mw_instance", ":", "Which", "MediaWiki", "instance", "to...
train
https://github.com/jfilter/mw-category-members/blob/9d3b11b5cfde2165a9ff1613ff11d7595a33320e/category_members/retrieve.py#L4-L42
ramrod-project/database-brain
schema/brain/jobs.py
wrap_good_state
def wrap_good_state(func_, *args, **kwargs): """ Decorator/Wrapper to verify the input is an acceptable state prior to calling a function on it :param f: <function> to call :param args: <tuple> positional args :param kwargs: <dict> keyword args :return: wrapped function return """ ...
python
def wrap_good_state(func_, *args, **kwargs): """ Decorator/Wrapper to verify the input is an acceptable state prior to calling a function on it :param f: <function> to call :param args: <tuple> positional args :param kwargs: <dict> keyword args :return: wrapped function return """ ...
[ "def", "wrap_good_state", "(", "func_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "verify_state", "(", "args", "[", "0", "]", ")", ":", "raise", "InvalidState", "(", "\"{} is not a valid state\"", ".", "format", "(", "args", "[", ...
Decorator/Wrapper to verify the input is an acceptable state prior to calling a function on it :param f: <function> to call :param args: <tuple> positional args :param kwargs: <dict> keyword args :return: wrapped function return
[ "Decorator", "/", "Wrapper", "to", "verify", "the", "input", "is", "an", "acceptable", "state", "prior", "to", "calling", "a", "function", "on", "it" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/jobs.py#L87-L99
ramrod-project/database-brain
schema/brain/jobs.py
transition
def transition(prior_state, next_state): """ Transitions to a non-standard state Raises InvalidStateTransition if next_state is not allowed. :param prior_state: <str> :param next_state: <str> :return: <str> """ if next_state not in STATES[prior_state][TRANSITION]: acceptable = ...
python
def transition(prior_state, next_state): """ Transitions to a non-standard state Raises InvalidStateTransition if next_state is not allowed. :param prior_state: <str> :param next_state: <str> :return: <str> """ if next_state not in STATES[prior_state][TRANSITION]: acceptable = ...
[ "def", "transition", "(", "prior_state", ",", "next_state", ")", ":", "if", "next_state", "not", "in", "STATES", "[", "prior_state", "]", "[", "TRANSITION", "]", ":", "acceptable", "=", "STATES", "[", "prior_state", "]", "[", "TRANSITION", "]", "err", "=",...
Transitions to a non-standard state Raises InvalidStateTransition if next_state is not allowed. :param prior_state: <str> :param next_state: <str> :return: <str>
[ "Transitions", "to", "a", "non", "-", "standard", "state" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/jobs.py#L135-L152
ramrod-project/database-brain
schema/brain/jobs.py
get_args
def get_args(job): """ This function gets the arguments from a job :param job: job dictionary :return: input tuple, optional tuple """ return tuple(_get_args_loop(job, INPUT_FIELD)), \ tuple(_get_args_loop(job, OPTIONAL_FIELD))
python
def get_args(job): """ This function gets the arguments from a job :param job: job dictionary :return: input tuple, optional tuple """ return tuple(_get_args_loop(job, INPUT_FIELD)), \ tuple(_get_args_loop(job, OPTIONAL_FIELD))
[ "def", "get_args", "(", "job", ")", ":", "return", "tuple", "(", "_get_args_loop", "(", "job", ",", "INPUT_FIELD", ")", ")", ",", "tuple", "(", "_get_args_loop", "(", "job", ",", "OPTIONAL_FIELD", ")", ")" ]
This function gets the arguments from a job :param job: job dictionary :return: input tuple, optional tuple
[ "This", "function", "gets", "the", "arguments", "from", "a", "job", ":", "param", "job", ":", "job", "dictionary", ":", "return", ":", "input", "tuple", "optional", "tuple" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/jobs.py#L182-L189
ramrod-project/database-brain
schema/brain/jobs.py
apply_args
def apply_args(job, inputs, optional_inputs=None): """ This function is error checking before the job gets updated. :param job: Must be a valid job :param inputs: Must be a tuple type :param optional_inputs: optional for OptionalInputs :return: job """ _apply_args_loop(job, inputs, I...
python
def apply_args(job, inputs, optional_inputs=None): """ This function is error checking before the job gets updated. :param job: Must be a valid job :param inputs: Must be a tuple type :param optional_inputs: optional for OptionalInputs :return: job """ _apply_args_loop(job, inputs, I...
[ "def", "apply_args", "(", "job", ",", "inputs", ",", "optional_inputs", "=", "None", ")", ":", "_apply_args_loop", "(", "job", ",", "inputs", ",", "INPUT_FIELD", ")", "_apply_args_loop", "(", "job", ",", "optional_inputs", ",", "OPTIONAL_FIELD", ")", "return",...
This function is error checking before the job gets updated. :param job: Must be a valid job :param inputs: Must be a tuple type :param optional_inputs: optional for OptionalInputs :return: job
[ "This", "function", "is", "error", "checking", "before", "the", "job", "gets", "updated", ".", ":", "param", "job", ":", "Must", "be", "a", "valid", "job", ":", "param", "inputs", ":", "Must", "be", "a", "tuple", "type", ":", "param", "optional_inputs", ...
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/jobs.py#L199-L210
jabbas/pynapi
pynapi/services/napiprojekt.py
Napiprojekt.get
def get(self, filename): """ returns subtitles as string """ params = { "v": 'dreambox', "kolejka": "false", "nick": "", "pass": "", "napios": sys.platform, "l": self.language.upper(), "f": self.prepareHash(filename),...
python
def get(self, filename): """ returns subtitles as string """ params = { "v": 'dreambox', "kolejka": "false", "nick": "", "pass": "", "napios": sys.platform, "l": self.language.upper(), "f": self.prepareHash(filename),...
[ "def", "get", "(", "self", ",", "filename", ")", ":", "params", "=", "{", "\"v\"", ":", "'dreambox'", ",", "\"kolejka\"", ":", "\"false\"", ",", "\"nick\"", ":", "\"\"", ",", "\"pass\"", ":", "\"\"", ",", "\"napios\"", ":", "sys", ".", "platform", ",",...
returns subtitles as string
[ "returns", "subtitles", "as", "string" ]
train
https://github.com/jabbas/pynapi/blob/d9b3b4d9cd05501c14fe5cc5903b1c21e1905753/pynapi/services/napiprojekt.py#L21-L51
jabbas/pynapi
pynapi/services/napiprojekt.py
Napiprojekt.discombobulate
def discombobulate(self, filehash): """ prepare napiprojekt scrambled hash """ idx = [0xe, 0x3, 0x6, 0x8, 0x2] mul = [2, 2, 5, 4, 3] add = [0, 0xd, 0x10, 0xb, 0x5] b = [] for i in xrange(len(idx)): a = add[i] m = mul[i] i = idx[i] ...
python
def discombobulate(self, filehash): """ prepare napiprojekt scrambled hash """ idx = [0xe, 0x3, 0x6, 0x8, 0x2] mul = [2, 2, 5, 4, 3] add = [0, 0xd, 0x10, 0xb, 0x5] b = [] for i in xrange(len(idx)): a = add[i] m = mul[i] i = idx[i] ...
[ "def", "discombobulate", "(", "self", ",", "filehash", ")", ":", "idx", "=", "[", "0xe", ",", "0x3", ",", "0x6", ",", "0x8", ",", "0x2", "]", "mul", "=", "[", "2", ",", "2", ",", "5", ",", "4", ",", "3", "]", "add", "=", "[", "0", ",", "0...
prepare napiprojekt scrambled hash
[ "prepare", "napiprojekt", "scrambled", "hash" ]
train
https://github.com/jabbas/pynapi/blob/d9b3b4d9cd05501c14fe5cc5903b1c21e1905753/pynapi/services/napiprojekt.py#L53-L70
aksas/pypo4sel
core/pypo4sel/core/elements.py
PageElement.exists
def exists(self): """ :return: True if element is present in the DOM, otherwise False. Ignore implicit and element timeouts and execute immediately. """ t = self.wait_timeout self.wait_timeout = 0 try: self.reload() return True ...
python
def exists(self): """ :return: True if element is present in the DOM, otherwise False. Ignore implicit and element timeouts and execute immediately. """ t = self.wait_timeout self.wait_timeout = 0 try: self.reload() return True ...
[ "def", "exists", "(", "self", ")", ":", "t", "=", "self", ".", "wait_timeout", "self", ".", "wait_timeout", "=", "0", "try", ":", "self", ".", "reload", "(", ")", "return", "True", "except", "NoSuchElementException", ":", "return", "False", "finally", ":...
:return: True if element is present in the DOM, otherwise False. Ignore implicit and element timeouts and execute immediately.
[ ":", "return", ":", "True", "if", "element", "is", "present", "in", "the", "DOM", "otherwise", "False", ".", "Ignore", "implicit", "and", "element", "timeouts", "and", "execute", "immediately", "." ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/elements.py#L85-L98
aksas/pypo4sel
core/pypo4sel/core/elements.py
PageElement.is_displayed
def is_displayed(self): """ :return: False if element is not present in the DOM or invisible, otherwise True. Ignore implicit and element timeouts and execute immediately. To wait when element displayed or not, use ``waiter.wait_displayed`` or ``waiter.wait_not_displayed`` ...
python
def is_displayed(self): """ :return: False if element is not present in the DOM or invisible, otherwise True. Ignore implicit and element timeouts and execute immediately. To wait when element displayed or not, use ``waiter.wait_displayed`` or ``waiter.wait_not_displayed`` ...
[ "def", "is_displayed", "(", "self", ")", ":", "t", "=", "self", ".", "wait_timeout", "self", ".", "wait_timeout", "=", "0", "try", ":", "return", "super", "(", "PageElement", ",", "self", ")", ".", "is_displayed", "(", ")", "except", "NoSuchElementExceptio...
:return: False if element is not present in the DOM or invisible, otherwise True. Ignore implicit and element timeouts and execute immediately. To wait when element displayed or not, use ``waiter.wait_displayed`` or ``waiter.wait_not_displayed``
[ ":", "return", ":", "False", "if", "element", "is", "not", "present", "in", "the", "DOM", "or", "invisible", "otherwise", "True", ".", "Ignore", "implicit", "and", "element", "timeouts", "and", "execute", "immediately", "." ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/elements.py#L100-L114
aksas/pypo4sel
core/pypo4sel/core/elements.py
PageElementsList.is_displayed
def is_displayed(self): """ :return: True id at least one element is displayed, otherwise False. Ignore implicit and element timeouts and execute immediately. """ t = self.wait_timeout self.wait_timeout = 0 try: self.reload() return...
python
def is_displayed(self): """ :return: True id at least one element is displayed, otherwise False. Ignore implicit and element timeouts and execute immediately. """ t = self.wait_timeout self.wait_timeout = 0 try: self.reload() return...
[ "def", "is_displayed", "(", "self", ")", ":", "t", "=", "self", ".", "wait_timeout", "self", ".", "wait_timeout", "=", "0", "try", ":", "self", ".", "reload", "(", ")", "return", "any", "(", "e", ".", "is_displayed", "(", ")", "for", "e", "in", "se...
:return: True id at least one element is displayed, otherwise False. Ignore implicit and element timeouts and execute immediately.
[ ":", "return", ":", "True", "id", "at", "least", "one", "element", "is", "displayed", "otherwise", "False", ".", "Ignore", "implicit", "and", "element", "timeouts", "and", "execute", "immediately", "." ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/elements.py#L240-L251
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/browser/forms.py
user_has_email
def user_has_email(username): """ make sure, that given user has an email associated """ user = api.user.get(username=username) if not user.getProperty("email"): msg = _( "This user doesn't have an email associated " "with their account." ) raise Invalid(msg) ...
python
def user_has_email(username): """ make sure, that given user has an email associated """ user = api.user.get(username=username) if not user.getProperty("email"): msg = _( "This user doesn't have an email associated " "with their account." ) raise Invalid(msg) ...
[ "def", "user_has_email", "(", "username", ")", ":", "user", "=", "api", ".", "user", ".", "get", "(", "username", "=", "username", ")", "if", "not", "user", ".", "getProperty", "(", "\"email\"", ")", ":", "msg", "=", "_", "(", "\"This user doesn't have a...
make sure, that given user has an email associated
[ "make", "sure", "that", "given", "user", "has", "an", "email", "associated" ]
train
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/forms.py#L19-L29
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/browser/forms.py
workspaces_provider
def workspaces_provider(context): """ create a vocab of all workspaces in this site """ catalog = api.portal.get_tool(name="portal_catalog") workspaces = catalog(portal_type="ploneintranet.workspace.workspacefolder") current = api.content.get_uuid(context) terms = [] for ws in workspace...
python
def workspaces_provider(context): """ create a vocab of all workspaces in this site """ catalog = api.portal.get_tool(name="portal_catalog") workspaces = catalog(portal_type="ploneintranet.workspace.workspacefolder") current = api.content.get_uuid(context) terms = [] for ws in workspace...
[ "def", "workspaces_provider", "(", "context", ")", ":", "catalog", "=", "api", ".", "portal", ".", "get_tool", "(", "name", "=", "\"portal_catalog\"", ")", "workspaces", "=", "catalog", "(", "portal_type", "=", "\"ploneintranet.workspace.workspacefolder\"", ")", "...
create a vocab of all workspaces in this site
[ "create", "a", "vocab", "of", "all", "workspaces", "in", "this", "site" ]
train
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/forms.py#L32-L46
Aslan11/wilos-cli
wilos/writers.py
Stdout.live_weather
def live_weather(self, live_weather): """Prints the live weather in a pretty format""" summary = live_weather['currently']['summary'] self.summary(summary) click.echo()
python
def live_weather(self, live_weather): """Prints the live weather in a pretty format""" summary = live_weather['currently']['summary'] self.summary(summary) click.echo()
[ "def", "live_weather", "(", "self", ",", "live_weather", ")", ":", "summary", "=", "live_weather", "[", "'currently'", "]", "[", "'summary'", "]", "self", ".", "summary", "(", "summary", ")", "click", ".", "echo", "(", ")" ]
Prints the live weather in a pretty format
[ "Prints", "the", "live", "weather", "in", "a", "pretty", "format" ]
train
https://github.com/Aslan11/wilos-cli/blob/2c3da3589f685e95b4f73237a1bfe56373ea4574/wilos/writers.py#L43-L47
Aslan11/wilos-cli
wilos/writers.py
Stdout.title
def title(self, title): """Prints the title""" title = " What's it like out side {0}? ".format(title) click.secho("{:=^62}".format(title), fg=self.colors.WHITE) click.echo()
python
def title(self, title): """Prints the title""" title = " What's it like out side {0}? ".format(title) click.secho("{:=^62}".format(title), fg=self.colors.WHITE) click.echo()
[ "def", "title", "(", "self", ",", "title", ")", ":", "title", "=", "\" What's it like out side {0}? \"", ".", "format", "(", "title", ")", "click", ".", "secho", "(", "\"{:=^62}\"", ".", "format", "(", "title", ")", ",", "fg", "=", "self", ".", "colors",...
Prints the title
[ "Prints", "the", "title" ]
train
https://github.com/Aslan11/wilos-cli/blob/2c3da3589f685e95b4f73237a1bfe56373ea4574/wilos/writers.py#L49-L53
Aslan11/wilos-cli
wilos/writers.py
Stdout.summary
def summary(self, summary): """Prints the ASCII Icon""" if summary is not None: if summary == 'Clear': click.secho(""" ________ \ | / / ____/ /__ ____ ______ .-. / / / / _ \/ __ `/ ___/ ‒ ( ) ‒ / /___/ / __/ /_/ / / `-᾿ \__...
python
def summary(self, summary): """Prints the ASCII Icon""" if summary is not None: if summary == 'Clear': click.secho(""" ________ \ | / / ____/ /__ ____ ______ .-. / / / / _ \/ __ `/ ___/ ‒ ( ) ‒ / /___/ / __/ /_/ / / `-᾿ \__...
[ "def", "summary", "(", "self", ",", "summary", ")", ":", "if", "summary", "is", "not", "None", ":", "if", "summary", "==", "'Clear'", ":", "click", ".", "secho", "(", "\"\"\"\n\n ________ \\ | /\n / ____/ /__ ____ ______ .-.\n / / / / _ ...
Prints the ASCII Icon
[ "Prints", "the", "ASCII", "Icon" ]
train
https://github.com/Aslan11/wilos-cli/blob/2c3da3589f685e95b4f73237a1bfe56373ea4574/wilos/writers.py#L55-L154
henrysher/kotocore
kotocore/loader.py
ResourceJSONLoader.get_available_options
def get_available_options(self, service_name): """ Fetches a collection of all JSON files for a given service. This checks user-created files (if present) as well as including the default service files. Example:: >>> loader.get_available_options('s3') {...
python
def get_available_options(self, service_name): """ Fetches a collection of all JSON files for a given service. This checks user-created files (if present) as well as including the default service files. Example:: >>> loader.get_available_options('s3') {...
[ "def", "get_available_options", "(", "self", ",", "service_name", ")", ":", "options", "=", "{", "}", "for", "data_dir", "in", "self", ".", "data_dirs", ":", "# Traverse all the directories trying to find the best match.", "service_glob", "=", "\"{0}-*.json\"", ".", "...
Fetches a collection of all JSON files for a given service. This checks user-created files (if present) as well as including the default service files. Example:: >>> loader.get_available_options('s3') { '2013-11-27': [ '~/.boto-overr...
[ "Fetches", "a", "collection", "of", "all", "JSON", "files", "for", "a", "given", "service", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/loader.py#L54-L104
henrysher/kotocore
kotocore/loader.py
ResourceJSONLoader.get_best_match
def get_best_match(self, options, service_name, api_version=None): """ Given a collection of possible service options, selects the best match. If no API version is provided, the path to the most recent API version will be returned. If an API version is provided & there is an exact ...
python
def get_best_match(self, options, service_name, api_version=None): """ Given a collection of possible service options, selects the best match. If no API version is provided, the path to the most recent API version will be returned. If an API version is provided & there is an exact ...
[ "def", "get_best_match", "(", "self", ",", "options", ",", "service_name", ",", "api_version", "=", "None", ")", ":", "if", "not", "options", ":", "msg", "=", "\"No JSON files provided. Please check your \"", "+", "\"configuration/install.\"", "raise", "NoResourceJSON...
Given a collection of possible service options, selects the best match. If no API version is provided, the path to the most recent API version will be returned. If an API version is provided & there is an exact match, the path to that version will be returned. If there is no exact match...
[ "Given", "a", "collection", "of", "possible", "service", "options", "selects", "the", "best", "match", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/loader.py#L106-L158
henrysher/kotocore
kotocore/loader.py
ResourceJSONLoader.load
def load(self, service_name, api_version=None, cached=True): """ Loads the desired JSON for a service. (uncached) This will fall back through all the ``data_dirs`` provided to the constructor, returning the **first** one it finds. :param service_name: The name of the desired se...
python
def load(self, service_name, api_version=None, cached=True): """ Loads the desired JSON for a service. (uncached) This will fall back through all the ``data_dirs`` provided to the constructor, returning the **first** one it finds. :param service_name: The name of the desired se...
[ "def", "load", "(", "self", ",", "service_name", ",", "api_version", "=", "None", ",", "cached", "=", "True", ")", ":", "# Fetch from the cache first if it's there.", "if", "cached", ":", "if", "service_name", "in", "self", ".", "_loaded_data", ":", "if", "api...
Loads the desired JSON for a service. (uncached) This will fall back through all the ``data_dirs`` provided to the constructor, returning the **first** one it finds. :param service_name: The name of the desired service :type service_name: string :param api_version: (Optional) ...
[ "Loads", "the", "desired", "JSON", "for", "a", "service", ".", "(", "uncached", ")" ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/loader.py#L160-L203
mbodenhamer/syn.utils
syn/utils/cmdargs/args.py
render_args
def render_args(arglst, argdct): '''Render arguments for command-line invocation. arglst: A list of Argument objects (specifies order) argdct: A mapping of argument names to values (specifies rendered values) ''' out = '' for arg in arglst: if arg.name in argdct: render...
python
def render_args(arglst, argdct): '''Render arguments for command-line invocation. arglst: A list of Argument objects (specifies order) argdct: A mapping of argument names to values (specifies rendered values) ''' out = '' for arg in arglst: if arg.name in argdct: render...
[ "def", "render_args", "(", "arglst", ",", "argdct", ")", ":", "out", "=", "''", "for", "arg", "in", "arglst", ":", "if", "arg", ".", "name", "in", "argdct", ":", "rendered", "=", "arg", ".", "render", "(", "argdct", "[", "arg", ".", "name", "]", ...
Render arguments for command-line invocation. arglst: A list of Argument objects (specifies order) argdct: A mapping of argument names to values (specifies rendered values)
[ "Render", "arguments", "for", "command", "-", "line", "invocation", "." ]
train
https://github.com/mbodenhamer/syn.utils/blob/82b0dfa27d08858e802a166a44870db10a02a964/syn/utils/cmdargs/args.py#L155-L170
hkff/FodtlMon
fodtlmon/mon.py
main
def main(argv): """ Main mon :param argv: console arguments :return: """ input_file = "" output_file = "" monitor = None formula = None trace = None iformula = None itrace = None isys = None online = False fuzzer = False l2m = False debug = False r...
python
def main(argv): """ Main mon :param argv: console arguments :return: """ input_file = "" output_file = "" monitor = None formula = None trace = None iformula = None itrace = None isys = None online = False fuzzer = False l2m = False debug = False r...
[ "def", "main", "(", "argv", ")", ":", "input_file", "=", "\"\"", "output_file", "=", "\"\"", "monitor", "=", "None", "formula", "=", "None", "trace", "=", "None", "iformula", "=", "None", "itrace", "=", "None", "isys", "=", "None", "online", "=", "Fals...
Main mon :param argv: console arguments :return:
[ "Main", "mon", ":", "param", "argv", ":", "console", "arguments", ":", "return", ":" ]
train
https://github.com/hkff/FodtlMon/blob/0c9015a1a1f0a4a64d52945c86b45441d5871c56/fodtlmon/mon.py#L35-L179
exekias/droplet
droplet/network/util.py
getifaddrs
def getifaddrs(): """ Return a list of network interfaces info, with this format: { 'interface_name': { 'ipv6': [{'scope': 5L, 'netmask': 'ffff:ffff:ffff:ffff::', 'addr': 'fe80::34f2:7dff:fe69:7c18'}], '...
python
def getifaddrs(): """ Return a list of network interfaces info, with this format: { 'interface_name': { 'ipv6': [{'scope': 5L, 'netmask': 'ffff:ffff:ffff:ffff::', 'addr': 'fe80::34f2:7dff:fe69:7c18'}], '...
[ "def", "getifaddrs", "(", ")", ":", "class", "ifa_ifu_u", "(", "Union", ")", ":", "_fields_", "=", "[", "(", "\"ifu_broadaddr\"", ",", "c_void_p", ")", ",", "(", "\"ifu_dstaddr\"", ",", "c_void_p", ")", "]", "class", "ifaddrs", "(", "Structure", ")", ":"...
Return a list of network interfaces info, with this format: { 'interface_name': { 'ipv6': [{'scope': 5L, 'netmask': 'ffff:ffff:ffff:ffff::', 'addr': 'fe80::34f2:7dff:fe69:7c18'}], 'hw': [{'addr': '36:f2:7d:69:7c...
[ "Return", "a", "list", "of", "network", "interfaces", "info", "with", "this", "format", ":" ]
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/network/util.py#L8-L181
jut-io/jut-python-tools
jut/api/integrations.py
get_webhook_url
def get_webhook_url(deployment_name, space='default', data_source='webhook', token_manager=None, app_url=defaults.APP_URL, **fields): """ return the webhook URL for posting webhook data to """ import_ur...
python
def get_webhook_url(deployment_name, space='default', data_source='webhook', token_manager=None, app_url=defaults.APP_URL, **fields): """ return the webhook URL for posting webhook data to """ import_ur...
[ "def", "get_webhook_url", "(", "deployment_name", ",", "space", "=", "'default'", ",", "data_source", "=", "'webhook'", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ",", "*", "*", "fields", ")", ":", "import_url", "=", ...
return the webhook URL for posting webhook data to
[ "return", "the", "webhook", "URL", "for", "posting", "webhook", "data", "to" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/integrations.py#L11-L33
knagra/farnsworth
farnswiki/templatetags/truncatehtml.py
truncatehtml
def truncatehtml(string, length, ellipsis='...'): """Truncate HTML string, preserving tag structure and character entities.""" length = int(length) output_length = 0 i = 0 pending_close_tags = {} while output_length < length and i < len(string): c = string[i] if c == '<': ...
python
def truncatehtml(string, length, ellipsis='...'): """Truncate HTML string, preserving tag structure and character entities.""" length = int(length) output_length = 0 i = 0 pending_close_tags = {} while output_length < length and i < len(string): c = string[i] if c == '<': ...
[ "def", "truncatehtml", "(", "string", ",", "length", ",", "ellipsis", "=", "'...'", ")", ":", "length", "=", "int", "(", "length", ")", "output_length", "=", "0", "i", "=", "0", "pending_close_tags", "=", "{", "}", "while", "output_length", "<", "length"...
Truncate HTML string, preserving tag structure and character entities.
[ "Truncate", "HTML", "string", "preserving", "tag", "structure", "and", "character", "entities", "." ]
train
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/farnswiki/templatetags/truncatehtml.py#L12-L75
evetrivia/thanatos
thanatos/questions/universe.py
remove_regions_with_no_gates
def remove_regions_with_no_gates(regions): """ Removes all Jove regions from a list of regions. :param regions: A list of tuples (regionID, regionName) :type regions: list :return: A list of regions minus those in jove space :rtype: list """ list_of_gateless_regions = [ (10000004,...
python
def remove_regions_with_no_gates(regions): """ Removes all Jove regions from a list of regions. :param regions: A list of tuples (regionID, regionName) :type regions: list :return: A list of regions minus those in jove space :rtype: list """ list_of_gateless_regions = [ (10000004,...
[ "def", "remove_regions_with_no_gates", "(", "regions", ")", ":", "list_of_gateless_regions", "=", "[", "(", "10000004", ",", "'UUA-F4'", ")", ",", "(", "10000017", ",", "'J7HZ-F'", ")", ",", "(", "10000019", ",", "'A821-A'", ")", ",", "]", "for", "gateless_r...
Removes all Jove regions from a list of regions. :param regions: A list of tuples (regionID, regionName) :type regions: list :return: A list of regions minus those in jove space :rtype: list
[ "Removes", "all", "Jove", "regions", "from", "a", "list", "of", "regions", "." ]
train
https://github.com/evetrivia/thanatos/blob/664c12a8ccf4d27ab0e06e0969bbb6381f74789c/thanatos/questions/universe.py#L80-L100
dev-pipeline/dev-pipeline-cmake
lib/devpipeline_cmake/cmake.py
_make_cmake
def _make_cmake(config_info): """This function initializes a CMake builder for building the project.""" configure_args = ["-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"] cmake_args = {} options, option_fns = _make_all_options() def _add_value(value, key): args_key, args_value = _EX_ARG_FNS[key](valu...
python
def _make_cmake(config_info): """This function initializes a CMake builder for building the project.""" configure_args = ["-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"] cmake_args = {} options, option_fns = _make_all_options() def _add_value(value, key): args_key, args_value = _EX_ARG_FNS[key](valu...
[ "def", "_make_cmake", "(", "config_info", ")", ":", "configure_args", "=", "[", "\"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON\"", "]", "cmake_args", "=", "{", "}", "options", ",", "option_fns", "=", "_make_all_options", "(", ")", "def", "_add_value", "(", "value", ",", ...
This function initializes a CMake builder for building the project.
[ "This", "function", "initializes", "a", "CMake", "builder", "for", "building", "the", "project", "." ]
train
https://github.com/dev-pipeline/dev-pipeline-cmake/blob/f0119d973d2dc14cc73d0fea0df1d263bde2a245/lib/devpipeline_cmake/cmake.py#L183-L207
dev-pipeline/dev-pipeline-cmake
lib/devpipeline_cmake/cmake.py
CMake.configure
def configure(self, src_dir, build_dir, **kwargs): """This function builds the cmake configure command.""" del kwargs ex_path = self._ex_args.get("project_path") if ex_path: src_dir = os.path.join(src_dir, ex_path) return [{"args": ["cmake", src_dir] + self._config_a...
python
def configure(self, src_dir, build_dir, **kwargs): """This function builds the cmake configure command.""" del kwargs ex_path = self._ex_args.get("project_path") if ex_path: src_dir = os.path.join(src_dir, ex_path) return [{"args": ["cmake", src_dir] + self._config_a...
[ "def", "configure", "(", "self", ",", "src_dir", ",", "build_dir", ",", "*", "*", "kwargs", ")", ":", "del", "kwargs", "ex_path", "=", "self", ".", "_ex_args", ".", "get", "(", "\"project_path\"", ")", "if", "ex_path", ":", "src_dir", "=", "os", ".", ...
This function builds the cmake configure command.
[ "This", "function", "builds", "the", "cmake", "configure", "command", "." ]
train
https://github.com/dev-pipeline/dev-pipeline-cmake/blob/f0119d973d2dc14cc73d0fea0df1d263bde2a245/lib/devpipeline_cmake/cmake.py#L34-L41
dev-pipeline/dev-pipeline-cmake
lib/devpipeline_cmake/cmake.py
CMake.build
def build(self, build_dir, **kwargs): """This function builds the cmake build command.""" # pylint: disable=no-self-use del kwargs args = ["cmake", "--build", build_dir] args.extend(self._get_build_flags()) return [{"args": args}]
python
def build(self, build_dir, **kwargs): """This function builds the cmake build command.""" # pylint: disable=no-self-use del kwargs args = ["cmake", "--build", build_dir] args.extend(self._get_build_flags()) return [{"args": args}]
[ "def", "build", "(", "self", ",", "build_dir", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=no-self-use", "del", "kwargs", "args", "=", "[", "\"cmake\"", ",", "\"--build\"", ",", "build_dir", "]", "args", ".", "extend", "(", "self", ".", "_get_bui...
This function builds the cmake build command.
[ "This", "function", "builds", "the", "cmake", "build", "command", "." ]
train
https://github.com/dev-pipeline/dev-pipeline-cmake/blob/f0119d973d2dc14cc73d0fea0df1d263bde2a245/lib/devpipeline_cmake/cmake.py#L43-L49
dev-pipeline/dev-pipeline-cmake
lib/devpipeline_cmake/cmake.py
CMake.install
def install(self, build_dir, install_dir=None, **kwargs): """This function builds the cmake install command.""" # pylint: disable=no-self-use del kwargs install_args = ["cmake", "--build", build_dir, "--target", "install"] install_args.extend(self._get_build_flags()) if i...
python
def install(self, build_dir, install_dir=None, **kwargs): """This function builds the cmake install command.""" # pylint: disable=no-self-use del kwargs install_args = ["cmake", "--build", build_dir, "--target", "install"] install_args.extend(self._get_build_flags()) if i...
[ "def", "install", "(", "self", ",", "build_dir", ",", "install_dir", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=no-self-use", "del", "kwargs", "install_args", "=", "[", "\"cmake\"", ",", "\"--build\"", ",", "build_dir", ",", "\"--target...
This function builds the cmake install command.
[ "This", "function", "builds", "the", "cmake", "install", "command", "." ]
train
https://github.com/dev-pipeline/dev-pipeline-cmake/blob/f0119d973d2dc14cc73d0fea0df1d263bde2a245/lib/devpipeline_cmake/cmake.py#L51-L59
cstockton/py-gensend
gensend/providers/common.py
Control._dict_if
def _dict_if(self, *args): """Returns the arguments in the list joined by STR. IF:CONDITION,DO,ELSE %{IF:False,'IS TRUE'} -> '' %{IF:True,'IS TRUE', 'NOT TRUE'} -> 'NOT TRUE' """ call_args = list(args) do_cond = call_args.pop(0) do_if = call_args.pop(...
python
def _dict_if(self, *args): """Returns the arguments in the list joined by STR. IF:CONDITION,DO,ELSE %{IF:False,'IS TRUE'} -> '' %{IF:True,'IS TRUE', 'NOT TRUE'} -> 'NOT TRUE' """ call_args = list(args) do_cond = call_args.pop(0) do_if = call_args.pop(...
[ "def", "_dict_if", "(", "self", ",", "*", "args", ")", ":", "call_args", "=", "list", "(", "args", ")", "do_cond", "=", "call_args", ".", "pop", "(", "0", ")", "do_if", "=", "call_args", ".", "pop", "(", "0", ")", "do_else", "=", "''", "if", "len...
Returns the arguments in the list joined by STR. IF:CONDITION,DO,ELSE %{IF:False,'IS TRUE'} -> '' %{IF:True,'IS TRUE', 'NOT TRUE'} -> 'NOT TRUE'
[ "Returns", "the", "arguments", "in", "the", "list", "joined", "by", "STR", ".", "IF", ":", "CONDITION", "DO", "ELSE" ]
train
https://github.com/cstockton/py-gensend/blob/8c8e911f8e8c386bea42967350beb4636fc19240/gensend/providers/common.py#L54-L68
cstockton/py-gensend
gensend/providers/common.py
Control._dict_repeat
def _dict_repeat(self, *args): """Do a thing N times REPEAT:N,DO %{REPEAT:10,%{INT}} -> '123 123 ... 123' """ call_args = list(args) do_count = call_args.pop(0) do_thing = call_args.pop(0) do_out = [] for i in range(int(do_count)): ...
python
def _dict_repeat(self, *args): """Do a thing N times REPEAT:N,DO %{REPEAT:10,%{INT}} -> '123 123 ... 123' """ call_args = list(args) do_count = call_args.pop(0) do_thing = call_args.pop(0) do_out = [] for i in range(int(do_count)): ...
[ "def", "_dict_repeat", "(", "self", ",", "*", "args", ")", ":", "call_args", "=", "list", "(", "args", ")", "do_count", "=", "call_args", ".", "pop", "(", "0", ")", "do_thing", "=", "call_args", ".", "pop", "(", "0", ")", "do_out", "=", "[", "]", ...
Do a thing N times REPEAT:N,DO %{REPEAT:10,%{INT}} -> '123 123 ... 123'
[ "Do", "a", "thing", "N", "times", "REPEAT", ":", "N", "DO" ]
train
https://github.com/cstockton/py-gensend/blob/8c8e911f8e8c386bea42967350beb4636fc19240/gensend/providers/common.py#L70-L83
cstockton/py-gensend
gensend/providers/common.py
Control.istrue
def istrue(self, *args): """Strict test for 'true' value test. If multiple args are provided it will test them all. ISTRUE:true %{ISTRUE:true} -> 'True' """ def is_true(val): if val is True: return True val = str(val).lower().s...
python
def istrue(self, *args): """Strict test for 'true' value test. If multiple args are provided it will test them all. ISTRUE:true %{ISTRUE:true} -> 'True' """ def is_true(val): if val is True: return True val = str(val).lower().s...
[ "def", "istrue", "(", "self", ",", "*", "args", ")", ":", "def", "is_true", "(", "val", ")", ":", "if", "val", "is", "True", ":", "return", "True", "val", "=", "str", "(", "val", ")", ".", "lower", "(", ")", ".", "strip", "(", ")", "return", ...
Strict test for 'true' value test. If multiple args are provided it will test them all. ISTRUE:true %{ISTRUE:true} -> 'True'
[ "Strict", "test", "for", "true", "value", "test", ".", "If", "multiple", "args", "are", "provided", "it", "will", "test", "them", "all", ".", "ISTRUE", ":", "true" ]
train
https://github.com/cstockton/py-gensend/blob/8c8e911f8e8c386bea42967350beb4636fc19240/gensend/providers/common.py#L102-L114