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
pyfca/pyfca
pyfca/implications.py
v_Us_dict.koenig
def koenig(self): """ This needs to be L = contextg.v_Us_B() """ L = self Y = L - (L*L) while True: Ybar = Y + ~Y take = L - Ybar if not len(take): return Y else: ZZ = list(set(take)-set(Y))#u...
python
def koenig(self): """ This needs to be L = contextg.v_Us_B() """ L = self Y = L - (L*L) while True: Ybar = Y + ~Y take = L - Ybar if not len(take): return Y else: ZZ = list(set(take)-set(Y))#u...
[ "def", "koenig", "(", "self", ")", ":", "L", "=", "self", "Y", "=", "L", "-", "(", "L", "*", "L", ")", "while", "True", ":", "Ybar", "=", "Y", "+", "~", "Y", "take", "=", "L", "-", "Ybar", "if", "not", "len", "(", "take", ")", ":", "retur...
This needs to be L = contextg.v_Us_B()
[ "This", "needs", "to", "be", "L", "=", "contextg", ".", "v_Us_B", "()" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L364-L383
train
Return the Koenig of the current set of resources.
pyfca/pyfca
pyfca/implications.py
Context.column
def column(self, i): """from right""" return ''.join([str(digitat2(r,i)) for r in self])
python
def column(self, i): """from right""" return ''.join([str(digitat2(r,i)) for r in self])
[ "def", "column", "(", "self", ",", "i", ")", ":", "return", "''", ".", "join", "(", "[", "str", "(", "digitat2", "(", "r", ",", "i", ")", ")", "for", "r", "in", "self", "]", ")" ]
from right
[ "from", "right" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L432-L434
train
from right return the column name
pyfca/pyfca
pyfca/implications.py
Context.UV_H
def UV_H(self): """ UV = all non-trivial (!V⊂U) implications U->V with UuV closed; in ternary coding (1=V,2=U) K = all closed sets This is UV_H function, but the returned implications are respected by all attribute sets of this context. This corresponds to a multiplication or & ...
python
def UV_H(self): """ UV = all non-trivial (!V⊂U) implications U->V with UuV closed; in ternary coding (1=V,2=U) K = all closed sets This is UV_H function, but the returned implications are respected by all attribute sets of this context. This corresponds to a multiplication or & ...
[ "def", "UV_H", "(", "self", ")", ":", "h", "=", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "&", "y", ",", "(", "H", "(", "g", ",", "self", ".", "width", "-", "1", ")", "for", "g", "in", "self", ")", ")", "return", "UV_H", "(", "h",...
UV = all non-trivial (!V⊂U) implications U->V with UuV closed; in ternary coding (1=V,2=U) K = all closed sets This is UV_H function, but the returned implications are respected by all attribute sets of this context. This corresponds to a multiplication or & operation of the Hg sets.
[ "UV", "=", "all", "non", "-", "trivial", "(", "!V⊂U", ")", "implications", "U", "-", ">", "V", "with", "UuV", "closed", ";", "in", "ternary", "coding", "(", "1", "=", "V", "2", "=", "U", ")", "K", "=", "all", "closed", "sets" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L454-L463
train
This function returns the H of the UV and UuV sets.
pyfca/pyfca
pyfca/implications.py
Context.UV_B
def UV_B(self): """ returns UV = all respected U->Ux in ternary coding (1=V,2=U) """ h = reduce(lambda x,y:x&y,(B(g,self.width-1) for g in self)) return UV_B(h, self.width)
python
def UV_B(self): """ returns UV = all respected U->Ux in ternary coding (1=V,2=U) """ h = reduce(lambda x,y:x&y,(B(g,self.width-1) for g in self)) return UV_B(h, self.width)
[ "def", "UV_B", "(", "self", ")", ":", "h", "=", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "&", "y", ",", "(", "B", "(", "g", ",", "self", ".", "width", "-", "1", ")", "for", "g", "in", "self", ")", ")", "return", "UV_B", "(", "h",...
returns UV = all respected U->Ux in ternary coding (1=V,2=U)
[ "returns", "UV", "=", "all", "respected", "U", "-", ">", "Ux", "in", "ternary", "coding", "(", "1", "=", "V", "2", "=", "U", ")" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L464-L469
train
returns UV = all respected Ux in ternary coding
pyfca/pyfca
pyfca/implications.py
Context.v_Us_B
def v_Us_B(self): """ returns the implications {v:Us} based on B This is L=∪ min L_i in [1]_ """ Bg = reduce(lambda x,y:x&y,(B(g,self.width-1) for g in self)) gw = self.width return v_Us_dict(Bg, gw)
python
def v_Us_B(self): """ returns the implications {v:Us} based on B This is L=∪ min L_i in [1]_ """ Bg = reduce(lambda x,y:x&y,(B(g,self.width-1) for g in self)) gw = self.width return v_Us_dict(Bg, gw)
[ "def", "v_Us_B", "(", "self", ")", ":", "Bg", "=", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "&", "y", ",", "(", "B", "(", "g", ",", "self", ".", "width", "-", "1", ")", "for", "g", "in", "self", ")", ")", "gw", "=", "self", ".", ...
returns the implications {v:Us} based on B This is L=∪ min L_i in [1]_
[ "returns", "the", "implications", "{", "v", ":", "Us", "}", "based", "on", "B", "This", "is", "L", "=", "∪", "min", "L_i", "in", "[", "1", "]", "_" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L470-L477
train
returns the implications v : Us based on B
nickpandolfi/Cyther
cyther/instructions.py
Instruction.processAndSetDefaults
def processAndSetDefaults(self): """ The heart of the 'Instruction' object. This method will make sure that all fields not entered will be defaulted to a correct value. Also checks for incongruities in the data entered, if it was by the user. """ # INPUT, OUTPUT, GIVEN + ...
python
def processAndSetDefaults(self): """ The heart of the 'Instruction' object. This method will make sure that all fields not entered will be defaulted to a correct value. Also checks for incongruities in the data entered, if it was by the user. """ # INPUT, OUTPUT, GIVEN + ...
[ "def", "processAndSetDefaults", "(", "self", ")", ":", "# INPUT, OUTPUT, GIVEN + BUILDABLE DEPS", "if", "not", "self", ".", "input", ":", "raise", "ValueError", "(", "NO_INPUT_FILE", ")", "if", "not", "self", ".", "output", ":", "# Build directory must exist, right?",...
The heart of the 'Instruction' object. This method will make sure that all fields not entered will be defaulted to a correct value. Also checks for incongruities in the data entered, if it was by the user.
[ "The", "heart", "of", "the", "Instruction", "object", ".", "This", "method", "will", "make", "sure", "that", "all", "fields", "not", "entered", "will", "be", "defaulted", "to", "a", "correct", "value", ".", "Also", "checks", "for", "incongruities", "in", "...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/instructions.py#L53-L82
train
This method is called by the base class to process the values in the instruction object.
teepark/greenhouse
greenhouse/scheduler.py
greenlet
def greenlet(func, args=(), kwargs=None): """create a new greenlet from a function and arguments :param func: the function the new greenlet should run :type func: function :param args: any positional arguments for the function :type args: tuple :param kwargs: any keyword arguments for the funct...
python
def greenlet(func, args=(), kwargs=None): """create a new greenlet from a function and arguments :param func: the function the new greenlet should run :type func: function :param args: any positional arguments for the function :type args: tuple :param kwargs: any keyword arguments for the funct...
[ "def", "greenlet", "(", "func", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "if", "args", "or", "kwargs", ":", "def", "target", "(", ")", ":", "return", "func", "(", "*", "args", ",", "*", "*", "(", "kwargs", "or", "{", ...
create a new greenlet from a function and arguments :param func: the function the new greenlet should run :type func: function :param args: any positional arguments for the function :type args: tuple :param kwargs: any keyword arguments for the function :type kwargs: dict or None the only ...
[ "create", "a", "new", "greenlet", "from", "a", "function", "and", "arguments" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L208-L228
train
create a new greenlet from a function and arguments
teepark/greenhouse
greenhouse/scheduler.py
schedule
def schedule(target=None, args=(), kwargs=None): """insert a greenlet into the scheduler If provided a function, it is wrapped in a new greenlet :param target: what to schedule :type target: function or greenlet :param args: arguments for the function (only used if ``target`` is a function...
python
def schedule(target=None, args=(), kwargs=None): """insert a greenlet into the scheduler If provided a function, it is wrapped in a new greenlet :param target: what to schedule :type target: function or greenlet :param args: arguments for the function (only used if ``target`` is a function...
[ "def", "schedule", "(", "target", "=", "None", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "if", "target", "is", "None", ":", "def", "decorator", "(", "target", ")", ":", "return", "schedule", "(", "target", ",", "args", "=", ...
insert a greenlet into the scheduler If provided a function, it is wrapped in a new greenlet :param target: what to schedule :type target: function or greenlet :param args: arguments for the function (only used if ``target`` is a function) :type args: tuple :param kwargs: keywo...
[ "insert", "a", "greenlet", "into", "the", "scheduler" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L263-L300
train
add a greenlet to the scheduler
teepark/greenhouse
greenhouse/scheduler.py
schedule_at
def schedule_at(unixtime, target=None, args=(), kwargs=None): """insert a greenlet into the scheduler to be run at a set time If provided a function, it is wrapped in a new greenlet :param unixtime: the unix timestamp at which the new greenlet should be started :type unixtime: int or float ...
python
def schedule_at(unixtime, target=None, args=(), kwargs=None): """insert a greenlet into the scheduler to be run at a set time If provided a function, it is wrapped in a new greenlet :param unixtime: the unix timestamp at which the new greenlet should be started :type unixtime: int or float ...
[ "def", "schedule_at", "(", "unixtime", ",", "target", "=", "None", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "if", "target", "is", "None", ":", "def", "decorator", "(", "target", ")", ":", "return", "schedule_at", "(", "unixti...
insert a greenlet into the scheduler to be run at a set time If provided a function, it is wrapped in a new greenlet :param unixtime: the unix timestamp at which the new greenlet should be started :type unixtime: int or float :param target: what to schedule :type target: function or greenl...
[ "insert", "a", "greenlet", "into", "the", "scheduler", "to", "be", "run", "at", "a", "set", "time" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L303-L344
train
add a greenlet to be run at a set time
teepark/greenhouse
greenhouse/scheduler.py
schedule_in
def schedule_in(secs, target=None, args=(), kwargs=None): """insert a greenlet into the scheduler to run after a set time If provided a function, it is wrapped in a new greenlet :param secs: the number of seconds to wait before running the target :type unixtime: int or float :param target: what to...
python
def schedule_in(secs, target=None, args=(), kwargs=None): """insert a greenlet into the scheduler to run after a set time If provided a function, it is wrapped in a new greenlet :param secs: the number of seconds to wait before running the target :type unixtime: int or float :param target: what to...
[ "def", "schedule_in", "(", "secs", ",", "target", "=", "None", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "return", "schedule_at", "(", "time", ".", "time", "(", ")", "+", "secs", ",", "target", ",", "args", ",", "kwargs", ...
insert a greenlet into the scheduler to run after a set time If provided a function, it is wrapped in a new greenlet :param secs: the number of seconds to wait before running the target :type unixtime: int or float :param target: what to schedule :type target: function or greenlet :param args:...
[ "insert", "a", "greenlet", "into", "the", "scheduler", "to", "run", "after", "a", "set", "time" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L347-L378
train
insert a greenlet into the scheduler to run after a set time
teepark/greenhouse
greenhouse/scheduler.py
schedule_recurring
def schedule_recurring(interval, target=None, maxtimes=0, starting_at=0, args=(), kwargs=None): """insert a greenlet into the scheduler to run regularly at an interval If provided a function, it is wrapped in a new greenlet :param interval: the number of seconds between invocations ...
python
def schedule_recurring(interval, target=None, maxtimes=0, starting_at=0, args=(), kwargs=None): """insert a greenlet into the scheduler to run regularly at an interval If provided a function, it is wrapped in a new greenlet :param interval: the number of seconds between invocations ...
[ "def", "schedule_recurring", "(", "interval", ",", "target", "=", "None", ",", "maxtimes", "=", "0", ",", "starting_at", "=", "0", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "starting_at", "=", "starting_at", "or", "time", ".", ...
insert a greenlet into the scheduler to run regularly at an interval If provided a function, it is wrapped in a new greenlet :param interval: the number of seconds between invocations :type interval: int or float :param target: what to schedule :type target: function or greenlet :param maxtime...
[ "insert", "a", "greenlet", "into", "the", "scheduler", "to", "run", "regularly", "at", "an", "interval" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L381-L442
train
schedule a greenlet to run at a specific interval
teepark/greenhouse
greenhouse/scheduler.py
schedule_exception
def schedule_exception(exception, target): """schedule a greenlet to have an exception raised in it immediately :param exception: the exception to raise in the greenlet :type exception: Exception :param target: the greenlet that should receive the exception :type target: greenlet """ if not...
python
def schedule_exception(exception, target): """schedule a greenlet to have an exception raised in it immediately :param exception: the exception to raise in the greenlet :type exception: Exception :param target: the greenlet that should receive the exception :type target: greenlet """ if not...
[ "def", "schedule_exception", "(", "exception", ",", "target", ")", ":", "if", "not", "isinstance", "(", "target", ",", "compat", ".", "greenlet", ")", ":", "raise", "TypeError", "(", "\"can only schedule exceptions for greenlets\"", ")", "if", "target", ".", "de...
schedule a greenlet to have an exception raised in it immediately :param exception: the exception to raise in the greenlet :type exception: Exception :param target: the greenlet that should receive the exception :type target: greenlet
[ "schedule", "a", "greenlet", "to", "have", "an", "exception", "raised", "in", "it", "immediately" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L445-L458
train
schedule a greenlet to have an exception raised in the target immediately
teepark/greenhouse
greenhouse/scheduler.py
schedule_exception_at
def schedule_exception_at(unixtime, exception, target): """schedule a greenlet to have an exception raised at a unix timestamp :param unixtime: when to raise the exception in the target :type unixtime: int or float :param exception: the exception to raise in the greenlet :type exception: Exception ...
python
def schedule_exception_at(unixtime, exception, target): """schedule a greenlet to have an exception raised at a unix timestamp :param unixtime: when to raise the exception in the target :type unixtime: int or float :param exception: the exception to raise in the greenlet :type exception: Exception ...
[ "def", "schedule_exception_at", "(", "unixtime", ",", "exception", ",", "target", ")", ":", "if", "not", "isinstance", "(", "target", ",", "compat", ".", "greenlet", ")", ":", "raise", "TypeError", "(", "\"can only schedule exceptions for greenlets\"", ")", "if", ...
schedule a greenlet to have an exception raised at a unix timestamp :param unixtime: when to raise the exception in the target :type unixtime: int or float :param exception: the exception to raise in the greenlet :type exception: Exception :param target: the greenlet that should receive the excepti...
[ "schedule", "a", "greenlet", "to", "have", "an", "exception", "raised", "at", "a", "unix", "timestamp" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L461-L476
train
schedule a greenlet to have an exception raised at a unix timestamp
teepark/greenhouse
greenhouse/scheduler.py
schedule_exception_in
def schedule_exception_in(secs, exception, target): """schedule a greenlet receive an exception after a number of seconds :param secs: the number of seconds to wait before raising :type secs: int or float :param exception: the exception to raise in the greenlet :type exception: Exception :param...
python
def schedule_exception_in(secs, exception, target): """schedule a greenlet receive an exception after a number of seconds :param secs: the number of seconds to wait before raising :type secs: int or float :param exception: the exception to raise in the greenlet :type exception: Exception :param...
[ "def", "schedule_exception_in", "(", "secs", ",", "exception", ",", "target", ")", ":", "schedule_exception_at", "(", "time", ".", "time", "(", ")", "+", "secs", ",", "exception", ",", "target", ")" ]
schedule a greenlet receive an exception after a number of seconds :param secs: the number of seconds to wait before raising :type secs: int or float :param exception: the exception to raise in the greenlet :type exception: Exception :param target: the greenlet that should receive the exception ...
[ "schedule", "a", "greenlet", "receive", "an", "exception", "after", "a", "number", "of", "seconds" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L479-L489
train
schedule a greenlet receive an exception after a number of seconds
teepark/greenhouse
greenhouse/scheduler.py
end
def end(target): """schedule a greenlet to be stopped immediately :param target: the greenlet to end :type target: greenlet """ if not isinstance(target, compat.greenlet): raise TypeError("argument must be a greenlet") if not target.dead: schedule(target) state.to_raise[...
python
def end(target): """schedule a greenlet to be stopped immediately :param target: the greenlet to end :type target: greenlet """ if not isinstance(target, compat.greenlet): raise TypeError("argument must be a greenlet") if not target.dead: schedule(target) state.to_raise[...
[ "def", "end", "(", "target", ")", ":", "if", "not", "isinstance", "(", "target", ",", "compat", ".", "greenlet", ")", ":", "raise", "TypeError", "(", "\"argument must be a greenlet\"", ")", "if", "not", "target", ".", "dead", ":", "schedule", "(", "target"...
schedule a greenlet to be stopped immediately :param target: the greenlet to end :type target: greenlet
[ "schedule", "a", "greenlet", "to", "be", "stopped", "immediately" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L492-L502
train
schedule a greenlet to be stopped immediately
teepark/greenhouse
greenhouse/scheduler.py
handle_exception
def handle_exception(klass, exc, tb, coro=None): """run all the registered exception handlers the first 3 arguments to this function match the output of ``sys.exc_info()`` :param klass: the exception klass :type klass: type :param exc: the exception instance :type exc: Exception :param...
python
def handle_exception(klass, exc, tb, coro=None): """run all the registered exception handlers the first 3 arguments to this function match the output of ``sys.exc_info()`` :param klass: the exception klass :type klass: type :param exc: the exception instance :type exc: Exception :param...
[ "def", "handle_exception", "(", "klass", ",", "exc", ",", "tb", ",", "coro", "=", "None", ")", ":", "if", "coro", "is", "None", ":", "coro", "=", "compat", ".", "getcurrent", "(", ")", "replacement", "=", "[", "]", "for", "weak", "in", "state", "."...
run all the registered exception handlers the first 3 arguments to this function match the output of ``sys.exc_info()`` :param klass: the exception klass :type klass: type :param exc: the exception instance :type exc: Exception :param tb: the traceback object :type tb: Traceback :p...
[ "run", "all", "the", "registered", "exception", "handlers" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L606-L659
train
run all the exception handlers that are registered with the given exception class and traceback object
teepark/greenhouse
greenhouse/scheduler.py
global_exception_handler
def global_exception_handler(handler): """add a callback for when an exception goes uncaught in any greenlet :param handler: the callback function. must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` the traceback obj...
python
def global_exception_handler(handler): """add a callback for when an exception goes uncaught in any greenlet :param handler: the callback function. must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` the traceback obj...
[ "def", "global_exception_handler", "(", "handler", ")", ":", "if", "not", "hasattr", "(", "handler", ",", "\"__call__\"", ")", ":", "raise", "TypeError", "(", "\"exception handlers must be callable\"", ")", "log", ".", "info", "(", "\"setting a new global exception ha...
add a callback for when an exception goes uncaught in any greenlet :param handler: the callback function. must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` the traceback object :type handler: function Note also...
[ "add", "a", "callback", "for", "when", "an", "exception", "goes", "uncaught", "in", "any", "greenlet" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L662-L682
train
add a callback for when an exception goes uncaught in any greenlet
teepark/greenhouse
greenhouse/scheduler.py
remove_global_exception_handler
def remove_global_exception_handler(handler): """remove a callback from the list of global exception handlers :param handler: the callback, previously added via :func:`global_exception_handler`, to remove :type handler: function :returns: bool, whether the handler was found (and theref...
python
def remove_global_exception_handler(handler): """remove a callback from the list of global exception handlers :param handler: the callback, previously added via :func:`global_exception_handler`, to remove :type handler: function :returns: bool, whether the handler was found (and theref...
[ "def", "remove_global_exception_handler", "(", "handler", ")", ":", "for", "i", ",", "cb", "in", "enumerate", "(", "state", ".", "global_exception_handlers", ")", ":", "cb", "=", "cb", "(", ")", "if", "cb", "is", "not", "None", "and", "cb", "is", "handle...
remove a callback from the list of global exception handlers :param handler: the callback, previously added via :func:`global_exception_handler`, to remove :type handler: function :returns: bool, whether the handler was found (and therefore removed)
[ "remove", "a", "callback", "from", "the", "list", "of", "global", "exception", "handlers" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L685-L701
train
remove a callback from the list of global exception handlers
teepark/greenhouse
greenhouse/scheduler.py
local_exception_handler
def local_exception_handler(handler=None, coro=None): """add a callback for when an exception occurs in a particular greenlet :param handler: the callback function, must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` ...
python
def local_exception_handler(handler=None, coro=None): """add a callback for when an exception occurs in a particular greenlet :param handler: the callback function, must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` ...
[ "def", "local_exception_handler", "(", "handler", "=", "None", ",", "coro", "=", "None", ")", ":", "if", "handler", "is", "None", ":", "return", "lambda", "h", ":", "local_exception_handler", "(", "h", ",", "coro", ")", "if", "not", "hasattr", "(", "hand...
add a callback for when an exception occurs in a particular greenlet :param handler: the callback function, must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` the traceback object :type handler: function :param c...
[ "add", "a", "callback", "for", "when", "an", "exception", "occurs", "in", "a", "particular", "greenlet" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L704-L733
train
add a callback function for when an exception occurs in a particular coroutine
teepark/greenhouse
greenhouse/scheduler.py
remove_local_exception_handler
def remove_local_exception_handler(handler, coro=None): """remove a callback from the list of exception handlers for a coroutine :param handler: the callback to remove :type handler: function :param coro: the coroutine for which to remove the local handler :type coro: greenlet :returns: bool, ...
python
def remove_local_exception_handler(handler, coro=None): """remove a callback from the list of exception handlers for a coroutine :param handler: the callback to remove :type handler: function :param coro: the coroutine for which to remove the local handler :type coro: greenlet :returns: bool, ...
[ "def", "remove_local_exception_handler", "(", "handler", ",", "coro", "=", "None", ")", ":", "if", "coro", "is", "None", ":", "coro", "=", "compat", ".", "getcurrent", "(", ")", "for", "i", ",", "cb", "in", "enumerate", "(", "state", ".", "local_exceptio...
remove a callback from the list of exception handlers for a coroutine :param handler: the callback to remove :type handler: function :param coro: the coroutine for which to remove the local handler :type coro: greenlet :returns: bool, whether the handler was found (and therefore removed)
[ "remove", "a", "callback", "from", "the", "list", "of", "exception", "handlers", "for", "a", "coroutine" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L736-L755
train
remove a callback from the list of exception handlers for a coroutine
teepark/greenhouse
greenhouse/scheduler.py
global_hook
def global_hook(handler): """add a callback to run in every switch between coroutines :param handler: the callback function, must be a function taking 2 arguments: - the greenlet being switched from - the greenlet being switched to be aware that only a weak reference to this f...
python
def global_hook(handler): """add a callback to run in every switch between coroutines :param handler: the callback function, must be a function taking 2 arguments: - the greenlet being switched from - the greenlet being switched to be aware that only a weak reference to this f...
[ "def", "global_hook", "(", "handler", ")", ":", "if", "not", "hasattr", "(", "handler", ",", "\"__call__\"", ")", ":", "raise", "TypeError", "(", "\"trace hooks must be callable\"", ")", "log", ".", "info", "(", "\"setting a new global hook callback\"", ")", "stat...
add a callback to run in every switch between coroutines :param handler: the callback function, must be a function taking 2 arguments: - the greenlet being switched from - the greenlet being switched to be aware that only a weak reference to this function will be held. :type h...
[ "add", "a", "callback", "to", "run", "in", "every", "switch", "between", "coroutines" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L758-L776
train
add a callback to run in every switch between coroutines
teepark/greenhouse
greenhouse/scheduler.py
remove_global_hook
def remove_global_hook(handler): """remove a callback from the list of global hooks :param handler: the callback function, previously added with global_hook, to remove from the list of global hooks :type handler: function :returns: bool, whether the handler was removed from the global ...
python
def remove_global_hook(handler): """remove a callback from the list of global hooks :param handler: the callback function, previously added with global_hook, to remove from the list of global hooks :type handler: function :returns: bool, whether the handler was removed from the global ...
[ "def", "remove_global_hook", "(", "handler", ")", ":", "for", "i", ",", "cb", "in", "enumerate", "(", "state", ".", "global_hooks", ")", ":", "cb", "=", "cb", "(", ")", "if", "cb", "is", "not", "None", "and", "cb", "is", "handler", ":", "state", "....
remove a callback from the list of global hooks :param handler: the callback function, previously added with global_hook, to remove from the list of global hooks :type handler: function :returns: bool, whether the handler was removed from the global hooks
[ "remove", "a", "callback", "from", "the", "list", "of", "global", "hooks" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L779-L795
train
remove a callback from the list of global hooks
teepark/greenhouse
greenhouse/scheduler.py
local_incoming_hook
def local_incoming_hook(handler=None, coro=None): """add a callback to run every time a greenlet is about to be switched to :param handler: the callback function, must be a function taking 2 arguments: - an integer indicating whether it is being called as an incoming (1) hook or an o...
python
def local_incoming_hook(handler=None, coro=None): """add a callback to run every time a greenlet is about to be switched to :param handler: the callback function, must be a function taking 2 arguments: - an integer indicating whether it is being called as an incoming (1) hook or an o...
[ "def", "local_incoming_hook", "(", "handler", "=", "None", ",", "coro", "=", "None", ")", ":", "if", "handler", "is", "None", ":", "return", "lambda", "h", ":", "local_incoming_hook", "(", "h", ",", "coro", ")", "if", "not", "hasattr", "(", "handler", ...
add a callback to run every time a greenlet is about to be switched to :param handler: the callback function, must be a function taking 2 arguments: - an integer indicating whether it is being called as an incoming (1) hook or an outgoing (2) hook (in this case it will always receive 1)....
[ "add", "a", "callback", "to", "run", "every", "time", "a", "greenlet", "is", "about", "to", "be", "switched", "to" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L798-L830
train
add a callback to run every time a greenlet is about to be switched into the local_incoming_hooks list
teepark/greenhouse
greenhouse/scheduler.py
remove_local_incoming_hook
def remove_local_incoming_hook(handler, coro=None): """remove a callback from the incoming hooks for a particular coro :param handler: the callback previously added via local_incoming_hook :type handler: function :param coro: the coroutine for which the hook should be removed :type coro: greenlet ...
python
def remove_local_incoming_hook(handler, coro=None): """remove a callback from the incoming hooks for a particular coro :param handler: the callback previously added via local_incoming_hook :type handler: function :param coro: the coroutine for which the hook should be removed :type coro: greenlet ...
[ "def", "remove_local_incoming_hook", "(", "handler", ",", "coro", "=", "None", ")", ":", "if", "coro", "is", "None", ":", "coro", "=", "compat", ".", "getcurrent", "(", ")", "for", "i", ",", "cb", "in", "enumerate", "(", "state", ".", "local_to_hooks", ...
remove a callback from the incoming hooks for a particular coro :param handler: the callback previously added via local_incoming_hook :type handler: function :param coro: the coroutine for which the hook should be removed :type coro: greenlet :returns: bool, whether the handler was found and remov...
[ "remove", "a", "callback", "from", "the", "incoming", "hooks", "for", "a", "particular", "coro" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L833-L852
train
remove a callback from the incoming hooks for a particular coroutine
teepark/greenhouse
greenhouse/scheduler.py
local_outgoing_hook
def local_outgoing_hook(handler=None, coro=None): """add a callback to run every time a greenlet is switched away from :param handler: the callback function, must be a function taking 2 arguments: - an integer indicating whether it is being called as an incoming (1) hook or as an out...
python
def local_outgoing_hook(handler=None, coro=None): """add a callback to run every time a greenlet is switched away from :param handler: the callback function, must be a function taking 2 arguments: - an integer indicating whether it is being called as an incoming (1) hook or as an out...
[ "def", "local_outgoing_hook", "(", "handler", "=", "None", ",", "coro", "=", "None", ")", ":", "if", "handler", "is", "None", ":", "return", "lambda", "h", ":", "local_outgoing_hook", "(", "h", ",", "coro", ")", "if", "not", "hasattr", "(", "handler", ...
add a callback to run every time a greenlet is switched away from :param handler: the callback function, must be a function taking 2 arguments: - an integer indicating whether it is being called as an incoming (1) hook or as an outgoing (2) hook (in this case it will always be 2). ...
[ "add", "a", "callback", "to", "run", "every", "time", "a", "greenlet", "is", "switched", "away", "from" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L855-L886
train
add a callback to run every time a greenlet is switched away from another greenlet
teepark/greenhouse
greenhouse/scheduler.py
remove_local_outgoing_hook
def remove_local_outgoing_hook(handler, coro=None): """remove a callback from the outgoing hooks for a particular coro :param handler: the callback previously added via local_outgoing_hook :type handler: function :param coro: the coroutine for which the hook should be removed :type coro: greenlet ...
python
def remove_local_outgoing_hook(handler, coro=None): """remove a callback from the outgoing hooks for a particular coro :param handler: the callback previously added via local_outgoing_hook :type handler: function :param coro: the coroutine for which the hook should be removed :type coro: greenlet ...
[ "def", "remove_local_outgoing_hook", "(", "handler", ",", "coro", "=", "None", ")", ":", "if", "coro", "is", "None", ":", "coro", "=", "compat", ".", "getcurrent", "(", ")", "for", "i", ",", "cb", "in", "enumerate", "(", "state", ".", "local_from_hooks",...
remove a callback from the outgoing hooks for a particular coro :param handler: the callback previously added via local_outgoing_hook :type handler: function :param coro: the coroutine for which the hook should be removed :type coro: greenlet :returns: bool, whether the handler was found and remov...
[ "remove", "a", "callback", "from", "the", "outgoing", "hooks", "for", "a", "particular", "coro" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L889-L908
train
remove a callback from the outgoing hooks for a particular coroutine
teepark/greenhouse
greenhouse/scheduler.py
set_ignore_interrupts
def set_ignore_interrupts(flag=True): """turn off EINTR-raising from emulated syscalls on interruption by signals due to the nature of greenhouse's system call emulation, ``signal.siginterrupt`` can't be made to work with it. specifically, greenhouse can't differentiate between different signals. so th...
python
def set_ignore_interrupts(flag=True): """turn off EINTR-raising from emulated syscalls on interruption by signals due to the nature of greenhouse's system call emulation, ``signal.siginterrupt`` can't be made to work with it. specifically, greenhouse can't differentiate between different signals. so th...
[ "def", "set_ignore_interrupts", "(", "flag", "=", "True", ")", ":", "log", ".", "info", "(", "\"setting ignore_interrupts to %r\"", "%", "flag", ")", "state", ".", "ignore_interrupts", "=", "bool", "(", "flag", ")" ]
turn off EINTR-raising from emulated syscalls on interruption by signals due to the nature of greenhouse's system call emulation, ``signal.siginterrupt`` can't be made to work with it. specifically, greenhouse can't differentiate between different signals. so this function toggles whether to restart fo...
[ "turn", "off", "EINTR", "-", "raising", "from", "emulated", "syscalls", "on", "interruption", "by", "signals" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L911-L924
train
turn off EINTR - raised from emulated syscalls on interruption by signals
teepark/greenhouse
greenhouse/scheduler.py
reset_poller
def reset_poller(poll=None): """replace the scheduler's poller, throwing away any pre-existing state this is only really a good idea in the new child process after a fork(2). """ state.poller = poll or poller.best() log.info("resetting fd poller, using %s" % type(state.poller).__name__)
python
def reset_poller(poll=None): """replace the scheduler's poller, throwing away any pre-existing state this is only really a good idea in the new child process after a fork(2). """ state.poller = poll or poller.best() log.info("resetting fd poller, using %s" % type(state.poller).__name__)
[ "def", "reset_poller", "(", "poll", "=", "None", ")", ":", "state", ".", "poller", "=", "poll", "or", "poller", ".", "best", "(", ")", "log", ".", "info", "(", "\"resetting fd poller, using %s\"", "%", "type", "(", "state", ".", "poller", ")", ".", "__...
replace the scheduler's poller, throwing away any pre-existing state this is only really a good idea in the new child process after a fork(2).
[ "replace", "the", "scheduler", "s", "poller", "throwing", "away", "any", "pre", "-", "existing", "state" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L927-L933
train
replace the scheduler s poller throwing away any pre - existing state
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/api.py
API.Call
def Call(method,url,payload,silent=False,hide_errors=[],session=None,recursion_cnt=0,debug=False): """Execute v1 API call. :param url: URL paths associated with the API call :param payload: dict containing all parameters to submit with POST call :param hide_errors: list of API error codes to ignore. These are...
python
def Call(method,url,payload,silent=False,hide_errors=[],session=None,recursion_cnt=0,debug=False): """Execute v1 API call. :param url: URL paths associated with the API call :param payload: dict containing all parameters to submit with POST call :param hide_errors: list of API error codes to ignore. These are...
[ "def", "Call", "(", "method", ",", "url", ",", "payload", ",", "silent", "=", "False", ",", "hide_errors", "=", "[", "]", ",", "session", "=", "None", ",", "recursion_cnt", "=", "0", ",", "debug", "=", "False", ")", ":", "if", "not", "clc", ".", ...
Execute v1 API call. :param url: URL paths associated with the API call :param payload: dict containing all parameters to submit with POST call :param hide_errors: list of API error codes to ignore. These are not http error codes but returned from the API itself :param recursion_cnt: recursion counter. This ...
[ "Execute", "v1", "API", "call", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/api.py#L76-L137
train
Execute v1 API call.
nickpandolfi/Cyther
cyther/tools.py
process_output
def process_output(output, *, condense=False, one=False, default=None, default_if_multiple=True, default_if_none=True): """ Taking a iterative container (list, tuple), this function will process its contents and condense if necessary. It also has functionality to try to assure that th...
python
def process_output(output, *, condense=False, one=False, default=None, default_if_multiple=True, default_if_none=True): """ Taking a iterative container (list, tuple), this function will process its contents and condense if necessary. It also has functionality to try to assure that th...
[ "def", "process_output", "(", "output", ",", "*", ",", "condense", "=", "False", ",", "one", "=", "False", ",", "default", "=", "None", ",", "default_if_multiple", "=", "True", ",", "default_if_none", "=", "True", ")", ":", "if", "condense", ":", "output...
Taking a iterative container (list, tuple), this function will process its contents and condense if necessary. It also has functionality to try to assure that the output has only one item in it if desired. If this is not the case, then it will return a 'default' in place of the output, if specified.
[ "Taking", "a", "iterative", "container", "(", "list", "tuple", ")", "this", "function", "will", "process", "its", "contents", "and", "condense", "if", "necessary", ".", "It", "also", "has", "functionality", "to", "try", "to", "assure", "that", "the", "output...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L45-L71
train
This function takes a list of items and returns a list of items.
nickpandolfi/Cyther
cyther/tools.py
assert_output
def assert_output(output, assert_equal): """ Check that two outputs have the same contents as one another, even if they aren't sorted yet """ sorted_output = sorted(output) sorted_assert = sorted(assert_equal) if sorted_output != sorted_assert: raise ValueError(ASSERT_ERROR.format(so...
python
def assert_output(output, assert_equal): """ Check that two outputs have the same contents as one another, even if they aren't sorted yet """ sorted_output = sorted(output) sorted_assert = sorted(assert_equal) if sorted_output != sorted_assert: raise ValueError(ASSERT_ERROR.format(so...
[ "def", "assert_output", "(", "output", ",", "assert_equal", ")", ":", "sorted_output", "=", "sorted", "(", "output", ")", "sorted_assert", "=", "sorted", "(", "assert_equal", ")", "if", "sorted_output", "!=", "sorted_assert", ":", "raise", "ValueError", "(", "...
Check that two outputs have the same contents as one another, even if they aren't sorted yet
[ "Check", "that", "two", "outputs", "have", "the", "same", "contents", "as", "one", "another", "even", "if", "they", "aren", "t", "sorted", "yet" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L78-L86
train
Check that two outputs have the same contents as one another.
nickpandolfi/Cyther
cyther/tools.py
write_dict_to_file
def write_dict_to_file(file_path, obj): """ Write a dictionary of string keys to a file """ lines = [] for key, value in obj.items(): lines.append(key + ':' + repr(value) + '\n') with open(file_path, 'w+') as file: file.writelines(lines) return None
python
def write_dict_to_file(file_path, obj): """ Write a dictionary of string keys to a file """ lines = [] for key, value in obj.items(): lines.append(key + ':' + repr(value) + '\n') with open(file_path, 'w+') as file: file.writelines(lines) return None
[ "def", "write_dict_to_file", "(", "file_path", ",", "obj", ")", ":", "lines", "=", "[", "]", "for", "key", ",", "value", "in", "obj", ".", "items", "(", ")", ":", "lines", ".", "append", "(", "key", "+", "':'", "+", "repr", "(", "value", ")", "+"...
Write a dictionary of string keys to a file
[ "Write", "a", "dictionary", "of", "string", "keys", "to", "a", "file" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L89-L100
train
Write a dictionary of string keys to a file
nickpandolfi/Cyther
cyther/tools.py
read_dict_from_file
def read_dict_from_file(file_path): """ Read a dictionary of strings from a file """ with open(file_path) as file: lines = file.read().splitlines() obj = {} for line in lines: key, value = line.split(':', maxsplit=1) obj[key] = eval(value) return obj
python
def read_dict_from_file(file_path): """ Read a dictionary of strings from a file """ with open(file_path) as file: lines = file.read().splitlines() obj = {} for line in lines: key, value = line.split(':', maxsplit=1) obj[key] = eval(value) return obj
[ "def", "read_dict_from_file", "(", "file_path", ")", ":", "with", "open", "(", "file_path", ")", "as", "file", ":", "lines", "=", "file", ".", "read", "(", ")", ".", "splitlines", "(", ")", "obj", "=", "{", "}", "for", "line", "in", "lines", ":", "...
Read a dictionary of strings from a file
[ "Read", "a", "dictionary", "of", "strings", "from", "a", "file" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L103-L115
train
Read a dictionary of strings from a file
nickpandolfi/Cyther
cyther/tools.py
get_input
def get_input(prompt, check, *, redo_prompt=None, repeat_prompt=False): """ Ask the user to input something on the terminal level, check their response and ask again if they didn't answer correctly """ if isinstance(check, str): check = (check,) to_join = [] for item in check: ...
python
def get_input(prompt, check, *, redo_prompt=None, repeat_prompt=False): """ Ask the user to input something on the terminal level, check their response and ask again if they didn't answer correctly """ if isinstance(check, str): check = (check,) to_join = [] for item in check: ...
[ "def", "get_input", "(", "prompt", ",", "check", ",", "*", ",", "redo_prompt", "=", "None", ",", "repeat_prompt", "=", "False", ")", ":", "if", "isinstance", "(", "check", ",", "str", ")", ":", "check", "=", "(", "check", ",", ")", "to_join", "=", ...
Ask the user to input something on the terminal level, check their response and ask again if they didn't answer correctly
[ "Ask", "the", "user", "to", "input", "something", "on", "the", "terminal", "level", "check", "their", "response", "and", "ask", "again", "if", "they", "didn", "t", "answer", "correctly" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L121-L155
train
Ask the user to input something on the terminal level check their response and ask again if they didn t answer correctly
nickpandolfi/Cyther
cyther/tools.py
get_choice
def get_choice(prompt, choices): """ Asks for a single choice out of multiple items. Given those items, and a prompt to ask the user with """ print() checker = [] for offset, choice in enumerate(choices): number = offset + 1 print("\t{}): '{}'\n".format(number, choice)) ...
python
def get_choice(prompt, choices): """ Asks for a single choice out of multiple items. Given those items, and a prompt to ask the user with """ print() checker = [] for offset, choice in enumerate(choices): number = offset + 1 print("\t{}): '{}'\n".format(number, choice)) ...
[ "def", "get_choice", "(", "prompt", ",", "choices", ")", ":", "print", "(", ")", "checker", "=", "[", "]", "for", "offset", ",", "choice", "in", "enumerate", "(", "choices", ")", ":", "number", "=", "offset", "+", "1", "print", "(", "\"\\t{}): '{}'\\n\...
Asks for a single choice out of multiple items. Given those items, and a prompt to ask the user with
[ "Asks", "for", "a", "single", "choice", "out", "of", "multiple", "items", ".", "Given", "those", "items", "and", "a", "prompt", "to", "ask", "the", "user", "with" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L158-L178
train
Asks for a single choice out of multiple items and a prompt to ask the user with the user with the specified choices.
nickpandolfi/Cyther
cyther/tools.py
generateBatches
def generateBatches(tasks, givens): """ A function to generate a batch of commands to run in a specific order as to meet all the dependencies for each command. For example, the commands with no dependencies are run first, and the commands with the most deep dependencies are run last """ _rem...
python
def generateBatches(tasks, givens): """ A function to generate a batch of commands to run in a specific order as to meet all the dependencies for each command. For example, the commands with no dependencies are run first, and the commands with the most deep dependencies are run last """ _rem...
[ "def", "generateBatches", "(", "tasks", ",", "givens", ")", ":", "_removeGivensFromTasks", "(", "tasks", ",", "givens", ")", "batches", "=", "[", "]", "while", "tasks", ":", "batch", "=", "set", "(", ")", "for", "task", ",", "dependencies", "in", "tasks"...
A function to generate a batch of commands to run in a specific order as to meet all the dependencies for each command. For example, the commands with no dependencies are run first, and the commands with the most deep dependencies are run last
[ "A", "function", "to", "generate", "a", "batch", "of", "commands", "to", "run", "in", "a", "specific", "order", "as", "to", "meet", "all", "the", "dependencies", "for", "each", "command", ".", "For", "example", "the", "commands", "with", "no", "dependencie...
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/tools.py#L191-L219
train
Generates a list of batches of commands that meet all the dependencies for each command in the tasks list.
thilux/tvdb_client
tvdb_client/utils/utils.py
query_param_string_from_option_args
def query_param_string_from_option_args(a2q_dict, args_dict): """ From a dictionary of arguments to query string parameters, loops through ad arguments list and makes a query string. :param a2q_dict: a dictionary containing argument_name > query string parameter name. :param args_dict: a dictionary cont...
python
def query_param_string_from_option_args(a2q_dict, args_dict): """ From a dictionary of arguments to query string parameters, loops through ad arguments list and makes a query string. :param a2q_dict: a dictionary containing argument_name > query string parameter name. :param args_dict: a dictionary cont...
[ "def", "query_param_string_from_option_args", "(", "a2q_dict", ",", "args_dict", ")", ":", "name_value_pairs", "=", "dict", "(", ")", "for", "ak", "in", "a2q_dict", ".", "keys", "(", ")", ":", "value", "=", "args_dict", "[", "ak", "]", "if", "value", "!=",...
From a dictionary of arguments to query string parameters, loops through ad arguments list and makes a query string. :param a2q_dict: a dictionary containing argument_name > query string parameter name. :param args_dict: a dictionary containing the argument_name > argument_value :return: a query string.
[ "From", "a", "dictionary", "of", "arguments", "to", "query", "string", "parameters", "loops", "through", "ad", "arguments", "list", "and", "makes", "a", "query", "string", ".", ":", "param", "a2q_dict", ":", "a", "dictionary", "containing", "argument_name", ">...
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/utils/utils.py#L6-L20
train
This function takes a dictionary of arguments to query string parameters and returns a query string.
thilux/tvdb_client
tvdb_client/utils/utils.py
make_str_content
def make_str_content(content): """ In python3+ requests.Response.content returns bytes instead of ol'good str. :param content: requests.Response.content :return: str representation of the requests.Response.content data """ if not isinstance(content, str): content = str(content.decode()) ...
python
def make_str_content(content): """ In python3+ requests.Response.content returns bytes instead of ol'good str. :param content: requests.Response.content :return: str representation of the requests.Response.content data """ if not isinstance(content, str): content = str(content.decode()) ...
[ "def", "make_str_content", "(", "content", ")", ":", "if", "not", "isinstance", "(", "content", ",", "str", ")", ":", "content", "=", "str", "(", "content", ".", "decode", "(", ")", ")", "return", "content" ]
In python3+ requests.Response.content returns bytes instead of ol'good str. :param content: requests.Response.content :return: str representation of the requests.Response.content data
[ "In", "python3", "+", "requests", ".", "Response", ".", "content", "returns", "bytes", "instead", "of", "ol", "good", "str", ".", ":", "param", "content", ":", "requests", ".", "Response", ".", "content", ":", "return", ":", "str", "representation", "of", ...
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/utils/utils.py#L23-L31
train
In python3 + requests. Response. content returns bytes instead of ol'good str.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Groups.Get
def Get(self,key): """Get group by providing name, ID, description or other unique key. If key is not unique and finds multiple matches only the first will be returned >>> clc.v2.Datacenter().Groups().Get("Default Group") <clc.APIv2.group.Group object at 0x1065e5250> """ for group in self.groups: i...
python
def Get(self,key): """Get group by providing name, ID, description or other unique key. If key is not unique and finds multiple matches only the first will be returned >>> clc.v2.Datacenter().Groups().Get("Default Group") <clc.APIv2.group.Group object at 0x1065e5250> """ for group in self.groups: i...
[ "def", "Get", "(", "self", ",", "key", ")", ":", "for", "group", "in", "self", ".", "groups", ":", "if", "group", ".", "id", ".", "lower", "(", ")", "==", "key", ".", "lower", "(", ")", ":", "return", "(", "group", ")", "elif", "group", ".", ...
Get group by providing name, ID, description or other unique key. If key is not unique and finds multiple matches only the first will be returned >>> clc.v2.Datacenter().Groups().Get("Default Group") <clc.APIv2.group.Group object at 0x1065e5250>
[ "Get", "group", "by", "providing", "name", "ID", "description", "or", "other", "unique", "key", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L65-L81
train
Get group by providing name ID description or other unique key.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Groups.Search
def Search(self,key): """Search group list by providing partial name, ID, description or other key. >>> clc.v2.Datacenter().Groups().Search("Default Group") [<clc.APIv2.group.Group object at 0x1065b0f50>, <clc.APIv2.group.Group object at 0x1065b0d10>] """ results = [] for group in self.groups: if grou...
python
def Search(self,key): """Search group list by providing partial name, ID, description or other key. >>> clc.v2.Datacenter().Groups().Search("Default Group") [<clc.APIv2.group.Group object at 0x1065b0f50>, <clc.APIv2.group.Group object at 0x1065b0d10>] """ results = [] for group in self.groups: if grou...
[ "def", "Search", "(", "self", ",", "key", ")", ":", "results", "=", "[", "]", "for", "group", "in", "self", ".", "groups", ":", "if", "group", ".", "id", ".", "lower", "(", ")", ".", "find", "(", "key", ".", "lower", "(", ")", ")", "!=", "-",...
Search group list by providing partial name, ID, description or other key. >>> clc.v2.Datacenter().Groups().Search("Default Group") [<clc.APIv2.group.Group object at 0x1065b0f50>, <clc.APIv2.group.Group object at 0x1065b0d10>]
[ "Search", "group", "list", "by", "providing", "partial", "name", "ID", "description", "or", "other", "key", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L84-L98
train
Search group list by providing partial name ID description or other key.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.GetAll
def GetAll(root_group_id,alias=None,session=None): """Gets a list of groups within a given account. >>> clc.v2.Group.GetAll("wa1-4416") [<clc.APIv2.group.Group object at 0x1065b0190>, <clc.APIv2.group.Group object at 0x1065b0dd0>] """ if not alias: alias = clc.v2.Account.GetAlias(session=session) groups...
python
def GetAll(root_group_id,alias=None,session=None): """Gets a list of groups within a given account. >>> clc.v2.Group.GetAll("wa1-4416") [<clc.APIv2.group.Group object at 0x1065b0190>, <clc.APIv2.group.Group object at 0x1065b0dd0>] """ if not alias: alias = clc.v2.Account.GetAlias(session=session) groups...
[ "def", "GetAll", "(", "root_group_id", ",", "alias", "=", "None", ",", "session", "=", "None", ")", ":", "if", "not", "alias", ":", "alias", "=", "clc", ".", "v2", ".", "Account", ".", "GetAlias", "(", "session", "=", "session", ")", "groups", "=", ...
Gets a list of groups within a given account. >>> clc.v2.Group.GetAll("wa1-4416") [<clc.APIv2.group.Group object at 0x1065b0190>, <clc.APIv2.group.Group object at 0x1065b0dd0>]
[ "Gets", "a", "list", "of", "groups", "within", "a", "given", "account", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L105-L118
train
Gets a list of groups within a given account.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.Refresh
def Refresh(self): """Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh() """ self.dirty = False self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session) self.data['changeInfo']['createdDate'] = clc.v2.time_utils....
python
def Refresh(self): """Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh() """ self.dirty = False self.data = clc.v2.API.Call('GET','groups/%s/%s' % (self.alias,self.id), session=self.session) self.data['changeInfo']['createdDate'] = clc.v2.time_utils....
[ "def", "Refresh", "(", "self", ")", ":", "self", ".", "dirty", "=", "False", "self", ".", "data", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "'groups/%s/%s'", "%", "(", "self", ".", "alias", ",", "self", ".", "id", ")", ...
Reloads the group object to synchronize with cloud representation. >>> clc.v2.Group("wa-1234").Refresh()
[ "Reloads", "the", "group", "object", "to", "synchronize", "with", "cloud", "representation", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L152-L163
train
Reloads the group object to synchronize with cloud representation.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.Defaults
def Defaults(self,key): """Returns default configurations for resources deployed to this group. If specified key is not defined returns None. # {"cpu":{"inherited":false},"memoryGB":{"inherited":false},"networkId":{"inherited":false}, # "primaryDns":{"value":"172.17.1.26","inherited":true},"secondaryDns":{"va...
python
def Defaults(self,key): """Returns default configurations for resources deployed to this group. If specified key is not defined returns None. # {"cpu":{"inherited":false},"memoryGB":{"inherited":false},"networkId":{"inherited":false}, # "primaryDns":{"value":"172.17.1.26","inherited":true},"secondaryDns":{"va...
[ "def", "Defaults", "(", "self", ",", "key", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'defaults'", ")", ":", "self", ".", "defaults", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "'groups/%s/%s/defaults'", "%", "(", ...
Returns default configurations for resources deployed to this group. If specified key is not defined returns None. # {"cpu":{"inherited":false},"memoryGB":{"inherited":false},"networkId":{"inherited":false}, # "primaryDns":{"value":"172.17.1.26","inherited":true},"secondaryDns":{"value":"172.17.1.27","inherited...
[ "Returns", "default", "configurations", "for", "resources", "deployed", "to", "this", "group", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L166-L181
train
Returns default configurations for resources deployed to this group.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.Subgroups
def Subgroups(self): """Returns a Groups object containing all child groups. >>> clc.v2.Group("wa1-4416").Subgroups() <clc.APIv2.group.Groups object at 0x105fa27d0> """ return(Groups(alias=self.alias,groups_lst=self.data['groups'],session=self.session))
python
def Subgroups(self): """Returns a Groups object containing all child groups. >>> clc.v2.Group("wa1-4416").Subgroups() <clc.APIv2.group.Groups object at 0x105fa27d0> """ return(Groups(alias=self.alias,groups_lst=self.data['groups'],session=self.session))
[ "def", "Subgroups", "(", "self", ")", ":", "return", "(", "Groups", "(", "alias", "=", "self", ".", "alias", ",", "groups_lst", "=", "self", ".", "data", "[", "'groups'", "]", ",", "session", "=", "self", ".", "session", ")", ")" ]
Returns a Groups object containing all child groups. >>> clc.v2.Group("wa1-4416").Subgroups() <clc.APIv2.group.Groups object at 0x105fa27d0>
[ "Returns", "a", "Groups", "object", "containing", "all", "child", "groups", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L184-L192
train
Returns a Groups object containing all child groups.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.Servers
def Servers(self): """Returns a Servers object containing all servers within the group. >>> clc.v2.Group("wa1-4416").Servers() <clc.APIv2.server.Servers object at 0x1065b0f10> """ return(clc.v2.Servers( alias=self.alias, servers_lst=[obj['id'] for obj in self.data['links'] if obj['rel']=='server'], ...
python
def Servers(self): """Returns a Servers object containing all servers within the group. >>> clc.v2.Group("wa1-4416").Servers() <clc.APIv2.server.Servers object at 0x1065b0f10> """ return(clc.v2.Servers( alias=self.alias, servers_lst=[obj['id'] for obj in self.data['links'] if obj['rel']=='server'], ...
[ "def", "Servers", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "Servers", "(", "alias", "=", "self", ".", "alias", ",", "servers_lst", "=", "[", "obj", "[", "'id'", "]", "for", "obj", "in", "self", ".", "data", "[", "'links'", "]"...
Returns a Servers object containing all servers within the group. >>> clc.v2.Group("wa1-4416").Servers() <clc.APIv2.server.Servers object at 0x1065b0f10>
[ "Returns", "a", "Servers", "object", "containing", "all", "servers", "within", "the", "group", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L224-L235
train
Returns a new Servers object containing all servers within the group.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/group.py
Group.Create
def Create(self,name,description=None): """Creates a new group >>> clc.v2.Datacenter(location="WA1").RootGroup().Create("Test3","Description3") <clc.APIv2.group.Group object at 0x10cc76c90> >>> print _ Test5 """ if not description: description = name r = clc.v2.API.Call( 'POST', 'groups/%s' %...
python
def Create(self,name,description=None): """Creates a new group >>> clc.v2.Datacenter(location="WA1").RootGroup().Create("Test3","Description3") <clc.APIv2.group.Group object at 0x10cc76c90> >>> print _ Test5 """ if not description: description = name r = clc.v2.API.Call( 'POST', 'groups/%s' %...
[ "def", "Create", "(", "self", ",", "name", ",", "description", "=", "None", ")", ":", "if", "not", "description", ":", "description", "=", "name", "r", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'POST'", ",", "'groups/%s'", "%", "(", "se...
Creates a new group >>> clc.v2.Datacenter(location="WA1").RootGroup().Create("Test3","Description3") <clc.APIv2.group.Group object at 0x10cc76c90> >>> print _ Test5
[ "Creates", "a", "new", "group" ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/group.py#L249-L266
train
Create a new group.
fiduswriter/django-npm-mjs
npm_mjs/templatetags/transpile.py
static_urls_js
def static_urls_js(): """ Add global variables to JavaScript about the location and latest version of transpiled files. Usage:: {% static_urls_js %} """ if apps.is_installed('django.contrib.staticfiles'): from django.contrib.staticfiles.storage import staticfiles_storage ...
python
def static_urls_js(): """ Add global variables to JavaScript about the location and latest version of transpiled files. Usage:: {% static_urls_js %} """ if apps.is_installed('django.contrib.staticfiles'): from django.contrib.staticfiles.storage import staticfiles_storage ...
[ "def", "static_urls_js", "(", ")", ":", "if", "apps", ".", "is_installed", "(", "'django.contrib.staticfiles'", ")", ":", "from", "django", ".", "contrib", ".", "staticfiles", ".", "storage", "import", "staticfiles_storage", "static_base_url", "=", "staticfiles_stor...
Add global variables to JavaScript about the location and latest version of transpiled files. Usage:: {% static_urls_js %}
[ "Add", "global", "variables", "to", "JavaScript", "about", "the", "location", "and", "latest", "version", "of", "transpiled", "files", ".", "Usage", "::", "{", "%", "static_urls_js", "%", "}" ]
5d9758325f2b2f389df776dce17ac471d35ec80b
https://github.com/fiduswriter/django-npm-mjs/blob/5d9758325f2b2f389df776dce17ac471d35ec80b/npm_mjs/templatetags/transpile.py#L54-L71
train
Add global variables to JavaScript about the location and latest version of the transpiled files.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/queue.py
Queue.List
def List(type='All'): """List of Queued requests and their current status details. https://t3n.zendesk.com/entries/20350251-List-Queue-Requests :param type: list items in the queue filtered by status (All, Pending, Complete, Error) """ r = clc.v1.API.Call('post','Queue/ListQueueRequests',{'ItemStatusType': ...
python
def List(type='All'): """List of Queued requests and their current status details. https://t3n.zendesk.com/entries/20350251-List-Queue-Requests :param type: list items in the queue filtered by status (All, Pending, Complete, Error) """ r = clc.v1.API.Call('post','Queue/ListQueueRequests',{'ItemStatusType': ...
[ "def", "List", "(", "type", "=", "'All'", ")", ":", "r", "=", "clc", ".", "v1", ".", "API", ".", "Call", "(", "'post'", ",", "'Queue/ListQueueRequests'", ",", "{", "'ItemStatusType'", ":", "Queue", ".", "item_status_type_map", "[", "type", "]", "}", ")...
List of Queued requests and their current status details. https://t3n.zendesk.com/entries/20350251-List-Queue-Requests :param type: list items in the queue filtered by status (All, Pending, Complete, Error)
[ "List", "of", "Queued", "requests", "and", "their", "current", "status", "details", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/queue.py#L18-L26
train
List Queued Requests and their current status details.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/queue.py
Queue.GetStatus
def GetStatus(request_id,silent=False): """Gets the status of the specified Blueprint deployment. https://t3n.zendesk.com/entries/20345638-Get-Request-Status :param request_id: the Request ID returned by any of the operations which Queues an async request to perform any given task :param silent: optionally di...
python
def GetStatus(request_id,silent=False): """Gets the status of the specified Blueprint deployment. https://t3n.zendesk.com/entries/20345638-Get-Request-Status :param request_id: the Request ID returned by any of the operations which Queues an async request to perform any given task :param silent: optionally di...
[ "def", "GetStatus", "(", "request_id", ",", "silent", "=", "False", ")", ":", "r", "=", "clc", ".", "v1", ".", "API", ".", "Call", "(", "'post'", ",", "'Queue/GetRequestStatus'", ",", "{", "'RequestID'", ":", "request_id", "}", ",", "silent", "=", "sil...
Gets the status of the specified Blueprint deployment. https://t3n.zendesk.com/entries/20345638-Get-Request-Status :param request_id: the Request ID returned by any of the operations which Queues an async request to perform any given task :param silent: optionally disable all status messages when run in CLI mod...
[ "Gets", "the", "status", "of", "the", "specified", "Blueprint", "deployment", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/queue.py#L30-L39
train
Gets the status of the specified Blueprint deployment.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Networks._Load
def _Load(self,location): """Load all networks associated with the given location. https://www.centurylinkcloud.com/api-docs/v2/#get-network-list#request """ # https://api.ctl.io/v2-experimental/networks/ALIAS/WA1 for network in clc.v2.API.Call('GET','/v2-experimental/networks/%s/%s' % (self.alias,location)...
python
def _Load(self,location): """Load all networks associated with the given location. https://www.centurylinkcloud.com/api-docs/v2/#get-network-list#request """ # https://api.ctl.io/v2-experimental/networks/ALIAS/WA1 for network in clc.v2.API.Call('GET','/v2-experimental/networks/%s/%s' % (self.alias,location)...
[ "def", "_Load", "(", "self", ",", "location", ")", ":", "# https://api.ctl.io/v2-experimental/networks/ALIAS/WA1", "for", "network", "in", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "'/v2-experimental/networks/%s/%s'", "%", "(", "self", ".", "...
Load all networks associated with the given location. https://www.centurylinkcloud.com/api-docs/v2/#get-network-list#request
[ "Load", "all", "networks", "associated", "with", "the", "given", "location", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L51-L59
train
Load all networks associated with the given location.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Networks.Get
def Get(self,key): """Get network by providing name, ID, or other unique key. If key is not unique and finds multiple matches only the first will be returned """ for network in self.networks: try: if network.id == key: return(network) if network.name == key: return(network) if network.cidr ...
python
def Get(self,key): """Get network by providing name, ID, or other unique key. If key is not unique and finds multiple matches only the first will be returned """ for network in self.networks: try: if network.id == key: return(network) if network.name == key: return(network) if network.cidr ...
[ "def", "Get", "(", "self", ",", "key", ")", ":", "for", "network", "in", "self", ".", "networks", ":", "try", ":", "if", "network", ".", "id", "==", "key", ":", "return", "(", "network", ")", "if", "network", ".", "name", "==", "key", ":", "retur...
Get network by providing name, ID, or other unique key. If key is not unique and finds multiple matches only the first will be returned
[ "Get", "network", "by", "providing", "name", "ID", "or", "other", "unique", "key", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L62-L76
train
Get network by providing name ID or other unique key.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Network.Create
def Create(alias=None,location=None,session=None): """Claims a new network within a given account. https://www.ctl.io/api-docs/v2/#networks-claim-network Returns operation id and link to check status """ if not alias: alias = clc.v2.Account.GetAlias(session=session) if not location: location = clc.v2.A...
python
def Create(alias=None,location=None,session=None): """Claims a new network within a given account. https://www.ctl.io/api-docs/v2/#networks-claim-network Returns operation id and link to check status """ if not alias: alias = clc.v2.Account.GetAlias(session=session) if not location: location = clc.v2.A...
[ "def", "Create", "(", "alias", "=", "None", ",", "location", "=", "None", ",", "session", "=", "None", ")", ":", "if", "not", "alias", ":", "alias", "=", "clc", ".", "v2", ".", "Account", ".", "GetAlias", "(", "session", "=", "session", ")", "if", ...
Claims a new network within a given account. https://www.ctl.io/api-docs/v2/#networks-claim-network Returns operation id and link to check status
[ "Claims", "a", "new", "network", "within", "a", "given", "account", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L102-L116
train
Claims a new network within a given account.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Network.Delete
def Delete(self,location=None): """Releases the calling network. https://www.ctl.io/api-docs/v2/#networks-release-network Returns a 204 and no content """ if not location: location = clc.v2.Account.GetLocation(session=self.session) return clc.v2.API.Call('POST','/v2-experimental/networks/%s/%s/%s/relea...
python
def Delete(self,location=None): """Releases the calling network. https://www.ctl.io/api-docs/v2/#networks-release-network Returns a 204 and no content """ if not location: location = clc.v2.Account.GetLocation(session=self.session) return clc.v2.API.Call('POST','/v2-experimental/networks/%s/%s/%s/relea...
[ "def", "Delete", "(", "self", ",", "location", "=", "None", ")", ":", "if", "not", "location", ":", "location", "=", "clc", ".", "v2", ".", "Account", ".", "GetLocation", "(", "session", "=", "self", ".", "session", ")", "return", "clc", ".", "v2", ...
Releases the calling network. https://www.ctl.io/api-docs/v2/#networks-release-network Returns a 204 and no content
[ "Releases", "the", "calling", "network", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L118-L129
train
Releases the calling network.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Network.Update
def Update(self,name,description=None,location=None): """Updates the attributes of a given Network via PUT. https://www.ctl.io/api-docs/v2/#networks-update-network { "name": "VLAN for Development Servers", "description": "Development Servers on 11.22.33.0/24" } Returns a 204 and no content ""...
python
def Update(self,name,description=None,location=None): """Updates the attributes of a given Network via PUT. https://www.ctl.io/api-docs/v2/#networks-update-network { "name": "VLAN for Development Servers", "description": "Development Servers on 11.22.33.0/24" } Returns a 204 and no content ""...
[ "def", "Update", "(", "self", ",", "name", ",", "description", "=", "None", ",", "location", "=", "None", ")", ":", "if", "not", "location", ":", "location", "=", "clc", ".", "v2", ".", "Account", ".", "GetLocation", "(", "session", "=", "self", ".",...
Updates the attributes of a given Network via PUT. https://www.ctl.io/api-docs/v2/#networks-update-network { "name": "VLAN for Development Servers", "description": "Development Servers on 11.22.33.0/24" } Returns a 204 and no content
[ "Updates", "the", "attributes", "of", "a", "given", "Network", "via", "PUT", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L131-L152
train
Updates the attributes of a given Network.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Network.Refresh
def Refresh(self, location=None): """Reloads the network object to synchronize with cloud representation. >>> clc.v2.Network("f58148729bd94b02ae8b652f5c5feba3").Refresh() GET https://api.ctl.io/v2-experimental/networks/{accountAlias}/{dataCenter}/{Network}?ipAddresses=none|claimed|free|all """ if not locati...
python
def Refresh(self, location=None): """Reloads the network object to synchronize with cloud representation. >>> clc.v2.Network("f58148729bd94b02ae8b652f5c5feba3").Refresh() GET https://api.ctl.io/v2-experimental/networks/{accountAlias}/{dataCenter}/{Network}?ipAddresses=none|claimed|free|all """ if not locati...
[ "def", "Refresh", "(", "self", ",", "location", "=", "None", ")", ":", "if", "not", "location", ":", "location", "=", "clc", ".", "v2", ".", "Account", ".", "GetLocation", "(", "session", "=", "self", ".", "session", ")", "new_object", "=", "clc", "....
Reloads the network object to synchronize with cloud representation. >>> clc.v2.Network("f58148729bd94b02ae8b652f5c5feba3").Refresh() GET https://api.ctl.io/v2-experimental/networks/{accountAlias}/{dataCenter}/{Network}?ipAddresses=none|claimed|free|all
[ "Reloads", "the", "network", "object", "to", "synchronize", "with", "cloud", "representation", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L154-L167
train
Reloads the network object to synchronize with cloud representation.
biocommons/uta-align
setup.py
install_build_requires
def install_build_requires(pkg_targets): """Iterate through build_requires list and pip install if package is not present accounting for version""" def pip_install(pkg_name, pkg_vers=None): pkg_name_version = '%s==%s' % (pkg_name, pkg_vers) if pkg_vers else pkg_name print '[WARNING] %s not ...
python
def install_build_requires(pkg_targets): """Iterate through build_requires list and pip install if package is not present accounting for version""" def pip_install(pkg_name, pkg_vers=None): pkg_name_version = '%s==%s' % (pkg_name, pkg_vers) if pkg_vers else pkg_name print '[WARNING] %s not ...
[ "def", "install_build_requires", "(", "pkg_targets", ")", ":", "def", "pip_install", "(", "pkg_name", ",", "pkg_vers", "=", "None", ")", ":", "pkg_name_version", "=", "'%s==%s'", "%", "(", "pkg_name", ",", "pkg_vers", ")", "if", "pkg_vers", "else", "pkg_name",...
Iterate through build_requires list and pip install if package is not present accounting for version
[ "Iterate", "through", "build_requires", "list", "and", "pip", "install", "if", "package", "is", "not", "present", "accounting", "for", "version" ]
c3af0a293bb6ce7d241a8ec9843e4a6bb18d751f
https://github.com/biocommons/uta-align/blob/c3af0a293bb6ce7d241a8ec9843e4a6bb18d751f/setup.py#L32-L61
train
Installs the build_requires list of the specified packages.
nickpandolfi/Cyther
cyther/processing.py
cueExtractAndRun
def cueExtractAndRun(args, file): """ Cues the @cyther code execution procedure """ filename = file['file_path'] if args['execute']: holla = run(filename) else: holla = run(filename, True) return holla
python
def cueExtractAndRun(args, file): """ Cues the @cyther code execution procedure """ filename = file['file_path'] if args['execute']: holla = run(filename) else: holla = run(filename, True) return holla
[ "def", "cueExtractAndRun", "(", "args", ",", "file", ")", ":", "filename", "=", "file", "[", "'file_path'", "]", "if", "args", "[", "'execute'", "]", ":", "holla", "=", "run", "(", "filename", ")", "else", ":", "holla", "=", "run", "(", "filename", "...
Cues the @cyther code execution procedure
[ "Cues", "the" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L12-L21
train
Cues the @cyther code execution procedure
nickpandolfi/Cyther
cyther/processing.py
initiateCompilation
def initiateCompilation(args, file): """ Starts the entire compilation procedure """ ####commands = finalizeCommands(args, file) commands = makeCommands(0, file) if not args['concise'] and args['print_args']: print_commands = bool(args['watch']) response = multiCall(*commands, print_...
python
def initiateCompilation(args, file): """ Starts the entire compilation procedure """ ####commands = finalizeCommands(args, file) commands = makeCommands(0, file) if not args['concise'] and args['print_args']: print_commands = bool(args['watch']) response = multiCall(*commands, print_...
[ "def", "initiateCompilation", "(", "args", ",", "file", ")", ":", "####commands = finalizeCommands(args, file)", "commands", "=", "makeCommands", "(", "0", ",", "file", ")", "if", "not", "args", "[", "'concise'", "]", "and", "args", "[", "'print_args'", "]", "...
Starts the entire compilation procedure
[ "Starts", "the", "entire", "compilation", "procedure" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L24-L33
train
Initiate the entire compilation procedure
nickpandolfi/Cyther
cyther/processing.py
cytherize
def cytherize(args, file): """ Used by core to integrate all the pieces of information, and to interface with the user. Compiles and cleans up. """ if isOutDated(file): if isUpdated(file): response = initiateCompilation(args, file) else: response = {'returncod...
python
def cytherize(args, file): """ Used by core to integrate all the pieces of information, and to interface with the user. Compiles and cleans up. """ if isOutDated(file): if isUpdated(file): response = initiateCompilation(args, file) else: response = {'returncod...
[ "def", "cytherize", "(", "args", ",", "file", ")", ":", "if", "isOutDated", "(", "file", ")", ":", "if", "isUpdated", "(", "file", ")", ":", "response", "=", "initiateCompilation", "(", "args", ",", "file", ")", "else", ":", "response", "=", "{", "'r...
Used by core to integrate all the pieces of information, and to interface with the user. Compiles and cleans up.
[ "Used", "by", "core", "to", "integrate", "all", "the", "pieces", "of", "information", "and", "to", "interface", "with", "the", "user", ".", "Compiles", "and", "cleans", "up", "." ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L36-L137
train
This function is used by core to integrate all the pieces of information and to interface the user with the core. Compiles and cleans up the entire tree.
nickpandolfi/Cyther
cyther/processing.py
run
def run(path, timer=False, repeat=3, number=10000, precision=2): """ Extracts and runs the '@cyther' code from the given file 'path' name """ code = extractAtCyther(path) if not code: output = "There was no '@cyther' code collected from the " \ "file '{}'\n".format(path) ...
python
def run(path, timer=False, repeat=3, number=10000, precision=2): """ Extracts and runs the '@cyther' code from the given file 'path' name """ code = extractAtCyther(path) if not code: output = "There was no '@cyther' code collected from the " \ "file '{}'\n".format(path) ...
[ "def", "run", "(", "path", ",", "timer", "=", "False", ",", "repeat", "=", "3", ",", "number", "=", "10000", ",", "precision", "=", "2", ")", ":", "code", "=", "extractAtCyther", "(", "path", ")", "if", "not", "code", ":", "output", "=", "\"There w...
Extracts and runs the '@cyther' code from the given file 'path' name
[ "Extracts", "and", "runs", "the" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L140-L166
train
Runs the Cython script from the given file path.
nickpandolfi/Cyther
cyther/processing.py
core
def core(args): """ The heart of Cyther, this function controls the main loop, and can be used to perform any Cyther action. You can call if using Cyther from the module level """ args = furtherArgsProcessing(args) numfiles = len(args['filenames']) interval = INTERVAL / numfiles fil...
python
def core(args): """ The heart of Cyther, this function controls the main loop, and can be used to perform any Cyther action. You can call if using Cyther from the module level """ args = furtherArgsProcessing(args) numfiles = len(args['filenames']) interval = INTERVAL / numfiles fil...
[ "def", "core", "(", "args", ")", ":", "args", "=", "furtherArgsProcessing", "(", "args", ")", "numfiles", "=", "len", "(", "args", "[", "'filenames'", "]", ")", "interval", "=", "INTERVAL", "/", "numfiles", "files", "=", "processFiles", "(", "args", ")",...
The heart of Cyther, this function controls the main loop, and can be used to perform any Cyther action. You can call if using Cyther from the module level
[ "The", "heart", "of", "Cyther", "this", "function", "controls", "the", "main", "loop", "and", "can", "be", "used", "to", "perform", "any", "Cyther", "action", ".", "You", "can", "call", "if", "using", "Cyther", "from", "the", "module", "level" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/processing.py#L169-L186
train
This function is the heart of Cyther. It will run the Cyther algorithm in a loop and return the base object.
cltl/KafNafParserPy
KafNafParserPy/header_data.py
Clp.set_timestamp
def set_timestamp(self,timestamp=None): """ Set the timestamp of the linguistic processor, set to None for the current time @type timestamp:string @param timestamp: version of the linguistic processor """ if timestamp is None: import time timestamp...
python
def set_timestamp(self,timestamp=None): """ Set the timestamp of the linguistic processor, set to None for the current time @type timestamp:string @param timestamp: version of the linguistic processor """ if timestamp is None: import time timestamp...
[ "def", "set_timestamp", "(", "self", ",", "timestamp", "=", "None", ")", ":", "if", "timestamp", "is", "None", ":", "import", "time", "timestamp", "=", "time", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%S%Z'", ")", "self", ".", "node", ".", "set", "(", "'ti...
Set the timestamp of the linguistic processor, set to None for the current time @type timestamp:string @param timestamp: version of the linguistic processor
[ "Set", "the", "timestamp", "of", "the", "linguistic", "processor", "set", "to", "None", "for", "the", "current", "time" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L332-L341
train
Set the timestamp of the linguistic processor
cltl/KafNafParserPy
KafNafParserPy/header_data.py
Clp.set_beginTimestamp
def set_beginTimestamp(self,btimestamp=None): """ Set the begin timestamp of the linguistic processor, set to None for the current time @type btimestamp: string @param btimestamp: version of the linguistic processor """ if btimestamp is None: import time ...
python
def set_beginTimestamp(self,btimestamp=None): """ Set the begin timestamp of the linguistic processor, set to None for the current time @type btimestamp: string @param btimestamp: version of the linguistic processor """ if btimestamp is None: import time ...
[ "def", "set_beginTimestamp", "(", "self", ",", "btimestamp", "=", "None", ")", ":", "if", "btimestamp", "is", "None", ":", "import", "time", "btimestamp", "=", "time", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%S%Z'", ")", "self", ".", "node", ".", "set", "("...
Set the begin timestamp of the linguistic processor, set to None for the current time @type btimestamp: string @param btimestamp: version of the linguistic processor
[ "Set", "the", "begin", "timestamp", "of", "the", "linguistic", "processor", "set", "to", "None", "for", "the", "current", "time" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L352-L361
train
Set the begin timestamp of the linguistic processor
cltl/KafNafParserPy
KafNafParserPy/header_data.py
Clp.set_endTimestamp
def set_endTimestamp(self,etimestamp=None): """ Set the end timestamp of the linguistic processor, set to None for the current time @type etimestamp: string @param etimestamp: version of the linguistic processor """ if etimestamp is None: import time ...
python
def set_endTimestamp(self,etimestamp=None): """ Set the end timestamp of the linguistic processor, set to None for the current time @type etimestamp: string @param etimestamp: version of the linguistic processor """ if etimestamp is None: import time ...
[ "def", "set_endTimestamp", "(", "self", ",", "etimestamp", "=", "None", ")", ":", "if", "etimestamp", "is", "None", ":", "import", "time", "etimestamp", "=", "time", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%S%Z'", ")", "self", ".", "node", ".", "set", "(", ...
Set the end timestamp of the linguistic processor, set to None for the current time @type etimestamp: string @param etimestamp: version of the linguistic processor
[ "Set", "the", "end", "timestamp", "of", "the", "linguistic", "processor", "set", "to", "None", "for", "the", "current", "time" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L372-L381
train
Set the end timestamp of the linguistic processor
cltl/KafNafParserPy
KafNafParserPy/header_data.py
CHeader.set_publicId
def set_publicId(self,publicId): ''' Sets the publicId to the public object @param publicId: a publicId (title of article) @type publicId: string ''' publicObj = self.get_public() if publicObj is not None: publicObj.set_publicid(publicId) else:...
python
def set_publicId(self,publicId): ''' Sets the publicId to the public object @param publicId: a publicId (title of article) @type publicId: string ''' publicObj = self.get_public() if publicObj is not None: publicObj.set_publicid(publicId) else:...
[ "def", "set_publicId", "(", "self", ",", "publicId", ")", ":", "publicObj", "=", "self", ".", "get_public", "(", ")", "if", "publicObj", "is", "not", "None", ":", "publicObj", ".", "set_publicid", "(", "publicId", ")", "else", ":", "publicObj", "=", "Cpu...
Sets the publicId to the public object @param publicId: a publicId (title of article) @type publicId: string
[ "Sets", "the", "publicId", "to", "the", "public", "object" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L559-L571
train
Sets the publicId to the public object.
cltl/KafNafParserPy
KafNafParserPy/header_data.py
CHeader.set_uri
def set_uri(self, uri): ''' Sets the uri to the public object @param uri: a uri @type uri: string ''' publicObj = self.get_public() if publicObj is not None: publicObj.set_uri(uri) else: publicObj = Cpublic() publicObj.s...
python
def set_uri(self, uri): ''' Sets the uri to the public object @param uri: a uri @type uri: string ''' publicObj = self.get_public() if publicObj is not None: publicObj.set_uri(uri) else: publicObj = Cpublic() publicObj.s...
[ "def", "set_uri", "(", "self", ",", "uri", ")", ":", "publicObj", "=", "self", ".", "get_public", "(", ")", "if", "publicObj", "is", "not", "None", ":", "publicObj", ".", "set_uri", "(", "uri", ")", "else", ":", "publicObj", "=", "Cpublic", "(", ")",...
Sets the uri to the public object @param uri: a uri @type uri: string
[ "Sets", "the", "uri", "to", "the", "public", "object" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L585-L597
train
Sets the uri to the public object
cltl/KafNafParserPy
KafNafParserPy/header_data.py
CHeader.remove_lp
def remove_lp(self,layer): """ Removes the linguistic processors for a given layer @type layer: string @param layer: the name of the layer """ for this_node in self.node.findall('linguisticProcessors'): if this_node.get('layer') == layer: self....
python
def remove_lp(self,layer): """ Removes the linguistic processors for a given layer @type layer: string @param layer: the name of the layer """ for this_node in self.node.findall('linguisticProcessors'): if this_node.get('layer') == layer: self....
[ "def", "remove_lp", "(", "self", ",", "layer", ")", ":", "for", "this_node", "in", "self", ".", "node", ".", "findall", "(", "'linguisticProcessors'", ")", ":", "if", "this_node", ".", "get", "(", "'layer'", ")", "==", "layer", ":", "self", ".", "node"...
Removes the linguistic processors for a given layer @type layer: string @param layer: the name of the layer
[ "Removes", "the", "linguistic", "processors", "for", "a", "given", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L620-L629
train
Removes the linguistic processors for a given layer.
cltl/KafNafParserPy
KafNafParserPy/header_data.py
CHeader.add_linguistic_processor
def add_linguistic_processor(self, layer ,my_lp): """ Adds a linguistic processor to a certain layer @type layer: string @param layer: the name of the layer @type my_lp: L{Clp} @param my_lp: the linguistic processor """ ## Locate the linguisticProcessor el...
python
def add_linguistic_processor(self, layer ,my_lp): """ Adds a linguistic processor to a certain layer @type layer: string @param layer: the name of the layer @type my_lp: L{Clp} @param my_lp: the linguistic processor """ ## Locate the linguisticProcessor el...
[ "def", "add_linguistic_processor", "(", "self", ",", "layer", ",", "my_lp", ")", ":", "## Locate the linguisticProcessor element for taht layer", "found_lp_obj", "=", "None", "for", "this_lp", "in", "self", ".", "node", ".", "findall", "(", "'linguisticProcessors'", "...
Adds a linguistic processor to a certain layer @type layer: string @param layer: the name of the layer @type my_lp: L{Clp} @param my_lp: the linguistic processor
[ "Adds", "a", "linguistic", "processor", "to", "a", "certain", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L631-L652
train
Adds a linguistic processor to a certain layer.
cltl/KafNafParserPy
KafNafParserPy/header_data.py
CHeader.get_fileDesc
def get_fileDesc(self): ''' Returns the fileDesc object or None if there is no such element @return: the fileDesc object @rtype: L{CfileDesc} ''' node = self.node.find('fileDesc') if node is not None: return CfileDesc(node=node) else: ...
python
def get_fileDesc(self): ''' Returns the fileDesc object or None if there is no such element @return: the fileDesc object @rtype: L{CfileDesc} ''' node = self.node.find('fileDesc') if node is not None: return CfileDesc(node=node) else: ...
[ "def", "get_fileDesc", "(", "self", ")", ":", "node", "=", "self", ".", "node", ".", "find", "(", "'fileDesc'", ")", "if", "node", "is", "not", "None", ":", "return", "CfileDesc", "(", "node", "=", "node", ")", "else", ":", "return", "None" ]
Returns the fileDesc object or None if there is no such element @return: the fileDesc object @rtype: L{CfileDesc}
[ "Returns", "the", "fileDesc", "object", "or", "None", "if", "there", "is", "no", "such", "element" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L654-L664
train
Returns the fileDesc object or None if there is no such element
cltl/KafNafParserPy
KafNafParserPy/header_data.py
CHeader.get_public
def get_public(self): ''' Returns the public object or None if there is no such element @return: the public object @rtype: L{Cpublic} ''' node = self.node.find('public') if node is not None: return Cpublic(node=node) else: return No...
python
def get_public(self): ''' Returns the public object or None if there is no such element @return: the public object @rtype: L{Cpublic} ''' node = self.node.find('public') if node is not None: return Cpublic(node=node) else: return No...
[ "def", "get_public", "(", "self", ")", ":", "node", "=", "self", ".", "node", ".", "find", "(", "'public'", ")", "if", "node", "is", "not", "None", ":", "return", "Cpublic", "(", "node", "=", "node", ")", "else", ":", "return", "None" ]
Returns the public object or None if there is no such element @return: the public object @rtype: L{Cpublic}
[ "Returns", "the", "public", "object", "or", "None", "if", "there", "is", "no", "such", "element" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/header_data.py#L674-L684
train
Returns the public object or None if there is no such element
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/blueprint.py
Blueprint.GetStatus
def GetStatus(request_id,location=None,alias=None,silent=False): """Gets the status of the specified Blueprint deployment. https://t3n.zendesk.com/entries/20561586-Get-Deployment-Status :param request_id: the int ID of the Blueprint Deployment to retrieve status for. :param alias: short code for a particular ...
python
def GetStatus(request_id,location=None,alias=None,silent=False): """Gets the status of the specified Blueprint deployment. https://t3n.zendesk.com/entries/20561586-Get-Deployment-Status :param request_id: the int ID of the Blueprint Deployment to retrieve status for. :param alias: short code for a particular ...
[ "def", "GetStatus", "(", "request_id", ",", "location", "=", "None", ",", "alias", "=", "None", ",", "silent", "=", "False", ")", ":", "if", "alias", "is", "None", ":", "alias", "=", "clc", ".", "v1", ".", "Account", ".", "GetAlias", "(", ")", "if"...
Gets the status of the specified Blueprint deployment. https://t3n.zendesk.com/entries/20561586-Get-Deployment-Status :param request_id: the int ID of the Blueprint Deployment to retrieve status for. :param alias: short code for a particular account. If none will use account's default alias :param location: ...
[ "Gets", "the", "status", "of", "the", "specified", "Blueprint", "deployment", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L34-L47
train
Get the status of a Blueprint Deployment.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/blueprint.py
Blueprint.GetPackages
def GetPackages(classification,visibility): """Gets a list of Blueprint Packages filtered by classification and visibility. https://t3n.zendesk.com/entries/20411357-Get-Packages :param classification: package type filter (System, Script, Software) :param visibility: package visibility filter (Public, Private,...
python
def GetPackages(classification,visibility): """Gets a list of Blueprint Packages filtered by classification and visibility. https://t3n.zendesk.com/entries/20411357-Get-Packages :param classification: package type filter (System, Script, Software) :param visibility: package visibility filter (Public, Private,...
[ "def", "GetPackages", "(", "classification", ",", "visibility", ")", ":", "r", "=", "clc", ".", "v1", ".", "API", ".", "Call", "(", "'post'", ",", "'Blueprint/GetPackages'", ",", "{", "'Classification'", ":", "Blueprint", ".", "classification_stoi", "[", "cl...
Gets a list of Blueprint Packages filtered by classification and visibility. https://t3n.zendesk.com/entries/20411357-Get-Packages :param classification: package type filter (System, Script, Software) :param visibility: package visibility filter (Public, Private, Shared)
[ "Gets", "a", "list", "of", "Blueprint", "Packages", "filtered", "by", "classification", "and", "visibility", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L51-L61
train
Gets a list of Blueprint Packages filtered by classification and visibility.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/blueprint.py
Blueprint.GetAllPackages
def GetAllPackages(classification): """Gets a list of all Blueprint Packages with a given classification. https://t3n.zendesk.com/entries/20411357-Get-Packages :param classification: package type filter (System, Script, Software) """ packages = [] for visibility in Blueprint.visibility_stoi.keys(): try...
python
def GetAllPackages(classification): """Gets a list of all Blueprint Packages with a given classification. https://t3n.zendesk.com/entries/20411357-Get-Packages :param classification: package type filter (System, Script, Software) """ packages = [] for visibility in Blueprint.visibility_stoi.keys(): try...
[ "def", "GetAllPackages", "(", "classification", ")", ":", "packages", "=", "[", "]", "for", "visibility", "in", "Blueprint", ".", "visibility_stoi", ".", "keys", "(", ")", ":", "try", ":", "for", "r", "in", "Blueprint", ".", "GetPackages", "(", "classifica...
Gets a list of all Blueprint Packages with a given classification. https://t3n.zendesk.com/entries/20411357-Get-Packages :param classification: package type filter (System, Script, Software)
[ "Gets", "a", "list", "of", "all", "Blueprint", "Packages", "with", "a", "given", "classification", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L65-L78
train
Gets a list of all Blueprint Packages with a given classification.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/blueprint.py
Blueprint.PackageUpload
def PackageUpload(package,ftp_url): """Uploads specified zip package to cloud endpoint. See URL below for description on how to properly create a package: https://t3n.zendesk.com/entries/20348448-Blueprints-Script-and-Software-Package-Management :param package: path to zip file containing package.manifest and...
python
def PackageUpload(package,ftp_url): """Uploads specified zip package to cloud endpoint. See URL below for description on how to properly create a package: https://t3n.zendesk.com/entries/20348448-Blueprints-Script-and-Software-Package-Management :param package: path to zip file containing package.manifest and...
[ "def", "PackageUpload", "(", "package", ",", "ftp_url", ")", ":", "#o = urlparse.urlparse(ftp_url)", "# Very weak URL checking", "#if o.scheme.lower() != \"ftp\": ", "#\tclc.v1.output.Status('ERROR',2,'Invalid FTP URL')", "#\treturn", "# Confirm file exists ", "if", "not", "os", "...
Uploads specified zip package to cloud endpoint. See URL below for description on how to properly create a package: https://t3n.zendesk.com/entries/20348448-Blueprints-Script-and-Software-Package-Management :param package: path to zip file containing package.manifest and supporting scripts :param ftp_url: ftp...
[ "Uploads", "specified", "zip", "package", "to", "cloud", "endpoint", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L107-L139
train
Uploads specified zip file to cloud endpoint.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/blueprint.py
Blueprint.PackagePublish
def PackagePublish(package,classification,visibility,os): """Publishes a Blueprint Package for use within the Blueprint Designer. https://t3n.zendesk.com/entries/20426453-Publish-Package :param package: path to zip file containing package.manifest and supporting scripts :param classification: package type (Sy...
python
def PackagePublish(package,classification,visibility,os): """Publishes a Blueprint Package for use within the Blueprint Designer. https://t3n.zendesk.com/entries/20426453-Publish-Package :param package: path to zip file containing package.manifest and supporting scripts :param classification: package type (Sy...
[ "def", "PackagePublish", "(", "package", ",", "classification", ",", "visibility", ",", "os", ")", ":", "r", "=", "clc", ".", "v1", ".", "API", ".", "Call", "(", "'post'", ",", "'Blueprint/PublishPackage'", ",", "{", "'Classification'", ":", "Blueprint", "...
Publishes a Blueprint Package for use within the Blueprint Designer. https://t3n.zendesk.com/entries/20426453-Publish-Package :param package: path to zip file containing package.manifest and supporting scripts :param classification: package type (System, Script, Software) :param visibility: package visibility...
[ "Publishes", "a", "Blueprint", "Package", "for", "use", "within", "the", "Blueprint", "Designer", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L143-L156
train
Publishes a Blueprint Package for use within the Blueprint Designer.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/blueprint.py
Blueprint.PackagePublishUI
def PackagePublishUI(package,type,visibility): """Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection. Interactive selection of one or more operating systems by name. :param package: path to zip file containing package.manifest and supporting scripts :param class...
python
def PackagePublishUI(package,type,visibility): """Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection. Interactive selection of one or more operating systems by name. :param package: path to zip file containing package.manifest and supporting scripts :param class...
[ "def", "PackagePublishUI", "(", "package", ",", "type", ",", "visibility", ")", ":", "# fetch OS list", "linux_lst", "=", "{", "'L'", ":", "{", "'selected'", ":", "False", ",", "'Description'", ":", "'All Linux'", "}", "}", "windows_lst", "=", "{", "'W'", ...
Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection. Interactive selection of one or more operating systems by name. :param package: path to zip file containing package.manifest and supporting scripts :param classification: package type (System, Script, Software) ...
[ "Publishes", "a", "Blueprint", "Package", "for", "use", "within", "the", "Blueprint", "Designer", "after", "interactive", "OS", "selection", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/blueprint.py#L214-L255
train
Publishes a Blueprint Package for use within the Blueprint Designer after interactive OS selection.
srossross/rpmfile
rpmfile/__init__.py
RPMFile.getmembers
def getmembers(self): ''' Return the members of the archive as a list of RPMInfo objects. The list has the same order as the members in the archive. ''' if self._members is None: self._members = _members = [] g = self.data_file magic = g.read(2...
python
def getmembers(self): ''' Return the members of the archive as a list of RPMInfo objects. The list has the same order as the members in the archive. ''' if self._members is None: self._members = _members = [] g = self.data_file magic = g.read(2...
[ "def", "getmembers", "(", "self", ")", ":", "if", "self", ".", "_members", "is", "None", ":", "self", ".", "_members", "=", "_members", "=", "[", "]", "g", "=", "self", ".", "data_file", "magic", "=", "g", ".", "read", "(", "2", ")", "while", "ma...
Return the members of the archive as a list of RPMInfo objects. The list has the same order as the members in the archive.
[ "Return", "the", "members", "of", "the", "archive", "as", "a", "list", "of", "RPMInfo", "objects", ".", "The", "list", "has", "the", "same", "order", "as", "the", "members", "in", "the", "archive", "." ]
3ab96f211da7b56f5e99d8cc248f714a6e542d31
https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L111-L133
train
Return the members of the archive as a list of RPMInfo objects. The list is the same order as the members in the archive.
srossross/rpmfile
rpmfile/__init__.py
RPMFile.getmember
def getmember(self, name): ''' Return an RPMInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. ''' member...
python
def getmember(self, name): ''' Return an RPMInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. ''' member...
[ "def", "getmember", "(", "self", ",", "name", ")", ":", "members", "=", "self", ".", "getmembers", "(", ")", "for", "m", "in", "members", "[", ":", ":", "-", "1", "]", ":", "if", "m", ".", "name", "==", "name", ":", "return", "m", "raise", "Key...
Return an RPMInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version.
[ "Return", "an", "RPMInfo", "object", "for", "member", "name", ".", "If", "name", "can", "not", "be", "found", "in", "the", "archive", "KeyError", "is", "raised", ".", "If", "a", "member", "occurs", "more", "than", "once", "in", "the", "archive", "its", ...
3ab96f211da7b56f5e99d8cc248f714a6e542d31
https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L135-L147
train
Return an RPMInfo object for the specified member name.
srossross/rpmfile
rpmfile/__init__.py
RPMFile.extractfile
def extractfile(self, member): ''' Extract a member from the archive as a file object. `member' may be a filename or an RPMInfo object. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() ''' if ...
python
def extractfile(self, member): ''' Extract a member from the archive as a file object. `member' may be a filename or an RPMInfo object. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() ''' if ...
[ "def", "extractfile", "(", "self", ",", "member", ")", ":", "if", "not", "isinstance", "(", "member", ",", "RPMInfo", ")", ":", "member", "=", "self", ".", "getmember", "(", "member", ")", "return", "_SubFile", "(", "self", ".", "data_file", ",", "memb...
Extract a member from the archive as a file object. `member' may be a filename or an RPMInfo object. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell()
[ "Extract", "a", "member", "from", "the", "archive", "as", "a", "file", "object", ".", "member", "may", "be", "a", "filename", "or", "an", "RPMInfo", "object", ".", "The", "file", "-", "like", "object", "is", "read", "-", "only", "and", "provides", "the...
3ab96f211da7b56f5e99d8cc248f714a6e542d31
https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L149-L158
train
Extracts a member from the archive as a file object.
srossross/rpmfile
rpmfile/__init__.py
RPMFile.data_file
def data_file(self): """Return the uncompressed raw CPIO data of the RPM archive.""" if self._data_file is None: fileobj = _SubFile(self._fileobj, self.data_offset) if self.headers["archive_compression"] == b"xz": if not getattr(sys.modules[__name__], 'lzma', Fa...
python
def data_file(self): """Return the uncompressed raw CPIO data of the RPM archive.""" if self._data_file is None: fileobj = _SubFile(self._fileobj, self.data_offset) if self.headers["archive_compression"] == b"xz": if not getattr(sys.modules[__name__], 'lzma', Fa...
[ "def", "data_file", "(", "self", ")", ":", "if", "self", ".", "_data_file", "is", "None", ":", "fileobj", "=", "_SubFile", "(", "self", ".", "_fileobj", ",", "self", ".", "data_offset", ")", "if", "self", ".", "headers", "[", "\"archive_compression\"", "...
Return the uncompressed raw CPIO data of the RPM archive.
[ "Return", "the", "uncompressed", "raw", "CPIO", "data", "of", "the", "RPM", "archive", "." ]
3ab96f211da7b56f5e99d8cc248f714a6e542d31
https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/__init__.py#L163-L176
train
Return the uncompressed raw CPIO data of the RPM archive.
fridex/json2sql
json2sql/utils.py
load_input
def load_input(definition): """Load and parse input if needed. :param definition: definition to use as an input (file, serialized JSON/YAML or dict) :return: loaded input :raises json2sql.ParsingInputError: when parsing fails """ if isinstance(definition, (str, io.TextIOWrapper)): try: ...
python
def load_input(definition): """Load and parse input if needed. :param definition: definition to use as an input (file, serialized JSON/YAML or dict) :return: loaded input :raises json2sql.ParsingInputError: when parsing fails """ if isinstance(definition, (str, io.TextIOWrapper)): try: ...
[ "def", "load_input", "(", "definition", ")", ":", "if", "isinstance", "(", "definition", ",", "(", "str", ",", "io", ".", "TextIOWrapper", ")", ")", ":", "try", ":", "definition", "=", "yaml", ".", "safe_load", "(", "definition", ")", "except", "Exceptio...
Load and parse input if needed. :param definition: definition to use as an input (file, serialized JSON/YAML or dict) :return: loaded input :raises json2sql.ParsingInputError: when parsing fails
[ "Load", "and", "parse", "input", "if", "needed", "." ]
a0851dd79827a684319b03fb899e129f81ff2d3a
https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/utils.py#L19-L32
train
Load and parse input if needed.
fridex/json2sql
json2sql/utils.py
any2sql
def any2sql(func, definition_dict=None, **definition_kwargs): """Handle general to SQL conversion. :param func: function to be called on the given definition :param definition_dict: statement definition in dict :param definition_kwargs: statement definition as kwargs :return: raw SQL statement ...
python
def any2sql(func, definition_dict=None, **definition_kwargs): """Handle general to SQL conversion. :param func: function to be called on the given definition :param definition_dict: statement definition in dict :param definition_kwargs: statement definition as kwargs :return: raw SQL statement ...
[ "def", "any2sql", "(", "func", ",", "definition_dict", "=", "None", ",", "*", "*", "definition_kwargs", ")", ":", "if", "definition_dict", "and", "definition_kwargs", ":", "raise", "InputError", "(", "\"Cannot process dict and kwargs input at the same time\"", ")", "d...
Handle general to SQL conversion. :param func: function to be called on the given definition :param definition_dict: statement definition in dict :param definition_kwargs: statement definition as kwargs :return: raw SQL statement
[ "Handle", "general", "to", "SQL", "conversion", "." ]
a0851dd79827a684319b03fb899e129f81ff2d3a
https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/utils.py#L35-L62
train
Handle general to SQL conversion.
fridex/json2sql
json2sql/select.py
_expand_join
def _expand_join(join_definition): """Expand join definition to `join' call. :param join_definition: join definition :return: expanded join definition """ join_table_name = join_definition.pop('table') join_func = getattr(mosql_query, join_definition.pop('join_type', 'join')) return join_fu...
python
def _expand_join(join_definition): """Expand join definition to `join' call. :param join_definition: join definition :return: expanded join definition """ join_table_name = join_definition.pop('table') join_func = getattr(mosql_query, join_definition.pop('join_type', 'join')) return join_fu...
[ "def", "_expand_join", "(", "join_definition", ")", ":", "join_table_name", "=", "join_definition", ".", "pop", "(", "'table'", ")", "join_func", "=", "getattr", "(", "mosql_query", ",", "join_definition", ".", "pop", "(", "'join_type'", ",", "'join'", ")", ")...
Expand join definition to `join' call. :param join_definition: join definition :return: expanded join definition
[ "Expand", "join", "definition", "to", "join", "call", "." ]
a0851dd79827a684319b03fb899e129f81ff2d3a
https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/select.py#L32-L40
train
Expand join definition to join call.
fridex/json2sql
json2sql/select.py
_construct_select_query
def _construct_select_query(**filter_definition): """Return SELECT statement that will be used as a filter. :param filter_definition: definition of a filter that should be used for SELECT construction :return: """ table_name = filter_definition.pop('table') distinct = filter_definition.pop('dis...
python
def _construct_select_query(**filter_definition): """Return SELECT statement that will be used as a filter. :param filter_definition: definition of a filter that should be used for SELECT construction :return: """ table_name = filter_definition.pop('table') distinct = filter_definition.pop('dis...
[ "def", "_construct_select_query", "(", "*", "*", "filter_definition", ")", ":", "table_name", "=", "filter_definition", ".", "pop", "(", "'table'", ")", "distinct", "=", "filter_definition", ".", "pop", "(", "'distinct'", ",", "False", ")", "select_count", "=", ...
Return SELECT statement that will be used as a filter. :param filter_definition: definition of a filter that should be used for SELECT construction :return:
[ "Return", "SELECT", "statement", "that", "will", "be", "used", "as", "a", "filter", "." ]
a0851dd79827a684319b03fb899e129f81ff2d3a
https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/select.py#L43-L90
train
Construct a SELECT statement that will be used as a filter.
teepark/greenhouse
greenhouse/io/sockets.py
Socket.accept
def accept(self): """accept a connection on the host/port to which the socket is bound .. note:: if there is no connection attempt already queued, this method will block until a connection is made :returns: a two-tuple of ``(socket, address)`` where the soc...
python
def accept(self): """accept a connection on the host/port to which the socket is bound .. note:: if there is no connection attempt already queued, this method will block until a connection is made :returns: a two-tuple of ``(socket, address)`` where the soc...
[ "def", "accept", "(", "self", ")", ":", "with", "self", ".", "_registered", "(", "'re'", ")", ":", "while", "1", ":", "try", ":", "client", ",", "addr", "=", "self", ".", "_sock", ".", "accept", "(", ")", "except", "socket", ".", "error", ",", "e...
accept a connection on the host/port to which the socket is bound .. note:: if there is no connection attempt already queued, this method will block until a connection is made :returns: a two-tuple of ``(socket, address)`` where the socket is connected, ...
[ "accept", "a", "connection", "on", "the", "host", "/", "port", "to", "which", "the", "socket", "is", "bound" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L102-L128
train
accept a connection on the host and port of the socket
teepark/greenhouse
greenhouse/io/sockets.py
Socket.connect
def connect(self, address): """initiate a new connection to a remote socket bound to an address .. note:: this method will block until the connection has been made :param address: the address to which to initiate a connection, the format of which depends on the socket's...
python
def connect(self, address): """initiate a new connection to a remote socket bound to an address .. note:: this method will block until the connection has been made :param address: the address to which to initiate a connection, the format of which depends on the socket's...
[ "def", "connect", "(", "self", ",", "address", ")", ":", "address", "=", "_dns_resolve", "(", "self", ",", "address", ")", "with", "self", ".", "_registered", "(", "'we'", ")", ":", "while", "1", ":", "err", "=", "self", ".", "_sock", ".", "connect_e...
initiate a new connection to a remote socket bound to an address .. note:: this method will block until the connection has been made :param address: the address to which to initiate a connection, the format of which depends on the socket's type; for TCP sockets, this is a ...
[ "initiate", "a", "new", "connection", "to", "a", "remote", "socket", "bound", "to", "an", "address" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L150-L172
train
initiate a new connection to a remote socket
teepark/greenhouse
greenhouse/io/sockets.py
Socket.getsockopt
def getsockopt(self, level, optname, *args, **kwargs): """get the value of a given socket option the values for ``level`` and ``optname`` will usually come from constants in the standard library ``socket`` module. consult the unix manpage ``getsockopt(2)`` for more information. ...
python
def getsockopt(self, level, optname, *args, **kwargs): """get the value of a given socket option the values for ``level`` and ``optname`` will usually come from constants in the standard library ``socket`` module. consult the unix manpage ``getsockopt(2)`` for more information. ...
[ "def", "getsockopt", "(", "self", ",", "level", ",", "optname", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_sock", ".", "getsockopt", "(", "level", ",", "optname", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
get the value of a given socket option the values for ``level`` and ``optname`` will usually come from constants in the standard library ``socket`` module. consult the unix manpage ``getsockopt(2)`` for more information. :param level: the level of the requested socket option :t...
[ "get", "the", "value", "of", "a", "given", "socket", "option" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L219-L238
train
getsockopt - get the value of a specific socket option
teepark/greenhouse
greenhouse/io/sockets.py
Socket.makefile
def makefile(self, mode='r', bufsize=-1): """create a file-like object that wraps the socket :param mode: like the ``mode`` argument for other files, indicates read ``'r'``, write ``'w'``, or both ``'r+'`` (default ``'r'``) :type mode: str :param bufsize: ...
python
def makefile(self, mode='r', bufsize=-1): """create a file-like object that wraps the socket :param mode: like the ``mode`` argument for other files, indicates read ``'r'``, write ``'w'``, or both ``'r+'`` (default ``'r'``) :type mode: str :param bufsize: ...
[ "def", "makefile", "(", "self", ",", "mode", "=", "'r'", ",", "bufsize", "=", "-", "1", ")", ":", "f", "=", "SocketFile", "(", "self", ".", "_sock", ",", "mode", ")", "f", ".", "_sock", ".", "settimeout", "(", "self", ".", "gettimeout", "(", ")",...
create a file-like object that wraps the socket :param mode: like the ``mode`` argument for other files, indicates read ``'r'``, write ``'w'``, or both ``'r+'`` (default ``'r'``) :type mode: str :param bufsize: the length of the read buffer to use. 0 means un...
[ "create", "a", "file", "-", "like", "object", "that", "wraps", "the", "socket" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L259-L277
train
create a file - like object that wraps the socket connection
teepark/greenhouse
greenhouse/io/sockets.py
Socket.recvfrom
def recvfrom(self, bufsize, flags=0): """receive data on a socket that isn't necessarily a 1-1 connection .. note:: this method will block until data is available to be read :param bufsize: the maximum number of bytes to receive. fewer may be returned, however :...
python
def recvfrom(self, bufsize, flags=0): """receive data on a socket that isn't necessarily a 1-1 connection .. note:: this method will block until data is available to be read :param bufsize: the maximum number of bytes to receive. fewer may be returned, however :...
[ "def", "recvfrom", "(", "self", ",", "bufsize", ",", "flags", "=", "0", ")", ":", "with", "self", ".", "_registered", "(", "'re'", ")", ":", "while", "1", ":", "if", "self", ".", "_closed", ":", "raise", "socket", ".", "error", "(", "errno", ".", ...
receive data on a socket that isn't necessarily a 1-1 connection .. note:: this method will block until data is available to be read :param bufsize: the maximum number of bytes to receive. fewer may be returned, however :type bufsize: int :param flags: ...
[ "receive", "data", "on", "a", "socket", "that", "isn", "t", "necessarily", "a", "1", "-", "1", "connection" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L346-L377
train
receive data on a socket that isn t necessarily a 1 - 1 connection
teepark/greenhouse
greenhouse/io/sockets.py
Socket.send
def send(self, data, flags=0): """send data over the socket connection .. note:: this method may block if the socket's send buffer is full :param data: the data to send :type data: str :param flags: flags for the send call. this has the same meaning as for ...
python
def send(self, data, flags=0): """send data over the socket connection .. note:: this method may block if the socket's send buffer is full :param data: the data to send :type data: str :param flags: flags for the send call. this has the same meaning as for ...
[ "def", "send", "(", "self", ",", "data", ",", "flags", "=", "0", ")", ":", "with", "self", ".", "_registered", "(", "'we'", ")", ":", "while", "1", ":", "try", ":", "return", "self", ".", "_sock", ".", "send", "(", "data", ")", "except", "socket"...
send data over the socket connection .. note:: this method may block if the socket's send buffer is full :param data: the data to send :type data: str :param flags: flags for the send call. this has the same meaning as for :meth:`recv` :type flags: int ...
[ "send", "data", "over", "the", "socket", "connection" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L415-L441
train
send data over the socket connection
teepark/greenhouse
greenhouse/io/sockets.py
Socket.sendall
def sendall(self, data, flags=0): """send data over the connection, and keep sending until it all goes .. note:: this method may block if the socket's send buffer is full :param data: the data to send :type data: str :param flags: flags for the send call. this has t...
python
def sendall(self, data, flags=0): """send data over the connection, and keep sending until it all goes .. note:: this method may block if the socket's send buffer is full :param data: the data to send :type data: str :param flags: flags for the send call. this has t...
[ "def", "sendall", "(", "self", ",", "data", ",", "flags", "=", "0", ")", ":", "sent", "=", "self", ".", "send", "(", "data", ",", "flags", ")", "while", "sent", "<", "len", "(", "data", ")", ":", "sent", "+=", "self", ".", "send", "(", "data", ...
send data over the connection, and keep sending until it all goes .. note:: this method may block if the socket's send buffer is full :param data: the data to send :type data: str :param flags: flags for the send call. this has the same meaning as for :meth:`rec...
[ "send", "data", "over", "the", "connection", "and", "keep", "sending", "until", "it", "all", "goes" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L443-L457
train
send data over the socket and keep sending until all goes
teepark/greenhouse
greenhouse/io/sockets.py
Socket.setsockopt
def setsockopt(self, level, optname, value): """set the value of a given socket option the values for ``level`` and ``optname`` will usually come from constants in the standard library ``socket`` module. consult the unix manpage ``setsockopt(2)`` for more information. :param le...
python
def setsockopt(self, level, optname, value): """set the value of a given socket option the values for ``level`` and ``optname`` will usually come from constants in the standard library ``socket`` module. consult the unix manpage ``setsockopt(2)`` for more information. :param le...
[ "def", "setsockopt", "(", "self", ",", "level", ",", "optname", ",", "value", ")", ":", "return", "self", ".", "_sock", ".", "setsockopt", "(", "level", ",", "optname", ",", "value", ")" ]
set the value of a given socket option the values for ``level`` and ``optname`` will usually come from constants in the standard library ``socket`` module. consult the unix manpage ``setsockopt(2)`` for more information. :param level: the level of the set socket option :type le...
[ "set", "the", "value", "of", "a", "given", "socket", "option" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L502-L516
train
set the value of an option in a given socket level
teepark/greenhouse
greenhouse/io/sockets.py
Socket.settimeout
def settimeout(self, timeout): """set the timeout for this specific socket :param timeout: the number of seconds the socket's blocking operations should block before raising a ``socket.timeout`` :type timeout: float or None """ if timeout is not None: ...
python
def settimeout(self, timeout): """set the timeout for this specific socket :param timeout: the number of seconds the socket's blocking operations should block before raising a ``socket.timeout`` :type timeout: float or None """ if timeout is not None: ...
[ "def", "settimeout", "(", "self", ",", "timeout", ")", ":", "if", "timeout", "is", "not", "None", ":", "timeout", "=", "float", "(", "timeout", ")", "self", ".", "_timeout", "=", "timeout" ]
set the timeout for this specific socket :param timeout: the number of seconds the socket's blocking operations should block before raising a ``socket.timeout`` :type timeout: float or None
[ "set", "the", "timeout", "for", "this", "specific", "socket" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/sockets.py#L528-L538
train
set the timeout for this specific socket
EVEprosper/ProsperCommon
prosper/common/_version.py
get_version
def get_version(): """find current version information Returns: (str): version information """ if not INSTALLED: try: with open('version.txt', 'r') as v_fh: return v_fh.read() except Exception: warnings.warn( 'Unable to re...
python
def get_version(): """find current version information Returns: (str): version information """ if not INSTALLED: try: with open('version.txt', 'r') as v_fh: return v_fh.read() except Exception: warnings.warn( 'Unable to re...
[ "def", "get_version", "(", ")", ":", "if", "not", "INSTALLED", ":", "try", ":", "with", "open", "(", "'version.txt'", ",", "'r'", ")", "as", "v_fh", ":", "return", "v_fh", ".", "read", "(", ")", "except", "Exception", ":", "warnings", ".", "warn", "(...
find current version information Returns: (str): version information
[ "find", "current", "version", "information" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/_version.py#L13-L31
train
find current version information
cltl/KafNafParserPy
KafNafParserPy/coreference_data.py
Ccoreference.add_span
def add_span(self,term_span): """ Adds a list of term ids a new span in the references @type term_span: list @param term_span: list of term ids """ new_span = Cspan() new_span.create_from_ids(term_span) self.node.append(new_span.get_node())
python
def add_span(self,term_span): """ Adds a list of term ids a new span in the references @type term_span: list @param term_span: list of term ids """ new_span = Cspan() new_span.create_from_ids(term_span) self.node.append(new_span.get_node())
[ "def", "add_span", "(", "self", ",", "term_span", ")", ":", "new_span", "=", "Cspan", "(", ")", "new_span", ".", "create_from_ids", "(", "term_span", ")", "self", ".", "node", ".", "append", "(", "new_span", ".", "get_node", "(", ")", ")" ]
Adds a list of term ids a new span in the references @type term_span: list @param term_span: list of term ids
[ "Adds", "a", "list", "of", "term", "ids", "a", "new", "span", "in", "the", "references" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/coreference_data.py#L78-L86
train
Adds a list of term ids a new span in the references
cltl/KafNafParserPy
KafNafParserPy/coreference_data.py
Ccoreference.remove_span
def remove_span(self,span): """ Removes a specific span from the coref object """ this_node = span.get_node() self.node.remove(this_node)
python
def remove_span(self,span): """ Removes a specific span from the coref object """ this_node = span.get_node() self.node.remove(this_node)
[ "def", "remove_span", "(", "self", ",", "span", ")", ":", "this_node", "=", "span", ".", "get_node", "(", ")", "self", ".", "node", ".", "remove", "(", "this_node", ")" ]
Removes a specific span from the coref object
[ "Removes", "a", "specific", "span", "from", "the", "coref", "object" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/coreference_data.py#L96-L101
train
Removes a specific span from the coref object
cltl/KafNafParserPy
KafNafParserPy/coreference_data.py
Ccoreferences.to_kaf
def to_kaf(self): """ Converts the coreference layer to KAF """ if self.type == 'NAF': for node_coref in self.__get_corefs_nodes(): node_coref.set('coid',node_coref.get('id')) del node_coref.attrib['id']
python
def to_kaf(self): """ Converts the coreference layer to KAF """ if self.type == 'NAF': for node_coref in self.__get_corefs_nodes(): node_coref.set('coid',node_coref.get('id')) del node_coref.attrib['id']
[ "def", "to_kaf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'NAF'", ":", "for", "node_coref", "in", "self", ".", "__get_corefs_nodes", "(", ")", ":", "node_coref", ".", "set", "(", "'coid'", ",", "node_coref", ".", "get", "(", "'id'", "...
Converts the coreference layer to KAF
[ "Converts", "the", "coreference", "layer", "to", "KAF" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/coreference_data.py#L194-L201
train
Converts the coreference layer to KAF
cltl/KafNafParserPy
KafNafParserPy/coreference_data.py
Ccoreferences.to_naf
def to_naf(self): """ Converts the coreference layer to NAF """ if self.type == 'KAF': for node_coref in self.__get_corefs_nodes(): node_coref.set('id',node_coref.get('coid')) del node_coref.attrib['coid']
python
def to_naf(self): """ Converts the coreference layer to NAF """ if self.type == 'KAF': for node_coref in self.__get_corefs_nodes(): node_coref.set('id',node_coref.get('coid')) del node_coref.attrib['coid']
[ "def", "to_naf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'KAF'", ":", "for", "node_coref", "in", "self", ".", "__get_corefs_nodes", "(", ")", ":", "node_coref", ".", "set", "(", "'id'", ",", "node_coref", ".", "get", "(", "'coid'", "...
Converts the coreference layer to NAF
[ "Converts", "the", "coreference", "layer", "to", "NAF" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/coreference_data.py#L203-L210
train
Converts the coreference layer to NAF
cltl/KafNafParserPy
KafNafParserPy/coreference_data.py
Ccoreferences.remove_coreference
def remove_coreference(self,coid): """ Removes the coreference with specific identifier @type coid: string @param coid: the coreference identifier """ for this_node in self.node.findall('coref'): if this_node.get('id') == coid: self.node.remove...
python
def remove_coreference(self,coid): """ Removes the coreference with specific identifier @type coid: string @param coid: the coreference identifier """ for this_node in self.node.findall('coref'): if this_node.get('id') == coid: self.node.remove...
[ "def", "remove_coreference", "(", "self", ",", "coid", ")", ":", "for", "this_node", "in", "self", ".", "node", ".", "findall", "(", "'coref'", ")", ":", "if", "this_node", ".", "get", "(", "'id'", ")", "==", "coid", ":", "self", ".", "node", ".", ...
Removes the coreference with specific identifier @type coid: string @param coid: the coreference identifier
[ "Removes", "the", "coreference", "with", "specific", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/coreference_data.py#L213-L222
train
Removes the coreference with specific identifier
mjirik/imtools
imtools/vesseltree_export.py
vt2esofspy
def vt2esofspy(vesseltree, outputfilename="tracer.txt", axisorder=[0, 1, 2]): """ exports vesseltree to esofspy format :param vesseltree: filename or vesseltree dictionary structure :param outputfilename: output file name :param axisorder: order of axis can be specified with this option :return...
python
def vt2esofspy(vesseltree, outputfilename="tracer.txt", axisorder=[0, 1, 2]): """ exports vesseltree to esofspy format :param vesseltree: filename or vesseltree dictionary structure :param outputfilename: output file name :param axisorder: order of axis can be specified with this option :return...
[ "def", "vt2esofspy", "(", "vesseltree", ",", "outputfilename", "=", "\"tracer.txt\"", ",", "axisorder", "=", "[", "0", ",", "1", ",", "2", "]", ")", ":", "if", "(", "type", "(", "vesseltree", ")", "==", "str", ")", "and", "os", ".", "path", ".", "i...
exports vesseltree to esofspy format :param vesseltree: filename or vesseltree dictionary structure :param outputfilename: output file name :param axisorder: order of axis can be specified with this option :return:
[ "exports", "vesseltree", "to", "esofspy", "format" ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/vesseltree_export.py#L22-L68
train
exports vesseltree to esofspy format