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
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
_RelatedCollectionWithMethods._to_fields
def _to_fields(self, *values): """ Take a list of values, which must be primary keys of the model linked to the related collection, and return a list of related fields. """ result = [] for related_instance in values: if not isinstance(related_instance, model.R...
python
def _to_fields(self, *values): """ Take a list of values, which must be primary keys of the model linked to the related collection, and return a list of related fields. """ result = [] for related_instance in values: if not isinstance(related_instance, model.R...
[ "def", "_to_fields", "(", "self", ",", "*", "values", ")", ":", "result", "=", "[", "]", "for", "related_instance", "in", "values", ":", "if", "not", "isinstance", "(", "related_instance", ",", "model", ".", "RedisModel", ")", ":", "related_instance", "=",...
Take a list of values, which must be primary keys of the model linked to the related collection, and return a list of related fields.
[ "Take", "a", "list", "of", "values", "which", "must", "be", "primary", "keys", "of", "the", "model", "linked", "to", "the", "related", "collection", "and", "return", "a", "list", "of", "related", "fields", "." ]
train
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L20-L30
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
_RelatedCollectionWithMethods._reverse_call
def _reverse_call(self, related_method, *values): """ Convert each value to a related field, then call the method on each field, passing self.instance as argument. If related_method is a string, it will be the method of the related field. If it's a callable, it's a function which...
python
def _reverse_call(self, related_method, *values): """ Convert each value to a related field, then call the method on each field, passing self.instance as argument. If related_method is a string, it will be the method of the related field. If it's a callable, it's a function which...
[ "def", "_reverse_call", "(", "self", ",", "related_method", ",", "*", "values", ")", ":", "related_fields", "=", "self", ".", "_to_fields", "(", "*", "values", ")", "for", "related_field", "in", "related_fields", ":", "if", "callable", "(", "related_method", ...
Convert each value to a related field, then call the method on each field, passing self.instance as argument. If related_method is a string, it will be the method of the related field. If it's a callable, it's a function which accept the related field and self.instance.
[ "Convert", "each", "value", "to", "a", "related", "field", "then", "call", "the", "method", "on", "each", "field", "passing", "self", ".", "instance", "as", "argument", ".", "If", "related_method", "is", "a", "string", "it", "will", "be", "the", "method", ...
train
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L32-L45
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
_RelatedCollectionForFK.srem
def srem(self, *values): """ Do a "set" call with self.instance as parameter for each value. Values must be primary keys of the related model. """ self._reverse_call(lambda related_field, value: related_field.delete(), *values)
python
def srem(self, *values): """ Do a "set" call with self.instance as parameter for each value. Values must be primary keys of the related model. """ self._reverse_call(lambda related_field, value: related_field.delete(), *values)
[ "def", "srem", "(", "self", ",", "*", "values", ")", ":", "self", ".", "_reverse_call", "(", "lambda", "related_field", ",", "value", ":", "related_field", ".", "delete", "(", ")", ",", "*", "values", ")" ]
Do a "set" call with self.instance as parameter for each value. Values must be primary keys of the related model.
[ "Do", "a", "set", "call", "with", "self", ".", "instance", "as", "parameter", "for", "each", "value", ".", "Values", "must", "be", "primary", "keys", "of", "the", "related", "model", "." ]
train
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L58-L63
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
RelatedCollectionForList.lrem
def lrem(self, *values): """ Do a "lrem" call with self.instance as parameter for each value. Values must be primary keys of the related model. The "count" argument of the final call will be 0 to remove all the matching values. """ self._reverse_call(lambda relate...
python
def lrem(self, *values): """ Do a "lrem" call with self.instance as parameter for each value. Values must be primary keys of the related model. The "count" argument of the final call will be 0 to remove all the matching values. """ self._reverse_call(lambda relate...
[ "def", "lrem", "(", "self", ",", "*", "values", ")", ":", "self", ".", "_reverse_call", "(", "lambda", "related_field", ",", "value", ":", "related_field", ".", "lrem", "(", "0", ",", "value", ")", ",", "*", "values", ")" ]
Do a "lrem" call with self.instance as parameter for each value. Values must be primary keys of the related model. The "count" argument of the final call will be 0 to remove all the matching values.
[ "Do", "a", "lrem", "call", "with", "self", ".", "instance", "as", "parameter", "for", "each", "value", ".", "Values", "must", "be", "primary", "keys", "of", "the", "related", "model", ".", "The", "count", "argument", "of", "the", "final", "call", "will",...
train
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L123-L130
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
RelatedCollectionForSortedSet.zadd
def zadd(self, *args, **kwargs): """ For each score/value given as paramter, do a "zadd" call with score/self.instance as parameter call for each value. Values must be primary keys of the related model. """ if 'values_callback' not in kwargs: kwargs['values_ca...
python
def zadd(self, *args, **kwargs): """ For each score/value given as paramter, do a "zadd" call with score/self.instance as parameter call for each value. Values must be primary keys of the related model. """ if 'values_callback' not in kwargs: kwargs['values_ca...
[ "def", "zadd", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'values_callback'", "not", "in", "kwargs", ":", "kwargs", "[", "'values_callback'", "]", "=", "self", ".", "_to_fields", "pieces", "=", "fields", ".", "SortedSetField...
For each score/value given as paramter, do a "zadd" call with score/self.instance as parameter call for each value. Values must be primary keys of the related model.
[ "For", "each", "score", "/", "value", "given", "as", "paramter", "do", "a", "zadd", "call", "with", "score", "/", "self", ".", "instance", "as", "parameter", "call", "for", "each", "value", ".", "Values", "must", "be", "primary", "keys", "of", "the", "...
train
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L140-L151
stuaxo/mnd
mnd/match.py
arg_comparitor
def arg_comparitor(name): """ :param arg name :return: pair containing name, comparitor given an argument name, munge it and return a proper comparitor >>> arg_comparitor("a") a, operator.eq >>> arg_comparitor("a__in") a, operator.contains """ if name.endswith("__in"): ...
python
def arg_comparitor(name): """ :param arg name :return: pair containing name, comparitor given an argument name, munge it and return a proper comparitor >>> arg_comparitor("a") a, operator.eq >>> arg_comparitor("a__in") a, operator.contains """ if name.endswith("__in"): ...
[ "def", "arg_comparitor", "(", "name", ")", ":", "if", "name", ".", "endswith", "(", "\"__in\"", ")", ":", "return", "name", "[", ":", "-", "4", "]", ",", "contains", "elif", "name", ".", "endswith", "(", "\"__ge\"", ")", ":", "return", "name", "[", ...
:param arg name :return: pair containing name, comparitor given an argument name, munge it and return a proper comparitor >>> arg_comparitor("a") a, operator.eq >>> arg_comparitor("a__in") a, operator.contains
[ ":", "param", "arg", "name", ":", "return", ":", "pair", "containing", "name", "comparitor" ]
train
https://github.com/stuaxo/mnd/blob/0eb30155d310fa1e550cb9efd6486816b9231d27/mnd/match.py#L12-L40
stuaxo/mnd
mnd/match.py
arg_match
def arg_match(m_arg, arg, comparator=eq, default=False): """ :param m_arg: value to match against or callable :param arg: arg to match :param comparator: function that returns True if m_arg and arg match :param default: will be returned if m_arg is None if m_arg is a callable it will be called...
python
def arg_match(m_arg, arg, comparator=eq, default=False): """ :param m_arg: value to match against or callable :param arg: arg to match :param comparator: function that returns True if m_arg and arg match :param default: will be returned if m_arg is None if m_arg is a callable it will be called...
[ "def", "arg_match", "(", "m_arg", ",", "arg", ",", "comparator", "=", "eq", ",", "default", "=", "False", ")", ":", "if", "m_arg", "is", "None", ":", "return", "default", "if", "isinstance", "(", "m_arg", ",", "dict", ")", ":", "for", "name", ",", ...
:param m_arg: value to match against or callable :param arg: arg to match :param comparator: function that returns True if m_arg and arg match :param default: will be returned if m_arg is None if m_arg is a callable it will be called with arg >>> arg_match(1, 1) True >>> arg_match(1, 2) ...
[ ":", "param", "m_arg", ":", "value", "to", "match", "against", "or", "callable", ":", "param", "arg", ":", "arg", "to", "match", ":", "param", "comparator", ":", "function", "that", "returns", "True", "if", "m_arg", "and", "arg", "match", ":", "param", ...
train
https://github.com/stuaxo/mnd/blob/0eb30155d310fa1e550cb9efd6486816b9231d27/mnd/match.py#L43-L82
stuaxo/mnd
mnd/match.py
args_match
def args_match(m_args, m_kwargs, default, *args, **kwargs): """ :param m_args: values to match args against :param m_kwargs: values to match kwargs against :param arg: args to match :param arg: kwargs to match """ if len(m_args) > len(args): return False for m_arg, arg in zip(m...
python
def args_match(m_args, m_kwargs, default, *args, **kwargs): """ :param m_args: values to match args against :param m_kwargs: values to match kwargs against :param arg: args to match :param arg: kwargs to match """ if len(m_args) > len(args): return False for m_arg, arg in zip(m...
[ "def", "args_match", "(", "m_args", ",", "m_kwargs", ",", "default", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "m_args", ")", ">", "len", "(", "args", ")", ":", "return", "False", "for", "m_arg", ",", "arg", "in", "zi...
:param m_args: values to match args against :param m_kwargs: values to match kwargs against :param arg: args to match :param arg: kwargs to match
[ ":", "param", "m_args", ":", "values", "to", "match", "args", "against", ":", "param", "m_kwargs", ":", "values", "to", "match", "kwargs", "against", ":", "param", "arg", ":", "args", "to", "match", ":", "param", "arg", ":", "kwargs", "to", "match" ]
train
https://github.com/stuaxo/mnd/blob/0eb30155d310fa1e550cb9efd6486816b9231d27/mnd/match.py#L85-L105
rerb/django-fortune
fortune/views.py
PackViewSet.loaded
def loaded(self, request, *args, **kwargs): """Return a list of loaded Packs. """ serializer = self.get_serializer(list(Pack.objects.all()), many=True) return Response(serializer.data)
python
def loaded(self, request, *args, **kwargs): """Return a list of loaded Packs. """ serializer = self.get_serializer(list(Pack.objects.all()), many=True) return Response(serializer.data)
[ "def", "loaded", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "serializer", "=", "self", ".", "get_serializer", "(", "list", "(", "Pack", ".", "objects", ".", "all", "(", ")", ")", ",", "many", "=", "True", ")...
Return a list of loaded Packs.
[ "Return", "a", "list", "of", "loaded", "Packs", "." ]
train
https://github.com/rerb/django-fortune/blob/f84d34f616ecabd4fab8351ad7d3062cc9d6b127/fortune/views.py#L30-L35
rerb/django-fortune
fortune/views.py
PackViewSet.available
def available(self, request, *args, **kwargs): """Return a list of available (unloaded) Pack names. """ packs = [] for pack_name in get_available_pack_names(): packs.append(pack_name) return Response(packs)
python
def available(self, request, *args, **kwargs): """Return a list of available (unloaded) Pack names. """ packs = [] for pack_name in get_available_pack_names(): packs.append(pack_name) return Response(packs)
[ "def", "available", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "packs", "=", "[", "]", "for", "pack_name", "in", "get_available_pack_names", "(", ")", ":", "packs", ".", "append", "(", "pack_name", ")", "return", ...
Return a list of available (unloaded) Pack names.
[ "Return", "a", "list", "of", "available", "(", "unloaded", ")", "Pack", "names", "." ]
train
https://github.com/rerb/django-fortune/blob/f84d34f616ecabd4fab8351ad7d3062cc9d6b127/fortune/views.py#L38-L44
pjuren/pyokit
src/pyokit/io/indexedFile.py
IndexedFile.indexed_file
def indexed_file(self, f): """ Setter for information about the file this object indexes. :param f: a tuple of (filename, handle), either (or both) of which can be None. If the handle is None, but filename is provided, then handle is created from the filename. If both handle and...
python
def indexed_file(self, f): """ Setter for information about the file this object indexes. :param f: a tuple of (filename, handle), either (or both) of which can be None. If the handle is None, but filename is provided, then handle is created from the filename. If both handle and...
[ "def", "indexed_file", "(", "self", ",", "f", ")", ":", "filename", ",", "handle", "=", "f", "if", "handle", "is", "None", "and", "filename", "is", "not", "None", ":", "handle", "=", "open", "(", "filename", ")", "if", "(", "handle", "is", "None", ...
Setter for information about the file this object indexes. :param f: a tuple of (filename, handle), either (or both) of which can be None. If the handle is None, but filename is provided, then handle is created from the filename. If both handle and filename are None, or th...
[ "Setter", "for", "information", "about", "the", "file", "this", "object", "indexes", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/indexedFile.py#L122-L147
pjuren/pyokit
src/pyokit/io/indexedFile.py
IndexedFile.__build_index
def __build_index(self, until=None, flush=False, verbose=False): """ build/expand the index for this file. :param until: expand the index until the record with this hash has been incorporated and then stop. If None, go until the iterator is exhausted. Note that if this h...
python
def __build_index(self, until=None, flush=False, verbose=False): """ build/expand the index for this file. :param until: expand the index until the record with this hash has been incorporated and then stop. If None, go until the iterator is exhausted. Note that if this h...
[ "def", "__build_index", "(", "self", ",", "until", "=", "None", ",", "flush", "=", "False", ",", "verbose", "=", "False", ")", ":", "assert", "(", "self", ".", "_indexed_file_handle", "is", "not", "None", ")", "if", "flush", ":", "self", ".", "_index",...
build/expand the index for this file. :param until: expand the index until the record with this hash has been incorporated and then stop. If None, go until the iterator is exhausted. Note that if this hash is already in the index, no new items will be :para...
[ "build", "/", "expand", "the", "index", "for", "this", "file", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/indexedFile.py#L149-L181
pjuren/pyokit
src/pyokit/io/indexedFile.py
IndexedFile.write_index
def write_index(self, fh, to_str_func=str, generate=True, verbose=False): """ Write this index to a file. Only the index dictionary itself is stored, no informatiom about the indexed file, or the open filehandle is retained. The Output format is just a tab-separated file, one record per line. The l...
python
def write_index(self, fh, to_str_func=str, generate=True, verbose=False): """ Write this index to a file. Only the index dictionary itself is stored, no informatiom about the indexed file, or the open filehandle is retained. The Output format is just a tab-separated file, one record per line. The l...
[ "def", "write_index", "(", "self", ",", "fh", ",", "to_str_func", "=", "str", ",", "generate", "=", "True", ",", "verbose", "=", "False", ")", ":", "try", ":", "handle", "=", "open", "(", "fh", ",", "\"w\"", ")", "except", "TypeError", ":", "# okay, ...
Write this index to a file. Only the index dictionary itself is stored, no informatiom about the indexed file, or the open filehandle is retained. The Output format is just a tab-separated file, one record per line. The last column is the file location for the record and all columns before that are col...
[ "Write", "this", "index", "to", "a", "file", "." ]
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/indexedFile.py#L248-L278
pjuren/pyokit
src/pyokit/io/indexedFile.py
IndexedFile.read_index
def read_index(self, fh, indexed_fh, rec_iterator=None, rec_hash_func=None, parse_hash=str, flush=True, no_reindex=True, verbose=False): """ Populate this index from a file. Input format is just a tab-separated file, one record per line. The last column is the file location...
python
def read_index(self, fh, indexed_fh, rec_iterator=None, rec_hash_func=None, parse_hash=str, flush=True, no_reindex=True, verbose=False): """ Populate this index from a file. Input format is just a tab-separated file, one record per line. The last column is the file location...
[ "def", "read_index", "(", "self", ",", "fh", ",", "indexed_fh", ",", "rec_iterator", "=", "None", ",", "rec_hash_func", "=", "None", ",", "parse_hash", "=", "str", ",", "flush", "=", "True", ",", "no_reindex", "=", "True", ",", "verbose", "=", "False", ...
Populate this index from a file. Input format is just a tab-separated file, one record per line. The last column is the file location for the record and all columns before that are collectively considered to be the hash key for that record (which is probably only 1 column, but this allows us to permit t...
[ "Populate", "this", "index", "from", "a", "file", ".", "Input", "format", "is", "just", "a", "tab", "-", "separated", "file", "one", "record", "per", "line", ".", "The", "last", "column", "is", "the", "file", "location", "for", "the", "record", "and", ...
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/indexedFile.py#L284-L390
eallik/spinoff
spinoff/actor/uri.py
Uri.steps
def steps(self): """Returns an iterable containing the steps to this `Uri` from the root `Uri`, including the root `Uri`.""" def _iter(uri, acc): acc.appendleft(uri.name if uri.name else '') return _iter(uri.parent, acc) if uri.parent else acc return _iter(self, acc=deque...
python
def steps(self): """Returns an iterable containing the steps to this `Uri` from the root `Uri`, including the root `Uri`.""" def _iter(uri, acc): acc.appendleft(uri.name if uri.name else '') return _iter(uri.parent, acc) if uri.parent else acc return _iter(self, acc=deque...
[ "def", "steps", "(", "self", ")", ":", "def", "_iter", "(", "uri", ",", "acc", ")", ":", "acc", ".", "appendleft", "(", "uri", ".", "name", "if", "uri", ".", "name", "else", "''", ")", "return", "_iter", "(", "uri", ".", "parent", ",", "acc", "...
Returns an iterable containing the steps to this `Uri` from the root `Uri`, including the root `Uri`.
[ "Returns", "an", "iterable", "containing", "the", "steps", "to", "this", "Uri", "from", "the", "root", "Uri", "including", "the", "root", "Uri", "." ]
train
https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/spinoff/actor/uri.py#L51-L56
eallik/spinoff
spinoff/actor/uri.py
Uri.parse
def parse(cls, addr): """Parses a new `Uri` instance from a string representation of a URI. >>> u1 = Uri.parse('/foo/bar') >>> u1.node, u1.steps, u1.path, u1.name (None, ['', 'foo', 'bar'], '/foo/bar', 'bar') >>> u2 = Uri.parse('somenode:123/foo/bar') >>> u2.node, u1.ste...
python
def parse(cls, addr): """Parses a new `Uri` instance from a string representation of a URI. >>> u1 = Uri.parse('/foo/bar') >>> u1.node, u1.steps, u1.path, u1.name (None, ['', 'foo', 'bar'], '/foo/bar', 'bar') >>> u2 = Uri.parse('somenode:123/foo/bar') >>> u2.node, u1.ste...
[ "def", "parse", "(", "cls", ",", "addr", ")", ":", "if", "addr", ".", "endswith", "(", "'/'", ")", ":", "raise", "ValueError", "(", "\"Uris must not end in '/'\"", ")", "# pragma: no cover", "parts", "=", "addr", ".", "split", "(", "'/'", ")", "if", "':'...
Parses a new `Uri` instance from a string representation of a URI. >>> u1 = Uri.parse('/foo/bar') >>> u1.node, u1.steps, u1.path, u1.name (None, ['', 'foo', 'bar'], '/foo/bar', 'bar') >>> u2 = Uri.parse('somenode:123/foo/bar') >>> u2.node, u1.steps, u2.path, ur2.name ('s...
[ "Parses", "a", "new", "Uri", "instance", "from", "a", "string", "representation", "of", "a", "URI", "." ]
train
https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/spinoff/actor/uri.py#L69-L95
benzrf/parthial
parthial/context.py
Environment.scopes_as
def scopes_as(self, new_scopes): """Replace my :attr:`scopes` for the duration of the with block. My global scope is not replaced. Args: new_scopes (list of dict-likes): The new :attr:`scopes` to use. """ old_scopes, self.scopes = self.scopes, new_scopes yie...
python
def scopes_as(self, new_scopes): """Replace my :attr:`scopes` for the duration of the with block. My global scope is not replaced. Args: new_scopes (list of dict-likes): The new :attr:`scopes` to use. """ old_scopes, self.scopes = self.scopes, new_scopes yie...
[ "def", "scopes_as", "(", "self", ",", "new_scopes", ")", ":", "old_scopes", ",", "self", ".", "scopes", "=", "self", ".", "scopes", ",", "new_scopes", "yield", "self", ".", "scopes", "=", "old_scopes" ]
Replace my :attr:`scopes` for the duration of the with block. My global scope is not replaced. Args: new_scopes (list of dict-likes): The new :attr:`scopes` to use.
[ "Replace", "my", ":", "attr", ":", "scopes", "for", "the", "duration", "of", "the", "with", "block", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L38-L48
benzrf/parthial
parthial/context.py
Environment.new_scope
def new_scope(self, new_scope={}): """Add a new innermost scope for the duration of the with block. Args: new_scope (dict-like): The scope to add. """ old_scopes, self.scopes = self.scopes, self.scopes.new_child(new_scope) yield self.scopes = old_scopes
python
def new_scope(self, new_scope={}): """Add a new innermost scope for the duration of the with block. Args: new_scope (dict-like): The scope to add. """ old_scopes, self.scopes = self.scopes, self.scopes.new_child(new_scope) yield self.scopes = old_scopes
[ "def", "new_scope", "(", "self", ",", "new_scope", "=", "{", "}", ")", ":", "old_scopes", ",", "self", ".", "scopes", "=", "self", ".", "scopes", ",", "self", ".", "scopes", ".", "new_child", "(", "new_scope", ")", "yield", "self", ".", "scopes", "="...
Add a new innermost scope for the duration of the with block. Args: new_scope (dict-like): The scope to add.
[ "Add", "a", "new", "innermost", "scope", "for", "the", "duration", "of", "the", "with", "block", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L51-L59
benzrf/parthial
parthial/context.py
Environment.new
def new(self, val): """Add a new value to me. Args: val (LispVal): The value to be added. Returns: LispVal: The added value. Raises: ~parthial.errs.LimitationError: If I already contain the maximum number of elements. """ ...
python
def new(self, val): """Add a new value to me. Args: val (LispVal): The value to be added. Returns: LispVal: The added value. Raises: ~parthial.errs.LimitationError: If I already contain the maximum number of elements. """ ...
[ "def", "new", "(", "self", ",", "val", ")", ":", "if", "len", "(", "self", ".", "things", ")", ">=", "self", ".", "max_things", ":", "raise", "LimitationError", "(", "'too many things'", ")", "self", ".", "things", ".", "add", "(", "val", ")", "retur...
Add a new value to me. Args: val (LispVal): The value to be added. Returns: LispVal: The added value. Raises: ~parthial.errs.LimitationError: If I already contain the maximum number of elements.
[ "Add", "a", "new", "value", "to", "me", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L61-L77
benzrf/parthial
parthial/context.py
Environment.rec_new
def rec_new(self, val): """Recursively add a new value and its children to me. Args: val (LispVal): The value to be added. Returns: LispVal: The added value. """ if val not in self.things: for child in val.children(): self.rec...
python
def rec_new(self, val): """Recursively add a new value and its children to me. Args: val (LispVal): The value to be added. Returns: LispVal: The added value. """ if val not in self.things: for child in val.children(): self.rec...
[ "def", "rec_new", "(", "self", ",", "val", ")", ":", "if", "val", "not", "in", "self", ".", "things", ":", "for", "child", "in", "val", ".", "children", "(", ")", ":", "self", ".", "rec_new", "(", "child", ")", "self", ".", "new", "(", "val", "...
Recursively add a new value and its children to me. Args: val (LispVal): The value to be added. Returns: LispVal: The added value.
[ "Recursively", "add", "a", "new", "value", "and", "its", "children", "to", "me", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L79-L92
benzrf/parthial
parthial/context.py
Environment.add_rec_new
def add_rec_new(self, k, val): """Recursively add a new value and its children to me, and assign a variable to it. Args: k (str): The name of the variable to assign. val (LispVal): The value to be added and assigned. Returns: LispVal: The added value...
python
def add_rec_new(self, k, val): """Recursively add a new value and its children to me, and assign a variable to it. Args: k (str): The name of the variable to assign. val (LispVal): The value to be added and assigned. Returns: LispVal: The added value...
[ "def", "add_rec_new", "(", "self", ",", "k", ",", "val", ")", ":", "self", ".", "rec_new", "(", "val", ")", "self", "[", "k", "]", "=", "val", "return", "val" ]
Recursively add a new value and its children to me, and assign a variable to it. Args: k (str): The name of the variable to assign. val (LispVal): The value to be added and assigned. Returns: LispVal: The added value.
[ "Recursively", "add", "a", "new", "value", "and", "its", "children", "to", "me", "and", "assign", "a", "variable", "to", "it", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L94-L107
benzrf/parthial
parthial/context.py
Environment.new_child
def new_child(self): """Get a new child :class:`Environment`. The child's scopes will be mine, with an additional empty innermost one. Returns: Environment: The child. """ child = Environment(self.globals, self.max_things) child.scopes = self.scopes....
python
def new_child(self): """Get a new child :class:`Environment`. The child's scopes will be mine, with an additional empty innermost one. Returns: Environment: The child. """ child = Environment(self.globals, self.max_things) child.scopes = self.scopes....
[ "def", "new_child", "(", "self", ")", ":", "child", "=", "Environment", "(", "self", ".", "globals", ",", "self", ".", "max_things", ")", "child", ".", "scopes", "=", "self", ".", "scopes", ".", "new_child", "(", ")", "child", ".", "things", "=", "We...
Get a new child :class:`Environment`. The child's scopes will be mine, with an additional empty innermost one. Returns: Environment: The child.
[ "Get", "a", "new", "child", ":", "class", ":", "Environment", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L109-L121
benzrf/parthial
parthial/context.py
Context.eval
def eval(self, expr): """Evaluate an expression. This does **not** add its argument (or its result) as an element of me! That is the responsibility of the code that created the object. This means that you need to :meth:`Environment.rec_new` any expression you get from user input...
python
def eval(self, expr): """Evaluate an expression. This does **not** add its argument (or its result) as an element of me! That is the responsibility of the code that created the object. This means that you need to :meth:`Environment.rec_new` any expression you get from user input...
[ "def", "eval", "(", "self", ",", "expr", ")", ":", "if", "self", ".", "depth", ">=", "self", ".", "max_depth", ":", "raise", "LimitationError", "(", "'too much nesting'", ")", "if", "self", ".", "steps", ">=", "self", ".", "max_steps", ":", "raise", "L...
Evaluate an expression. This does **not** add its argument (or its result) as an element of me! That is the responsibility of the code that created the object. This means that you need to :meth:`Environment.rec_new` any expression you get from user input before evaluating it. T...
[ "Evaluate", "an", "expression", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L212-L243
benzrf/parthial
parthial/context.py
Context.eval_in_new
def eval_in_new(cls, expr, *args, **kwargs): """:meth:`eval` an expression in a new, temporary :class:`Context`. This should be safe to use directly on user input. Args: expr (LispVal): The expression to evaluate. *args: Args for the :class:`Context` constructor. ...
python
def eval_in_new(cls, expr, *args, **kwargs): """:meth:`eval` an expression in a new, temporary :class:`Context`. This should be safe to use directly on user input. Args: expr (LispVal): The expression to evaluate. *args: Args for the :class:`Context` constructor. ...
[ "def", "eval_in_new", "(", "cls", ",", "expr", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ctx", "=", "cls", "(", "*", "args", ",", "*", "*", "kwargs", ")", "ctx", ".", "env", ".", "rec_new", "(", "expr", ")", "return", "ctx", ".", ...
:meth:`eval` an expression in a new, temporary :class:`Context`. This should be safe to use directly on user input. Args: expr (LispVal): The expression to evaluate. *args: Args for the :class:`Context` constructor. **kwargs: Kwargs for the :class:`Context` construc...
[ ":", "meth", ":", "eval", "an", "expression", "in", "a", "new", "temporary", ":", "class", ":", "Context", "." ]
train
https://github.com/benzrf/parthial/blob/ab1e316aec87ed34dda0ec0e145fe0c8cc8e907f/parthial/context.py#L246-L258
brbsix/subsystem
subsystem/subsystem.py
devnull
def devnull(): """Temporarily redirect stdout and stderr to /dev/null.""" try: original_stderr = os.dup(sys.stderr.fileno()) original_stdout = os.dup(sys.stdout.fileno()) null = open(os.devnull, 'w') os.dup2(null.fileno(), sys.stderr.fileno()) os.dup2(null.fileno(), sys....
python
def devnull(): """Temporarily redirect stdout and stderr to /dev/null.""" try: original_stderr = os.dup(sys.stderr.fileno()) original_stdout = os.dup(sys.stdout.fileno()) null = open(os.devnull, 'w') os.dup2(null.fileno(), sys.stderr.fileno()) os.dup2(null.fileno(), sys....
[ "def", "devnull", "(", ")", ":", "try", ":", "original_stderr", "=", "os", ".", "dup", "(", "sys", ".", "stderr", ".", "fileno", "(", ")", ")", "original_stdout", "=", "os", ".", "dup", "(", "sys", ".", "stdout", ".", "fileno", "(", ")", ")", "nu...
Temporarily redirect stdout and stderr to /dev/null.
[ "Temporarily", "redirect", "stdout", "and", "stderr", "to", "/", "dev", "/", "null", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L148-L165
brbsix/subsystem
subsystem/subsystem.py
error
def error(*args): """Display error message via stderr or GUI.""" if sys.stdin.isatty(): print('ERROR:', *args, file=sys.stderr) else: notify_error(*args)
python
def error(*args): """Display error message via stderr or GUI.""" if sys.stdin.isatty(): print('ERROR:', *args, file=sys.stderr) else: notify_error(*args)
[ "def", "error", "(", "*", "args", ")", ":", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "print", "(", "'ERROR:'", ",", "*", "args", ",", "file", "=", "sys", ".", "stderr", ")", "else", ":", "notify_error", "(", "*", "args", ")" ]
Display error message via stderr or GUI.
[ "Display", "error", "message", "via", "stderr", "or", "GUI", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L168-L173
brbsix/subsystem
subsystem/subsystem.py
failure
def failure(path, downloader): """Display warning message via stderr or GUI.""" base = os.path.basename(path) if sys.stdin.isatty(): print('INFO [{}]: Failed to download {!r}'.format(downloader, base)) else: notify_failure(base, downloader)
python
def failure(path, downloader): """Display warning message via stderr or GUI.""" base = os.path.basename(path) if sys.stdin.isatty(): print('INFO [{}]: Failed to download {!r}'.format(downloader, base)) else: notify_failure(base, downloader)
[ "def", "failure", "(", "path", ",", "downloader", ")", ":", "base", "=", "os", ".", "path", ".", "basename", "(", "path", ")", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "print", "(", "'INFO [{}]: Failed to download {!r}'", ".", "format", ...
Display warning message via stderr or GUI.
[ "Display", "warning", "message", "via", "stderr", "or", "GUI", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L183-L189
brbsix/subsystem
subsystem/subsystem.py
have
def have(cmd): """Determine whether supplied argument is a command on the PATH.""" try: # Python 3.3+ only from shutil import which except ImportError: def which(cmd): """ Given a command, return the path which conforms to the given mode on the PA...
python
def have(cmd): """Determine whether supplied argument is a command on the PATH.""" try: # Python 3.3+ only from shutil import which except ImportError: def which(cmd): """ Given a command, return the path which conforms to the given mode on the PA...
[ "def", "have", "(", "cmd", ")", ":", "try", ":", "# Python 3.3+ only", "from", "shutil", "import", "which", "except", "ImportError", ":", "def", "which", "(", "cmd", ")", ":", "\"\"\"\n Given a command, return the path which conforms to the given mode\n ...
Determine whether supplied argument is a command on the PATH.
[ "Determine", "whether", "supplied", "argument", "is", "a", "command", "on", "the", "PATH", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L198-L238
brbsix/subsystem
subsystem/subsystem.py
main
def main(args=None): """Start application.""" dlx = Downloader() epilog = dlx.epilog() options, arguments = parse(args, epilog) # create list of video files that don't have accompanying 'srt' subtitles targets = [p for p in arguments if os.path.isfile(p) and not os.path.exists(...
python
def main(args=None): """Start application.""" dlx = Downloader() epilog = dlx.epilog() options, arguments = parse(args, epilog) # create list of video files that don't have accompanying 'srt' subtitles targets = [p for p in arguments if os.path.isfile(p) and not os.path.exists(...
[ "def", "main", "(", "args", "=", "None", ")", ":", "dlx", "=", "Downloader", "(", ")", "epilog", "=", "dlx", ".", "epilog", "(", ")", "options", ",", "arguments", "=", "parse", "(", "args", ",", "epilog", ")", "# create list of video files that don't have ...
Start application.
[ "Start", "application", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L241-L273
brbsix/subsystem
subsystem/subsystem.py
multithreader
def multithreader(args, paths): """Execute multiple processes at once.""" def shellprocess(path): """Return a ready-to-use subprocess.""" import subprocess return subprocess.Popen(args + [path], stderr=subprocess.DEVNULL, s...
python
def multithreader(args, paths): """Execute multiple processes at once.""" def shellprocess(path): """Return a ready-to-use subprocess.""" import subprocess return subprocess.Popen(args + [path], stderr=subprocess.DEVNULL, s...
[ "def", "multithreader", "(", "args", ",", "paths", ")", ":", "def", "shellprocess", "(", "path", ")", ":", "\"\"\"Return a ready-to-use subprocess.\"\"\"", "import", "subprocess", "return", "subprocess", ".", "Popen", "(", "args", "+", "[", "path", "]", ",", "...
Execute multiple processes at once.
[ "Execute", "multiple", "processes", "at", "once", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L276-L289
brbsix/subsystem
subsystem/subsystem.py
parse
def parse(args, epilog): """ Parse command-line arguments. Arguments may consist of any combination of directories, files, and options. """ import argparse from locale import getlocale # set the default language default_language = getlocale()[0].split('_')[0].lower() parser = argp...
python
def parse(args, epilog): """ Parse command-line arguments. Arguments may consist of any combination of directories, files, and options. """ import argparse from locale import getlocale # set the default language default_language = getlocale()[0].split('_')[0].lower() parser = argp...
[ "def", "parse", "(", "args", ",", "epilog", ")", ":", "import", "argparse", "from", "locale", "import", "getlocale", "# set the default language", "default_language", "=", "getlocale", "(", ")", "[", "0", "]", ".", "split", "(", "'_'", ")", "[", "0", "]", ...
Parse command-line arguments. Arguments may consist of any combination of directories, files, and options.
[ "Parse", "command", "-", "line", "arguments", ".", "Arguments", "may", "consist", "of", "any", "combination", "of", "directories", "files", "and", "options", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L314-L374
brbsix/subsystem
subsystem/subsystem.py
prompt_gui
def prompt_gui(path): """Prompt for a new filename via GUI.""" import subprocess filepath, extension = os.path.splitext(path) basename = os.path.basename(filepath) dirname = os.path.dirname(filepath) retry_text = 'Sorry, please try again...' icon = 'video-x-generic' # detect and conf...
python
def prompt_gui(path): """Prompt for a new filename via GUI.""" import subprocess filepath, extension = os.path.splitext(path) basename = os.path.basename(filepath) dirname = os.path.dirname(filepath) retry_text = 'Sorry, please try again...' icon = 'video-x-generic' # detect and conf...
[ "def", "prompt_gui", "(", "path", ")", ":", "import", "subprocess", "filepath", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "path", ")", "basename", "=", "os", ".", "path", ".", "basename", "(", "filepath", ")", "dirname", "=", "os"...
Prompt for a new filename via GUI.
[ "Prompt", "for", "a", "new", "filename", "via", "GUI", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L386-L441
brbsix/subsystem
subsystem/subsystem.py
prompt_terminal
def prompt_terminal(path): """Prompt for a new filename via terminal.""" def rlinput(prompt_msg, prefill=''): """ One line is read from standard input. Display `prompt_msg` on standard error. `prefill` is placed into the editing buffer before editing begins. """ ...
python
def prompt_terminal(path): """Prompt for a new filename via terminal.""" def rlinput(prompt_msg, prefill=''): """ One line is read from standard input. Display `prompt_msg` on standard error. `prefill` is placed into the editing buffer before editing begins. """ ...
[ "def", "prompt_terminal", "(", "path", ")", ":", "def", "rlinput", "(", "prompt_msg", ",", "prefill", "=", "''", ")", ":", "\"\"\"\n One line is read from standard input. Display `prompt_msg` on\n standard error. `prefill` is placed into the editing buffer\n befo...
Prompt for a new filename via terminal.
[ "Prompt", "for", "a", "new", "filename", "via", "terminal", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L444-L476
brbsix/subsystem
subsystem/subsystem.py
rename
def rename(path): """Rename a file if necessary.""" new_path = prompt(path) if path != new_path: try: from shutil import move except ImportError: from os import rename as move move(path, new_path) return new_path
python
def rename(path): """Rename a file if necessary.""" new_path = prompt(path) if path != new_path: try: from shutil import move except ImportError: from os import rename as move move(path, new_path) return new_path
[ "def", "rename", "(", "path", ")", ":", "new_path", "=", "prompt", "(", "path", ")", "if", "path", "!=", "new_path", ":", "try", ":", "from", "shutil", "import", "move", "except", "ImportError", ":", "from", "os", "import", "rename", "as", "move", "mov...
Rename a file if necessary.
[ "Rename", "a", "file", "if", "necessary", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L479-L492
brbsix/subsystem
subsystem/subsystem.py
scan
def scan(subtitles): """Remove advertising from subtitles.""" from importlib.util import find_spec try: import subnuker except ImportError: fatal('Unable to scan subtitles. Please install subnuker.') # check whether aeidon is available aeidon = find_spec('aeidon') is not None ...
python
def scan(subtitles): """Remove advertising from subtitles.""" from importlib.util import find_spec try: import subnuker except ImportError: fatal('Unable to scan subtitles. Please install subnuker.') # check whether aeidon is available aeidon = find_spec('aeidon') is not None ...
[ "def", "scan", "(", "subtitles", ")", ":", "from", "importlib", ".", "util", "import", "find_spec", "try", ":", "import", "subnuker", "except", "ImportError", ":", "fatal", "(", "'Unable to scan subtitles. Please install subnuker.'", ")", "# check whether aeidon is avai...
Remove advertising from subtitles.
[ "Remove", "advertising", "from", "subtitles", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L495-L520
brbsix/subsystem
subsystem/subsystem.py
warning
def warning(*args): """Display warning message via stderr or GUI.""" if sys.stdin.isatty(): print('WARNING:', *args, file=sys.stderr) else: notify_warning(*args)
python
def warning(*args): """Display warning message via stderr or GUI.""" if sys.stdin.isatty(): print('WARNING:', *args, file=sys.stderr) else: notify_warning(*args)
[ "def", "warning", "(", "*", "args", ")", ":", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "print", "(", "'WARNING:'", ",", "*", "args", ",", "file", "=", "sys", ".", "stderr", ")", "else", ":", "notify_warning", "(", "*", "args", ")"...
Display warning message via stderr or GUI.
[ "Display", "warning", "message", "via", "stderr", "or", "GUI", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L523-L528
brbsix/subsystem
subsystem/subsystem.py
Downloader.getavailable
def getavailable(self): """Return a list of subtitle downloaders available.""" from importlib import import_module available = [] for script in self.SCRIPTS: if have(script): available.append(script) for module in self.MODULES: try: ...
python
def getavailable(self): """Return a list of subtitle downloaders available.""" from importlib import import_module available = [] for script in self.SCRIPTS: if have(script): available.append(script) for module in self.MODULES: try: ...
[ "def", "getavailable", "(", "self", ")", ":", "from", "importlib", "import", "import_module", "available", "=", "[", "]", "for", "script", "in", "self", ".", "SCRIPTS", ":", "if", "have", "(", "script", ")", ":", "available", ".", "append", "(", "script"...
Return a list of subtitle downloaders available.
[ "Return", "a", "list", "of", "subtitle", "downloaders", "available", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L59-L77
brbsix/subsystem
subsystem/subsystem.py
Downloader.getdefault
def getdefault(self): """Return an available default downloader.""" if not self.available: error('No supported downloaders available') print('\nPlease install one of the following:', file=sys.stderr) print(self.SUPPORTED, file=sys.stderr) sys.exit(1) ...
python
def getdefault(self): """Return an available default downloader.""" if not self.available: error('No supported downloaders available') print('\nPlease install one of the following:', file=sys.stderr) print(self.SUPPORTED, file=sys.stderr) sys.exit(1) ...
[ "def", "getdefault", "(", "self", ")", ":", "if", "not", "self", ".", "available", ":", "error", "(", "'No supported downloaders available'", ")", "print", "(", "'\\nPlease install one of the following:'", ",", "file", "=", "sys", ".", "stderr", ")", "print", "(...
Return an available default downloader.
[ "Return", "an", "available", "default", "downloader", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L79-L96
brbsix/subsystem
subsystem/subsystem.py
Downloader.download
def download(self, paths, tool, language): """Download subtitles via a number of tools.""" if tool not in self.available: fatal('{!r} is not installed'.format(tool)) try: from . import plugins downloader = plugins.__getattribute__(tool) except Attrib...
python
def download(self, paths, tool, language): """Download subtitles via a number of tools.""" if tool not in self.available: fatal('{!r} is not installed'.format(tool)) try: from . import plugins downloader = plugins.__getattribute__(tool) except Attrib...
[ "def", "download", "(", "self", ",", "paths", ",", "tool", ",", "language", ")", ":", "if", "tool", "not", "in", "self", ".", "available", ":", "fatal", "(", "'{!r} is not installed'", ".", "format", "(", "tool", ")", ")", "try", ":", "from", ".", "i...
Download subtitles via a number of tools.
[ "Download", "subtitles", "via", "a", "number", "of", "tools", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L98-L119
brbsix/subsystem
subsystem/subsystem.py
Downloader.epilog
def epilog(self): """Return text formatted for the usage description's epilog.""" bold = '\033[1m' end = '\033[0m' available = self.available.copy() index = available.index(Config.DOWNLOADER_DEFAULT) available[index] = bold + '(' + available[index] + ')' + end fo...
python
def epilog(self): """Return text formatted for the usage description's epilog.""" bold = '\033[1m' end = '\033[0m' available = self.available.copy() index = available.index(Config.DOWNLOADER_DEFAULT) available[index] = bold + '(' + available[index] + ')' + end fo...
[ "def", "epilog", "(", "self", ")", ":", "bold", "=", "'\\033[1m'", "end", "=", "'\\033[0m'", "available", "=", "self", ".", "available", ".", "copy", "(", ")", "index", "=", "available", ".", "index", "(", "Config", ".", "DOWNLOADER_DEFAULT", ")", "avail...
Return text formatted for the usage description's epilog.
[ "Return", "text", "formatted", "for", "the", "usage", "description", "s", "epilog", "." ]
train
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L121-L130
alfred82santa/aio-service-client
service_client/mocks.py
MockManager.patch_mock_desc
def patch_mock_desc(self, patch, *args, **kwarg): """ Context manager or decorator in order to patch a mock definition of service endpoint in a test. :param patch: Dictionary in order to update endpoint's mock definition :type patch: dict :param service_name: Name of ser...
python
def patch_mock_desc(self, patch, *args, **kwarg): """ Context manager or decorator in order to patch a mock definition of service endpoint in a test. :param patch: Dictionary in order to update endpoint's mock definition :type patch: dict :param service_name: Name of ser...
[ "def", "patch_mock_desc", "(", "self", ",", "patch", ",", "*", "args", ",", "*", "*", "kwarg", ")", ":", "return", "PatchMockDescDefinition", "(", "patch", ",", "self", ",", "*", "args", ",", "*", "*", "kwarg", ")" ]
Context manager or decorator in order to patch a mock definition of service endpoint in a test. :param patch: Dictionary in order to update endpoint's mock definition :type patch: dict :param service_name: Name of service where you want to use mock. If None it will be used a...
[ "Context", "manager", "or", "decorator", "in", "order", "to", "patch", "a", "mock", "definition", "of", "service", "endpoint", "in", "a", "test", "." ]
train
https://github.com/alfred82santa/aio-service-client/blob/dd9ad49e23067b22178534915aa23ba24f6ff39b/service_client/mocks.py#L60-L80
alfred82santa/aio-service-client
service_client/mocks.py
MockManager.use_mock
def use_mock(self, mock, *args, **kwarg): """ Context manager or decorator in order to use a coroutine as mock of service endpoint in a test. :param mock: Coroutine to use as mock. It should behave like :meth:`~ClientSession.request`. :type mock: coroutine :param service...
python
def use_mock(self, mock, *args, **kwarg): """ Context manager or decorator in order to use a coroutine as mock of service endpoint in a test. :param mock: Coroutine to use as mock. It should behave like :meth:`~ClientSession.request`. :type mock: coroutine :param service...
[ "def", "use_mock", "(", "self", ",", "mock", ",", "*", "args", ",", "*", "*", "kwarg", ")", ":", "return", "UseMockDefinition", "(", "mock", ",", "self", ",", "*", "args", ",", "*", "*", "kwarg", ")" ]
Context manager or decorator in order to use a coroutine as mock of service endpoint in a test. :param mock: Coroutine to use as mock. It should behave like :meth:`~ClientSession.request`. :type mock: coroutine :param service_name: Name of service where you want to use mock. If None it ...
[ "Context", "manager", "or", "decorator", "in", "order", "to", "use", "a", "coroutine", "as", "mock", "of", "service", "endpoint", "in", "a", "test", "." ]
train
https://github.com/alfred82santa/aio-service-client/blob/dd9ad49e23067b22178534915aa23ba24f6ff39b/service_client/mocks.py#L82-L101
alfred82santa/aio-service-client
service_client/mocks.py
Mock._create_mock
def _create_mock(self, endpoint_desc, session, request_params, mock_desc, loop): """ The class imported should have the __call__ function defined to be an object directly callable """ try: mock_def = mock_manager.next_mock(self.service_client.name, ...
python
def _create_mock(self, endpoint_desc, session, request_params, mock_desc, loop): """ The class imported should have the __call__ function defined to be an object directly callable """ try: mock_def = mock_manager.next_mock(self.service_client.name, ...
[ "def", "_create_mock", "(", "self", ",", "endpoint_desc", ",", "session", ",", "request_params", ",", "mock_desc", ",", "loop", ")", ":", "try", ":", "mock_def", "=", "mock_manager", ".", "next_mock", "(", "self", ".", "service_client", ".", "name", ",", "...
The class imported should have the __call__ function defined to be an object directly callable
[ "The", "class", "imported", "should", "have", "the", "__call__", "function", "defined", "to", "be", "an", "object", "directly", "callable" ]
train
https://github.com/alfred82santa/aio-service-client/blob/dd9ad49e23067b22178534915aa23ba24f6ff39b/service_client/mocks.py#L147-L165
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/setuphandlers.py
post_install
def post_install(context): """ - sets an acl user group to hold all intranet users - setup the dynamic groups plugin - sets the addable types for the ploneintranet policy """ marker = 'ploneintranet-workspace.marker' if context.readDataFile(marker) is None: return portal = api.p...
python
def post_install(context): """ - sets an acl user group to hold all intranet users - setup the dynamic groups plugin - sets the addable types for the ploneintranet policy """ marker = 'ploneintranet-workspace.marker' if context.readDataFile(marker) is None: return portal = api.p...
[ "def", "post_install", "(", "context", ")", ":", "marker", "=", "'ploneintranet-workspace.marker'", "if", "context", ".", "readDataFile", "(", "marker", ")", "is", "None", ":", "return", "portal", "=", "api", ".", "portal", ".", "get", "(", ")", "# Set up a ...
- sets an acl user group to hold all intranet users - setup the dynamic groups plugin - sets the addable types for the ploneintranet policy
[ "-", "sets", "an", "acl", "user", "group", "to", "hold", "all", "intranet", "users", "-", "setup", "the", "dynamic", "groups", "plugin", "-", "sets", "the", "addable", "types", "for", "the", "ploneintranet", "policy" ]
train
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/setuphandlers.py#L10-L63
kodexlab/reliure
reliure/types.py
GenericType.validate
def validate(self, value): """ Abstract method, check if a value is correct (type). Should raise :class:`TypeError` if the type the validation fail. :param value: the value to validate :return: the given value (that may have been converted) """ for validator in s...
python
def validate(self, value): """ Abstract method, check if a value is correct (type). Should raise :class:`TypeError` if the type the validation fail. :param value: the value to validate :return: the given value (that may have been converted) """ for validator in s...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "for", "validator", "in", "self", ".", "validators", ":", "errors", "=", "[", "]", "try", ":", "validator", "(", "value", ")", "except", "ValidationError", "as", "err", ":", "errors", ".", "append...
Abstract method, check if a value is correct (type). Should raise :class:`TypeError` if the type the validation fail. :param value: the value to validate :return: the given value (that may have been converted)
[ "Abstract", "method", "check", "if", "a", "value", "is", "correct", "(", "type", ")", ".", "Should", "raise", ":", "class", ":", "TypeError", "if", "the", "type", "the", "validation", "fail", ".", ":", "param", "value", ":", "the", "value", "to", "vali...
train
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/types.py#L108-L123
kodexlab/reliure
reliure/types.py
GenericType.serialize
def serialize(self, value, **kwargs): """ pre-serialize value """ if self._serialize is not None: return self._serialize(value, **kwargs) else: return value
python
def serialize(self, value, **kwargs): """ pre-serialize value """ if self._serialize is not None: return self._serialize(value, **kwargs) else: return value
[ "def", "serialize", "(", "self", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_serialize", "is", "not", "None", ":", "return", "self", ".", "_serialize", "(", "value", ",", "*", "*", "kwargs", ")", "else", ":", "return", "va...
pre-serialize value
[ "pre", "-", "serialize", "value" ]
train
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/types.py#L132-L137
kodexlab/reliure
reliure/types.py
GenericType.as_dict
def as_dict(self): """ returns a dictionary view of the option :returns: the option converted in a dict :rtype: dict """ info = {} info["type"] = self.__class__.__name__ info["help"] = self.help info["default"] = self.default info["multi"]...
python
def as_dict(self): """ returns a dictionary view of the option :returns: the option converted in a dict :rtype: dict """ info = {} info["type"] = self.__class__.__name__ info["help"] = self.help info["default"] = self.default info["multi"]...
[ "def", "as_dict", "(", "self", ")", ":", "info", "=", "{", "}", "info", "[", "\"type\"", "]", "=", "self", ".", "__class__", ".", "__name__", "info", "[", "\"help\"", "]", "=", "self", ".", "help", "info", "[", "\"default\"", "]", "=", "self", ".",...
returns a dictionary view of the option :returns: the option converted in a dict :rtype: dict
[ "returns", "a", "dictionary", "view", "of", "the", "option", ":", "returns", ":", "the", "option", "converted", "in", "a", "dict", ":", "rtype", ":", "dict" ]
train
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/types.py#L139-L154
despawnerer/computer
computer/evaluate.py
evaluate
def evaluate(expr, **variables): """ >>> evaluate('2**6') 64 >>> evaluate('1 + 2*3**(2 + 2) / (6 + -7)') -161.0 >>> evaluate('5 < 4') False >>> evaluate('5 < a < 10', a=6) True """ module = ast.parse(expr) # Module(body=[Expr(value=...)]) if len(module.body) != 1: ...
python
def evaluate(expr, **variables): """ >>> evaluate('2**6') 64 >>> evaluate('1 + 2*3**(2 + 2) / (6 + -7)') -161.0 >>> evaluate('5 < 4') False >>> evaluate('5 < a < 10', a=6) True """ module = ast.parse(expr) # Module(body=[Expr(value=...)]) if len(module.body) != 1: ...
[ "def", "evaluate", "(", "expr", ",", "*", "*", "variables", ")", ":", "module", "=", "ast", ".", "parse", "(", "expr", ")", "# Module(body=[Expr(value=...)])", "if", "len", "(", "module", ".", "body", ")", "!=", "1", ":", "raise", "BadExpression", "(", ...
>>> evaluate('2**6') 64 >>> evaluate('1 + 2*3**(2 + 2) / (6 + -7)') -161.0 >>> evaluate('5 < 4') False >>> evaluate('5 < a < 10', a=6) True
[ ">>>", "evaluate", "(", "2", "**", "6", ")", "64", ">>>", "evaluate", "(", "1", "+", "2", "*", "3", "**", "(", "2", "+", "2", ")", "/", "(", "6", "+", "-", "7", ")", ")", "-", "161", ".", "0", ">>>", "evaluate", "(", "5", "<", "4", ")",...
train
https://github.com/despawnerer/computer/blob/31d83b176b3ee6e6b85dd1282ecbc9820b615003/computer/evaluate.py#L20-L43
sirrice/scorpionsql
scorpionsql/db.py
db_schema
def db_schema(db, table): """ only works for postgres @return dictionary of column name -> data type """ typedict = [('int', int), ('double', float), ('timestamp', datetime), ('date', date), ('time', dttime), ('text', str), ('char', str)] ret = {} q = '''select c...
python
def db_schema(db, table): """ only works for postgres @return dictionary of column name -> data type """ typedict = [('int', int), ('double', float), ('timestamp', datetime), ('date', date), ('time', dttime), ('text', str), ('char', str)] ret = {} q = '''select c...
[ "def", "db_schema", "(", "db", ",", "table", ")", ":", "typedict", "=", "[", "(", "'int'", ",", "int", ")", ",", "(", "'double'", ",", "float", ")", ",", "(", "'timestamp'", ",", "datetime", ")", ",", "(", "'date'", ",", "date", ")", ",", "(", ...
only works for postgres @return dictionary of column name -> data type
[ "only", "works", "for", "postgres" ]
train
https://github.com/sirrice/scorpionsql/blob/baa05b745fae5df3171244c3e32160bd36c99e86/scorpionsql/db.py#L60-L87
abe-winter/pg13-py
pg13/stubredis.py
complete_message
def complete_message(buf): "returns msg,buf_remaining or None,buf" # todo: read dollar-length for strings; I dont think I can blindly trust newlines. learn about escaping # note: all the length checks are +1 over what I need because I'm asking for *complete* lines. lines=buf.split('\r\n') if len(lines)<=...
python
def complete_message(buf): "returns msg,buf_remaining or None,buf" # todo: read dollar-length for strings; I dont think I can blindly trust newlines. learn about escaping # note: all the length checks are +1 over what I need because I'm asking for *complete* lines. lines=buf.split('\r\n') if len(lines)<=...
[ "def", "complete_message", "(", "buf", ")", ":", "# todo: read dollar-length for strings; I dont think I can blindly trust newlines. learn about escaping\r", "# note: all the length checks are +1 over what I need because I'm asking for *complete* lines.\r", "lines", "=", "buf", ".", "split",...
returns msg,buf_remaining or None,buf
[ "returns", "msg", "buf_remaining", "or", "None", "buf" ]
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/stubredis.py#L80-L101
abe-winter/pg13-py
pg13/stubredis.py
repl
def repl(host,port): "todo: replace this with real redis client" client=redis.StrictRedis(host,port,socket_timeout=0.1) # timeout is for pubsub -- it shares the connection_pool pubsub=client.pubsub() snt=SubNotifyThread(host,port); snt.start() while 1: try: command=raw_input('command> ') # this has ...
python
def repl(host,port): "todo: replace this with real redis client" client=redis.StrictRedis(host,port,socket_timeout=0.1) # timeout is for pubsub -- it shares the connection_pool pubsub=client.pubsub() snt=SubNotifyThread(host,port); snt.start() while 1: try: command=raw_input('command> ') # this has ...
[ "def", "repl", "(", "host", ",", "port", ")", ":", "client", "=", "redis", ".", "StrictRedis", "(", "host", ",", "port", ",", "socket_timeout", "=", "0.1", ")", "# timeout is for pubsub -- it shares the connection_pool\r", "pubsub", "=", "client", ".", "pubsub",...
todo: replace this with real redis client
[ "todo", ":", "replace", "this", "with", "real", "redis", "client" ]
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/stubredis.py#L143-L160
abe-winter/pg13-py
pg13/stubredis.py
RedisState.process_message
def process_message(self,msg,sock): "serialize and deserialize" command=msg[0] try: f={'GET':self.get,'SET':self.set,'SUBSCRIBE':self.sub,'PUBLISH':self.pub, 'PING':self.ping,'GETSET':self.getset,'EXPIRE':self.expire,'DEL':self.delete}[command] except KeyError: print msg; raise args=msg[...
python
def process_message(self,msg,sock): "serialize and deserialize" command=msg[0] try: f={'GET':self.get,'SET':self.set,'SUBSCRIBE':self.sub,'PUBLISH':self.pub, 'PING':self.ping,'GETSET':self.getset,'EXPIRE':self.expire,'DEL':self.delete}[command] except KeyError: print msg; raise args=msg[...
[ "def", "process_message", "(", "self", ",", "msg", ",", "sock", ")", ":", "command", "=", "msg", "[", "0", "]", "try", ":", "f", "=", "{", "'GET'", ":", "self", ".", "get", ",", "'SET'", ":", "self", ".", "set", ",", "'SUBSCRIBE'", ":", "self", ...
serialize and deserialize
[ "serialize", "and", "deserialize" ]
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/stubredis.py#L22-L33
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._load_playbook_from_file
def _load_playbook_from_file(self, path, vars={}): ''' run top level error checking on playbooks and allow them to include other playbooks. ''' playbook_data = utils.parse_yaml_from_file(path) accumulated_plays = [] play_basedirs = [] if type(playbook_data) != ...
python
def _load_playbook_from_file(self, path, vars={}): ''' run top level error checking on playbooks and allow them to include other playbooks. ''' playbook_data = utils.parse_yaml_from_file(path) accumulated_plays = [] play_basedirs = [] if type(playbook_data) != ...
[ "def", "_load_playbook_from_file", "(", "self", ",", "path", ",", "vars", "=", "{", "}", ")", ":", "playbook_data", "=", "utils", ".", "parse_yaml_from_file", "(", "path", ")", "accumulated_plays", "=", "[", "]", "play_basedirs", "=", "[", "]", "if", "type...
run top level error checking on playbooks and allow them to include other playbooks.
[ "run", "top", "level", "error", "checking", "on", "playbooks", "and", "allow", "them", "to", "include", "other", "playbooks", "." ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L125-L186
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook.run
def run(self): ''' run all patterns in the playbook ''' plays = [] matched_tags_all = set() unmatched_tags_all = set() # loop through all patterns and run them self.callbacks.on_start() for (play_ds, play_basedir) in zip(self.playbook, self.play_basedirs): ...
python
def run(self): ''' run all patterns in the playbook ''' plays = [] matched_tags_all = set() unmatched_tags_all = set() # loop through all patterns and run them self.callbacks.on_start() for (play_ds, play_basedir) in zip(self.playbook, self.play_basedirs): ...
[ "def", "run", "(", "self", ")", ":", "plays", "=", "[", "]", "matched_tags_all", "=", "set", "(", ")", "unmatched_tags_all", "=", "set", "(", ")", "# loop through all patterns and run them", "self", ".", "callbacks", ".", "on_start", "(", ")", "for", "(", ...
run all patterns in the playbook
[ "run", "all", "patterns", "in", "the", "playbook" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L190-L229
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._async_poll
def _async_poll(self, poller, async_seconds, async_poll_interval): ''' launch an async job, if poll_interval is set, wait for completion ''' results = poller.wait(async_seconds, async_poll_interval) # mark any hosts that are still listed as started as failed # since these likely got ki...
python
def _async_poll(self, poller, async_seconds, async_poll_interval): ''' launch an async job, if poll_interval is set, wait for completion ''' results = poller.wait(async_seconds, async_poll_interval) # mark any hosts that are still listed as started as failed # since these likely got ki...
[ "def", "_async_poll", "(", "self", ",", "poller", ",", "async_seconds", ",", "async_poll_interval", ")", ":", "results", "=", "poller", ".", "wait", "(", "async_seconds", ",", "async_poll_interval", ")", "# mark any hosts that are still listed as started as failed", "# ...
launch an async job, if poll_interval is set, wait for completion
[ "launch", "an", "async", "job", "if", "poll_interval", "is", "set", "wait", "for", "completion" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L233-L245
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._list_available_hosts
def _list_available_hosts(self, *args): ''' returns a list of hosts that haven't failed and aren't dark ''' return [ h for h in self.inventory.list_hosts(*args) if (h not in self.stats.failures) and (h not in self.stats.dark)]
python
def _list_available_hosts(self, *args): ''' returns a list of hosts that haven't failed and aren't dark ''' return [ h for h in self.inventory.list_hosts(*args) if (h not in self.stats.failures) and (h not in self.stats.dark)]
[ "def", "_list_available_hosts", "(", "self", ",", "*", "args", ")", ":", "return", "[", "h", "for", "h", "in", "self", ".", "inventory", ".", "list_hosts", "(", "*", "args", ")", "if", "(", "h", "not", "in", "self", ".", "stats", ".", "failures", "...
returns a list of hosts that haven't failed and aren't dark
[ "returns", "a", "list", "of", "hosts", "that", "haven", "t", "failed", "and", "aren", "t", "dark" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L249-L252
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._run_task_internal
def _run_task_internal(self, task): ''' run a particular module step in a playbook ''' hosts = self._list_available_hosts() self.inventory.restrict_to(hosts) runner = cirruscluster.ext.ansible.runner.Runner( pattern=task.play.hosts, inventory=self.inventory, module_name=tas...
python
def _run_task_internal(self, task): ''' run a particular module step in a playbook ''' hosts = self._list_available_hosts() self.inventory.restrict_to(hosts) runner = cirruscluster.ext.ansible.runner.Runner( pattern=task.play.hosts, inventory=self.inventory, module_name=tas...
[ "def", "_run_task_internal", "(", "self", ",", "task", ")", ":", "hosts", "=", "self", ".", "_list_available_hosts", "(", ")", "self", ".", "inventory", ".", "restrict_to", "(", "hosts", ")", "runner", "=", "cirruscluster", ".", "ext", ".", "ansible", ".",...
run a particular module step in a playbook
[ "run", "a", "particular", "module", "step", "in", "a", "playbook" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L256-L293
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._run_task
def _run_task(self, play, task, is_handler): ''' run a single task in the playbook and recursively run any subtasks. ''' self.callbacks.on_task_start(utils.template(play.basedir, task.name, task.module_vars, lookup_fatal=False), is_handler) # load up an appropriate ansible runner to run the t...
python
def _run_task(self, play, task, is_handler): ''' run a single task in the playbook and recursively run any subtasks. ''' self.callbacks.on_task_start(utils.template(play.basedir, task.name, task.module_vars, lookup_fatal=False), is_handler) # load up an appropriate ansible runner to run the t...
[ "def", "_run_task", "(", "self", ",", "play", ",", "task", ",", "is_handler", ")", ":", "self", ".", "callbacks", ".", "on_task_start", "(", "utils", ".", "template", "(", "play", ".", "basedir", ",", "task", ".", "name", ",", "task", ".", "module_vars...
run a single task in the playbook and recursively run any subtasks.
[ "run", "a", "single", "task", "in", "the", "playbook", "and", "recursively", "run", "any", "subtasks", "." ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L297-L335
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._flag_handler
def _flag_handler(self, play, handler_name, host): ''' if a task has any notify elements, flag handlers for run at end of execution cycle for hosts that have indicated changes have been made ''' found = False for x in play.handlers(): if handler_name ...
python
def _flag_handler(self, play, handler_name, host): ''' if a task has any notify elements, flag handlers for run at end of execution cycle for hosts that have indicated changes have been made ''' found = False for x in play.handlers(): if handler_name ...
[ "def", "_flag_handler", "(", "self", ",", "play", ",", "handler_name", ",", "host", ")", ":", "found", "=", "False", "for", "x", "in", "play", ".", "handlers", "(", ")", ":", "if", "handler_name", "==", "utils", ".", "template", "(", "play", ".", "ba...
if a task has any notify elements, flag handlers for run at end of execution cycle for hosts that have indicated changes have been made
[ "if", "a", "task", "has", "any", "notify", "elements", "flag", "handlers", "for", "run", "at", "end", "of", "execution", "cycle", "for", "hosts", "that", "have", "indicated", "changes", "have", "been", "made" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L339-L353
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._do_setup_step
def _do_setup_step(self, play): ''' get facts from the remote system ''' host_list = self._list_available_hosts(play.hosts) if play.gather_facts is False: return {} elif play.gather_facts is None: host_list = [h for h in host_list if h not in self.SETUP_CACHE or...
python
def _do_setup_step(self, play): ''' get facts from the remote system ''' host_list = self._list_available_hosts(play.hosts) if play.gather_facts is False: return {} elif play.gather_facts is None: host_list = [h for h in host_list if h not in self.SETUP_CACHE or...
[ "def", "_do_setup_step", "(", "self", ",", "play", ")", ":", "host_list", "=", "self", ".", "_list_available_hosts", "(", "play", ".", "hosts", ")", "if", "play", ".", "gather_facts", "is", "False", ":", "return", "{", "}", "elif", "play", ".", "gather_f...
get facts from the remote system
[ "get", "facts", "from", "the", "remote", "system" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L357-L391
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
PlayBook._run_play
def _run_play(self, play): ''' run a list of tasks for a given pattern, in order ''' self.callbacks.on_play_start(play.name) # if no hosts matches this play, drop out if not self.inventory.list_hosts(play.hosts): self.callbacks.on_no_hosts_matched() return True ...
python
def _run_play(self, play): ''' run a list of tasks for a given pattern, in order ''' self.callbacks.on_play_start(play.name) # if no hosts matches this play, drop out if not self.inventory.list_hosts(play.hosts): self.callbacks.on_no_hosts_matched() return True ...
[ "def", "_run_play", "(", "self", ",", "play", ")", ":", "self", ".", "callbacks", ".", "on_play_start", "(", "play", ".", "name", ")", "# if no hosts matches this play, drop out", "if", "not", "self", ".", "inventory", ".", "list_hosts", "(", "play", ".", "h...
run a list of tasks for a given pattern, in order
[ "run", "a", "list", "of", "tasks", "for", "a", "given", "pattern", "in", "order" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L395-L461
vowatchka/palindromus
palindromus/__init__.py
check
def check(somestr, check = STRING, interchange = ALL): """ Checks that some string, word or text are palindrome. Checking performs case-insensitive :param str somestr: It is some string that will be checked for palindrome :keyword int check: It is mode of checking. Follows modes are available: ...
python
def check(somestr, check = STRING, interchange = ALL): """ Checks that some string, word or text are palindrome. Checking performs case-insensitive :param str somestr: It is some string that will be checked for palindrome :keyword int check: It is mode of checking. Follows modes are available: ...
[ "def", "check", "(", "somestr", ",", "check", "=", "STRING", ",", "interchange", "=", "ALL", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "somestr", ")", "if", "not", "isinstance", "(", "check", ",", "int", ")", ":", "raise", "Type...
Checks that some string, word or text are palindrome. Checking performs case-insensitive :param str somestr: It is some string that will be checked for palindrome :keyword int check: It is mode of checking. Follows modes are available: - STRING - means that checking of string performs...
[ "Checks", "that", "some", "string", "word", "or", "text", "are", "palindrome", ".", "Checking", "performs", "case", "-", "insensitive", ":", "param", "str", "somestr", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "palindrome", ...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L133-L188
vowatchka/palindromus
palindromus/__init__.py
checkstring
def checkstring(somestr, interchange = ALL): """ Checks that some string is palindrome. Checking performs case-insensitive :param str somestr: It is some string that will be checked for palindrome as string. The string is any string that you want. The string also can be multiline. If t...
python
def checkstring(somestr, interchange = ALL): """ Checks that some string is palindrome. Checking performs case-insensitive :param str somestr: It is some string that will be checked for palindrome as string. The string is any string that you want. The string also can be multiline. If t...
[ "def", "checkstring", "(", "somestr", ",", "interchange", "=", "ALL", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "somestr", ")", "if", "somestr", "!=", "\"\"", ":", "# remove all special symbols", "pattern", "=", "r'[^\\w]+|[_]+'", "purest...
Checks that some string is palindrome. Checking performs case-insensitive :param str somestr: It is some string that will be checked for palindrome as string. The string is any string that you want. The string also can be multiline. If the checked string does not contains any alphabetic c...
[ "Checks", "that", "some", "string", "is", "palindrome", ".", "Checking", "performs", "case", "-", "insensitive", ":", "param", "str", "somestr", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "palindrome", "as", "string", ".", "...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L190-L230
vowatchka/palindromus
palindromus/__init__.py
checkword
def checkword(someword, interchange = ALL): """ Checks that some word is palindrome. Checking performs case-insensitive :param str someword: It is some string that will be checked for palindrome as word. What is the word see at help(palindromus.isword) :keyword dict interchange: It is di...
python
def checkword(someword, interchange = ALL): """ Checks that some word is palindrome. Checking performs case-insensitive :param str someword: It is some string that will be checked for palindrome as word. What is the word see at help(palindromus.isword) :keyword dict interchange: It is di...
[ "def", "checkword", "(", "someword", ",", "interchange", "=", "ALL", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "someword", ")", "if", "isword", "(", "someword", ")", ":", "return", "checkstring", "(", "someword", ",", "interchange", ...
Checks that some word is palindrome. Checking performs case-insensitive :param str someword: It is some string that will be checked for palindrome as word. What is the word see at help(palindromus.isword) :keyword dict interchange: It is dictionary of interchangeable letters :except T...
[ "Checks", "that", "some", "word", "is", "palindrome", ".", "Checking", "performs", "case", "-", "insensitive", ":", "param", "str", "someword", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "palindrome", "as", "word", ".", "Wha...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L232-L254
vowatchka/palindromus
palindromus/__init__.py
checkmultiline
def checkmultiline(sometext, interchange = ALL): """ Checks that some text is multiline palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as multiline palindrome. The multiline palindrome is text that contains palindrome at ...
python
def checkmultiline(sometext, interchange = ALL): """ Checks that some text is multiline palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as multiline palindrome. The multiline palindrome is text that contains palindrome at ...
[ "def", "checkmultiline", "(", "sometext", ",", "interchange", "=", "ALL", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "sometext", ")", "if", "istext", "(", "sometext", ")", ":", "lines", "=", "re", ".", "split", "(", "r'\\r\\n|\\n|\\r...
Checks that some text is multiline palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as multiline palindrome. The multiline palindrome is text that contains palindrome at each line (what is the text see at help(palindrom...
[ "Checks", "that", "some", "text", "is", "multiline", "palindrome", ".", "Checking", "performs", "case", "-", "insensitive", ":", "param", "str", "sometext", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "palindrome", "as", "multi...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L256-L289
vowatchka/palindromus
palindromus/__init__.py
checktext
def checktext(sometext, interchange = ALL): """ Checks that some text is palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. ...
python
def checktext(sometext, interchange = ALL): """ Checks that some text is palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. ...
[ "def", "checktext", "(", "sometext", ",", "interchange", "=", "ALL", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "sometext", ")", "if", "istext", "(", "sometext", ")", ":", "return", "checkstring", "(", "sometext", ",", "interchange", ...
Checks that some text is palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. :keyword dict interchange: It is dictionary o...
[ "Checks", "that", "some", "text", "is", "palindrome", ".", "Checking", "performs", "case", "-", "insensitive", ":", "param", "str", "sometext", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "palindrome", "as", "text", ".", "Wha...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L291-L316
vowatchka/palindromus
palindromus/__init__.py
checksuper
def checksuper(sometext, interchange = ALL): """ Checks that some text is superpalindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for superpalindrome as text. What is the text see at help(palindromus.istext) The text can be multil...
python
def checksuper(sometext, interchange = ALL): """ Checks that some text is superpalindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for superpalindrome as text. What is the text see at help(palindromus.istext) The text can be multil...
[ "def", "checksuper", "(", "sometext", ",", "interchange", "=", "ALL", ")", ":", "def", "text_by_columns", "(", "text", ",", "columns", ")", ":", "column_idx", "=", "0", "result_text", "=", "\"\"", "while", "column_idx", "+", "1", "<=", "columns", ":", "f...
Checks that some text is superpalindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for superpalindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. :keyword dict interchange: It is di...
[ "Checks", "that", "some", "text", "is", "superpalindrome", ".", "Checking", "performs", "case", "-", "insensitive", ":", "param", "str", "sometext", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "superpalindrome", "as", "text", "...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L318-L366
vowatchka/palindromus
palindromus/__init__.py
isword
def isword(somestr): """ Checks that some string is a word :param str somestr: It is some string that will be checked for word. The word is a string that contains only alphabetic characters, its length not less 2 characters and noone characters does not reeats more than 2 times in ...
python
def isword(somestr): """ Checks that some string is a word :param str somestr: It is some string that will be checked for word. The word is a string that contains only alphabetic characters, its length not less 2 characters and noone characters does not reeats more than 2 times in ...
[ "def", "isword", "(", "somestr", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "somestr", ")", "if", "somestr", ".", "isalpha", "(", ")", "and", "len", "(", "somestr", ")", ">", "1", ":", "# find characters that repeats more then 2 times in...
Checks that some string is a word :param str somestr: It is some string that will be checked for word. The word is a string that contains only alphabetic characters, its length not less 2 characters and noone characters does not reeats more than 2 times in a row. The word ca...
[ "Checks", "that", "some", "string", "is", "a", "word", ":", "param", "str", "somestr", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "word", ".", "The", "word", "is", "a", "string", "that", "contains", "only", "alphabetic", ...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L368-L398
vowatchka/palindromus
palindromus/__init__.py
isspecword
def isspecword(somestr): """ Checks that some string is a special word :param str somestr: It is some string that will be checked for special word. The special word is a string that contains only alphabetic characters, its length not less 1 character and not more 2 characters and a...
python
def isspecword(somestr): """ Checks that some string is a special word :param str somestr: It is some string that will be checked for special word. The special word is a string that contains only alphabetic characters, its length not less 1 character and not more 2 characters and a...
[ "def", "isspecword", "(", "somestr", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "somestr", ")", "if", "somestr", ".", "isalpha", "(", ")", "and", "len", "(", "somestr", ")", "in", "[", "1", ",", "2", "]", ":", "# find characters ...
Checks that some string is a special word :param str somestr: It is some string that will be checked for special word. The special word is a string that contains only alphabetic characters, its length not less 1 character and not more 2 characters and also noone characters does not re...
[ "Checks", "that", "some", "string", "is", "a", "special", "word", ":", "param", "str", "somestr", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "special", "word", ".", "The", "special", "word", "is", "a", "string", "that", ...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L400-L432
vowatchka/palindromus
palindromus/__init__.py
istext
def istext(somestr): """ Checks that some string is a text :param str somestr: It is some string that will be checked for text. The text is string that contains only words or special words such as preposition (what is the word and the special word see at help(palindromus.isword) and help(...
python
def istext(somestr): """ Checks that some string is a text :param str somestr: It is some string that will be checked for text. The text is string that contains only words or special words such as preposition (what is the word and the special word see at help(palindromus.isword) and help(...
[ "def", "istext", "(", "somestr", ")", ":", "# check invalid data types", "OnlyStringsCanBeChecked", "(", "somestr", ")", "# get all matches", "matches", "=", "re", ".", "findall", "(", "r'\\w+'", ",", "somestr", ".", "strip", "(", ")", ",", "flags", "=", "re",...
Checks that some string is a text :param str somestr: It is some string that will be checked for text. The text is string that contains only words or special words such as preposition (what is the word and the special word see at help(palindromus.isword) and help(palindromus.isspecword)). ...
[ "Checks", "that", "some", "string", "is", "a", "text", ":", "param", "str", "somestr", ":", "It", "is", "some", "string", "that", "will", "be", "checked", "for", "text", ".", "The", "text", "is", "string", "that", "contains", "only", "words", "or", "sp...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L434-L463
diefans/objective
src/objective/fields.py
CollectionMixin._deserialize
def _deserialize(self, value, environment=None): """A collection traverses over something to deserialize its value.""" if not isinstance(value, CollectionABC): raise exc.Invalid(self) items_class = self.items.__class__ invalids = [] # traverse items and match again...
python
def _deserialize(self, value, environment=None): """A collection traverses over something to deserialize its value.""" if not isinstance(value, CollectionABC): raise exc.Invalid(self) items_class = self.items.__class__ invalids = [] # traverse items and match again...
[ "def", "_deserialize", "(", "self", ",", "value", ",", "environment", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "CollectionABC", ")", ":", "raise", "exc", ".", "Invalid", "(", "self", ")", "items_class", "=", "self", ".", "it...
A collection traverses over something to deserialize its value.
[ "A", "collection", "traverses", "over", "something", "to", "deserialize", "its", "value", "." ]
train
https://github.com/diefans/objective/blob/e2de37f1cd4f5ad147ab3a5dee7dffd6806f2f88/src/objective/fields.py#L43-L67
diefans/objective
src/objective/fields.py
Mapping._deserialize
def _deserialize(self, value, environment=None): """A collection traverses over something to deserialize its value. :param value: a ``dict`` wich contains mapped values """ if not isinstance(value, MappingABC): raise exc.Invalid(self) # traverse items and match aga...
python
def _deserialize(self, value, environment=None): """A collection traverses over something to deserialize its value. :param value: a ``dict`` wich contains mapped values """ if not isinstance(value, MappingABC): raise exc.Invalid(self) # traverse items and match aga...
[ "def", "_deserialize", "(", "self", ",", "value", ",", "environment", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "MappingABC", ")", ":", "raise", "exc", ".", "Invalid", "(", "self", ")", "# traverse items and match against validated s...
A collection traverses over something to deserialize its value. :param value: a ``dict`` wich contains mapped values
[ "A", "collection", "traverses", "over", "something", "to", "deserialize", "its", "value", "." ]
train
https://github.com/diefans/objective/blob/e2de37f1cd4f5ad147ab3a5dee7dffd6806f2f88/src/objective/fields.py#L125-L159
bwesterb/mirte
src/main.py
parse_cmdLine_instructions
def parse_cmdLine_instructions(args): """ Parses command-line arguments. These are instruction to the manager to create instances and put settings. """ instructions = dict() rargs = list() for arg in args: if arg[:2] == '--': tmp = arg[2:] bits = tmp.spli...
python
def parse_cmdLine_instructions(args): """ Parses command-line arguments. These are instruction to the manager to create instances and put settings. """ instructions = dict() rargs = list() for arg in args: if arg[:2] == '--': tmp = arg[2:] bits = tmp.spli...
[ "def", "parse_cmdLine_instructions", "(", "args", ")", ":", "instructions", "=", "dict", "(", ")", "rargs", "=", "list", "(", ")", "for", "arg", "in", "args", ":", "if", "arg", "[", ":", "2", "]", "==", "'--'", ":", "tmp", "=", "arg", "[", "2", "...
Parses command-line arguments. These are instruction to the manager to create instances and put settings.
[ "Parses", "command", "-", "line", "arguments", ".", "These", "are", "instruction", "to", "the", "manager", "to", "create", "instances", "and", "put", "settings", "." ]
train
https://github.com/bwesterb/mirte/blob/c58db8c993cd15ffdc64b52703cd466213913200/src/main.py#L14-L29
bwesterb/mirte
src/main.py
execute_cmdLine_instructions
def execute_cmdLine_instructions(instructions, m, l): """ Applies the instructions given via <instructions> on the manager <m> """ opt_lut = dict() inst_lut = dict() for k, v in six.iteritems(instructions): bits = k.split('-', 1) if len(bits) == 1: if v not in m.modul...
python
def execute_cmdLine_instructions(instructions, m, l): """ Applies the instructions given via <instructions> on the manager <m> """ opt_lut = dict() inst_lut = dict() for k, v in six.iteritems(instructions): bits = k.split('-', 1) if len(bits) == 1: if v not in m.modul...
[ "def", "execute_cmdLine_instructions", "(", "instructions", ",", "m", ",", "l", ")", ":", "opt_lut", "=", "dict", "(", ")", "inst_lut", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "instructions", ")", ":", "bits", ...
Applies the instructions given via <instructions> on the manager <m>
[ "Applies", "the", "instructions", "given", "via", "<instructions", ">", "on", "the", "manager", "<m", ">" ]
train
https://github.com/bwesterb/mirte/blob/c58db8c993cd15ffdc64b52703cd466213913200/src/main.py#L32-L67
bwesterb/mirte
src/main.py
main
def main(): """ Entry-point """ sarah.coloredLogging.basicConfig(level=logging.DEBUG, formatter=MirteFormatter()) l = logging.getLogger('mirte') instructions, args = parse_cmdLine_instructions(sys.argv[1:]) m = Manager(l) load_mirteFile(args[0] if args else '...
python
def main(): """ Entry-point """ sarah.coloredLogging.basicConfig(level=logging.DEBUG, formatter=MirteFormatter()) l = logging.getLogger('mirte') instructions, args = parse_cmdLine_instructions(sys.argv[1:]) m = Manager(l) load_mirteFile(args[0] if args else '...
[ "def", "main", "(", ")", ":", "sarah", ".", "coloredLogging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", ",", "formatter", "=", "MirteFormatter", "(", ")", ")", "l", "=", "logging", ".", "getLogger", "(", "'mirte'", ")", "instruction...
Entry-point
[ "Entry", "-", "point" ]
train
https://github.com/bwesterb/mirte/blob/c58db8c993cd15ffdc64b52703cd466213913200/src/main.py#L86-L95
minhhoit/yacms
yacms/pages/middleware.py
PageMiddleware.installed
def installed(cls): """ Used in ``yacms.pages.views.page`` to ensure ``PageMiddleware`` or a subclass has been installed. We cache the result on the ``PageMiddleware._installed`` to only run this once. Short path is to just check for the dotted path to ``PageMiddleware`` ...
python
def installed(cls): """ Used in ``yacms.pages.views.page`` to ensure ``PageMiddleware`` or a subclass has been installed. We cache the result on the ``PageMiddleware._installed`` to only run this once. Short path is to just check for the dotted path to ``PageMiddleware`` ...
[ "def", "installed", "(", "cls", ")", ":", "try", ":", "return", "cls", ".", "_installed", "except", "AttributeError", ":", "name", "=", "\"yacms.pages.middleware.PageMiddleware\"", "mw_setting", "=", "get_middleware_setting", "(", ")", "installed", "=", "name", "i...
Used in ``yacms.pages.views.page`` to ensure ``PageMiddleware`` or a subclass has been installed. We cache the result on the ``PageMiddleware._installed`` to only run this once. Short path is to just check for the dotted path to ``PageMiddleware`` in ``MIDDLEWARE_CLASSES`` - if not found...
[ "Used", "in", "yacms", ".", "pages", ".", "views", ".", "page", "to", "ensure", "PageMiddleware", "or", "a", "subclass", "has", "been", "installed", ".", "We", "cache", "the", "result", "on", "the", "PageMiddleware", ".", "_installed", "to", "only", "run",...
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/middleware.py#L43-L64
minhhoit/yacms
yacms/pages/middleware.py
PageMiddleware.process_view
def process_view(self, request, view_func, view_args, view_kwargs): """ Per-request mechanics for the current page object. """ # Load the closest matching page by slug, and assign it to the # request object. If none found, skip all further processing. slug = path_to_slug...
python
def process_view(self, request, view_func, view_args, view_kwargs): """ Per-request mechanics for the current page object. """ # Load the closest matching page by slug, and assign it to the # request object. If none found, skip all further processing. slug = path_to_slug...
[ "def", "process_view", "(", "self", ",", "request", ",", "view_func", ",", "view_args", ",", "view_kwargs", ")", ":", "# Load the closest matching page by slug, and assign it to the", "# request object. If none found, skip all further processing.", "slug", "=", "path_to_slug", ...
Per-request mechanics for the current page object.
[ "Per", "-", "request", "mechanics", "for", "the", "current", "page", "object", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/middleware.py#L66-L125
tomprince/nomenclature
nomenclature/syscalls.py
unshare
def unshare(flags): """ Disassociate parts of the process execution context. :param flags int: A bitmask that specifies which parts of the execution context should be unshared. """ res = lib.unshare(flags) if res != 0: _check_error(ffi.errno)
python
def unshare(flags): """ Disassociate parts of the process execution context. :param flags int: A bitmask that specifies which parts of the execution context should be unshared. """ res = lib.unshare(flags) if res != 0: _check_error(ffi.errno)
[ "def", "unshare", "(", "flags", ")", ":", "res", "=", "lib", ".", "unshare", "(", "flags", ")", "if", "res", "!=", "0", ":", "_check_error", "(", "ffi", ".", "errno", ")" ]
Disassociate parts of the process execution context. :param flags int: A bitmask that specifies which parts of the execution context should be unshared.
[ "Disassociate", "parts", "of", "the", "process", "execution", "context", "." ]
train
https://github.com/tomprince/nomenclature/blob/81af4a590034f75211f028d485c0d83fceda5af2/nomenclature/syscalls.py#L15-L24
tomprince/nomenclature
nomenclature/syscalls.py
setns
def setns(fd, nstype): """ Reassociate thread with a namespace :param fd int: The file descriptor referreing to one of the namespace entries in a :directory::`/proc/<pid>/ns/` directory. :param nstype int: The type of namespace the calling thread should be reasscoiated with. """ ...
python
def setns(fd, nstype): """ Reassociate thread with a namespace :param fd int: The file descriptor referreing to one of the namespace entries in a :directory::`/proc/<pid>/ns/` directory. :param nstype int: The type of namespace the calling thread should be reasscoiated with. """ ...
[ "def", "setns", "(", "fd", ",", "nstype", ")", ":", "res", "=", "lib", ".", "setns", "(", "fd", ",", "nstype", ")", "if", "res", "!=", "0", ":", "_check_error", "(", "ffi", ".", "errno", ")" ]
Reassociate thread with a namespace :param fd int: The file descriptor referreing to one of the namespace entries in a :directory::`/proc/<pid>/ns/` directory. :param nstype int: The type of namespace the calling thread should be reasscoiated with.
[ "Reassociate", "thread", "with", "a", "namespace" ]
train
https://github.com/tomprince/nomenclature/blob/81af4a590034f75211f028d485c0d83fceda5af2/nomenclature/syscalls.py#L27-L38
xtrementl/focus
focus/task.py
Task._reset
def _reset(self): """ Resets class properties. """ self._name = None self._start_time = None self._owner = os.getuid() self._paths['task_dir'] = None self._paths['task_config'] = None self._loaded = False
python
def _reset(self): """ Resets class properties. """ self._name = None self._start_time = None self._owner = os.getuid() self._paths['task_dir'] = None self._paths['task_config'] = None self._loaded = False
[ "def", "_reset", "(", "self", ")", ":", "self", ".", "_name", "=", "None", "self", ".", "_start_time", "=", "None", "self", ".", "_owner", "=", "os", ".", "getuid", "(", ")", "self", ".", "_paths", "[", "'task_dir'", "]", "=", "None", "self", ".", ...
Resets class properties.
[ "Resets", "class", "properties", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L51-L60
xtrementl/focus
focus/task.py
Task._save_active_file
def _save_active_file(self): """ Saves current task information to active file. Example format:: active_task { name "task name"; start_time "2012-04-23 15:18:22"; } """ _parser = parser.SettingParser() ...
python
def _save_active_file(self): """ Saves current task information to active file. Example format:: active_task { name "task name"; start_time "2012-04-23 15:18:22"; } """ _parser = parser.SettingParser() ...
[ "def", "_save_active_file", "(", "self", ")", ":", "_parser", "=", "parser", ".", "SettingParser", "(", ")", "# add name", "_parser", ".", "add_option", "(", "None", ",", "'name'", ",", "common", ".", "to_utf8", "(", "self", ".", "_name", ")", ")", "# ad...
Saves current task information to active file. Example format:: active_task { name "task name"; start_time "2012-04-23 15:18:22"; }
[ "Saves", "current", "task", "information", "to", "active", "file", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L73-L94
xtrementl/focus
focus/task.py
Task._clean_prior
def _clean_prior(self): """ Cleans up from a previous task that didn't exit cleanly. Returns ``True`` if previous task was cleaned. """ if self._loaded: try: pid_file = daemon.get_daemon_pidfile(self) # check if it exists so we don't...
python
def _clean_prior(self): """ Cleans up from a previous task that didn't exit cleanly. Returns ``True`` if previous task was cleaned. """ if self._loaded: try: pid_file = daemon.get_daemon_pidfile(self) # check if it exists so we don't...
[ "def", "_clean_prior", "(", "self", ")", ":", "if", "self", ".", "_loaded", ":", "try", ":", "pid_file", "=", "daemon", ".", "get_daemon_pidfile", "(", "self", ")", "# check if it exists so we don't raise", "if", "os", ".", "path", ".", "isfile", "(", "pid_f...
Cleans up from a previous task that didn't exit cleanly. Returns ``True`` if previous task was cleaned.
[ "Cleans", "up", "from", "a", "previous", "task", "that", "didn", "t", "exit", "cleanly", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L96-L120
xtrementl/focus
focus/task.py
Task.load
def load(self): """ Loads a task if the active file is available. """ try: _parser = parser.parse_config(self._paths['active_file'], self.HEADER_ACTIVE_FILE) # parse expected options into a dict to de-dupe keys =...
python
def load(self): """ Loads a task if the active file is available. """ try: _parser = parser.parse_config(self._paths['active_file'], self.HEADER_ACTIVE_FILE) # parse expected options into a dict to de-dupe keys =...
[ "def", "load", "(", "self", ")", ":", "try", ":", "_parser", "=", "parser", ".", "parse_config", "(", "self", ".", "_paths", "[", "'active_file'", "]", ",", "self", ".", "HEADER_ACTIVE_FILE", ")", "# parse expected options into a dict to de-dupe", "keys", "=", ...
Loads a task if the active file is available.
[ "Loads", "a", "task", "if", "the", "active", "file", "is", "available", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L129-L177
xtrementl/focus
focus/task.py
Task.exists
def exists(self, task_name): """ Determines if task directory exists. `task_name` Task name. Returns ``True`` if task exists. """ try: return os.path.exists(self._get_task_dir(task_name)) except OSError: return False
python
def exists(self, task_name): """ Determines if task directory exists. `task_name` Task name. Returns ``True`` if task exists. """ try: return os.path.exists(self._get_task_dir(task_name)) except OSError: return False
[ "def", "exists", "(", "self", ",", "task_name", ")", ":", "try", ":", "return", "os", ".", "path", ".", "exists", "(", "self", ".", "_get_task_dir", "(", "task_name", ")", ")", "except", "OSError", ":", "return", "False" ]
Determines if task directory exists. `task_name` Task name. Returns ``True`` if task exists.
[ "Determines", "if", "task", "directory", "exists", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L179-L192
xtrementl/focus
focus/task.py
Task.create
def create(self, task_name, clone_task=None): """ Creates a new task directory. `task_name` Task name. `clone_task` Existing task name to use as a template for new task. Returns boolean. * Raises ``Value`` if task name is invalid...
python
def create(self, task_name, clone_task=None): """ Creates a new task directory. `task_name` Task name. `clone_task` Existing task name to use as a template for new task. Returns boolean. * Raises ``Value`` if task name is invalid...
[ "def", "create", "(", "self", ",", "task_name", ",", "clone_task", "=", "None", ")", ":", "if", "not", "task_name", "or", "task_name", ".", "startswith", "(", "'-'", ")", ":", "raise", "ValueError", "(", "'Invalid task name'", ")", "try", ":", "task_dir", ...
Creates a new task directory. `task_name` Task name. `clone_task` Existing task name to use as a template for new task. Returns boolean. * Raises ``Value`` if task name is invalid, ``TaskExists`` if task already exists, or ...
[ "Creates", "a", "new", "task", "directory", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L205-L248
xtrementl/focus
focus/task.py
Task.rename
def rename(self, old_task_name, new_task_name): """ Renames an existing task directory. `old_task_name` Current task name. `new_task_name` New task name. Returns ``True`` if rename successful. """ if not old_task_name or ...
python
def rename(self, old_task_name, new_task_name): """ Renames an existing task directory. `old_task_name` Current task name. `new_task_name` New task name. Returns ``True`` if rename successful. """ if not old_task_name or ...
[ "def", "rename", "(", "self", ",", "old_task_name", ",", "new_task_name", ")", ":", "if", "not", "old_task_name", "or", "old_task_name", ".", "startswith", "(", "'-'", ")", ":", "raise", "ValueError", "(", "'Old task name is invalid'", ")", "if", "not", "new_t...
Renames an existing task directory. `old_task_name` Current task name. `new_task_name` New task name. Returns ``True`` if rename successful.
[ "Renames", "an", "existing", "task", "directory", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L250-L283
xtrementl/focus
focus/task.py
Task.remove
def remove(self, task_name): """ Removes an existing task directory. `task_name` Task name. Returns ``True`` if removal successful. """ try: task_dir = self._get_task_dir(task_name) shutil.rmtree(task_dir) return ...
python
def remove(self, task_name): """ Removes an existing task directory. `task_name` Task name. Returns ``True`` if removal successful. """ try: task_dir = self._get_task_dir(task_name) shutil.rmtree(task_dir) return ...
[ "def", "remove", "(", "self", ",", "task_name", ")", ":", "try", ":", "task_dir", "=", "self", ".", "_get_task_dir", "(", "task_name", ")", "shutil", ".", "rmtree", "(", "task_dir", ")", "return", "True", "except", "OSError", ":", "return", "False" ]
Removes an existing task directory. `task_name` Task name. Returns ``True`` if removal successful.
[ "Removes", "an", "existing", "task", "directory", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L285-L300
xtrementl/focus
focus/task.py
Task.get_list_info
def get_list_info(self, task_name=None): """ Lists all tasks and associated information. `task_name` Task name to limit. Default: return all valid tasks. Returns list of tuples (task_name, options, block_options) """ try: tasks = [] ...
python
def get_list_info(self, task_name=None): """ Lists all tasks and associated information. `task_name` Task name to limit. Default: return all valid tasks. Returns list of tuples (task_name, options, block_options) """ try: tasks = [] ...
[ "def", "get_list_info", "(", "self", ",", "task_name", "=", "None", ")", ":", "try", ":", "tasks", "=", "[", "]", "# get all tasks dirs", "tasks_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_paths", "[", "'base_dir'", "]", ",", "'tasks...
Lists all tasks and associated information. `task_name` Task name to limit. Default: return all valid tasks. Returns list of tuples (task_name, options, block_options)
[ "Lists", "all", "tasks", "and", "associated", "information", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L302-L345
xtrementl/focus
focus/task.py
Task.start
def start(self, task_name): """ Starts a new task matching the provided name. `task_name` Name of existing task to start. Returns boolean. * Raises a ``TaskNotFound`` exception if task doesn't exist, an ``InvalidTaskConfig` exception if task c...
python
def start(self, task_name): """ Starts a new task matching the provided name. `task_name` Name of existing task to start. Returns boolean. * Raises a ``TaskNotFound`` exception if task doesn't exist, an ``InvalidTaskConfig` exception if task c...
[ "def", "start", "(", "self", ",", "task_name", ")", ":", "self", ".", "_clean_prior", "(", ")", "if", "self", ".", "_loaded", ":", "raise", "errors", ".", "ActiveTask", "# get paths", "task_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", ...
Starts a new task matching the provided name. `task_name` Name of existing task to start. Returns boolean. * Raises a ``TaskNotFound`` exception if task doesn't exist, an ``InvalidTaskConfig` exception if task config file is invalid, or ...
[ "Starts", "a", "new", "task", "matching", "the", "provided", "name", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L347-L417
xtrementl/focus
focus/task.py
Task.stop
def stop(self): """ Stops the current task and cleans up, including removing active task config file. * Raises ``NoActiveTask`` exception if no active task found. """ self._clean_prior() if not self._loaded: raise errors.NoActiveTask se...
python
def stop(self): """ Stops the current task and cleans up, including removing active task config file. * Raises ``NoActiveTask`` exception if no active task found. """ self._clean_prior() if not self._loaded: raise errors.NoActiveTask se...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_clean_prior", "(", ")", "if", "not", "self", ".", "_loaded", ":", "raise", "errors", ".", "NoActiveTask", "self", ".", "_clean", "(", ")" ]
Stops the current task and cleans up, including removing active task config file. * Raises ``NoActiveTask`` exception if no active task found.
[ "Stops", "the", "current", "task", "and", "cleans", "up", "including", "removing", "active", "task", "config", "file", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L419-L431
xtrementl/focus
focus/task.py
Task.set_total_duration
def set_total_duration(self, duration): """ Set the total task duration in minutes. """ if duration < 1: raise ValueError(u'Duration must be postive') elif self.duration > duration: raise ValueError(u'{0} must be greater than current duration') self....
python
def set_total_duration(self, duration): """ Set the total task duration in minutes. """ if duration < 1: raise ValueError(u'Duration must be postive') elif self.duration > duration: raise ValueError(u'{0} must be greater than current duration') self....
[ "def", "set_total_duration", "(", "self", ",", "duration", ")", ":", "if", "duration", "<", "1", ":", "raise", "ValueError", "(", "u'Duration must be postive'", ")", "elif", "self", ".", "duration", ">", "duration", ":", "raise", "ValueError", "(", "u'{0} must...
Set the total task duration in minutes.
[ "Set", "the", "total", "task", "duration", "in", "minutes", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L433-L442
xtrementl/focus
focus/task.py
Task.active
def active(self): """ Returns if task is active. """ if not os.path.isfile(self._paths['active_file']): return False return self._loaded
python
def active(self): """ Returns if task is active. """ if not os.path.isfile(self._paths['active_file']): return False return self._loaded
[ "def", "active", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "self", ".", "_paths", "[", "'active_file'", "]", ")", ":", "return", "False", "return", "self", ".", "_loaded" ]
Returns if task is active.
[ "Returns", "if", "task", "is", "active", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L454-L459
xtrementl/focus
focus/task.py
Task.duration
def duration(self): """ Returns task's current duration in minutes. """ if not self._loaded: return 0 delta = datetime.datetime.now() - self._start_time total_secs = (delta.microseconds + (delta.seconds + delta.days * 24 * 3600) * ...
python
def duration(self): """ Returns task's current duration in minutes. """ if not self._loaded: return 0 delta = datetime.datetime.now() - self._start_time total_secs = (delta.microseconds + (delta.seconds + delta.days * 24 * 3600) * ...
[ "def", "duration", "(", "self", ")", ":", "if", "not", "self", ".", "_loaded", ":", "return", "0", "delta", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "-", "self", ".", "_start_time", "total_secs", "=", "(", "delta", ".", "microseconds", ...
Returns task's current duration in minutes.
[ "Returns", "task", "s", "current", "duration", "in", "minutes", "." ]
train
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/task.py#L474-L486
rackerlabs/silverberg
silverberg/marshal.py
prepare
def prepare(query, params): """ For every match of the form ":param_name", call marshal on kwargs['param_name'] and replace that section of the query with the result """ def repl(match): name = match.group(1)[1:] if name in params: return marshal(params[name]) ...
python
def prepare(query, params): """ For every match of the form ":param_name", call marshal on kwargs['param_name'] and replace that section of the query with the result """ def repl(match): name = match.group(1)[1:] if name in params: return marshal(params[name]) ...
[ "def", "prepare", "(", "query", ",", "params", ")", ":", "def", "repl", "(", "match", ")", ":", "name", "=", "match", ".", "group", "(", "1", ")", "[", "1", ":", "]", "if", "name", "in", "params", ":", "return", "marshal", "(", "params", "[", "...
For every match of the form ":param_name", call marshal on kwargs['param_name'] and replace that section of the query with the result
[ "For", "every", "match", "of", "the", "form", ":", "param_name", "call", "marshal", "on", "kwargs", "[", "param_name", "]", "and", "replace", "that", "section", "of", "the", "query", "with", "the", "result" ]
train
https://github.com/rackerlabs/silverberg/blob/c6fae78923a019f1615e9516ab30fa105c72a542/silverberg/marshal.py#L58-L75
aksas/pypo4sel
core/pypo4sel/core/common.py
define_selector
def define_selector(by, value, el_class): """ :param by: :param value: :param el_class: :rtype: tuple[type, str|tuple[str, str]] :return: """ el = el_class selector = by if isinstance(value, six.string_types): selector = (by, value) elif value is not None: el ...
python
def define_selector(by, value, el_class): """ :param by: :param value: :param el_class: :rtype: tuple[type, str|tuple[str, str]] :return: """ el = el_class selector = by if isinstance(value, six.string_types): selector = (by, value) elif value is not None: el ...
[ "def", "define_selector", "(", "by", ",", "value", ",", "el_class", ")", ":", "el", "=", "el_class", "selector", "=", "by", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "selector", "=", "(", "by", ",", "value", ")", "e...
:param by: :param value: :param el_class: :rtype: tuple[type, str|tuple[str, str]] :return:
[ ":", "param", "by", ":", ":", "param", "value", ":", ":", "param", "el_class", ":", ":", "rtype", ":", "tuple", "[", "type", "str|tuple", "[", "str", "str", "]]", ":", "return", ":" ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/common.py#L95-L113
aksas/pypo4sel
core/pypo4sel/core/common.py
build_locator
def build_locator(selector): """ - ID = "#valid_id" - CLASS_NAME = ".valid_class_name" - TAG_NAME = "valid_tag_name" - XPATH = start with "./" or "//" or "$x:" - LINK_TEXT = start with "$link_text:" - PARTIAL_LINK_TEXT = start with "$partial_link_text:" - NAME = "@valid_name_attribute_va...
python
def build_locator(selector): """ - ID = "#valid_id" - CLASS_NAME = ".valid_class_name" - TAG_NAME = "valid_tag_name" - XPATH = start with "./" or "//" or "$x:" - LINK_TEXT = start with "$link_text:" - PARTIAL_LINK_TEXT = start with "$partial_link_text:" - NAME = "@valid_name_attribute_va...
[ "def", "build_locator", "(", "selector", ")", ":", "if", "type", "(", "selector", ")", "is", "tuple", ":", "return", "selector", "if", "not", "isinstance", "(", "selector", ",", "six", ".", "string_types", ")", ":", "raise", "InvalidSelectorException", "(", ...
- ID = "#valid_id" - CLASS_NAME = ".valid_class_name" - TAG_NAME = "valid_tag_name" - XPATH = start with "./" or "//" or "$x:" - LINK_TEXT = start with "$link_text:" - PARTIAL_LINK_TEXT = start with "$partial_link_text:" - NAME = "@valid_name_attribute_value" CSS_SELECTOR = all other that s...
[ "-", "ID", "=", "#valid_id", "-", "CLASS_NAME", "=", ".", "valid_class_name", "-", "TAG_NAME", "=", "valid_tag_name", "-", "XPATH", "=", "start", "with", ".", "/", "or", "//", "or", "$x", ":", "-", "LINK_TEXT", "=", "start", "with", "$link_text", ":", ...
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/common.py#L226-L252
aksas/pypo4sel
core/pypo4sel/core/common.py
PageElementsContainer.all_elements
def all_elements(self): """returns all public BasePageElements grouped by this element and it parent(s) :rtype: list[(str, BasePageElement)] """ return [(k, getattr(self, k)) for k, v in get_members_safety(self.__class__) if not k.startswith("_") and isinstance(v, (BasePa...
python
def all_elements(self): """returns all public BasePageElements grouped by this element and it parent(s) :rtype: list[(str, BasePageElement)] """ return [(k, getattr(self, k)) for k, v in get_members_safety(self.__class__) if not k.startswith("_") and isinstance(v, (BasePa...
[ "def", "all_elements", "(", "self", ")", ":", "return", "[", "(", "k", ",", "getattr", "(", "self", ",", "k", ")", ")", "for", "k", ",", "v", "in", "get_members_safety", "(", "self", ".", "__class__", ")", "if", "not", "k", ".", "startswith", "(", ...
returns all public BasePageElements grouped by this element and it parent(s) :rtype: list[(str, BasePageElement)]
[ "returns", "all", "public", "BasePageElements", "grouped", "by", "this", "element", "and", "it", "parent", "(", "s", ")", ":", "rtype", ":", "list", "[", "(", "str", "BasePageElement", ")", "]" ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/common.py#L35-L40
aksas/pypo4sel
core/pypo4sel/core/common.py
FindOverride.child_element
def child_element(self, by=By.ID, value=None, el_class=None): """ Doesn't rise NoSuchElementException in case if there are no element with the selector. In this case ``exists()`` and ``is_displayed()`` methods of the element will return *False*. Attempt to call any other method supposed ...
python
def child_element(self, by=By.ID, value=None, el_class=None): """ Doesn't rise NoSuchElementException in case if there are no element with the selector. In this case ``exists()`` and ``is_displayed()`` methods of the element will return *False*. Attempt to call any other method supposed ...
[ "def", "child_element", "(", "self", ",", "by", "=", "By", ".", "ID", ",", "value", "=", "None", ",", "el_class", "=", "None", ")", ":", "el", ",", "selector", "=", "define_selector", "(", "by", ",", "value", ",", "el_class", ")", "return", "self", ...
Doesn't rise NoSuchElementException in case if there are no element with the selector. In this case ``exists()`` and ``is_displayed()`` methods of the element will return *False*. Attempt to call any other method supposed to interact with browser will raise NoSuchElementException. usages with `...
[ "Doesn", "t", "rise", "NoSuchElementException", "in", "case", "if", "there", "are", "no", "element", "with", "the", "selector", ".", "In", "this", "case", "exists", "()", "and", "is_displayed", "()", "methods", "of", "the", "element", "will", "return", "*", ...
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/common.py#L117-L141
aksas/pypo4sel
core/pypo4sel/core/common.py
FindOverride.child_elements
def child_elements(self, by=By.ID, value=None, el_class=None): """ alias for ``find_elements`` :param by: :param value: :param el_class: :return: """ el, selector = define_selector(by, value, el_class) return self._init_element(elements.PageElement...
python
def child_elements(self, by=By.ID, value=None, el_class=None): """ alias for ``find_elements`` :param by: :param value: :param el_class: :return: """ el, selector = define_selector(by, value, el_class) return self._init_element(elements.PageElement...
[ "def", "child_elements", "(", "self", ",", "by", "=", "By", ".", "ID", ",", "value", "=", "None", ",", "el_class", "=", "None", ")", ":", "el", ",", "selector", "=", "define_selector", "(", "by", ",", "value", ",", "el_class", ")", "return", "self", ...
alias for ``find_elements`` :param by: :param value: :param el_class: :return:
[ "alias", "for", "find_elements", ":", "param", "by", ":", ":", "param", "value", ":", ":", "param", "el_class", ":", ":", "return", ":" ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/common.py#L143-L152
aksas/pypo4sel
core/pypo4sel/core/common.py
FindOverride.find_element
def find_element(self, by=By.ID, value=None, el_class=None): """ usages with ``'one string'`` selector: - find_element(by: str) -> PageElement - find_element(by: str, value: T <= PageElement) -> T usages with ``'webdriver'`` By selector - find_element(by: str, value: ...
python
def find_element(self, by=By.ID, value=None, el_class=None): """ usages with ``'one string'`` selector: - find_element(by: str) -> PageElement - find_element(by: str, value: T <= PageElement) -> T usages with ``'webdriver'`` By selector - find_element(by: str, value: ...
[ "def", "find_element", "(", "self", ",", "by", "=", "By", ".", "ID", ",", "value", "=", "None", ",", "el_class", "=", "None", ")", ":", "el", "=", "self", ".", "child_element", "(", "by", ",", "value", ",", "el_class", ")", "el", ".", "reload", "...
usages with ``'one string'`` selector: - find_element(by: str) -> PageElement - find_element(by: str, value: T <= PageElement) -> T usages with ``'webdriver'`` By selector - find_element(by: str, value: str) -> PageElement - find_element(by: str, value: str, el_class: T <= P...
[ "usages", "with", "one", "string", "selector", ":", "-", "find_element", "(", "by", ":", "str", ")", "-", ">", "PageElement", "-", "find_element", "(", "by", ":", "str", "value", ":", "T", "<", "=", "PageElement", ")", "-", ">", "T" ]
train
https://github.com/aksas/pypo4sel/blob/935b5f9bfa6682aefdef8a43ebcbcf274dec752c/core/pypo4sel/core/common.py#L154-L175