repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
noahbenson/pimms
pimms/util.py
flatten_maps
def flatten_maps(*args, **kwargs): ''' flatten_maps(*args, **kwags) yields a tuple of the maps in the given arguments; this flattens over lists and iterables so long as all elements eventually yield True to is_map(el). The optional keyword arguments passed make up the final map. This funtion do...
python
def flatten_maps(*args, **kwargs): ''' flatten_maps(*args, **kwags) yields a tuple of the maps in the given arguments; this flattens over lists and iterables so long as all elements eventually yield True to is_map(el). The optional keyword arguments passed make up the final map. This funtion do...
[ "def", "flatten_maps", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "_recur", "(", "arg", ",", "work", ")", ":", "if", "is_map", "(", "arg", ")", ":", "work", ".", "append", "(", "arg", ")", "elif", "is_str", "(", "arg", ")", "or...
flatten_maps(*args, **kwags) yields a tuple of the maps in the given arguments; this flattens over lists and iterables so long as all elements eventually yield True to is_map(el). The optional keyword arguments passed make up the final map. This funtion does not evaluate any values of any of the maps a...
[ "flatten_maps", "(", "*", "args", "**", "kwags", ")", "yields", "a", "tuple", "of", "the", "maps", "in", "the", "given", "arguments", ";", "this", "flattens", "over", "lists", "and", "iterables", "so", "long", "as", "all", "elements", "eventually", "yield"...
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L775-L793
train
This function flattens a list of maps into a single tuple.
noahbenson/pimms
pimms/util.py
collect
def collect(*args, **kwargs): ''' collect(m1, m2, ...) yields a persistent map whose keys are the union of all keys in the given maps m1, m2, etc. and whose values are tuples containing each of the given maps (in provided order) that contain the given key. This function never evaluates the values in...
python
def collect(*args, **kwargs): ''' collect(m1, m2, ...) yields a persistent map whose keys are the union of all keys in the given maps m1, m2, etc. and whose values are tuples containing each of the given maps (in provided order) that contain the given key. This function never evaluates the values in...
[ "def", "collect", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "flatten_maps", "(", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "args", ")", "==", "0", ":", "return", "ps", ".", "m", "(", ")", "m", "=", "{", ...
collect(m1, m2, ...) yields a persistent map whose keys are the union of all keys in the given maps m1, m2, etc. and whose values are tuples containing each of the given maps (in provided order) that contain the given key. This function never evaluates the values in the maps so it implicitly supports ...
[ "collect", "(", "m1", "m2", "...", ")", "yields", "a", "persistent", "map", "whose", "keys", "are", "the", "union", "of", "all", "keys", "in", "the", "given", "maps", "m1", "m2", "etc", ".", "and", "whose", "values", "are", "tuples", "containing", "eac...
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L794-L811
train
Returns a persistent map containing all the given keys in the given order.
noahbenson/pimms
pimms/util.py
merge
def merge(*args, **kwargs): ''' merge(...) lazily collapses all arguments, which must be python Mapping objects of some kind, into a single mapping from left-to-right. The mapping that is returned is a lazy persistent object that does not request the value of a key from any of the maps provided unti...
python
def merge(*args, **kwargs): ''' merge(...) lazily collapses all arguments, which must be python Mapping objects of some kind, into a single mapping from left-to-right. The mapping that is returned is a lazy persistent object that does not request the value of a key from any of the maps provided unti...
[ "def", "merge", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "table", "import", "(", "is_itable", ",", "ITable", ")", "# figure out the choose-fn", "choose_fn", "=", "None", "if", "'choose'", "in", "kwargs", ":", "choose_fn", "=", "k...
merge(...) lazily collapses all arguments, which must be python Mapping objects of some kind, into a single mapping from left-to-right. The mapping that is returned is a lazy persistent object that does not request the value of a key from any of the maps provided until they are requested of it; in thi...
[ "merge", "(", "...", ")", "lazily", "collapses", "all", "arguments", "which", "must", "be", "python", "Mapping", "objects", "of", "some", "kind", "into", "a", "single", "mapping", "from", "left", "-", "to", "-", "right", ".", "The", "mapping", "that", "i...
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L818-L856
train
Merge two or more maps into a single lazy persistent object.
noahbenson/pimms
pimms/util.py
is_persistent
def is_persistent(arg): ''' is_persistent(x) yields True if x is a persistent object and False if not. Note that this persistence can only be checked by the pimms library, so immutable/persistent structures not known to pimms or defined in terms of pimms's immutables library cannot be evaluated cor...
python
def is_persistent(arg): ''' is_persistent(x) yields True if x is a persistent object and False if not. Note that this persistence can only be checked by the pimms library, so immutable/persistent structures not known to pimms or defined in terms of pimms's immutables library cannot be evaluated cor...
[ "def", "is_persistent", "(", "arg", ")", ":", "from", ".", "immutable", "import", "(", "is_imm", ",", "imm_is_persistent", ")", "if", "is_imm", "(", "arg", ")", ":", "return", "imm_is_persistent", "(", "arg", ")", "elif", "isinstance", "(", "arg", ",", "...
is_persistent(x) yields True if x is a persistent object and False if not. Note that this persistence can only be checked by the pimms library, so immutable/persistent structures not known to pimms or defined in terms of pimms's immutables library cannot be evaluated correctly. Additionally, is_persis...
[ "is_persistent", "(", "x", ")", "yields", "True", "if", "x", "is", "a", "persistent", "object", "and", "False", "if", "not", "." ]
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L884-L905
train
Returns True if the argument is a persistent object and False otherwise.
noahbenson/pimms
pimms/util.py
persist
def persist(arg, depth=Ellipsis, on_mutable=None): ''' persist(x) yields a persistent version of x if possible, or yields x itself. The transformations performed by persist(x) are as follows: * If x is an immutable object, yields x.persist() * If x is a set, yield a frozenset of of persist(u) f...
python
def persist(arg, depth=Ellipsis, on_mutable=None): ''' persist(x) yields a persistent version of x if possible, or yields x itself. The transformations performed by persist(x) are as follows: * If x is an immutable object, yields x.persist() * If x is a set, yield a frozenset of of persist(u) f...
[ "def", "persist", "(", "arg", ",", "depth", "=", "Ellipsis", ",", "on_mutable", "=", "None", ")", ":", "from", ".", "immutable", "import", "(", "is_imm", ",", "imm_copy", ")", "# Parse the on_mutable argument", "if", "on_mutable", "is", "None", ":", "on_muta...
persist(x) yields a persistent version of x if possible, or yields x itself. The transformations performed by persist(x) are as follows: * If x is an immutable object, yields x.persist() * If x is a set, yield a frozenset of of persist(u) for all u in x. * If x is a numpy array, yield imm_array(x...
[ "persist", "(", "x", ")", "yields", "a", "persistent", "version", "of", "x", "if", "possible", "or", "yields", "x", "itself", "." ]
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L906-L1003
train
Returns a persistent version of the given argument.
noahbenson/pimms
pimms/util.py
dissoc
def dissoc(m, *args, **kw): ''' dissoc(m, k1, k2...) yields a map equivalent to m without the arguments k1, k2, etc. If m is a mutable pythin dictionary, this is equivalent to using del m[k] for k in [k1, k2...] then returning m itself. If m is a persistent map, this is equivalent to calling m = m.d...
python
def dissoc(m, *args, **kw): ''' dissoc(m, k1, k2...) yields a map equivalent to m without the arguments k1, k2, etc. If m is a mutable pythin dictionary, this is equivalent to using del m[k] for k in [k1, k2...] then returning m itself. If m is a persistent map, this is equivalent to calling m = m.d...
[ "def", "dissoc", "(", "m", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "len", "(", "kw", ")", "==", "0", ":", "err", "=", "False", "elif", "len", "(", "kw", ")", "==", "1", ":", "err", "=", "kw", "[", "'error'", "]", "else", ":...
dissoc(m, k1, k2...) yields a map equivalent to m without the arguments k1, k2, etc. If m is a mutable pythin dictionary, this is equivalent to using del m[k] for k in [k1, k2...] then returning m itself. If m is a persistent map, this is equivalent to calling m = m.discard(k) for all the keys then re...
[ "dissoc", "(", "m", "k1", "k2", "...", ")", "yields", "a", "map", "equivalent", "to", "m", "without", "the", "arguments", "k1", "k2", "etc", ".", "If", "m", "is", "a", "mutable", "pythin", "dictionary", "this", "is", "equivalent", "to", "using", "del",...
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L1004-L1059
train
Returns a mutable pythin dictionary with the arguments k1 k2... etc.
noahbenson/pimms
pimms/util.py
assoc
def assoc(m, *args, **kw): ''' assoc(m, k1, v1, k2, v2...) yields a map equivalent to m without the arguments k1, k2, etc. associated with the values v1, v2, etc. If m is a mutable python dictionary, this is equivalent to using m[k] = v for all the given key-value pairs then returning m itself. If m...
python
def assoc(m, *args, **kw): ''' assoc(m, k1, v1, k2, v2...) yields a map equivalent to m without the arguments k1, k2, etc. associated with the values v1, v2, etc. If m is a mutable python dictionary, this is equivalent to using m[k] = v for all the given key-value pairs then returning m itself. If m...
[ "def", "assoc", "(", "m", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "len", "(", "args", ")", "%", "2", "!=", "0", ":", "raise", "ValueError", "(", "'assoc arguments must be given as key-value pairs'", ")", "args", "=", "(", "u", "for", "...
assoc(m, k1, v1, k2, v2...) yields a map equivalent to m without the arguments k1, k2, etc. associated with the values v1, v2, etc. If m is a mutable python dictionary, this is equivalent to using m[k] = v for all the given key-value pairs then returning m itself. If m is a persistent map, this is equ...
[ "assoc", "(", "m", "k1", "v1", "k2", "v2", "...", ")", "yields", "a", "map", "equivalent", "to", "m", "without", "the", "arguments", "k1", "k2", "etc", ".", "associated", "with", "the", "values", "v1", "v2", "etc", ".", "If", "m", "is", "a", "mutab...
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L1060-L1105
train
assoc returns a mutable python dictionary with the given arguments k1 v1 k2 v2 etc.
noahbenson/pimms
pimms/util.py
LazyPMap._examine_val
def _examine_val(self, k, val): 'should only be called internally' if not isinstance(val, (types.FunctionType, partial)): return val vid = id(val) if vid in self._memoized: return self._memoized[vid] elif [] != getargspec_py27like(val)[0]: return val ...
python
def _examine_val(self, k, val): 'should only be called internally' if not isinstance(val, (types.FunctionType, partial)): return val vid = id(val) if vid in self._memoized: return self._memoized[vid] elif [] != getargspec_py27like(val)[0]: return val ...
[ "def", "_examine_val", "(", "self", ",", "k", ",", "val", ")", ":", "if", "not", "isinstance", "(", "val", ",", "(", "types", ".", "FunctionType", ",", "partial", ")", ")", ":", "return", "val", "vid", "=", "id", "(", "val", ")", "if", "vid", "in...
should only be called internally
[ "should", "only", "be", "called", "internally" ]
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L582-L593
train
should only be called internally
noahbenson/pimms
pimms/util.py
LazyPMap.is_lazy
def is_lazy(self, k): ''' lmap.is_lazy(k) yields True if the given k is lazy and unmemoized in the given lazy map, lmap, otherwise False. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)) or \ id(v) in self._memoized or \ ...
python
def is_lazy(self, k): ''' lmap.is_lazy(k) yields True if the given k is lazy and unmemoized in the given lazy map, lmap, otherwise False. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)) or \ id(v) in self._memoized or \ ...
[ "def", "is_lazy", "(", "self", ",", "k", ")", ":", "v", "=", "ps", ".", "PMap", ".", "__getitem__", "(", "self", ",", "k", ")", "if", "not", "isinstance", "(", "v", ",", "(", "types", ".", "FunctionType", ",", "partial", ")", ")", "or", "id", "...
lmap.is_lazy(k) yields True if the given k is lazy and unmemoized in the given lazy map, lmap, otherwise False.
[ "lmap", ".", "is_lazy", "(", "k", ")", "yields", "True", "if", "the", "given", "k", "is", "lazy", "and", "unmemoized", "in", "the", "given", "lazy", "map", "lmap", "otherwise", "False", "." ]
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L652-L663
train
Returns True if the given key is lazy and unmemoized in the given lazy map otherwise False.
noahbenson/pimms
pimms/util.py
LazyPMap.is_memoized
def is_memoized(self, k): ''' lmap.is_memoized(k) yields True if k is a key in the given lazy map lmap that is both lazy and already memoized. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)): return False else: ...
python
def is_memoized(self, k): ''' lmap.is_memoized(k) yields True if k is a key in the given lazy map lmap that is both lazy and already memoized. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)): return False else: ...
[ "def", "is_memoized", "(", "self", ",", "k", ")", ":", "v", "=", "ps", ".", "PMap", ".", "__getitem__", "(", "self", ",", "k", ")", "if", "not", "isinstance", "(", "v", ",", "(", "types", ".", "FunctionType", ",", "partial", ")", ")", ":", "retur...
lmap.is_memoized(k) yields True if k is a key in the given lazy map lmap that is both lazy and already memoized.
[ "lmap", ".", "is_memoized", "(", "k", ")", "yields", "True", "if", "k", "is", "a", "key", "in", "the", "given", "lazy", "map", "lmap", "that", "is", "both", "lazy", "and", "already", "memoized", "." ]
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L664-L673
train
Returns True if k is a key in the given lazy map lmap that is already memoized.
noahbenson/pimms
pimms/util.py
LazyPMap.is_normal
def is_normal(self, k): ''' lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy nor a formerly-lazy memoized key. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)) or [] != getargspec_py27like(...
python
def is_normal(self, k): ''' lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy nor a formerly-lazy memoized key. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)) or [] != getargspec_py27like(...
[ "def", "is_normal", "(", "self", ",", "k", ")", ":", "v", "=", "ps", ".", "PMap", ".", "__getitem__", "(", "self", ",", "k", ")", "if", "not", "isinstance", "(", "v", ",", "(", "types", ".", "FunctionType", ",", "partial", ")", ")", "or", "[", ...
lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy nor a formerly-lazy memoized key.
[ "lmap", ".", "is_normal", "(", "k", ")", "yields", "True", "if", "k", "is", "a", "key", "in", "the", "given", "lazy", "map", "lmap", "that", "is", "neither", "lazy", "nor", "a", "formerly", "-", "lazy", "memoized", "key", "." ]
9051b86d6b858a7a13511b72c48dc21bc903dab2
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L674-L683
train
is_normal yields True if k is a key in the given lazy map lmap that is not a formerly - lazy memoized key.
praekeltfoundation/seed-message-sender
message_sender/signals.py
psh_fire_msg_action_if_new
def psh_fire_msg_action_if_new(sender, instance, created, **kwargs): """ Post save hook to fire message send task """ if created: from message_sender.tasks import send_message send_message.apply_async(kwargs={"message_id": str(instance.id)})
python
def psh_fire_msg_action_if_new(sender, instance, created, **kwargs): """ Post save hook to fire message send task """ if created: from message_sender.tasks import send_message send_message.apply_async(kwargs={"message_id": str(instance.id)})
[ "def", "psh_fire_msg_action_if_new", "(", "sender", ",", "instance", ",", "created", ",", "*", "*", "kwargs", ")", ":", "if", "created", ":", "from", "message_sender", ".", "tasks", "import", "send_message", "send_message", ".", "apply_async", "(", "kwargs", "...
Post save hook to fire message send task
[ "Post", "save", "hook", "to", "fire", "message", "send", "task" ]
257b01635171b9dbe1f5f13baa810c971bb2620e
https://github.com/praekeltfoundation/seed-message-sender/blob/257b01635171b9dbe1f5f13baa810c971bb2620e/message_sender/signals.py#L4-L10
train
Post save hook to fire message send task
praekeltfoundation/seed-message-sender
message_sender/signals.py
update_default_channels
def update_default_channels(sender, instance, created, **kwargs): """ Post save hook to ensure that there is only one default """ if instance.default: Channel.objects.filter(default=True).exclude( channel_id=instance.channel_id ).update(default=False)
python
def update_default_channels(sender, instance, created, **kwargs): """ Post save hook to ensure that there is only one default """ if instance.default: Channel.objects.filter(default=True).exclude( channel_id=instance.channel_id ).update(default=False)
[ "def", "update_default_channels", "(", "sender", ",", "instance", ",", "created", ",", "*", "*", "kwargs", ")", ":", "if", "instance", ".", "default", ":", "Channel", ".", "objects", ".", "filter", "(", "default", "=", "True", ")", ".", "exclude", "(", ...
Post save hook to ensure that there is only one default
[ "Post", "save", "hook", "to", "ensure", "that", "there", "is", "only", "one", "default" ]
257b01635171b9dbe1f5f13baa810c971bb2620e
https://github.com/praekeltfoundation/seed-message-sender/blob/257b01635171b9dbe1f5f13baa810c971bb2620e/message_sender/signals.py#L13-L19
train
Post save hook to ensure that there is only one default channel
saxix/drf-api-checker
src/drf_api_checker/fs.py
mktree
def mktree(newdir): """works the way a good mkdir should :) - already exists, silently complete - regular file in the way, raise an exception - parent directory(ies) does not exist, make them as well """ if os.path.isdir(newdir): pass elif os.path.isfile(newdir): ...
python
def mktree(newdir): """works the way a good mkdir should :) - already exists, silently complete - regular file in the way, raise an exception - parent directory(ies) does not exist, make them as well """ if os.path.isdir(newdir): pass elif os.path.isfile(newdir): ...
[ "def", "mktree", "(", "newdir", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "newdir", ")", ":", "pass", "elif", "os", ".", "path", ".", "isfile", "(", "newdir", ")", ":", "raise", "OSError", "(", "\"a file with the same name as the desired \"", ...
works the way a good mkdir should :) - already exists, silently complete - regular file in the way, raise an exception - parent directory(ies) does not exist, make them as well
[ "works", "the", "way", "a", "good", "mkdir", "should", ":", ")", "-", "already", "exists", "silently", "complete", "-", "regular", "file", "in", "the", "way", "raise", "an", "exception", "-", "parent", "directory", "(", "ies", ")", "does", "not", "exist"...
c84e598f3a95b5b63cf758dcaced89c02b53d772
https://github.com/saxix/drf-api-checker/blob/c84e598f3a95b5b63cf758dcaced89c02b53d772/src/drf_api_checker/fs.py#L5-L17
train
Make a tree of the tree of files.
DeV1doR/aioethereum
aioethereum/management/shh.py
ShhMixin.shh_post
def shh_post(self, from_=None, to=None, *, topics, payload, priority, ttl): """https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post """ # FIXME: Not working obj = { 'from': from_, 'to': to, 'topics': topics, 'payload': payload, ...
python
def shh_post(self, from_=None, to=None, *, topics, payload, priority, ttl): """https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post """ # FIXME: Not working obj = { 'from': from_, 'to': to, 'topics': topics, 'payload': payload, ...
[ "def", "shh_post", "(", "self", ",", "from_", "=", "None", ",", "to", "=", "None", ",", "*", ",", "topics", ",", "payload", ",", "priority", ",", "ttl", ")", ":", "# FIXME: Not working", "obj", "=", "{", "'from'", ":", "from_", ",", "'to'", ":", "t...
https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#shh_post" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/shh.py#L16-L28
train
Send a message to the set of topics and payload.
DeV1doR/aioethereum
aioethereum/management/shh.py
ShhMixin.shh_newFilter
def shh_newFilter(self, to=None, *, topics): """https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter DEPRECATED """ obj = { 'to': to, 'topics': topics, } warnings.warn('deprecated', DeprecationWarning) return (yield from self.rpc_c...
python
def shh_newFilter(self, to=None, *, topics): """https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter DEPRECATED """ obj = { 'to': to, 'topics': topics, } warnings.warn('deprecated', DeprecationWarning) return (yield from self.rpc_c...
[ "def", "shh_newFilter", "(", "self", ",", "to", "=", "None", ",", "*", ",", "topics", ")", ":", "obj", "=", "{", "'to'", ":", "to", ",", "'topics'", ":", "topics", ",", "}", "warnings", ".", "warn", "(", "'deprecated'", ",", "DeprecationWarning", ")"...
https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter DEPRECATED
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#shh_newfilter" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/shh.py#L68-L78
train
This is deprecated and will be removed in favor of the old filter.
romanorac/discomll
discomll/classification/linear_svm.py
map_fit
def map_fit(interface, state, label, inp): """ Function calculates matrices ete and etde for every sample, aggregates and output them. """ import numpy as np ete, etde = 0, 0 out = interface.output(0) for row in inp: row = row.strip().split(state["delimiter"]) # split row i...
python
def map_fit(interface, state, label, inp): """ Function calculates matrices ete and etde for every sample, aggregates and output them. """ import numpy as np ete, etde = 0, 0 out = interface.output(0) for row in inp: row = row.strip().split(state["delimiter"]) # split row i...
[ "def", "map_fit", "(", "interface", ",", "state", ",", "label", ",", "inp", ")", ":", "import", "numpy", "as", "np", "ete", ",", "etde", "=", "0", ",", "0", "out", "=", "interface", ".", "output", "(", "0", ")", "for", "row", "in", "inp", ":", ...
Function calculates matrices ete and etde for every sample, aggregates and output them.
[ "Function", "calculates", "matrices", "ete", "and", "etde", "for", "every", "sample", "aggregates", "and", "output", "them", "." ]
a4703daffb2ba3c9f614bc3dbe45ae55884aea00
https://github.com/romanorac/discomll/blob/a4703daffb2ba3c9f614bc3dbe45ae55884aea00/discomll/classification/linear_svm.py#L15-L36
train
Function calculates matrices ete etde for every sample aggregates and outputs them.
romanorac/discomll
discomll/classification/linear_svm.py
reduce_fit
def reduce_fit(interface, state, label, inp): """ Function joins all partially calculated matrices ETE and ETDe, aggregates them and it calculates final parameters. """ import numpy as np out = interface.output(0) sum_etde = 0 sum_ete = [0 for _ in range(len(state["X_indices"]) + 1)] fo...
python
def reduce_fit(interface, state, label, inp): """ Function joins all partially calculated matrices ETE and ETDe, aggregates them and it calculates final parameters. """ import numpy as np out = interface.output(0) sum_etde = 0 sum_ete = [0 for _ in range(len(state["X_indices"]) + 1)] fo...
[ "def", "reduce_fit", "(", "interface", ",", "state", ",", "label", ",", "inp", ")", ":", "import", "numpy", "as", "np", "out", "=", "interface", ".", "output", "(", "0", ")", "sum_etde", "=", "0", "sum_ete", "=", "[", "0", "for", "_", "in", "range"...
Function joins all partially calculated matrices ETE and ETDe, aggregates them and it calculates final parameters.
[ "Function", "joins", "all", "partially", "calculated", "matrices", "ETE", "and", "ETDe", "aggregates", "them", "and", "it", "calculates", "final", "parameters", "." ]
a4703daffb2ba3c9f614bc3dbe45ae55884aea00
https://github.com/romanorac/discomll/blob/a4703daffb2ba3c9f614bc3dbe45ae55884aea00/discomll/classification/linear_svm.py#L39-L55
train
Function joins all partially calculated matrices ETE and ETDe aggregates them and calculates final parameters.
romanorac/discomll
discomll/classification/linear_svm.py
fit
def fit(dataset, nu=0.1, save_results=True, show=False): """ Function starts a job for calculation of model parameters Parameters ---------- input - dataset object with input urls and other parameters nu - parameter to adjust the classifier save_results - save results to ddfs show - sho...
python
def fit(dataset, nu=0.1, save_results=True, show=False): """ Function starts a job for calculation of model parameters Parameters ---------- input - dataset object with input urls and other parameters nu - parameter to adjust the classifier save_results - save results to ddfs show - sho...
[ "def", "fit", "(", "dataset", ",", "nu", "=", "0.1", ",", "save_results", "=", "True", ",", "show", "=", "False", ")", ":", "from", "disco", ".", "worker", ".", "pipeline", ".", "worker", "import", "Worker", ",", "Stage", "from", "disco", ".", "core"...
Function starts a job for calculation of model parameters Parameters ---------- input - dataset object with input urls and other parameters nu - parameter to adjust the classifier save_results - save results to ddfs show - show info about job execution Returns ------- Urls of fit m...
[ "Function", "starts", "a", "job", "for", "calculation", "of", "model", "parameters" ]
a4703daffb2ba3c9f614bc3dbe45ae55884aea00
https://github.com/romanorac/discomll/blob/a4703daffb2ba3c9f614bc3dbe45ae55884aea00/discomll/classification/linear_svm.py#L77-L115
train
Function starts a job for calculation of model parameters on the classifier and returns the url of the fit model on the classifier
romanorac/discomll
discomll/classification/linear_svm.py
predict
def predict(dataset, fitmodel_url, save_results=True, show=False): """ Function starts a job that makes predictions to input data with a given model. Parameters ---------- input - dataset object with input urls and other parameters fitmodel_url - model created in fit phase save_results - sa...
python
def predict(dataset, fitmodel_url, save_results=True, show=False): """ Function starts a job that makes predictions to input data with a given model. Parameters ---------- input - dataset object with input urls and other parameters fitmodel_url - model created in fit phase save_results - sa...
[ "def", "predict", "(", "dataset", ",", "fitmodel_url", ",", "save_results", "=", "True", ",", "show", "=", "False", ")", ":", "from", "disco", ".", "worker", ".", "pipeline", ".", "worker", "import", "Worker", ",", "Stage", "from", "disco", ".", "core", ...
Function starts a job that makes predictions to input data with a given model. Parameters ---------- input - dataset object with input urls and other parameters fitmodel_url - model created in fit phase save_results - save results to ddfs show - show info about job execution Returns --...
[ "Function", "starts", "a", "job", "that", "makes", "predictions", "to", "input", "data", "with", "a", "given", "model", "." ]
a4703daffb2ba3c9f614bc3dbe45ae55884aea00
https://github.com/romanorac/discomll/blob/a4703daffb2ba3c9f614bc3dbe45ae55884aea00/discomll/classification/linear_svm.py#L118-L148
train
Function starts a job that makes predictions to input data with a given model.
djaodjin/djaodjin-deployutils
deployutils/filesys.py
fingerprint
def fingerprint(dirnames, prefix=None, previous=[]): #pylint:disable=dangerous-default-value """ Returns a list of paths available from *dirname*. When previous is specified, returns a list of additional files only. Example: [{ "Key": "abc.txt", "LastModified": "Mon, 05 Jan 2015 12:00:00...
python
def fingerprint(dirnames, prefix=None, previous=[]): #pylint:disable=dangerous-default-value """ Returns a list of paths available from *dirname*. When previous is specified, returns a list of additional files only. Example: [{ "Key": "abc.txt", "LastModified": "Mon, 05 Jan 2015 12:00:00...
[ "def", "fingerprint", "(", "dirnames", ",", "prefix", "=", "None", ",", "previous", "=", "[", "]", ")", ":", "#pylint:disable=dangerous-default-value", "results", "=", "[", "]", "for", "dirname", "in", "dirnames", ":", "for", "filename", "in", "os", ".", "...
Returns a list of paths available from *dirname*. When previous is specified, returns a list of additional files only. Example: [{ "Key": "abc.txt", "LastModified": "Mon, 05 Jan 2015 12:00:00 UTC"}, { "Key": "def.txt", "LastModified": "Mon, 05 Jan 2015 12:00:001 UTC"}, ]
[ "Returns", "a", "list", "of", "paths", "available", "from", "*", "dirname", "*", ".", "When", "previous", "is", "specified", "returns", "a", "list", "of", "additional", "files", "only", "." ]
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
https://github.com/djaodjin/djaodjin-deployutils/blob/a0fe3cf3030dbbf09025c69ce75a69b326565dd8/deployutils/filesys.py#L30-L65
train
Returns a list of paths available from a directory.
djaodjin/djaodjin-deployutils
deployutils/filesys.py
list_local
def list_local(paths, prefix=None): """ Returns a list of all files (recursively) present in a directory with their timestamp. Example: [{ "Key": "abc.txt", "LastModified": "Mon, 05 Jan 2015 12:00:00 UTC"}, { "Key": "def.txt", "LastModified": "Mon, 05 Jan 2015 12:00:001 UTC"}, ...
python
def list_local(paths, prefix=None): """ Returns a list of all files (recursively) present in a directory with their timestamp. Example: [{ "Key": "abc.txt", "LastModified": "Mon, 05 Jan 2015 12:00:00 UTC"}, { "Key": "def.txt", "LastModified": "Mon, 05 Jan 2015 12:00:001 UTC"}, ...
[ "def", "list_local", "(", "paths", ",", "prefix", "=", "None", ")", ":", "results", "=", "[", "]", "for", "path", "in", "paths", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "for", "filename", "in", "os", ".", "listdir", "("...
Returns a list of all files (recursively) present in a directory with their timestamp. Example: [{ "Key": "abc.txt", "LastModified": "Mon, 05 Jan 2015 12:00:00 UTC"}, { "Key": "def.txt", "LastModified": "Mon, 05 Jan 2015 12:00:001 UTC"}, ]
[ "Returns", "a", "list", "of", "all", "files", "(", "recursively", ")", "present", "in", "a", "directory", "with", "their", "timestamp", "." ]
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
https://github.com/djaodjin/djaodjin-deployutils/blob/a0fe3cf3030dbbf09025c69ce75a69b326565dd8/deployutils/filesys.py#L68-L106
train
Returns a list of all files present in a directory and with their timestamp.
djaodjin/djaodjin-deployutils
deployutils/apps/django/mockup/views.py
RedirectFormMixin.validate_redirect_url
def validate_redirect_url(next_url): """ Returns the next_url path if next_url matches allowed hosts. """ if not next_url: return None parts = urlparse(next_url) if parts.netloc: domain, _ = split_domain_port(parts.netloc) allowed_hosts...
python
def validate_redirect_url(next_url): """ Returns the next_url path if next_url matches allowed hosts. """ if not next_url: return None parts = urlparse(next_url) if parts.netloc: domain, _ = split_domain_port(parts.netloc) allowed_hosts...
[ "def", "validate_redirect_url", "(", "next_url", ")", ":", "if", "not", "next_url", ":", "return", "None", "parts", "=", "urlparse", "(", "next_url", ")", "if", "parts", ".", "netloc", ":", "domain", ",", "_", "=", "split_domain_port", "(", "parts", ".", ...
Returns the next_url path if next_url matches allowed hosts.
[ "Returns", "the", "next_url", "path", "if", "next_url", "matches", "allowed", "hosts", "." ]
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
https://github.com/djaodjin/djaodjin-deployutils/blob/a0fe3cf3030dbbf09025c69ce75a69b326565dd8/deployutils/apps/django/mockup/views.py#L51-L65
train
Validate the next_url against the allowed hosts.
bitlabstudio/django-currency-history
currency_history/templatetags/currency_history_tags.py
convert_currency
def convert_currency(amount, from_currency, to_currency): ''' Converts currencies. Example: {% convert_currency 2 'EUR' 'SGD' as amount %} ''' try: rate = CurrencyRate.objects.get( from_currency__iso_code=from_currency, to_currency__iso_code=to_currency) exc...
python
def convert_currency(amount, from_currency, to_currency): ''' Converts currencies. Example: {% convert_currency 2 'EUR' 'SGD' as amount %} ''' try: rate = CurrencyRate.objects.get( from_currency__iso_code=from_currency, to_currency__iso_code=to_currency) exc...
[ "def", "convert_currency", "(", "amount", ",", "from_currency", ",", "to_currency", ")", ":", "try", ":", "rate", "=", "CurrencyRate", ".", "objects", ".", "get", "(", "from_currency__iso_code", "=", "from_currency", ",", "to_currency__iso_code", "=", "to_currency...
Converts currencies. Example: {% convert_currency 2 'EUR' 'SGD' as amount %}
[ "Converts", "currencies", "." ]
65fd0fd79c925cd2e87db59762a4ee7066e47c9f
https://github.com/bitlabstudio/django-currency-history/blob/65fd0fd79c925cd2e87db59762a4ee7066e47c9f/currency_history/templatetags/currency_history_tags.py#L11-L29
train
Converts amount from one currency to another.
DeV1doR/aioethereum
aioethereum/management/web3.py
Web3Mixin.web3_sha3
def web3_sha3(self, data): """https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3 :param data: Data for hashing :type data: str :return: Keccak-256 :rtype: str """ data = add_0x(binascii.hexlify(str(data).encode('utf-8'))) return (yield from self.rp...
python
def web3_sha3(self, data): """https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3 :param data: Data for hashing :type data: str :return: Keccak-256 :rtype: str """ data = add_0x(binascii.hexlify(str(data).encode('utf-8'))) return (yield from self.rp...
[ "def", "web3_sha3", "(", "self", ",", "data", ")", ":", "data", "=", "add_0x", "(", "binascii", ".", "hexlify", "(", "str", "(", "data", ")", ".", "encode", "(", "'utf-8'", ")", ")", ")", "return", "(", "yield", "from", "self", ".", "rpc_call", "("...
https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3 :param data: Data for hashing :type data: str :return: Keccak-256 :rtype: str
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#web3_sha3" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/web3.py#L19-L29
train
This is a web3_sha3 method.
mkoura/dump2polarion
dump2polarion/csv_unicode.py
get_csv_reader
def get_csv_reader(csvfile, dialect=csv.excel, encoding="utf-8", **kwds): """Returns csv reader.""" try: # pylint: disable=pointless-statement unicode return UnicodeReader(csvfile, dialect=dialect, encoding=encoding, **kwds) except NameError: return csv.reader(csvfile, dialec...
python
def get_csv_reader(csvfile, dialect=csv.excel, encoding="utf-8", **kwds): """Returns csv reader.""" try: # pylint: disable=pointless-statement unicode return UnicodeReader(csvfile, dialect=dialect, encoding=encoding, **kwds) except NameError: return csv.reader(csvfile, dialec...
[ "def", "get_csv_reader", "(", "csvfile", ",", "dialect", "=", "csv", ".", "excel", ",", "encoding", "=", "\"utf-8\"", ",", "*", "*", "kwds", ")", ":", "try", ":", "# pylint: disable=pointless-statement", "unicode", "return", "UnicodeReader", "(", "csvfile", ",...
Returns csv reader.
[ "Returns", "csv", "reader", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/csv_unicode.py#L8-L15
train
Returns csv reader.
mkoura/dump2polarion
dump2polarion/csv_unicode.py
UnicodeReader.next
def next(self): """Returns the next row of the reader’s iterable object.""" row = self.reader.next() return [s.decode("utf-8") for s in row]
python
def next(self): """Returns the next row of the reader’s iterable object.""" row = self.reader.next() return [s.decode("utf-8") for s in row]
[ "def", "next", "(", "self", ")", ":", "row", "=", "self", ".", "reader", ".", "next", "(", ")", "return", "[", "s", ".", "decode", "(", "\"utf-8\"", ")", "for", "s", "in", "row", "]" ]
Returns the next row of the reader’s iterable object.
[ "Returns", "the", "next", "row", "of", "the", "reader’s", "iterable", "object", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/csv_unicode.py#L43-L46
train
Returns the next row of the reader s iterable object.
djaodjin/djaodjin-deployutils
deployutils/apps/django/urlbuilders.py
url_prefixed
def url_prefixed(regex, view, name=None): """ Returns a urlpattern prefixed with the APP_NAME in debug mode. """ return url(r'^%(app_prefix)s%(regex)s' % { 'app_prefix': APP_PREFIX, 'regex': regex}, view, name=name)
python
def url_prefixed(regex, view, name=None): """ Returns a urlpattern prefixed with the APP_NAME in debug mode. """ return url(r'^%(app_prefix)s%(regex)s' % { 'app_prefix': APP_PREFIX, 'regex': regex}, view, name=name)
[ "def", "url_prefixed", "(", "regex", ",", "view", ",", "name", "=", "None", ")", ":", "return", "url", "(", "r'^%(app_prefix)s%(regex)s'", "%", "{", "'app_prefix'", ":", "APP_PREFIX", ",", "'regex'", ":", "regex", "}", ",", "view", ",", "name", "=", "nam...
Returns a urlpattern prefixed with the APP_NAME in debug mode.
[ "Returns", "a", "urlpattern", "prefixed", "with", "the", "APP_NAME", "in", "debug", "mode", "." ]
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
https://github.com/djaodjin/djaodjin-deployutils/blob/a0fe3cf3030dbbf09025c69ce75a69b326565dd8/deployutils/apps/django/urlbuilders.py#L37-L42
train
Returns a urlpattern prefixed with the APP_NAME in debug mode.
tek/myo
myo/output/parser/base.py
simple_parse_process
def simple_parse_process( parser: Parser[A, B], node: str, output: List[str], result: List[OutputEvent[A, B]], current: List[OutputLine[A]], ) -> List[OutputEvent[A, B]]: ''' Parse a list of output lines. The algorithm starts at the graph node 'start' 1. detach th...
python
def simple_parse_process( parser: Parser[A, B], node: str, output: List[str], result: List[OutputEvent[A, B]], current: List[OutputLine[A]], ) -> List[OutputEvent[A, B]]: ''' Parse a list of output lines. The algorithm starts at the graph node 'start' 1. detach th...
[ "def", "simple_parse_process", "(", "parser", ":", "Parser", "[", "A", ",", "B", "]", ",", "node", ":", "str", ",", "output", ":", "List", "[", "str", "]", ",", "result", ":", "List", "[", "OutputEvent", "[", "A", ",", "B", "]", "]", ",", "curren...
Parse a list of output lines. The algorithm starts at the graph node 'start' 1. detach the first output line into *line* and *rest* and call *parse_line* 2. find an edge that matches to current line a) if a match was found 3. construct an *OutputLine* 4. set the current node to t...
[ "Parse", "a", "list", "of", "output", "lines", ".", "The", "algorithm", "starts", "at", "the", "graph", "node", "start", "1", ".", "detach", "the", "first", "output", "line", "into", "*", "line", "*", "and", "*", "rest", "*", "and", "call", "*", "par...
3772a00a021cbf4efb55786e26881767d854afe8
https://github.com/tek/myo/blob/3772a00a021cbf4efb55786e26881767d854afe8/myo/output/parser/base.py#L84-L127
train
Parse a list of output lines and return a list of events.
oemof/oemof.db
oemof/db/tools.py
get_polygon_from_nuts
def get_polygon_from_nuts(conn, nuts): r"""A one-line summary that does not use variable names or the function name. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : array_like Array_like means all th...
python
def get_polygon_from_nuts(conn, nuts): r"""A one-line summary that does not use variable names or the function name. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : array_like Array_like means all th...
[ "def", "get_polygon_from_nuts", "(", "conn", ",", "nuts", ")", ":", "# TODO@Günni", "if", "isinstance", "(", "nuts", ",", "str", ")", ":", "nuts", "=", "[", "nuts", ",", "'xyz'", "]", "logging", ".", "debug", "(", "'Getting polygon from DB'", ")", "sql", ...
r"""A one-line summary that does not use variable names or the function name. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : array_like Array_like means all those objects -- lists, nested lists, etc. --...
[ "r", "A", "one", "-", "line", "summary", "that", "does", "not", "use", "variable", "names", "or", "the", "function", "name", "." ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L40-L133
train
r Returns a polygon that can be used to create a new nuts object.
oemof/oemof.db
oemof/db/tools.py
get_polygon_from_postgis
def get_polygon_from_postgis(conn, schema, table, gcol='geom', union=False): r"""A one-line summary that does not use variable names or the function name. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : arra...
python
def get_polygon_from_postgis(conn, schema, table, gcol='geom', union=False): r"""A one-line summary that does not use variable names or the function name. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : arra...
[ "def", "get_polygon_from_postgis", "(", "conn", ",", "schema", ",", "table", ",", "gcol", "=", "'geom'", ",", "union", "=", "False", ")", ":", "# TODO@Günni", "logging", ".", "debug", "(", "'Getting polygon from DB table'", ")", "if", "union", ":", "geo_string...
r"""A one-line summary that does not use variable names or the function name. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : array_like Array_like means all those objects -- lists, nested lists, etc. --...
[ "r", "A", "one", "-", "line", "summary", "that", "does", "not", "use", "variable", "names", "or", "the", "function", "name", "." ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L136-L231
train
r Returns a polygon that can be used in a postgis table.
oemof/oemof.db
oemof/db/tools.py
tz_from_geom
def tz_from_geom(connection, geometry): r"""Finding the timezone of a given point or polygon geometry, assuming that the polygon is not crossing a border of a timezone. For a given point or polygon geometry not located within the timezone dataset (e.g. sea) the nearest timezone based on the bounding box...
python
def tz_from_geom(connection, geometry): r"""Finding the timezone of a given point or polygon geometry, assuming that the polygon is not crossing a border of a timezone. For a given point or polygon geometry not located within the timezone dataset (e.g. sea) the nearest timezone based on the bounding box...
[ "def", "tz_from_geom", "(", "connection", ",", "geometry", ")", ":", "# TODO@Günni", "if", "geometry", ".", "geom_type", "in", "[", "'Polygon'", ",", "'MultiPolygon'", "]", ":", "coords", "=", "geometry", ".", "centroid", "else", ":", "coords", "=", "geometr...
r"""Finding the timezone of a given point or polygon geometry, assuming that the polygon is not crossing a border of a timezone. For a given point or polygon geometry not located within the timezone dataset (e.g. sea) the nearest timezone based on the bounding boxes of the geometries is returned. Param...
[ "r", "Finding", "the", "timezone", "of", "a", "given", "point", "or", "polygon", "geometry", "assuming", "that", "the", "polygon", "is", "not", "crossing", "a", "border", "of", "a", "timezone", ".", "For", "a", "given", "point", "or", "polygon", "geometry"...
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L234-L272
train
r Returns the timezone of a given point or polygon geometry assuming that the polygon is crossing a border of a timezone.
oemof/oemof.db
oemof/db/tools.py
get_windzone
def get_windzone(conn, geometry): 'Find windzone from map.' # TODO@Günni if geometry.geom_type in ['Polygon', 'MultiPolygon']: coords = geometry.centroid else: coords = geometry sql = """ SELECT zone FROM oemof_test.windzones WHERE st_contains(geom, ST_PointFromText('...
python
def get_windzone(conn, geometry): 'Find windzone from map.' # TODO@Günni if geometry.geom_type in ['Polygon', 'MultiPolygon']: coords = geometry.centroid else: coords = geometry sql = """ SELECT zone FROM oemof_test.windzones WHERE st_contains(geom, ST_PointFromText('...
[ "def", "get_windzone", "(", "conn", ",", "geometry", ")", ":", "# TODO@Günni", "if", "geometry", ".", "geom_type", "in", "[", "'Polygon'", ",", "'MultiPolygon'", "]", ":", "coords", "=", "geometry", ".", "centroid", "else", ":", "coords", "=", "geometry", ...
Find windzone from map.
[ "Find", "windzone", "from", "map", "." ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L275-L291
train
Find windzone from map.
oemof/oemof.db
oemof/db/tools.py
create_empty_table_serial_primary
def create_empty_table_serial_primary(conn, schema, table, columns=None, id_col='id'): r"""New database table with primary key type serial and empty columns Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schem...
python
def create_empty_table_serial_primary(conn, schema, table, columns=None, id_col='id'): r"""New database table with primary key type serial and empty columns Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schem...
[ "def", "create_empty_table_serial_primary", "(", "conn", ",", "schema", ",", "table", ",", "columns", "=", "None", ",", "id_col", "=", "'id'", ")", ":", "sql_str", "=", "\"\"\"CREATE TABLE {schema}.{table} ({id_col} SERIAL PRIMARY KEY\n NOT NULL)\n \"\"\"", "....
r"""New database table with primary key type serial and empty columns Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table columns : list, optional Columns that ...
[ "r", "New", "database", "table", "with", "primary", "key", "type", "serial", "and", "empty", "columns" ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L294-L330
train
r Creates an empty table with serial primary key and empty columns.
oemof/oemof.db
oemof/db/tools.py
grant_db_access
def grant_db_access(conn, schema, table, role): r"""Gives access to database users/ groups Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table role : str da...
python
def grant_db_access(conn, schema, table, role): r"""Gives access to database users/ groups Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table role : str da...
[ "def", "grant_db_access", "(", "conn", ",", "schema", ",", "table", ",", "role", ")", ":", "grant_str", "=", "\"\"\"GRANT ALL ON TABLE {schema}.{table}\n TO {role} WITH GRANT OPTION;\"\"\"", ".", "format", "(", "schema", "=", "schema", ",", "table", "=", "table", ...
r"""Gives access to database users/ groups Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table role : str database role that access is granted to
[ "r", "Gives", "access", "to", "database", "users", "/", "groups" ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L332-L351
train
r Gives access to database users and groups of the object holding the specified role
oemof/oemof.db
oemof/db/tools.py
add_primary_key
def add_primary_key(conn, schema, table, pk_col): r"""Adds primary key to database table Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table pk_col : str Co...
python
def add_primary_key(conn, schema, table, pk_col): r"""Adds primary key to database table Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table pk_col : str Co...
[ "def", "add_primary_key", "(", "conn", ",", "schema", ",", "table", ",", "pk_col", ")", ":", "sql_str", "=", "\"\"\"alter table {schema}.{table} add primary key ({col})\"\"\"", ".", "format", "(", "schema", "=", "schema", ",", "table", "=", "table", ",", "col", ...
r"""Adds primary key to database table Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table pk_col : str Column that primary key is applied to
[ "r", "Adds", "primary", "key", "to", "database", "table" ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L354-L372
train
r Adds a primary key to the database table
oemof/oemof.db
oemof/db/tools.py
change_owner_to
def change_owner_to(conn, schema, table, role): r"""Changes table's ownership to role Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table role : str databas...
python
def change_owner_to(conn, schema, table, role): r"""Changes table's ownership to role Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table role : str databas...
[ "def", "change_owner_to", "(", "conn", ",", "schema", ",", "table", ",", "role", ")", ":", "sql_str", "=", "\"\"\"ALTER TABLE {schema}.{table}\n OWNER TO {role};\"\"\"", ".", "format", "(", "schema", "=", "schema", ",", "table", "=", "table", ",", "role", ...
r"""Changes table's ownership to role Parameters ---------- conn : sqlalchemy connection object A valid connection to a database schema : str The database schema table : str The database table role : str database role that access is granted to
[ "r", "Changes", "table", "s", "ownership", "to", "role" ]
d51ac50187f03a875bd7ce5991ed4772e8b77b93
https://github.com/oemof/oemof.db/blob/d51ac50187f03a875bd7ce5991ed4772e8b77b93/oemof/db/tools.py#L375-L395
train
r Changes table s ownership to role
mgoral/subconvert
src/subconvert/gui/DataModel.py
DataController.createDataFromFile
def createDataFromFile(self, filePath, inputEncoding = None, defaultFps = None): """Fetch a given filePath and parse its contents. May raise the following exceptions: * RuntimeError - generic exception telling that parsing was unsuccessfull * IOError - failed to open a file at given fil...
python
def createDataFromFile(self, filePath, inputEncoding = None, defaultFps = None): """Fetch a given filePath and parse its contents. May raise the following exceptions: * RuntimeError - generic exception telling that parsing was unsuccessfull * IOError - failed to open a file at given fil...
[ "def", "createDataFromFile", "(", "self", ",", "filePath", ",", "inputEncoding", "=", "None", ",", "defaultFps", "=", "None", ")", ":", "file_", "=", "File", "(", "filePath", ")", "if", "inputEncoding", "is", "None", ":", "inputEncoding", "=", "file_", "."...
Fetch a given filePath and parse its contents. May raise the following exceptions: * RuntimeError - generic exception telling that parsing was unsuccessfull * IOError - failed to open a file at given filePath @return SubtitleData filled with non-empty, default datafields. Client should...
[ "Fetch", "a", "given", "filePath", "and", "parse", "its", "contents", "." ]
59701e5e69ef1ca26ce7d1d766c936664aa2cb32
https://github.com/mgoral/subconvert/blob/59701e5e69ef1ca26ce7d1d766c936664aa2cb32/src/subconvert/gui/DataModel.py#L62-L88
train
Fetch a given filePath and parse its contents.
mgoral/subconvert
src/subconvert/gui/DataModel.py
DataController.execute
def execute(self, cmd): """Execute a command to modify storage[cmd.filePath]""" if not cmd.filePath in self._history.keys(): self._history[cmd.filePath] = SubtitleUndoStack(self) try: self._history[cmd.filePath].push(cmd) except: self._...
python
def execute(self, cmd): """Execute a command to modify storage[cmd.filePath]""" if not cmd.filePath in self._history.keys(): self._history[cmd.filePath] = SubtitleUndoStack(self) try: self._history[cmd.filePath].push(cmd) except: self._...
[ "def", "execute", "(", "self", ",", "cmd", ")", ":", "if", "not", "cmd", ".", "filePath", "in", "self", ".", "_history", ".", "keys", "(", ")", ":", "self", ".", "_history", "[", "cmd", ".", "filePath", "]", "=", "SubtitleUndoStack", "(", "self", "...
Execute a command to modify storage[cmd.filePath]
[ "Execute", "a", "command", "to", "modify", "storage", "[", "cmd", ".", "filePath", "]" ]
59701e5e69ef1ca26ce7d1d766c936664aa2cb32
https://github.com/mgoral/subconvert/blob/59701e5e69ef1ca26ce7d1d766c936664aa2cb32/src/subconvert/gui/DataModel.py#L90-L103
train
Execute a command to modify storage [ cmd. filePath ]
mkoura/dump2polarion
dump2polarion/properties.py
_set_property
def _set_property(xml_root, name, value, properties=None): """Sets property to specified value.""" if properties is None: properties = xml_root.find("properties") for prop in properties: if prop.get("name") == name: prop.set("value", utils.get_unicode_str(value)) bre...
python
def _set_property(xml_root, name, value, properties=None): """Sets property to specified value.""" if properties is None: properties = xml_root.find("properties") for prop in properties: if prop.get("name") == name: prop.set("value", utils.get_unicode_str(value)) bre...
[ "def", "_set_property", "(", "xml_root", ",", "name", ",", "value", ",", "properties", "=", "None", ")", ":", "if", "properties", "is", "None", ":", "properties", "=", "xml_root", ".", "find", "(", "\"properties\"", ")", "for", "prop", "in", "properties", ...
Sets property to specified value.
[ "Sets", "property", "to", "specified", "value", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L19-L31
train
Sets property to specified value.
mkoura/dump2polarion
dump2polarion/properties.py
generate_response_property
def generate_response_property(name=None, value=None): """Generates response property.""" name = name or "dump2polarion" value = value or "".join(random.sample(string.ascii_lowercase, 12)) return (name, value)
python
def generate_response_property(name=None, value=None): """Generates response property.""" name = name or "dump2polarion" value = value or "".join(random.sample(string.ascii_lowercase, 12)) return (name, value)
[ "def", "generate_response_property", "(", "name", "=", "None", ",", "value", "=", "None", ")", ":", "name", "=", "name", "or", "\"dump2polarion\"", "value", "=", "value", "or", "\"\"", ".", "join", "(", "random", ".", "sample", "(", "string", ".", "ascii...
Generates response property.
[ "Generates", "response", "property", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L75-L79
train
Generates response property.
mkoura/dump2polarion
dump2polarion/properties.py
fill_response_property
def fill_response_property(xml_root, name=None, value=None): """Returns response property and fills it if missing.""" name, value = generate_response_property(name, value) response_property = None if xml_root.tag == "testsuites": response_property = _fill_testsuites_response_property(xml_root, ...
python
def fill_response_property(xml_root, name=None, value=None): """Returns response property and fills it if missing.""" name, value = generate_response_property(name, value) response_property = None if xml_root.tag == "testsuites": response_property = _fill_testsuites_response_property(xml_root, ...
[ "def", "fill_response_property", "(", "xml_root", ",", "name", "=", "None", ",", "value", "=", "None", ")", ":", "name", ",", "value", "=", "generate_response_property", "(", "name", ",", "value", ")", "response_property", "=", "None", "if", "xml_root", ".",...
Returns response property and fills it if missing.
[ "Returns", "response", "property", "and", "fills", "it", "if", "missing", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L122-L134
train
Returns response property and fills it if missing.
mkoura/dump2polarion
dump2polarion/properties.py
remove_response_property
def remove_response_property(xml_root): """Removes response properties if exist.""" if xml_root.tag == "testsuites": properties = xml_root.find("properties") resp_properties = [] for prop in properties: prop_name = prop.get("name", "") if "polarion-response-" in p...
python
def remove_response_property(xml_root): """Removes response properties if exist.""" if xml_root.tag == "testsuites": properties = xml_root.find("properties") resp_properties = [] for prop in properties: prop_name = prop.get("name", "") if "polarion-response-" in p...
[ "def", "remove_response_property", "(", "xml_root", ")", ":", "if", "xml_root", ".", "tag", "==", "\"testsuites\"", ":", "properties", "=", "xml_root", ".", "find", "(", "\"properties\"", ")", "resp_properties", "=", "[", "]", "for", "prop", "in", "properties"...
Removes response properties if exist.
[ "Removes", "response", "properties", "if", "exist", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L137-L153
train
Removes response properties if exist.
mkoura/dump2polarion
dump2polarion/properties.py
remove_property
def remove_property(xml_root, partial_name): """Removes properties if exist.""" if xml_root.tag in ("testsuites", "testcases", "requirements"): properties = xml_root.find("properties") remove_properties = [] for prop in properties: prop_name = prop.get("name", "") ...
python
def remove_property(xml_root, partial_name): """Removes properties if exist.""" if xml_root.tag in ("testsuites", "testcases", "requirements"): properties = xml_root.find("properties") remove_properties = [] for prop in properties: prop_name = prop.get("name", "") ...
[ "def", "remove_property", "(", "xml_root", ",", "partial_name", ")", ":", "if", "xml_root", ".", "tag", "in", "(", "\"testsuites\"", ",", "\"testcases\"", ",", "\"requirements\"", ")", ":", "properties", "=", "xml_root", ".", "find", "(", "\"properties\"", ")"...
Removes properties if exist.
[ "Removes", "properties", "if", "exist", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L156-L168
train
Removes properties if exist.
mkoura/dump2polarion
dump2polarion/properties.py
set_lookup_method
def set_lookup_method(xml_root, value): """Changes lookup method.""" if xml_root.tag == "testsuites": _set_property(xml_root, "polarion-lookup-method", value) elif xml_root.tag in ("testcases", "requirements"): _set_property(xml_root, "lookup-method", value) else: raise Dump2Pola...
python
def set_lookup_method(xml_root, value): """Changes lookup method.""" if xml_root.tag == "testsuites": _set_property(xml_root, "polarion-lookup-method", value) elif xml_root.tag in ("testcases", "requirements"): _set_property(xml_root, "lookup-method", value) else: raise Dump2Pola...
[ "def", "set_lookup_method", "(", "xml_root", ",", "value", ")", ":", "if", "xml_root", ".", "tag", "==", "\"testsuites\"", ":", "_set_property", "(", "xml_root", ",", "\"polarion-lookup-method\"", ",", "value", ")", "elif", "xml_root", ".", "tag", "in", "(", ...
Changes lookup method.
[ "Changes", "lookup", "method", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L171-L178
train
Changes lookup method.
mkoura/dump2polarion
dump2polarion/properties.py
set_dry_run
def set_dry_run(xml_root, value=True): """Sets dry-run so records are not updated, only log file is produced.""" value_str = str(value).lower() assert value_str in ("true", "false") if xml_root.tag == "testsuites": _set_property(xml_root, "polarion-dry-run", value_str) elif xml_root.tag in (...
python
def set_dry_run(xml_root, value=True): """Sets dry-run so records are not updated, only log file is produced.""" value_str = str(value).lower() assert value_str in ("true", "false") if xml_root.tag == "testsuites": _set_property(xml_root, "polarion-dry-run", value_str) elif xml_root.tag in (...
[ "def", "set_dry_run", "(", "xml_root", ",", "value", "=", "True", ")", ":", "value_str", "=", "str", "(", "value", ")", ".", "lower", "(", ")", "assert", "value_str", "in", "(", "\"true\"", ",", "\"false\"", ")", "if", "xml_root", ".", "tag", "==", "...
Sets dry-run so records are not updated, only log file is produced.
[ "Sets", "dry", "-", "run", "so", "records", "are", "not", "updated", "only", "log", "file", "is", "produced", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L181-L190
train
Sets dry - run so records are not updated only log file is produced.
darvid/biome
src/biome/__init__.py
Habitat.get_environ
def get_environ(cls, prefix): """Retrieves environment variables from a namespace. Args: prefix (str): The prefix, without a trailing underscore. Returns: list: A list of environment variable keys and values. """ return ((key[len(prefix) + 1:], value) ...
python
def get_environ(cls, prefix): """Retrieves environment variables from a namespace. Args: prefix (str): The prefix, without a trailing underscore. Returns: list: A list of environment variable keys and values. """ return ((key[len(prefix) + 1:], value) ...
[ "def", "get_environ", "(", "cls", ",", "prefix", ")", ":", "return", "(", "(", "key", "[", "len", "(", "prefix", ")", "+", "1", ":", "]", ",", "value", ")", "for", "key", ",", "value", "in", "os", ".", "environ", ".", "items", "(", ")", "if", ...
Retrieves environment variables from a namespace. Args: prefix (str): The prefix, without a trailing underscore. Returns: list: A list of environment variable keys and values.
[ "Retrieves", "environment", "variables", "from", "a", "namespace", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L63-L75
train
Retrieves environment variables from a namespace.
darvid/biome
src/biome/__init__.py
Habitat.get_bool
def get_bool(self, name, default=None): """Retrieves an environment variable value as ``bool``. Integer values are converted as expected: zero evaluates to ``False``, and non-zero to ``True``. String values of ``'true'`` and ``'false'`` are evaluated case insensitive. Args: ...
python
def get_bool(self, name, default=None): """Retrieves an environment variable value as ``bool``. Integer values are converted as expected: zero evaluates to ``False``, and non-zero to ``True``. String values of ``'true'`` and ``'false'`` are evaluated case insensitive. Args: ...
[ "def", "get_bool", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "not", "in", "self", ":", "if", "default", "is", "not", "None", ":", "return", "default", "raise", "EnvironmentError", ".", "not_found", "(", "self", ".",...
Retrieves an environment variable value as ``bool``. Integer values are converted as expected: zero evaluates to ``False``, and non-zero to ``True``. String values of ``'true'`` and ``'false'`` are evaluated case insensitive. Args: name (str): The case-insensitive, unprefix...
[ "Retrieves", "an", "environment", "variable", "value", "as", "bool", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L102-L128
train
Retrieves an environment variable value as a bool.
darvid/biome
src/biome/__init__.py
Habitat.get_dict
def get_dict(self, name, default=None): """Retrieves an environment variable value as a dictionary. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``EnvironmentError``. ...
python
def get_dict(self, name, default=None): """Retrieves an environment variable value as a dictionary. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``EnvironmentError``. ...
[ "def", "get_dict", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "not", "in", "self", ":", "if", "default", "is", "not", "None", ":", "return", "default", "raise", "EnvironmentError", ".", "not_found", "(", "self", ".",...
Retrieves an environment variable value as a dictionary. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``EnvironmentError``. Returns: dict: The environment...
[ "Retrieves", "an", "environment", "variable", "value", "as", "a", "dictionary", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L130-L150
train
Retrieves an environment variable value as a dictionary.
darvid/biome
src/biome/__init__.py
Habitat.get_int
def get_int(self, name, default=None): """Retrieves an environment variable as an integer. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``EnvironmentError``. ...
python
def get_int(self, name, default=None): """Retrieves an environment variable as an integer. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``EnvironmentError``. ...
[ "def", "get_int", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "not", "in", "self", ":", "if", "default", "is", "not", "None", ":", "return", "default", "raise", "EnvironmentError", ".", "not_found", "(", "self", ".", ...
Retrieves an environment variable as an integer. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``EnvironmentError``. Returns: int: The environment variable...
[ "Retrieves", "an", "environment", "variable", "as", "an", "integer", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L152-L174
train
Retrieves an environment variable as an integer.
darvid/biome
src/biome/__init__.py
Habitat.get_list
def get_list(self, name, default=None): """Retrieves an environment variable as a list. Note that while implicit access of environment variables containing tuples will return tuples, using this method will coerce tuples to lists. Args: name (str): The case-insensiti...
python
def get_list(self, name, default=None): """Retrieves an environment variable as a list. Note that while implicit access of environment variables containing tuples will return tuples, using this method will coerce tuples to lists. Args: name (str): The case-insensiti...
[ "def", "get_list", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "not", "in", "self", ":", "if", "default", "is", "not", "None", ":", "return", "default", "raise", "EnvironmentError", ".", "not_found", "(", "self", ".",...
Retrieves an environment variable as a list. Note that while implicit access of environment variables containing tuples will return tuples, using this method will coerce tuples to lists. Args: name (str): The case-insensitive, unprefixed variable name. default: ...
[ "Retrieves", "an", "environment", "variable", "as", "a", "list", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L176-L202
train
Retrieves an environment variable as a list.
darvid/biome
src/biome/__init__.py
Habitat.get_path
def get_path(self, name, default=None): """Retrieves an environment variable as a filesystem path. Requires the `pathlib`_ library if using Python <= 3.4. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be ret...
python
def get_path(self, name, default=None): """Retrieves an environment variable as a filesystem path. Requires the `pathlib`_ library if using Python <= 3.4. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be ret...
[ "def", "get_path", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "not", "in", "self", ":", "if", "default", "is", "not", "None", ":", "return", "default", "raise", "EnvironmentError", ".", "not_found", "(", "self", ".",...
Retrieves an environment variable as a filesystem path. Requires the `pathlib`_ library if using Python <= 3.4. Args: name (str): The case-insensitive, unprefixed variable name. default: If provided, a default value will be returned instead of throwing ``Environ...
[ "Retrieves", "an", "environment", "variable", "as", "a", "filesystem", "path", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L204-L230
train
Retrieves an environment variable as a filesystem path.
darvid/biome
src/biome/__init__.py
Habitat.refresh
def refresh(self): """Update all environment variables from ``os.environ``. Use if ``os.environ`` was modified dynamically *after* you accessed an environment namespace with ``biome``. """ super(Habitat, self).update(self.get_environ(self._prefix))
python
def refresh(self): """Update all environment variables from ``os.environ``. Use if ``os.environ`` was modified dynamically *after* you accessed an environment namespace with ``biome``. """ super(Habitat, self).update(self.get_environ(self._prefix))
[ "def", "refresh", "(", "self", ")", ":", "super", "(", "Habitat", ",", "self", ")", ".", "update", "(", "self", ".", "get_environ", "(", "self", ".", "_prefix", ")", ")" ]
Update all environment variables from ``os.environ``. Use if ``os.environ`` was modified dynamically *after* you accessed an environment namespace with ``biome``.
[ "Update", "all", "environment", "variables", "from", "os", ".", "environ", "." ]
e1f1945165df9def31af42e5e13b623e1de97f01
https://github.com/darvid/biome/blob/e1f1945165df9def31af42e5e13b623e1de97f01/src/biome/__init__.py#L232-L239
train
Update all environment variables from os. environ.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._top_element
def _top_element(self): """Returns top XML element.""" top = etree.Element("testsuites") comment = etree.Comment("Generated for testrun {}".format(self.testrun_id)) top.append(comment) return top
python
def _top_element(self): """Returns top XML element.""" top = etree.Element("testsuites") comment = etree.Comment("Generated for testrun {}".format(self.testrun_id)) top.append(comment) return top
[ "def", "_top_element", "(", "self", ")", ":", "top", "=", "etree", ".", "Element", "(", "\"testsuites\"", ")", "comment", "=", "etree", ".", "Comment", "(", "\"Generated for testrun {}\"", ".", "format", "(", "self", ".", "testrun_id", ")", ")", "top", "."...
Returns top XML element.
[ "Returns", "top", "XML", "element", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L51-L56
train
Returns the top XML element.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._properties_element
def _properties_element(self, parent_element): """Returns properties XML element.""" testsuites_properties = etree.SubElement(parent_element, "properties") etree.SubElement( testsuites_properties, "property", {"name": "polarion-testrun-id", "value": str(self....
python
def _properties_element(self, parent_element): """Returns properties XML element.""" testsuites_properties = etree.SubElement(parent_element, "properties") etree.SubElement( testsuites_properties, "property", {"name": "polarion-testrun-id", "value": str(self....
[ "def", "_properties_element", "(", "self", ",", "parent_element", ")", ":", "testsuites_properties", "=", "etree", ".", "SubElement", "(", "parent_element", ",", "\"properties\"", ")", "etree", ".", "SubElement", "(", "testsuites_properties", ",", "\"property\"", ",...
Returns properties XML element.
[ "Returns", "properties", "XML", "element", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L58-L91
train
Returns properties XML element.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._fill_lookup_prop
def _fill_lookup_prop(self, testsuites_properties): """Fills the polarion-lookup-method property.""" if not self._lookup_prop: raise Dump2PolarionException("Failed to set the 'polarion-lookup-method' property") etree.SubElement( testsuites_properties, "proper...
python
def _fill_lookup_prop(self, testsuites_properties): """Fills the polarion-lookup-method property.""" if not self._lookup_prop: raise Dump2PolarionException("Failed to set the 'polarion-lookup-method' property") etree.SubElement( testsuites_properties, "proper...
[ "def", "_fill_lookup_prop", "(", "self", ",", "testsuites_properties", ")", ":", "if", "not", "self", ".", "_lookup_prop", ":", "raise", "Dump2PolarionException", "(", "\"Failed to set the 'polarion-lookup-method' property\"", ")", "etree", ".", "SubElement", "(", "test...
Fills the polarion-lookup-method property.
[ "Fills", "the", "polarion", "-", "lookup", "-", "method", "property", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L93-L102
train
Fills the polarion - lookup - method property.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._transform_result
def _transform_result(self, result): """Calls transform function on result.""" if self._transform_func: result = self._transform_func(result) return result or None
python
def _transform_result(self, result): """Calls transform function on result.""" if self._transform_func: result = self._transform_func(result) return result or None
[ "def", "_transform_result", "(", "self", ",", "result", ")", ":", "if", "self", ".", "_transform_func", ":", "result", "=", "self", ".", "_transform_func", "(", "result", ")", "return", "result", "or", "None" ]
Calls transform function on result.
[ "Calls", "transform", "function", "on", "result", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L144-L148
train
Calls transform function on result.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._get_verdict
def _get_verdict(result): """Gets verdict of the testcase.""" verdict = result.get("verdict") if not verdict: return None verdict = verdict.strip().lower() if verdict not in Verdicts.PASS + Verdicts.FAIL + Verdicts.SKIP + Verdicts.WAIT: return None ...
python
def _get_verdict(result): """Gets verdict of the testcase.""" verdict = result.get("verdict") if not verdict: return None verdict = verdict.strip().lower() if verdict not in Verdicts.PASS + Verdicts.FAIL + Verdicts.SKIP + Verdicts.WAIT: return None ...
[ "def", "_get_verdict", "(", "result", ")", ":", "verdict", "=", "result", ".", "get", "(", "\"verdict\"", ")", "if", "not", "verdict", ":", "return", "None", "verdict", "=", "verdict", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "verdict", ...
Gets verdict of the testcase.
[ "Gets", "verdict", "of", "the", "testcase", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L151-L159
train
Gets verdict of the testcase.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._set_lookup_prop
def _set_lookup_prop(self, result_data): """Set lookup property based on processed testcases if not configured.""" if self._lookup_prop: return if result_data.get("id"): self._lookup_prop = "id" elif result_data.get("title"): self._lookup_prop = "name...
python
def _set_lookup_prop(self, result_data): """Set lookup property based on processed testcases if not configured.""" if self._lookup_prop: return if result_data.get("id"): self._lookup_prop = "id" elif result_data.get("title"): self._lookup_prop = "name...
[ "def", "_set_lookup_prop", "(", "self", ",", "result_data", ")", ":", "if", "self", ".", "_lookup_prop", ":", "return", "if", "result_data", ".", "get", "(", "\"id\"", ")", ":", "self", ".", "_lookup_prop", "=", "\"id\"", "elif", "result_data", ".", "get",...
Set lookup property based on processed testcases if not configured.
[ "Set", "lookup", "property", "based", "on", "processed", "testcases", "if", "not", "configured", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L161-L173
train
Set lookup property based on processed testcases if not configured.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._check_lookup_prop
def _check_lookup_prop(self, result_data): """Checks that selected lookup property can be used for this testcase.""" if not self._lookup_prop: return False if not result_data.get("id") and self._lookup_prop != "name": return False if not result_data.get("title") ...
python
def _check_lookup_prop(self, result_data): """Checks that selected lookup property can be used for this testcase.""" if not self._lookup_prop: return False if not result_data.get("id") and self._lookup_prop != "name": return False if not result_data.get("title") ...
[ "def", "_check_lookup_prop", "(", "self", ",", "result_data", ")", ":", "if", "not", "self", ".", "_lookup_prop", ":", "return", "False", "if", "not", "result_data", ".", "get", "(", "\"id\"", ")", "and", "self", ".", "_lookup_prop", "!=", "\"name\"", ":",...
Checks that selected lookup property can be used for this testcase.
[ "Checks", "that", "selected", "lookup", "property", "can", "be", "used", "for", "this", "testcase", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L175-L184
train
Checks that the selected lookup property can be used for this testcase.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._fill_out_err
def _fill_out_err(result, testcase): """Adds stdout and stderr if present.""" if result.get("stdout"): system_out = etree.SubElement(testcase, "system-out") system_out.text = utils.get_unicode_str(result["stdout"]) if result.get("stderr"): system_err = etree....
python
def _fill_out_err(result, testcase): """Adds stdout and stderr if present.""" if result.get("stdout"): system_out = etree.SubElement(testcase, "system-out") system_out.text = utils.get_unicode_str(result["stdout"]) if result.get("stderr"): system_err = etree....
[ "def", "_fill_out_err", "(", "result", ",", "testcase", ")", ":", "if", "result", ".", "get", "(", "\"stdout\"", ")", ":", "system_out", "=", "etree", ".", "SubElement", "(", "testcase", ",", "\"system-out\"", ")", "system_out", ".", "text", "=", "utils", ...
Adds stdout and stderr if present.
[ "Adds", "stdout", "and", "stderr", "if", "present", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L199-L207
train
Adds stdout and stderr if present.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._fill_properties
def _fill_properties(verdict, result, testcase, testcase_id, testcase_title): """Adds properties into testcase element.""" properties = etree.SubElement(testcase, "properties") etree.SubElement( properties, "property", {"name": "polarion-testcase-id", "value":...
python
def _fill_properties(verdict, result, testcase, testcase_id, testcase_title): """Adds properties into testcase element.""" properties = etree.SubElement(testcase, "properties") etree.SubElement( properties, "property", {"name": "polarion-testcase-id", "value":...
[ "def", "_fill_properties", "(", "verdict", ",", "result", ",", "testcase", ",", "testcase_id", ",", "testcase_title", ")", ":", "properties", "=", "etree", ".", "SubElement", "(", "testcase", ",", "\"properties\"", ")", "etree", ".", "SubElement", "(", "proper...
Adds properties into testcase element.
[ "Adds", "properties", "into", "testcase", "element", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L210-L236
train
Adds properties into the testcase element.
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport.export
def export(self): """Returns XUnit XML.""" top = self._top_element() properties = self._properties_element(top) testsuite = self._testsuite_element(top) self._fill_tests_results(testsuite) self._fill_lookup_prop(properties) return utils.prettify_xml(top)
python
def export(self): """Returns XUnit XML.""" top = self._top_element() properties = self._properties_element(top) testsuite = self._testsuite_element(top) self._fill_tests_results(testsuite) self._fill_lookup_prop(properties) return utils.prettify_xml(top)
[ "def", "export", "(", "self", ")", ":", "top", "=", "self", ".", "_top_element", "(", ")", "properties", "=", "self", ".", "_properties_element", "(", "top", ")", "testsuite", "=", "self", ".", "_testsuite_element", "(", "top", ")", "self", ".", "_fill_t...
Returns XUnit XML.
[ "Returns", "XUnit", "XML", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L290-L297
train
Returns XUnit XML.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getBalance
def eth_getBalance(self, address, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance :param address: Account address :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: wei ...
python
def eth_getBalance(self, address, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance :param address: Account address :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: wei ...
[ "def", "eth_getBalance", "(", "self", ",", "address", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "validate_block", "(", "block", ")", "return", "hex_to_dec", "(", "(", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getBalance'", ","...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance :param address: Account address :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: wei :rtype: int
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getbalance" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L81-L95
train
Get the balance of an account
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getStorageAt
def eth_getStorageAt(self, address, position=0, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat :param address: Storage address :type address: str :param position: Position in storage (optional) :type position: int :param blo...
python
def eth_getStorageAt(self, address, position=0, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat :param address: Storage address :type address: str :param position: Position in storage (optional) :type position: int :param blo...
[ "def", "eth_getStorageAt", "(", "self", ",", "address", ",", "position", "=", "0", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "validate_block", "(", "block", ")", "return", "hex_to_dec", "(", "(", "yield", "from", "self", ".", "rpc_call...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat :param address: Storage address :type address: str :param position: Position in storage (optional) :type position: int :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :...
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getstorageat" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L98-L116
train
Get the storage at the specified position in the specified block.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getTransactionCount
def eth_getTransactionCount(self, address, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount :param address: Account address :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS ...
python
def eth_getTransactionCount(self, address, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount :param address: Account address :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS ...
[ "def", "eth_getTransactionCount", "(", "self", ",", "address", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "validate_block", "(", "block", ")", "return", "hex_to_dec", "(", "(", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getTransac...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount :param address: Account address :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_gettransactioncount" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L119-L133
train
Get the number of transactions in the specified block.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getBlockTransactionCountByHash
def eth_getBlockTransactionCountByHash(self, bhash): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash :param bhash: Block hash :type bhash: str :return: count :rtype: int or None """ response = yield from self.rpc_call('eth_ge...
python
def eth_getBlockTransactionCountByHash(self, bhash): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash :param bhash: Block hash :type bhash: str :return: count :rtype: int or None """ response = yield from self.rpc_call('eth_ge...
[ "def", "eth_getBlockTransactionCountByHash", "(", "self", ",", "bhash", ")", ":", "response", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getBlockTransactionCountByHash'", ",", "[", "bhash", "]", ")", "if", "response", ":", "return", "hex_to_dec", ...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash :param bhash: Block hash :type bhash: str :return: count :rtype: int or None
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getblocktransactioncountbyhash" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L136-L149
train
This interface is used to get the number of transactions in a specific block.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getBlockTransactionCountByNumber
def eth_getBlockTransactionCountByNumber(self, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int """ ...
python
def eth_getBlockTransactionCountByNumber(self, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int """ ...
[ "def", "eth_getBlockTransactionCountByNumber", "(", "self", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "validate_block", "(", "block", ")", "return", "hex_to_dec", "(", "(", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getBlockTransacti...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getblocktransactioncountbynumber" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L152-L163
train
Get the number of transactions in a specific block.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getUncleCountByBlockHash
def eth_getUncleCountByBlockHash(self, bhash): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash :param bhash: Block hash :type bhash: str :return: count :rtype: int or None """ response = yield from self.rpc_call('eth_getUncleCountB...
python
def eth_getUncleCountByBlockHash(self, bhash): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash :param bhash: Block hash :type bhash: str :return: count :rtype: int or None """ response = yield from self.rpc_call('eth_getUncleCountB...
[ "def", "eth_getUncleCountByBlockHash", "(", "self", ",", "bhash", ")", ":", "response", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getUncleCountByBlockHash'", ",", "[", "bhash", "]", ")", "if", "response", ":", "return", "hex_to_dec", "(", "resp...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash :param bhash: Block hash :type bhash: str :return: count :rtype: int or None
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getunclecountbyblockhash" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L166-L179
train
This interface is used to get the uncle count of a specific block.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getUncleCountByBlockNumber
def eth_getUncleCountByBlockNumber(self, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int """ block = ...
python
def eth_getUncleCountByBlockNumber(self, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int """ block = ...
[ "def", "eth_getUncleCountByBlockNumber", "(", "self", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "validate_block", "(", "block", ")", "response", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getUncleCountByBlockNumber'", ",", "[", ...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: count :rtype: int
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getunclecountbyblocknumber" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L182-L196
train
This interface is used to get the uncle count by block number.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getCode
def eth_getCode(self, address, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode :param address: Address of contract :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: code ...
python
def eth_getCode(self, address, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode :param address: Address of contract :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: code ...
[ "def", "eth_getCode", "(", "self", ",", "address", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "validate_block", "(", "block", ")", "return", "(", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getCode'", ",", "[", "address", ",", ...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode :param address: Address of contract :type address: str :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :return: code :rtype: str
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getcode" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L199-L212
train
Get the code of a specific block.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_sendTransaction
def eth_sendTransaction(self, from_, to=None, gas=None, gas_price=None, value=None, data=None, nonce=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction :param from_: From account address :type from_: str ...
python
def eth_sendTransaction(self, from_, to=None, gas=None, gas_price=None, value=None, data=None, nonce=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction :param from_: From account address :type from_: str ...
[ "def", "eth_sendTransaction", "(", "self", ",", "from_", ",", "to", "=", "None", ",", "gas", "=", "None", ",", "gas_price", "=", "None", ",", "value", "=", "None", ",", "data", "=", "None", ",", "nonce", "=", "None", ")", ":", "obj", "=", "{", "}...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction :param from_: From account address :type from_: str :param to: To account address (optional) :type to: str :param gas: Gas amount for current transaction (optional) :type gas: int :param gas_pr...
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_sendtransaction" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L230-L274
train
Send a transaction to the specified account.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_call
def eth_call(self, from_, to=None, gas=None, gas_price=None, value=None, data=None, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call :param from_: From account address :type from_: str :param to: To account address (o...
python
def eth_call(self, from_, to=None, gas=None, gas_price=None, value=None, data=None, block=BLOCK_TAG_LATEST): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call :param from_: From account address :type from_: str :param to: To account address (o...
[ "def", "eth_call", "(", "self", ",", "from_", ",", "to", "=", "None", ",", "gas", "=", "None", ",", "gas_price", "=", "None", ",", "value", "=", "None", ",", "data", "=", "None", ",", "block", "=", "BLOCK_TAG_LATEST", ")", ":", "block", "=", "valid...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call :param from_: From account address :type from_: str :param to: To account address (optional) :type to: str :param gas: Gas amount for current transaction (optional) :type gas: int :param gas_price: Gas pr...
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_call" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L289-L331
train
Send a call to Ethernet.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_estimateGas
def eth_estimateGas(self, from_, to=None, gas=None, gas_price=None, value=None, data=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas :param from_: From account address :type from_: str :param to: To account address (optional) :ty...
python
def eth_estimateGas(self, from_, to=None, gas=None, gas_price=None, value=None, data=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas :param from_: From account address :type from_: str :param to: To account address (optional) :ty...
[ "def", "eth_estimateGas", "(", "self", ",", "from_", ",", "to", "=", "None", ",", "gas", "=", "None", ",", "gas_price", "=", "None", ",", "value", "=", "None", ",", "data", "=", "None", ")", ":", "obj", "=", "{", "}", "obj", "[", "'from'", "]", ...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas :param from_: From account address :type from_: str :param to: To account address (optional) :type to: str :param gas: Gas amount for current transaction (optional) :type gas: int :param gas_price:...
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_estimategas" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L334-L372
train
Estimate gas amount for current transaction
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getBlockByHash
def eth_getBlockByHash(self, bhash, tx_objects=True): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash :param bhash: Block hash :type bhash: str :param tx_objects: Return txs full object (optional) :type tx_objects: bool :return: block :rtyp...
python
def eth_getBlockByHash(self, bhash, tx_objects=True): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash :param bhash: Block hash :type bhash: str :param tx_objects: Return txs full object (optional) :type tx_objects: bool :return: block :rtyp...
[ "def", "eth_getBlockByHash", "(", "self", ",", "bhash", ",", "tx_objects", "=", "True", ")", ":", "result", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getBlockByHash'", ",", "[", "bhash", ",", "tx_objects", "]", ")", "# TODO: Update result respo...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash :param bhash: Block hash :type bhash: str :param tx_objects: Return txs full object (optional) :type tx_objects: bool :return: block :rtype: dict or None
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getblockbyhash" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L375-L390
train
Get the block with the given hash.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getBlockByNumber
def eth_getBlockByNumber(self, block=BLOCK_TAG_LATEST, tx_objects=True): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :param tx_objects: Return txs full object (optional) :type...
python
def eth_getBlockByNumber(self, block=BLOCK_TAG_LATEST, tx_objects=True): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :param tx_objects: Return txs full object (optional) :type...
[ "def", "eth_getBlockByNumber", "(", "self", ",", "block", "=", "BLOCK_TAG_LATEST", ",", "tx_objects", "=", "True", ")", ":", "block", "=", "validate_block", "(", "block", ")", "result", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getBlockByNumber...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :param tx_objects: Return txs full object (optional) :type tx_objects: bool :return: block :rtype: dict or None
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getblockbynumber" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L393-L409
train
Get block by number.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getTransactionByBlockHashAndIndex
def eth_getTransactionByBlockHashAndIndex(self, bhash, index=0): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex :param bhash: Block hash :type bhash: str :param index: Index position (optional) :type index: int """ result...
python
def eth_getTransactionByBlockHashAndIndex(self, bhash, index=0): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex :param bhash: Block hash :type bhash: str :param index: Index position (optional) :type index: int """ result...
[ "def", "eth_getTransactionByBlockHashAndIndex", "(", "self", ",", "bhash", ",", "index", "=", "0", ")", ":", "result", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getTransactionByBlockHashAndIndex'", ",", "[", "bhash", ",", "hex", "(", "index", "...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex :param bhash: Block hash :type bhash: str :param index: Index position (optional) :type index: int
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_gettransactionbyblockhashandindex" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L426-L438
train
Get the transaction by block hash and index.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getTransactionByBlockNumberAndIndex
def eth_getTransactionByBlockNumberAndIndex(self, block=BLOCK_TAG_LATEST, index=0): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex :param block: Block tag or number (optional) :type block: int or BLOCK_TA...
python
def eth_getTransactionByBlockNumberAndIndex(self, block=BLOCK_TAG_LATEST, index=0): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex :param block: Block tag or number (optional) :type block: int or BLOCK_TA...
[ "def", "eth_getTransactionByBlockNumberAndIndex", "(", "self", ",", "block", "=", "BLOCK_TAG_LATEST", ",", "index", "=", "0", ")", ":", "block", "=", "validate_block", "(", "block", ")", "result", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getTr...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex :param block: Block tag or number (optional) :type block: int or BLOCK_TAGS :param index: Index position (optional) :type index: int :return: transaction :rtype: dict or None
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_gettransactionbyblocknumberandindex" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L441-L458
train
Get transaction by block number and index.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getUncleByBlockHashAndIndex
def eth_getUncleByBlockHashAndIndex(self, bhash, index=0): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex :param bhash: Block hash :type bhash: str :param index: Index position (optional) :type index: int :return: block :rtype...
python
def eth_getUncleByBlockHashAndIndex(self, bhash, index=0): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex :param bhash: Block hash :type bhash: str :param index: Index position (optional) :type index: int :return: block :rtype...
[ "def", "eth_getUncleByBlockHashAndIndex", "(", "self", ",", "bhash", ",", "index", "=", "0", ")", ":", "result", "=", "yield", "from", "self", ".", "rpc_call", "(", "'eth_getUncleByBlockHashAndIndex'", ",", "[", "bhash", ",", "hex", "(", "index", ")", "]", ...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex :param bhash: Block hash :type bhash: str :param index: Index position (optional) :type index: int :return: block :rtype: dict or None
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getunclebyblockhashandindex" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L476-L491
train
Get uncle by block hash and index.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_newFilter
def eth_newFilter(self, from_block=BLOCK_TAG_LATEST, to_block=BLOCK_TAG_LATEST, address=None, topics=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter :param from_block: Block tag or number (optional) :type from_block: int or BLOCK_TAGS :param...
python
def eth_newFilter(self, from_block=BLOCK_TAG_LATEST, to_block=BLOCK_TAG_LATEST, address=None, topics=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter :param from_block: Block tag or number (optional) :type from_block: int or BLOCK_TAGS :param...
[ "def", "eth_newFilter", "(", "self", ",", "from_block", "=", "BLOCK_TAG_LATEST", ",", "to_block", "=", "BLOCK_TAG_LATEST", ",", "address", "=", "None", ",", "topics", "=", "None", ")", ":", "obj", "=", "{", "'fromBlock'", ":", "validate_block", "(", "from_bl...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter :param from_block: Block tag or number (optional) :type from_block: int or BLOCK_TAGS :param to_block: Block tag or number (optional) :type to_block: int or BLOCK_TAGS :param address: Contract address (optional) ...
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_newfilter" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L550-L575
train
This interface is used to create a new filter for a specific set of attributes.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_getLogs
def eth_getLogs(self, from_block=BLOCK_TAG_LATEST, to_block=BLOCK_TAG_LATEST, address=None, topics=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs :param from_block: Block tag or number (optional) :type from_block: int or BLOCK_TAGS :param to_bl...
python
def eth_getLogs(self, from_block=BLOCK_TAG_LATEST, to_block=BLOCK_TAG_LATEST, address=None, topics=None): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs :param from_block: Block tag or number (optional) :type from_block: int or BLOCK_TAGS :param to_bl...
[ "def", "eth_getLogs", "(", "self", ",", "from_block", "=", "BLOCK_TAG_LATEST", ",", "to_block", "=", "BLOCK_TAG_LATEST", ",", "address", "=", "None", ",", "topics", "=", "None", ")", ":", "obj", "=", "{", "'fromBlock'", ":", "validate_block", "(", "from_bloc...
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs :param from_block: Block tag or number (optional) :type from_block: int or BLOCK_TAGS :param to_block: Block tag or number (optional) :type to_block: int or BLOCK_TAGS :param address: Contract address (optional) ...
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_getlogs" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L632-L658
train
Get the logs from the network.
DeV1doR/aioethereum
aioethereum/management/eth.py
EthMixin.eth_submitWork
def eth_submitWork(self, nonce, header, mix_digest): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork :param nonce: Nonce of work :type nonce: int :param header: Pow-hash header :type header: str :param mix_digest: Mix digest :type mix_digest: s...
python
def eth_submitWork(self, nonce, header, mix_digest): """https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork :param nonce: Nonce of work :type nonce: int :param header: Pow-hash header :type header: str :param mix_digest: Mix digest :type mix_digest: s...
[ "def", "eth_submitWork", "(", "self", ",", "nonce", ",", "header", ",", "mix_digest", ")", ":", "return", "(", "yield", "from", "self", ".", "rpc_call", "(", "'eth_submitWork'", ",", "[", "nonce", ",", "header", ",", "mix_digest", "]", ")", ")" ]
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork :param nonce: Nonce of work :type nonce: int :param header: Pow-hash header :type header: str :param mix_digest: Mix digest :type mix_digest: str :return: success :rtype: bool
[ "https", ":", "//", "github", ".", "com", "/", "ethereum", "/", "wiki", "/", "wiki", "/", "JSON", "-", "RPC#eth_submitwork" ]
85eb46550d862b3ccc309914ea871ca1c7b42157
https://github.com/DeV1doR/aioethereum/blob/85eb46550d862b3ccc309914ea871ca1c7b42157/aioethereum/management/eth.py#L670-L686
train
Submit a work to the blockchain.
iLampard/x-utils
xutils/date_utils/misc.py
is_within_hour_range
def is_within_hour_range(ref_time, start_time, end_time): """ :param ref_time: datetime/string, 需要判断的时间变量 :param start_time: string, 时间区间上限 :param end_time: string, 时间下限 :return: 判断某个时间是否在限定的时间范围内 """ str_ref_time = ref_time.strftime('%Y%m%d') start_time_ = mktime(strptime(str_ref_time +...
python
def is_within_hour_range(ref_time, start_time, end_time): """ :param ref_time: datetime/string, 需要判断的时间变量 :param start_time: string, 时间区间上限 :param end_time: string, 时间下限 :return: 判断某个时间是否在限定的时间范围内 """ str_ref_time = ref_time.strftime('%Y%m%d') start_time_ = mktime(strptime(str_ref_time +...
[ "def", "is_within_hour_range", "(", "ref_time", ",", "start_time", ",", "end_time", ")", ":", "str_ref_time", "=", "ref_time", ".", "strftime", "(", "'%Y%m%d'", ")", "start_time_", "=", "mktime", "(", "strptime", "(", "str_ref_time", "+", "'-'", "+", "start_ti...
:param ref_time: datetime/string, 需要判断的时间变量 :param start_time: string, 时间区间上限 :param end_time: string, 时间下限 :return: 判断某个时间是否在限定的时间范围内
[ ":", "param", "ref_time", ":", "datetime", "/", "string", "需要判断的时间变量", ":", "param", "start_time", ":", "string", "时间区间上限", ":", "param", "end_time", ":", "string", "时间下限", ":", "return", ":", "判断某个时间是否在限定的时间范围内" ]
291d92832ee0e0c89bc22e10ecf2f44445e0d300
https://github.com/iLampard/x-utils/blob/291d92832ee0e0c89bc22e10ecf2f44445e0d300/xutils/date_utils/misc.py#L8-L22
train
Check if a date is within a given hour range.
codenerix/django-codenerix-products
codenerix_products/models.py
ProductFinal.get_value_product_unique
def get_value_product_unique(self, pos): """ Return all products unique relationship with POS's Storage (only salable zones) """ qs = ProductUnique.objects.filter( box__box_structure__zone__storage__in=pos.storage_stock.filter(storage_zones__salable=True), product...
python
def get_value_product_unique(self, pos): """ Return all products unique relationship with POS's Storage (only salable zones) """ qs = ProductUnique.objects.filter( box__box_structure__zone__storage__in=pos.storage_stock.filter(storage_zones__salable=True), product...
[ "def", "get_value_product_unique", "(", "self", ",", "pos", ")", ":", "qs", "=", "ProductUnique", ".", "objects", ".", "filter", "(", "box__box_structure__zone__storage__in", "=", "pos", ".", "storage_stock", ".", "filter", "(", "storage_zones__salable", "=", "Tru...
Return all products unique relationship with POS's Storage (only salable zones)
[ "Return", "all", "products", "unique", "relationship", "with", "POS", "s", "Storage", "(", "only", "salable", "zones", ")" ]
778622d502b8705aa854fe3b69e419839214c86e
https://github.com/codenerix/django-codenerix-products/blob/778622d502b8705aa854fe3b69e419839214c86e/codenerix_products/models.py#L1373-L1381
train
Return all products unique relationship with POS s Storage
mkoura/dump2polarion
dump2polarion/parselogs.py
parse
def parse(log_file): """Parse log file.""" with io.open(os.path.expanduser(log_file), encoding="utf-8") as input_file: for line in input_file: if "Starting import of XUnit results" in line: obj = XUnitParser break elif "Starting import of test case...
python
def parse(log_file): """Parse log file.""" with io.open(os.path.expanduser(log_file), encoding="utf-8") as input_file: for line in input_file: if "Starting import of XUnit results" in line: obj = XUnitParser break elif "Starting import of test case...
[ "def", "parse", "(", "log_file", ")", ":", "with", "io", ".", "open", "(", "os", ".", "path", ".", "expanduser", "(", "log_file", ")", ",", "encoding", "=", "\"utf-8\"", ")", "as", "input_file", ":", "for", "line", "in", "input_file", ":", "if", "\"S...
Parse log file.
[ "Parse", "log", "file", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/parselogs.py#L246-L264
train
Parse the log file and return a list of the testcases and requirements.
mkoura/dump2polarion
dump2polarion/parselogs.py
XUnitParser.get_result
def get_result(self, line): """Gets work item name and id.""" res = self.RESULT_SEARCH.search(line) try: name, ids = res.group(1), res.group(2) except (AttributeError, IndexError): return None ids = ids.split("/") tc_id = ids[0] try: ...
python
def get_result(self, line): """Gets work item name and id.""" res = self.RESULT_SEARCH.search(line) try: name, ids = res.group(1), res.group(2) except (AttributeError, IndexError): return None ids = ids.split("/") tc_id = ids[0] try: ...
[ "def", "get_result", "(", "self", ",", "line", ")", ":", "res", "=", "self", ".", "RESULT_SEARCH", ".", "search", "(", "line", ")", "try", ":", "name", ",", "ids", "=", "res", ".", "group", "(", "1", ")", ",", "res", ".", "group", "(", "2", ")"...
Gets work item name and id.
[ "Gets", "work", "item", "name", "and", "id", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/parselogs.py#L63-L77
train
Gets work item name and id.
mkoura/dump2polarion
dump2polarion/parselogs.py
XUnitParser.get_result_warn
def get_result_warn(self, line): """Gets work item name of item that was not successfully imported.""" res = self.RESULT_WARN_SEARCH.search(line) try: return LogItem(res.group(1), None, None) except (AttributeError, IndexError): pass # try again with cust...
python
def get_result_warn(self, line): """Gets work item name of item that was not successfully imported.""" res = self.RESULT_WARN_SEARCH.search(line) try: return LogItem(res.group(1), None, None) except (AttributeError, IndexError): pass # try again with cust...
[ "def", "get_result_warn", "(", "self", ",", "line", ")", ":", "res", "=", "self", ".", "RESULT_WARN_SEARCH", ".", "search", "(", "line", ")", "try", ":", "return", "LogItem", "(", "res", ".", "group", "(", "1", ")", ",", "None", ",", "None", ")", "...
Gets work item name of item that was not successfully imported.
[ "Gets", "work", "item", "name", "of", "item", "that", "was", "not", "successfully", "imported", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/parselogs.py#L79-L92
train
Gets work item name of item that was not successfully imported.
mkoura/dump2polarion
dump2polarion/parselogs.py
RequirementsParser.get_requirement
def get_requirement(self, line): """Gets requirement name and id.""" res = self.REQ_SEARCH.search(line) try: name, tc_id = res.group(1), res.group(2) except (AttributeError, IndexError): return None return LogItem(name, tc_id, None)
python
def get_requirement(self, line): """Gets requirement name and id.""" res = self.REQ_SEARCH.search(line) try: name, tc_id = res.group(1), res.group(2) except (AttributeError, IndexError): return None return LogItem(name, tc_id, None)
[ "def", "get_requirement", "(", "self", ",", "line", ")", ":", "res", "=", "self", ".", "REQ_SEARCH", ".", "search", "(", "line", ")", "try", ":", "name", ",", "tc_id", "=", "res", ".", "group", "(", "1", ")", ",", "res", ".", "group", "(", "2", ...
Gets requirement name and id.
[ "Gets", "requirement", "name", "and", "id", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/parselogs.py#L198-L206
train
Gets requirement name and id.
mkoura/dump2polarion
dump2polarion/parselogs.py
RequirementsParser.get_requirement_warn
def get_requirement_warn(self, line): """Gets name of test case that was not successfully imported.""" res = self.REQ_WARN_SEARCH.search(line) try: return LogItem(res.group(1), None, None) except (AttributeError, IndexError): return None
python
def get_requirement_warn(self, line): """Gets name of test case that was not successfully imported.""" res = self.REQ_WARN_SEARCH.search(line) try: return LogItem(res.group(1), None, None) except (AttributeError, IndexError): return None
[ "def", "get_requirement_warn", "(", "self", ",", "line", ")", ":", "res", "=", "self", ".", "REQ_WARN_SEARCH", ".", "search", "(", "line", ")", "try", ":", "return", "LogItem", "(", "res", ".", "group", "(", "1", ")", ",", "None", ",", "None", ")", ...
Gets name of test case that was not successfully imported.
[ "Gets", "name", "of", "test", "case", "that", "was", "not", "successfully", "imported", "." ]
f4bd24e9d5070e282aad15f1e8bb514c0525cd37
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/parselogs.py#L208-L214
train
Gets name of test case that was not successfully imported.
markfinger/assembla
assembla/lib.py
assembla_filter
def assembla_filter(func): """ Filters :data for the objects in it which possess attributes equal in name/value to a key/value in kwargs. Each key/value combination in kwargs is compared against the object, so multiple keyword arguments can be passed in to constrain the filtering. """ @wrap...
python
def assembla_filter(func): """ Filters :data for the objects in it which possess attributes equal in name/value to a key/value in kwargs. Each key/value combination in kwargs is compared against the object, so multiple keyword arguments can be passed in to constrain the filtering. """ @wrap...
[ "def", "assembla_filter", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "class_instance", ",", "*", "*", "kwargs", ")", ":", "# Get the result", "extra_params", "=", "kwargs", ".", "get", "(", "'extra_params'", ",", "None", ...
Filters :data for the objects in it which possess attributes equal in name/value to a key/value in kwargs. Each key/value combination in kwargs is compared against the object, so multiple keyword arguments can be passed in to constrain the filtering.
[ "Filters", ":", "data", "for", "the", "objects", "in", "it", "which", "possess", "attributes", "equal", "in", "name", "/", "value", "to", "a", "key", "/", "value", "in", "kwargs", "." ]
967a77a5ba718df94f60e832b6e0cf14c72426aa
https://github.com/markfinger/assembla/blob/967a77a5ba718df94f60e832b6e0cf14c72426aa/assembla/lib.py#L43-L76
train
A function that returns a list of objects in the object which possess attributes equal in name / value to a key / value combination.
syrusakbary/flask-beaker
flask_beaker.py
BeakerSession.init_app
def init_app(self, app): '''Initalizes the application with the extension. :param app: The Flask application object. ''' self.app = app self._session_conf = app.config.get('BEAKER_SESSION', { 'session.type': 'file', 'session.data_dir': '/tmp/sessi...
python
def init_app(self, app): '''Initalizes the application with the extension. :param app: The Flask application object. ''' self.app = app self._session_conf = app.config.get('BEAKER_SESSION', { 'session.type': 'file', 'session.data_dir': '/tmp/sessi...
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "self", ".", "app", "=", "app", "self", ".", "_session_conf", "=", "app", ".", "config", ".", "get", "(", "'BEAKER_SESSION'", ",", "{", "'session.type'", ":", "'file'", ",", "'session.data_dir'", ":",...
Initalizes the application with the extension. :param app: The Flask application object.
[ "Initalizes", "the", "application", "with", "the", "extension", ".", ":", "param", "app", ":", "The", "Flask", "application", "object", "." ]
fd9e4dc4f6edf123557744b3e8c45e583d0ef8ef
https://github.com/syrusakbary/flask-beaker/blob/fd9e4dc4f6edf123557744b3e8c45e583d0ef8ef/flask_beaker.py#L32-L44
train
Initalizes the application with the extension.
djaodjin/djaodjin-deployutils
deployutils/configs.py
locate_config
def locate_config(confname, app_name, location=None, prefix='etc', verbose=False): """ Returns absolute path on the filesystem to a config file named *confname*. """ candidates = [] if location: candidate = os.path.normpath(os.path.join(location, confname)) if os.pa...
python
def locate_config(confname, app_name, location=None, prefix='etc', verbose=False): """ Returns absolute path on the filesystem to a config file named *confname*. """ candidates = [] if location: candidate = os.path.normpath(os.path.join(location, confname)) if os.pa...
[ "def", "locate_config", "(", "confname", ",", "app_name", ",", "location", "=", "None", ",", "prefix", "=", "'etc'", ",", "verbose", "=", "False", ")", ":", "candidates", "=", "[", "]", "if", "location", ":", "candidate", "=", "os", ".", "path", ".", ...
Returns absolute path on the filesystem to a config file named *confname*.
[ "Returns", "absolute", "path", "on", "the", "filesystem", "to", "a", "config", "file", "named", "*", "confname", "*", "." ]
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
https://github.com/djaodjin/djaodjin-deployutils/blob/a0fe3cf3030dbbf09025c69ce75a69b326565dd8/deployutils/configs.py#L51-L78
train
Locates a config file in the system.
djaodjin/djaodjin-deployutils
deployutils/configs.py
load_config
def load_config(app_name, *args, **kwargs): """ Given a path to a file, parse its lines in ini-like format, and then set them in the current namespace. Quiet by default. Set verbose to True to see the absolute path to the config files printed on stderr. """ configure_logging() # compat...
python
def load_config(app_name, *args, **kwargs): """ Given a path to a file, parse its lines in ini-like format, and then set them in the current namespace. Quiet by default. Set verbose to True to see the absolute path to the config files printed on stderr. """ configure_logging() # compat...
[ "def", "load_config", "(", "app_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "configure_logging", "(", ")", "# compatible with Python 2 and 3.", "prefix", "=", "kwargs", ".", "get", "(", "'prefix'", ",", "'etc'", ")", "verbose", "=", "kwargs",...
Given a path to a file, parse its lines in ini-like format, and then set them in the current namespace. Quiet by default. Set verbose to True to see the absolute path to the config files printed on stderr.
[ "Given", "a", "path", "to", "a", "file", "parse", "its", "lines", "in", "ini", "-", "like", "format", "and", "then", "set", "them", "in", "the", "current", "namespace", "." ]
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
https://github.com/djaodjin/djaodjin-deployutils/blob/a0fe3cf3030dbbf09025c69ce75a69b326565dd8/deployutils/configs.py#L82-L166
train
Load a config file from a path to a file and set it in the current namespace.
skioo/django-customer-billing
billing/actions/accounts.py
close
def close(account_id: str) -> None: """ Closes the account. :param account_id: the account to close :return: Nothing """ logger.info('closing-account', account_id=account_id) with transaction.atomic(): account = Account.objects.get(pk=account_id) account.close() acco...
python
def close(account_id: str) -> None: """ Closes the account. :param account_id: the account to close :return: Nothing """ logger.info('closing-account', account_id=account_id) with transaction.atomic(): account = Account.objects.get(pk=account_id) account.close() acco...
[ "def", "close", "(", "account_id", ":", "str", ")", "->", "None", ":", "logger", ".", "info", "(", "'closing-account'", ",", "account_id", "=", "account_id", ")", "with", "transaction", ".", "atomic", "(", ")", ":", "account", "=", "Account", ".", "objec...
Closes the account. :param account_id: the account to close :return: Nothing
[ "Closes", "the", "account", "." ]
6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d
https://github.com/skioo/django-customer-billing/blob/6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d/billing/actions/accounts.py#L22-L33
train
Closes the account.
skioo/django-customer-billing
billing/actions/accounts.py
create_invoices
def create_invoices(account_id: str, due_date: date) -> Sequence[Invoice]: """ Creates the invoices for any due positive charges in the account. If there are due positive charges in different currencies, one invoice is created for each currency. :param account_id: The account to invoice. :param due...
python
def create_invoices(account_id: str, due_date: date) -> Sequence[Invoice]: """ Creates the invoices for any due positive charges in the account. If there are due positive charges in different currencies, one invoice is created for each currency. :param account_id: The account to invoice. :param due...
[ "def", "create_invoices", "(", "account_id", ":", "str", ",", "due_date", ":", "date", ")", "->", "Sequence", "[", "Invoice", "]", ":", "invoices", "=", "[", "]", "with", "transaction", ".", "atomic", "(", ")", ":", "due_charges", "=", "Charge", ".", "...
Creates the invoices for any due positive charges in the account. If there are due positive charges in different currencies, one invoice is created for each currency. :param account_id: The account to invoice. :param due_date: The due date for any invoice that gets created. :return: A possibly-empty li...
[ "Creates", "the", "invoices", "for", "any", "due", "positive", "charges", "in", "the", "account", ".", "If", "there", "are", "due", "positive", "charges", "in", "different", "currencies", "one", "invoice", "is", "created", "for", "each", "currency", "." ]
6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d
https://github.com/skioo/django-customer-billing/blob/6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d/billing/actions/accounts.py#L50-L77
train
Creates the invoices for any due positive charges in the account.
skioo/django-customer-billing
billing/actions/accounts.py
add_charge
def add_charge(account_id: str, amount: Money, reverses_id: Optional[str] = None, product_code: Optional[str] = None, product_properties: Optional[Dict[str, str]] = None) -> Charge: """ Add a charge to the account. :param account_id: The account o...
python
def add_charge(account_id: str, amount: Money, reverses_id: Optional[str] = None, product_code: Optional[str] = None, product_properties: Optional[Dict[str, str]] = None) -> Charge: """ Add a charge to the account. :param account_id: The account o...
[ "def", "add_charge", "(", "account_id", ":", "str", ",", "amount", ":", "Money", ",", "reverses_id", ":", "Optional", "[", "str", "]", "=", "None", ",", "product_code", ":", "Optional", "[", "str", "]", "=", "None", ",", "product_properties", ":", "Optio...
Add a charge to the account. :param account_id: The account on which to add the charge :param amount: The amount of the charge :param reverses_id: Set this if this charge reverses another one :param product_code: A code identifying the type of product cnarged :param product_properties: A dict of h...
[ "Add", "a", "charge", "to", "the", "account", "." ]
6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d
https://github.com/skioo/django-customer-billing/blob/6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d/billing/actions/accounts.py#L80-L114
train
Add a charge to the account.
skioo/django-customer-billing
billing/actions/accounts.py
assign_funds_to_account_pending_invoices
def assign_funds_to_account_pending_invoices(account_id: str) -> Sequence[str]: """ Tries to pay pending account invoices (starting from the oldest) with available funds. :param account_id: the account on which to perform the operation :return: The ids of the invoices that were paid (possibly empty list...
python
def assign_funds_to_account_pending_invoices(account_id: str) -> Sequence[str]: """ Tries to pay pending account invoices (starting from the oldest) with available funds. :param account_id: the account on which to perform the operation :return: The ids of the invoices that were paid (possibly empty list...
[ "def", "assign_funds_to_account_pending_invoices", "(", "account_id", ":", "str", ")", "->", "Sequence", "[", "str", "]", ":", "logger", ".", "info", "(", "'assign-funds-to-pending-invoices'", ",", "account_id", "=", "str", "(", "account_id", ")", ")", "paid_invoi...
Tries to pay pending account invoices (starting from the oldest) with available funds. :param account_id: the account on which to perform the operation :return: The ids of the invoices that were paid (possibly empty list).
[ "Tries", "to", "pay", "pending", "account", "invoices", "(", "starting", "from", "the", "oldest", ")", "with", "available", "funds", ".", ":", "param", "account_id", ":", "the", "account", "on", "which", "to", "perform", "the", "operation", ":", "return", ...
6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d
https://github.com/skioo/django-customer-billing/blob/6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d/billing/actions/accounts.py#L117-L134
train
Tries to pay pending invoices starting from the oldest with available funds.
skioo/django-customer-billing
billing/actions/accounts.py
assign_funds_to_invoice
def assign_funds_to_invoice(invoice_id: str) -> bool: """ Uses the available funds on the account (credits and payments) to pay the given invoice. :param invoice_id: The id of the invoice. :return: True if the invoice status is paid. A lot of side effects may occur in the database: - Funds (eit...
python
def assign_funds_to_invoice(invoice_id: str) -> bool: """ Uses the available funds on the account (credits and payments) to pay the given invoice. :param invoice_id: The id of the invoice. :return: True if the invoice status is paid. A lot of side effects may occur in the database: - Funds (eit...
[ "def", "assign_funds_to_invoice", "(", "invoice_id", ":", "str", ")", "->", "bool", ":", "logger", ".", "info", "(", "'assign-funds-to-invoice'", ",", "invoice_id", "=", "invoice_id", ")", "invoice", "=", "Invoice", ".", "objects", ".", "get", "(", "pk", "="...
Uses the available funds on the account (credits and payments) to pay the given invoice. :param invoice_id: The id of the invoice. :return: True if the invoice status is paid. A lot of side effects may occur in the database: - Funds (either payments or credits) may get assigned to the invoice. - Th...
[ "Uses", "the", "available", "funds", "on", "the", "account", "(", "credits", "and", "payments", ")", "to", "pay", "the", "given", "invoice", ".", ":", "param", "invoice_id", ":", "The", "id", "of", "the", "invoice", ".", ":", "return", ":", "True", "if...
6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d
https://github.com/skioo/django-customer-billing/blob/6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d/billing/actions/accounts.py#L137-L222
train
Assigns funds to an invoice.
Genida/dependenpy
src/dependenpy/dsm.py
DSM.build_tree
def build_tree(self): """Build the Python packages tree.""" for spec in self.specs: if spec.ismodule: self.modules.append(Module(spec.name, spec.path, dsm=self)) else: self.packages.append(Package( spec.name, spec.path, ...
python
def build_tree(self): """Build the Python packages tree.""" for spec in self.specs: if spec.ismodule: self.modules.append(Module(spec.name, spec.path, dsm=self)) else: self.packages.append(Package( spec.name, spec.path, ...
[ "def", "build_tree", "(", "self", ")", ":", "for", "spec", "in", "self", ".", "specs", ":", "if", "spec", ".", "ismodule", ":", "self", ".", "modules", ".", "append", "(", "Module", "(", "spec", ".", "name", ",", "spec", ".", "path", ",", "dsm", ...
Build the Python packages tree.
[ "Build", "the", "Python", "packages", "tree", "." ]
df099c17cbe735c990eca9197e39cfc5eb8a4c8e
https://github.com/Genida/dependenpy/blob/df099c17cbe735c990eca9197e39cfc5eb8a4c8e/src/dependenpy/dsm.py#L86-L97
train
Build the Python packages tree.
Genida/dependenpy
src/dependenpy/dsm.py
Package.split_limits_heads
def split_limits_heads(self): """ Return first parts of dot-separated strings, and rest of strings. Returns: (list of str, list of str): the heads and rest of the strings. """ heads = [] new_limit_to = [] for limit in self.limit_to: if '.'...
python
def split_limits_heads(self): """ Return first parts of dot-separated strings, and rest of strings. Returns: (list of str, list of str): the heads and rest of the strings. """ heads = [] new_limit_to = [] for limit in self.limit_to: if '.'...
[ "def", "split_limits_heads", "(", "self", ")", ":", "heads", "=", "[", "]", "new_limit_to", "=", "[", "]", "for", "limit", "in", "self", ".", "limit_to", ":", "if", "'.'", "in", "limit", ":", "name", ",", "limit", "=", "limit", ".", "split", "(", "...
Return first parts of dot-separated strings, and rest of strings. Returns: (list of str, list of str): the heads and rest of the strings.
[ "Return", "first", "parts", "of", "dot", "-", "separated", "strings", "and", "rest", "of", "strings", "." ]
df099c17cbe735c990eca9197e39cfc5eb8a4c8e
https://github.com/Genida/dependenpy/blob/df099c17cbe735c990eca9197e39cfc5eb8a4c8e/src/dependenpy/dsm.py#L171-L187
train
Return first parts of dot - separated strings and rest of strings.