partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
PickleParameter._store
Returns a dictionary for storage. Every element in the dictionary except for 'explored_data' is a pickle dump. Reusage of objects is identified over the object id, i.e. python's built-in id function. 'explored_data' contains the references to the objects to be able to recall the order...
pypet/parameter.py
def _store(self): """Returns a dictionary for storage. Every element in the dictionary except for 'explored_data' is a pickle dump. Reusage of objects is identified over the object id, i.e. python's built-in id function. 'explored_data' contains the references to the objects to be abl...
def _store(self): """Returns a dictionary for storage. Every element in the dictionary except for 'explored_data' is a pickle dump. Reusage of objects is identified over the object id, i.e. python's built-in id function. 'explored_data' contains the references to the objects to be abl...
[ "Returns", "a", "dictionary", "for", "storage", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1737-L1784
[ "def", "_store", "(", "self", ")", ":", "store_dict", "=", "{", "}", "if", "self", ".", "_data", "is", "not", "None", ":", "dump", "=", "pickle", ".", "dumps", "(", "self", ".", "_data", ",", "protocol", "=", "self", ".", "v_protocol", ")", "store_...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
PickleParameter._load
Reconstructs objects from the pickle dumps in `load_dict`. The 'explored_data' entry in `load_dict` is used to reconstruct the exploration range in the correct order. Sets the `v_protocol` property to the protocol used to store 'data'.
pypet/parameter.py
def _load(self, load_dict): """Reconstructs objects from the pickle dumps in `load_dict`. The 'explored_data' entry in `load_dict` is used to reconstruct the exploration range in the correct order. Sets the `v_protocol` property to the protocol used to store 'data'. """ ...
def _load(self, load_dict): """Reconstructs objects from the pickle dumps in `load_dict`. The 'explored_data' entry in `load_dict` is used to reconstruct the exploration range in the correct order. Sets the `v_protocol` property to the protocol used to store 'data'. """ ...
[ "Reconstructs", "objects", "from", "the", "pickle", "dumps", "in", "load_dict", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1792-L1832
[ "def", "_load", "(", "self", ",", "load_dict", ")", ":", "if", "self", ".", "v_locked", ":", "raise", "pex", ".", "ParameterLockedException", "(", "'Parameter `%s` is locked!'", "%", "self", ".", "v_full_name", ")", "if", "'data'", "in", "load_dict", ":", "d...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_translate_key
Translates integer indices into the appropriate names
pypet/parameter.py
def f_translate_key(self, key): """Translates integer indices into the appropriate names""" if isinstance(key, int): if key == 0: key = self.v_name else: key = self.v_name + '_%d' % key return key
def f_translate_key(self, key): """Translates integer indices into the appropriate names""" if isinstance(key, int): if key == 0: key = self.v_name else: key = self.v_name + '_%d' % key return key
[ "Translates", "integer", "indices", "into", "the", "appropriate", "names" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1983-L1990
[ "def", "f_translate_key", "(", "self", ",", "key", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "if", "key", "==", "0", ":", "key", "=", "self", ".", "v_name", "else", ":", "key", "=", "self", ".", "v_name", "+", "'_%d'", "%", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_val_to_str
Summarizes data handled by the result as a string. Calls `__repr__` on all handled data. Data is NOT ordered. Truncates the string if it is longer than :const:`pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH` :return: string
pypet/parameter.py
def f_val_to_str(self): """Summarizes data handled by the result as a string. Calls `__repr__` on all handled data. Data is NOT ordered. Truncates the string if it is longer than :const:`pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH` :return: string """ resstrl...
def f_val_to_str(self): """Summarizes data handled by the result as a string. Calls `__repr__` on all handled data. Data is NOT ordered. Truncates the string if it is longer than :const:`pypetconstants.HDF5_STRCOL_MAX_VALUE_LENGTH` :return: string """ resstrl...
[ "Summarizes", "data", "handled", "by", "the", "result", "as", "a", "string", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L1996-L2027
[ "def", "f_val_to_str", "(", "self", ")", ":", "resstrlist", "=", "[", "]", "strlen", "=", "0", "for", "key", "in", "self", ".", "_data", ":", "val", "=", "self", ".", "_data", "[", "key", "]", "resstr", "=", "'%s=%s, '", "%", "(", "key", ",", "re...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_to_dict
Returns all handled data as a dictionary. :param copy: Whether the original dictionary or a shallow copy is returned. :return: Data dictionary
pypet/parameter.py
def f_to_dict(self, copy=True): """Returns all handled data as a dictionary. :param copy: Whether the original dictionary or a shallow copy is returned. :return: Data dictionary """ if copy: return self._data.copy() else: return sel...
def f_to_dict(self, copy=True): """Returns all handled data as a dictionary. :param copy: Whether the original dictionary or a shallow copy is returned. :return: Data dictionary """ if copy: return self._data.copy() else: return sel...
[ "Returns", "all", "handled", "data", "as", "a", "dictionary", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2051-L2064
[ "def", "f_to_dict", "(", "self", ",", "copy", "=", "True", ")", ":", "if", "copy", ":", "return", "self", ".", "_data", ".", "copy", "(", ")", "else", ":", "return", "self", ".", "_data" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_set
Method to put data into the result. :param args: The first positional argument is stored with the name of the result. Following arguments are stored with `name_X` where `X` is the position of the argument. :param kwargs: Arguments are stored with the key as name. ...
pypet/parameter.py
def f_set(self, *args, **kwargs): """ Method to put data into the result. :param args: The first positional argument is stored with the name of the result. Following arguments are stored with `name_X` where `X` is the position of the argument. :param kwargs...
def f_set(self, *args, **kwargs): """ Method to put data into the result. :param args: The first positional argument is stored with the name of the result. Following arguments are stored with `name_X` where `X` is the position of the argument. :param kwargs...
[ "Method", "to", "put", "data", "into", "the", "result", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2078-L2112
[ "def", "f_set", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", "and", "self", ".", "v_name", "is", "None", ":", "raise", "AttributeError", "(", "'Cannot set positional value because I do not have a name!'", ")", "for", "idx", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_get
Returns items handled by the result. If only a single name is given, a single data item is returned. If several names are given, a list is returned. For integer inputs the result returns `resultname_X`. If the result contains only a single entry you can call `f_get()` without arguments. ...
pypet/parameter.py
def f_get(self, *args): """Returns items handled by the result. If only a single name is given, a single data item is returned. If several names are given, a list is returned. For integer inputs the result returns `resultname_X`. If the result contains only a single entry you can ca...
def f_get(self, *args): """Returns items handled by the result. If only a single name is given, a single data item is returned. If several names are given, a list is returned. For integer inputs the result returns `resultname_X`. If the result contains only a single entry you can ca...
[ "Returns", "items", "handled", "by", "the", "result", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2134-L2189
[ "def", "f_get", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "0", ":", "if", "len", "(", "self", ".", "_data", ")", "==", "1", ":", "return", "list", "(", "self", ".", "_data", ".", "values", "(", ")", ")", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_set_single
Sets a single data item of the result. Raises TypeError if the type of the outer data structure is not understood. Note that the type check is shallow. For example, if the data item is a list, the individual list elements are NOT checked whether their types are appropriate. :param name...
pypet/parameter.py
def f_set_single(self, name, item): """Sets a single data item of the result. Raises TypeError if the type of the outer data structure is not understood. Note that the type check is shallow. For example, if the data item is a list, the individual list elements are NOT checked whether th...
def f_set_single(self, name, item): """Sets a single data item of the result. Raises TypeError if the type of the outer data structure is not understood. Note that the type check is shallow. For example, if the data item is a list, the individual list elements are NOT checked whether th...
[ "Sets", "a", "single", "data", "item", "of", "the", "result", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2191-L2227
[ "def", "f_set_single", "(", "self", ",", "name", ",", "item", ")", ":", "if", "self", ".", "v_stored", ":", "self", ".", "_logger", ".", "debug", "(", "'You are changing an already stored result. If '", "'you not explicitly overwrite the data on disk, this change '", "'...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
Result.f_remove
Removes `*args` from the result
pypet/parameter.py
def f_remove(self, *args): """Removes `*args` from the result""" for arg in args: arg = self.f_translate_key(arg) if arg in self._data: del self._data[arg] else: raise AttributeError('Your result `%s` does not contain %s.' % (self.name_...
def f_remove(self, *args): """Removes `*args` from the result""" for arg in args: arg = self.f_translate_key(arg) if arg in self._data: del self._data[arg] else: raise AttributeError('Your result `%s` does not contain %s.' % (self.name_...
[ "Removes", "*", "args", "from", "the", "result" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2255-L2262
[ "def", "f_remove", "(", "self", ",", "*", "args", ")", ":", "for", "arg", "in", "args", ":", "arg", "=", "self", ".", "f_translate_key", "(", "arg", ")", "if", "arg", "in", "self", ".", "_data", ":", "del", "self", ".", "_data", "[", "arg", "]", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
SparseResult._supports
Supports everything of parent class and csr, csc, bsr, and dia sparse matrices.
pypet/parameter.py
def _supports(self, item): """Supports everything of parent class and csr, csc, bsr, and dia sparse matrices.""" if SparseParameter._is_supported_matrix(item): return True else: return super(SparseResult, self)._supports(item)
def _supports(self, item): """Supports everything of parent class and csr, csc, bsr, and dia sparse matrices.""" if SparseParameter._is_supported_matrix(item): return True else: return super(SparseResult, self)._supports(item)
[ "Supports", "everything", "of", "parent", "class", "and", "csr", "csc", "bsr", "and", "dia", "sparse", "matrices", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2337-L2342
[ "def", "_supports", "(", "self", ",", "item", ")", ":", "if", "SparseParameter", ".", "_is_supported_matrix", "(", "item", ")", ":", "return", "True", "else", ":", "return", "super", "(", "SparseResult", ",", "self", ")", ".", "_supports", "(", "item", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
SparseResult._store
Returns a storage dictionary understood by the storage service. Sparse matrices are extracted similar to the :class:`~pypet.parameter.SparseParameter` and marked with the identifier `__spsp__`.
pypet/parameter.py
def _store(self): """Returns a storage dictionary understood by the storage service. Sparse matrices are extracted similar to the :class:`~pypet.parameter.SparseParameter` and marked with the identifier `__spsp__`. """ store_dict = {} for key in self._data: ...
def _store(self): """Returns a storage dictionary understood by the storage service. Sparse matrices are extracted similar to the :class:`~pypet.parameter.SparseParameter` and marked with the identifier `__spsp__`. """ store_dict = {} for key in self._data: ...
[ "Returns", "a", "storage", "dictionary", "understood", "by", "the", "storage", "service", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2352-L2377
[ "def", "_store", "(", "self", ")", ":", "store_dict", "=", "{", "}", "for", "key", "in", "self", ".", "_data", ":", "val", "=", "self", ".", "_data", "[", "key", "]", "if", "SparseParameter", ".", "_is_supported_matrix", "(", "val", ")", ":", "data_l...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
SparseResult._load
Loads data from `load_dict` Reconstruction of sparse matrices similar to the :class:`~pypet.parameter.SparseParameter`.
pypet/parameter.py
def _load(self, load_dict): """Loads data from `load_dict` Reconstruction of sparse matrices similar to the :class:`~pypet.parameter.SparseParameter`. """ for key in list(load_dict.keys()): # We delete keys over time: if key in load_dict: if Spar...
def _load(self, load_dict): """Loads data from `load_dict` Reconstruction of sparse matrices similar to the :class:`~pypet.parameter.SparseParameter`. """ for key in list(load_dict.keys()): # We delete keys over time: if key in load_dict: if Spar...
[ "Loads", "data", "from", "load_dict" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2379-L2401
[ "def", "_load", "(", "self", ",", "load_dict", ")", ":", "for", "key", "in", "list", "(", "load_dict", ".", "keys", "(", ")", ")", ":", "# We delete keys over time:", "if", "key", "in", "load_dict", ":", "if", "SparseResult", ".", "IDENTIFIER", "in", "ke...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
PickleResult.f_set_single
Adds a single data item to the pickle result. Note that it is NOT checked if the item can be pickled!
pypet/parameter.py
def f_set_single(self, name, item): """Adds a single data item to the pickle result. Note that it is NOT checked if the item can be pickled! """ if self.v_stored: self._logger.debug('You are changing an already stored result. If ' 'you not...
def f_set_single(self, name, item): """Adds a single data item to the pickle result. Note that it is NOT checked if the item can be pickled! """ if self.v_stored: self._logger.debug('You are changing an already stored result. If ' 'you not...
[ "Adds", "a", "single", "data", "item", "to", "the", "pickle", "result", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2448-L2463
[ "def", "f_set_single", "(", "self", ",", "name", ",", "item", ")", ":", "if", "self", ".", "v_stored", ":", "self", ".", "_logger", ".", "debug", "(", "'You are changing an already stored result. If '", "'you not explicitly overwrite the data on disk, this change '", "'...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
PickleResult._store
Returns a dictionary containing pickle dumps
pypet/parameter.py
def _store(self): """Returns a dictionary containing pickle dumps""" store_dict = {} for key, val in self._data.items(): store_dict[key] = pickle.dumps(val, protocol=self.v_protocol) store_dict[PickleResult.PROTOCOL] = self.v_protocol return store_dict
def _store(self): """Returns a dictionary containing pickle dumps""" store_dict = {} for key, val in self._data.items(): store_dict[key] = pickle.dumps(val, protocol=self.v_protocol) store_dict[PickleResult.PROTOCOL] = self.v_protocol return store_dict
[ "Returns", "a", "dictionary", "containing", "pickle", "dumps" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2466-L2472
[ "def", "_store", "(", "self", ")", ":", "store_dict", "=", "{", "}", "for", "key", ",", "val", "in", "self", ".", "_data", ".", "items", "(", ")", ":", "store_dict", "[", "key", "]", "=", "pickle", ".", "dumps", "(", "val", ",", "protocol", "=", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
PickleResult._load
Reconstructs all items from the pickle dumps in `load_dict`. Sets the `v_protocol` property to the protocol of the first reconstructed item.
pypet/parameter.py
def _load(self, load_dict): """Reconstructs all items from the pickle dumps in `load_dict`. Sets the `v_protocol` property to the protocol of the first reconstructed item. """ try: self.v_protocol = load_dict.pop(PickleParameter.PROTOCOL) except KeyError: ...
def _load(self, load_dict): """Reconstructs all items from the pickle dumps in `load_dict`. Sets the `v_protocol` property to the protocol of the first reconstructed item. """ try: self.v_protocol = load_dict.pop(PickleParameter.PROTOCOL) except KeyError: ...
[ "Reconstructs", "all", "items", "from", "the", "pickle", "dumps", "in", "load_dict", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2474-L2488
[ "def", "_load", "(", "self", ",", "load_dict", ")", ":", "try", ":", "self", ".", "v_protocol", "=", "load_dict", ".", "pop", "(", "PickleParameter", ".", "PROTOCOL", ")", "except", "KeyError", ":", "# For backwards compatibility", "dump", "=", "next", "(", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
main
Simply merge all trajectories in the working directory
examples/example_22_saga_python/merge_trajs.py
def main(): """Simply merge all trajectories in the working directory""" folder = os.getcwd() print('Merging all files') merge_all_in_folder(folder, delete_other_files=True, # We will only keep one trajectory dynamic_imports=FunctionParameter, ...
def main(): """Simply merge all trajectories in the working directory""" folder = os.getcwd() print('Merging all files') merge_all_in_folder(folder, delete_other_files=True, # We will only keep one trajectory dynamic_imports=FunctionParameter, ...
[ "Simply", "merge", "all", "trajectories", "in", "the", "working", "directory" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/merge_trajs.py#L9-L17
[ "def", "main", "(", ")", ":", "folder", "=", "os", ".", "getcwd", "(", ")", "print", "(", "'Merging all files'", ")", "merge_all_in_folder", "(", "folder", ",", "delete_other_files", "=", "True", ",", "# We will only keep one trajectory", "dynamic_imports", "=", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
upload_file
Uploads a file
examples/example_22_saga_python/start_saga.py
def upload_file(filename, session): """ Uploads a file """ print('Uploading file %s' % filename) outfilesource = os.path.join(os.getcwd(), filename) outfiletarget = 'sftp://' + ADDRESS + WORKING_DIR out = saga.filesystem.File(outfilesource, session=session, flags=OVERWRITE) out.copy(outfiletarge...
def upload_file(filename, session): """ Uploads a file """ print('Uploading file %s' % filename) outfilesource = os.path.join(os.getcwd(), filename) outfiletarget = 'sftp://' + ADDRESS + WORKING_DIR out = saga.filesystem.File(outfilesource, session=session, flags=OVERWRITE) out.copy(outfiletarge...
[ "Uploads", "a", "file" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L25-L32
[ "def", "upload_file", "(", "filename", ",", "session", ")", ":", "print", "(", "'Uploading file %s'", "%", "filename", ")", "outfilesource", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "filename", ")", "outfiletarget", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
download_file
Downloads a file
examples/example_22_saga_python/start_saga.py
def download_file(filename, session): """ Downloads a file """ print('Downloading file %s' % filename) infilesource = os.path.join('sftp://' + ADDRESS + WORKING_DIR, filename) infiletarget = os.path.join(os.getcwd(), filename) incoming = saga.filesystem.File(infileso...
def download_file(filename, session): """ Downloads a file """ print('Downloading file %s' % filename) infilesource = os.path.join('sftp://' + ADDRESS + WORKING_DIR, filename) infiletarget = os.path.join(os.getcwd(), filename) incoming = saga.filesystem.File(infileso...
[ "Downloads", "a", "file" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L35-L43
[ "def", "download_file", "(", "filename", ",", "session", ")", ":", "print", "(", "'Downloading file %s'", "%", "filename", ")", "infilesource", "=", "os", ".", "path", ".", "join", "(", "'sftp://'", "+", "ADDRESS", "+", "WORKING_DIR", ",", "filename", ")", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
create_session
Creates and returns a new SAGA session
examples/example_22_saga_python/start_saga.py
def create_session(): """ Creates and returns a new SAGA session """ ctx = saga.Context("UserPass") ctx.user_id = USER ctx.user_pass = PASSWORD session = saga.Session() session.add_context(ctx) return session
def create_session(): """ Creates and returns a new SAGA session """ ctx = saga.Context("UserPass") ctx.user_id = USER ctx.user_pass = PASSWORD session = saga.Session() session.add_context(ctx) return session
[ "Creates", "and", "returns", "a", "new", "SAGA", "session" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L46-L55
[ "def", "create_session", "(", ")", ":", "ctx", "=", "saga", ".", "Context", "(", "\"UserPass\"", ")", "ctx", ".", "user_id", "=", "USER", "ctx", ".", "user_pass", "=", "PASSWORD", "session", "=", "saga", ".", "Session", "(", ")", "session", ".", "add_c...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
merge_trajectories
Merges all trajectories found in the working directory
examples/example_22_saga_python/start_saga.py
def merge_trajectories(session): """ Merges all trajectories found in the working directory """ jd = saga.job.Description() jd.executable = 'python' jd.arguments = ['merge_trajs.py'] jd.output = "mysagajob_merge.stdout" jd.error = "mysagajob_merge.stderr" jd.wo...
def merge_trajectories(session): """ Merges all trajectories found in the working directory """ jd = saga.job.Description() jd.executable = 'python' jd.arguments = ['merge_trajs.py'] jd.output = "mysagajob_merge.stdout" jd.error = "mysagajob_merge.stderr" jd.wo...
[ "Merges", "all", "trajectories", "found", "in", "the", "working", "directory" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L58-L82
[ "def", "merge_trajectories", "(", "session", ")", ":", "jd", "=", "saga", ".", "job", ".", "Description", "(", ")", "jd", ".", "executable", "=", "'python'", "jd", ".", "arguments", "=", "[", "'merge_trajs.py'", "]", "jd", ".", "output", "=", "\"mysagajo...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
start_jobs
Starts all jobs and runs `the_task.py` in batches.
examples/example_22_saga_python/start_saga.py
def start_jobs(session): """ Starts all jobs and runs `the_task.py` in batches. """ js = saga.job.Service('ssh://' + ADDRESS, session=session) batches = range(3) jobs = [] for batch in batches: print('Starting batch %d' % batch) jd = saga.job.Description() jd.executable ...
def start_jobs(session): """ Starts all jobs and runs `the_task.py` in batches. """ js = saga.job.Service('ssh://' + ADDRESS, session=session) batches = range(3) jobs = [] for batch in batches: print('Starting batch %d' % batch) jd = saga.job.Description() jd.executable ...
[ "Starts", "all", "jobs", "and", "runs", "the_task", ".", "py", "in", "batches", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/start_saga.py#L85-L123
[ "def", "start_jobs", "(", "session", ")", ":", "js", "=", "saga", ".", "job", ".", "Service", "(", "'ssh://'", "+", "ADDRESS", ",", "session", "=", "session", ")", "batches", "=", "range", "(", "3", ")", "jobs", "=", "[", "]", "for", "batch", "in",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
multiply
Sophisticated simulation of multiplication
examples/example_21_scoop_multiprocessing.py
def multiply(traj): """Sophisticated simulation of multiplication""" z=traj.x*traj.y traj.f_add_result('z',z=z, comment='I am the product of two reals!')
def multiply(traj): """Sophisticated simulation of multiplication""" z=traj.x*traj.y traj.f_add_result('z',z=z, comment='I am the product of two reals!')
[ "Sophisticated", "simulation", "of", "multiplication" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_21_scoop_multiprocessing.py#L16-L19
[ "def", "multiply", "(", "traj", ")", ":", "z", "=", "traj", ".", "x", "*", "traj", ".", "y", "traj", ".", "f_add_result", "(", "'z'", ",", "z", "=", "z", ",", "comment", "=", "'I am the product of two reals!'", ")" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
main
Main function to protect the *entry point* of the program. If you want to use multiprocessing with SCOOP you need to wrap your main code creating an environment into a function. Otherwise the newly started child processes will re-execute the code and throw errors (also see http://scoop.readthedocs.org/...
examples/example_21_scoop_multiprocessing.py
def main(): """Main function to protect the *entry point* of the program. If you want to use multiprocessing with SCOOP you need to wrap your main code creating an environment into a function. Otherwise the newly started child processes will re-execute the code and throw errors (also see http://sco...
def main(): """Main function to protect the *entry point* of the program. If you want to use multiprocessing with SCOOP you need to wrap your main code creating an environment into a function. Otherwise the newly started child processes will re-execute the code and throw errors (also see http://sco...
[ "Main", "function", "to", "protect", "the", "*", "entry", "point", "*", "of", "the", "program", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_21_scoop_multiprocessing.py#L22-L64
[ "def", "main", "(", ")", ":", "# Create an environment that handles running.", "# Let's enable multiprocessing with scoop:", "filename", "=", "os", ".", "path", ".", "join", "(", "'hdf5'", ",", "'example_21.hdf5'", ")", "env", "=", "Environment", "(", "trajectory", "=...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
run_neuron
Runs a simulation of a model neuron. :param traj: Container with all parameters. :return: An estimate of the firing rate of the neuron
examples/example_13_post_processing/main.py
def run_neuron(traj): """Runs a simulation of a model neuron. :param traj: Container with all parameters. :return: An estimate of the firing rate of the neuron """ # Extract all parameters from `traj` V_init = traj.par.neuron.V_init I = traj.par.neuron.I tau_V = tra...
def run_neuron(traj): """Runs a simulation of a model neuron. :param traj: Container with all parameters. :return: An estimate of the firing rate of the neuron """ # Extract all parameters from `traj` V_init = traj.par.neuron.V_init I = traj.par.neuron.I tau_V = tra...
[ "Runs", "a", "simulation", "of", "a", "model", "neuron", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_13_post_processing/main.py#L11-L64
[ "def", "run_neuron", "(", "traj", ")", ":", "# Extract all parameters from `traj`", "V_init", "=", "traj", ".", "par", ".", "neuron", ".", "V_init", "I", "=", "traj", ".", "par", ".", "neuron", ".", "I", "tau_V", "=", "traj", ".", "par", ".", "neuron", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
neuron_postproc
Postprocessing, sorts computed firing rates into a table :param traj: Container for results and parameters :param result_list: List of tuples, where first entry is the run index and second is the actual result of the corresponding run. :return:
examples/example_13_post_processing/main.py
def neuron_postproc(traj, result_list): """Postprocessing, sorts computed firing rates into a table :param traj: Container for results and parameters :param result_list: List of tuples, where first entry is the run index and second is the actual result of the corresponding run. ...
def neuron_postproc(traj, result_list): """Postprocessing, sorts computed firing rates into a table :param traj: Container for results and parameters :param result_list: List of tuples, where first entry is the run index and second is the actual result of the corresponding run. ...
[ "Postprocessing", "sorts", "computed", "firing", "rates", "into", "a", "table" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_13_post_processing/main.py#L68-L108
[ "def", "neuron_postproc", "(", "traj", ",", "result_list", ")", ":", "# Let's create a pandas DataFrame to sort the computed firing rate according to the", "# parameters. We could have also used a 2D numpy array.", "# But a pandas DataFrame has the advantage that we can index into directly with"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
add_parameters
Adds all parameters to `traj`
examples/example_13_post_processing/main.py
def add_parameters(traj): """Adds all parameters to `traj`""" print('Adding Parameters') traj.f_add_parameter('neuron.V_init', 0.0, comment='The initial condition for the ' 'membrane potential') traj.f_add_parameter('neuron.I', 0.0, ...
def add_parameters(traj): """Adds all parameters to `traj`""" print('Adding Parameters') traj.f_add_parameter('neuron.V_init', 0.0, comment='The initial condition for the ' 'membrane potential') traj.f_add_parameter('neuron.I', 0.0, ...
[ "Adds", "all", "parameters", "to", "traj" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_13_post_processing/main.py#L111-L131
[ "def", "add_parameters", "(", "traj", ")", ":", "print", "(", "'Adding Parameters'", ")", "traj", ".", "f_add_parameter", "(", "'neuron.V_init'", ",", "0.0", ",", "comment", "=", "'The initial condition for the '", "'membrane potential'", ")", "traj", ".", "f_add_pa...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
add_exploration
Explores different values of `I` and `tau_ref`.
examples/example_13_post_processing/main.py
def add_exploration(traj): """Explores different values of `I` and `tau_ref`.""" print('Adding exploration of I and tau_ref') explore_dict = {'neuron.I': np.arange(0, 1.01, 0.01).tolist(), 'neuron.tau_ref': [5.0, 7.5, 10.0]} explore_dict = cartesian_product(explore_dict, ('neuron....
def add_exploration(traj): """Explores different values of `I` and `tau_ref`.""" print('Adding exploration of I and tau_ref') explore_dict = {'neuron.I': np.arange(0, 1.01, 0.01).tolist(), 'neuron.tau_ref': [5.0, 7.5, 10.0]} explore_dict = cartesian_product(explore_dict, ('neuron....
[ "Explores", "different", "values", "of", "I", "and", "tau_ref", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_13_post_processing/main.py#L134-L147
[ "def", "add_exploration", "(", "traj", ")", ":", "print", "(", "'Adding exploration of I and tau_ref'", ")", "explore_dict", "=", "{", "'neuron.I'", ":", "np", ".", "arange", "(", "0", ",", "1.01", ",", "0.01", ")", ".", "tolist", "(", ")", ",", "'neuron.t...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkRunner.execute_network_pre_run
Runs a network before the actual experiment. Called by a :class:`~pypet.brian2.network.NetworkManager`. Similar to :func:`~pypet.brian2.network.NetworkRunner.run_network`. Subruns and their durations are extracted from the trajectory. All :class:`~pypet.brian2.parameter.Brian2Parameter...
pypet/brian2/network.py
def execute_network_pre_run(self, traj, network, network_dict, component_list, analyser_list): """Runs a network before the actual experiment. Called by a :class:`~pypet.brian2.network.NetworkManager`. Similar to :func:`~pypet.brian2.network.NetworkRunner.run_network`. Subruns and thei...
def execute_network_pre_run(self, traj, network, network_dict, component_list, analyser_list): """Runs a network before the actual experiment. Called by a :class:`~pypet.brian2.network.NetworkManager`. Similar to :func:`~pypet.brian2.network.NetworkRunner.run_network`. Subruns and thei...
[ "Runs", "a", "network", "before", "the", "actual", "experiment", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L276-L303
[ "def", "execute_network_pre_run", "(", "self", ",", "traj", ",", "network", ",", "network_dict", ",", "component_list", ",", "analyser_list", ")", ":", "self", ".", "_execute_network_run", "(", "traj", ",", "network", ",", "network_dict", ",", "component_list", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkRunner.execute_network_run
Runs a network in an experimental run. Called by a :class:`~pypet.brian2.network.NetworkManager`. A network run is divided into several subruns which are defined as :class:`~pypet.brian2.parameter.Brian2Parameter` instances. These subruns are extracted from the trajectory. All ...
pypet/brian2/network.py
def execute_network_run(self, traj, network, network_dict, component_list, analyser_list): """Runs a network in an experimental run. Called by a :class:`~pypet.brian2.network.NetworkManager`. A network run is divided into several subruns which are defined as :class:`~pypet.brian2.param...
def execute_network_run(self, traj, network, network_dict, component_list, analyser_list): """Runs a network in an experimental run. Called by a :class:`~pypet.brian2.network.NetworkManager`. A network run is divided into several subruns which are defined as :class:`~pypet.brian2.param...
[ "Runs", "a", "network", "in", "an", "experimental", "run", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L305-L381
[ "def", "execute_network_run", "(", "self", ",", "traj", ",", "network", ",", "network_dict", ",", "component_list", ",", "analyser_list", ")", ":", "self", ".", "_execute_network_run", "(", "traj", ",", "network", ",", "network_dict", ",", "component_list", ",",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkRunner._extract_subruns
Extracts subruns from the trajectory. :param traj: Trajectory container :param pre_run: Boolean whether current run is regular or a pre-run :raises: RuntimeError if orders are duplicates or even missing
pypet/brian2/network.py
def _extract_subruns(self, traj, pre_run=False): """Extracts subruns from the trajectory. :param traj: Trajectory container :param pre_run: Boolean whether current run is regular or a pre-run :raises: RuntimeError if orders are duplicates or even missing """ if pre_ru...
def _extract_subruns(self, traj, pre_run=False): """Extracts subruns from the trajectory. :param traj: Trajectory container :param pre_run: Boolean whether current run is regular or a pre-run :raises: RuntimeError if orders are duplicates or even missing """ if pre_ru...
[ "Extracts", "subruns", "from", "the", "trajectory", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L383-L420
[ "def", "_extract_subruns", "(", "self", ",", "traj", ",", "pre_run", "=", "False", ")", ":", "if", "pre_run", ":", "durations_list", "=", "traj", ".", "f_get_all", "(", "self", ".", "_pre_durations_group_name", ")", "else", ":", "durations_list", "=", "traj"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkRunner._execute_network_run
Generic `execute_network_run` function, handles experimental runs as well as pre-runs. See also :func:`~pypet.brian2.network.NetworkRunner.execute_network_run` and :func:`~pypet.brian2.network.NetworkRunner.execute_network_pre_run`.
pypet/brian2/network.py
def _execute_network_run(self, traj, network, network_dict, component_list, analyser_list, pre_run=False): """Generic `execute_network_run` function, handles experimental runs as well as pre-runs. See also :func:`~pypet.brian2.network.NetworkRunner.execute_network_run` and ...
def _execute_network_run(self, traj, network, network_dict, component_list, analyser_list, pre_run=False): """Generic `execute_network_run` function, handles experimental runs as well as pre-runs. See also :func:`~pypet.brian2.network.NetworkRunner.execute_network_run` and ...
[ "Generic", "execute_network_run", "function", "handles", "experimental", "runs", "as", "well", "as", "pre", "-", "runs", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L422-L483
[ "def", "_execute_network_run", "(", "self", ",", "traj", ",", "network", ",", "network_dict", ",", "component_list", ",", "analyser_list", ",", "pre_run", "=", "False", ")", ":", "# Initially extract the `subrun_list`", "subrun_list", "=", "self", ".", "_extract_sub...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkManager.add_parameters
Adds parameters for a network simulation. Calls :func:`~pypet.brian2.network.NetworkComponent.add_parameters` for all components, analyser, and the network runner (in this order). :param traj: Trajectory container
pypet/brian2/network.py
def add_parameters(self, traj): """Adds parameters for a network simulation. Calls :func:`~pypet.brian2.network.NetworkComponent.add_parameters` for all components, analyser, and the network runner (in this order). :param traj: Trajectory container """ self._logger.in...
def add_parameters(self, traj): """Adds parameters for a network simulation. Calls :func:`~pypet.brian2.network.NetworkComponent.add_parameters` for all components, analyser, and the network runner (in this order). :param traj: Trajectory container """ self._logger.in...
[ "Adds", "parameters", "for", "a", "network", "simulation", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L541-L563
[ "def", "add_parameters", "(", "self", ",", "traj", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Adding Parameters of Components'", ")", "for", "component", "in", "self", ".", "components", ":", "component", ".", "add_parameters", "(", "traj", ")", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkManager.pre_build
Pre-builds network components. Calls :func:`~pypet.brian2.network.NetworkComponent.pre_build` for all components, analysers, and the network runner. `pre_build` is not automatically called but either needs to be executed manually by the user, either calling it directly or by using ...
pypet/brian2/network.py
def pre_build(self, traj): """Pre-builds network components. Calls :func:`~pypet.brian2.network.NetworkComponent.pre_build` for all components, analysers, and the network runner. `pre_build` is not automatically called but either needs to be executed manually by the user, eithe...
def pre_build(self, traj): """Pre-builds network components. Calls :func:`~pypet.brian2.network.NetworkComponent.pre_build` for all components, analysers, and the network runner. `pre_build` is not automatically called but either needs to be executed manually by the user, eithe...
[ "Pre", "-", "builds", "network", "components", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L565-L595
[ "def", "pre_build", "(", "self", ",", "traj", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Pre-Building Components'", ")", "for", "component", "in", "self", ".", "components", ":", "component", ".", "pre_build", "(", "traj", ",", "self", ".", "_...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkManager.build
Pre-builds network components. Calls :func:`~pypet.brian2.network.NetworkComponent.build` for all components, analysers and the network runner. `build` does not need to be called by the user. If `~pypet.brian2.network.run_network` is passed to an :class:`~pypet.environment.Environment`...
pypet/brian2/network.py
def build(self, traj): """Pre-builds network components. Calls :func:`~pypet.brian2.network.NetworkComponent.build` for all components, analysers and the network runner. `build` does not need to be called by the user. If `~pypet.brian2.network.run_network` is passed to an :clas...
def build(self, traj): """Pre-builds network components. Calls :func:`~pypet.brian2.network.NetworkComponent.build` for all components, analysers and the network runner. `build` does not need to be called by the user. If `~pypet.brian2.network.run_network` is passed to an :clas...
[ "Pre", "-", "builds", "network", "components", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L598-L624
[ "def", "build", "(", "self", ",", "traj", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Building Components'", ")", "for", "component", "in", "self", ".", "components", ":", "component", ".", "build", "(", "traj", ",", "self", ".", "_brian_list",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkManager.pre_run_network
Starts a network run before the individual run. Useful if a network needs an initial run that can be shared by all individual experimental runs during parameter exploration. Needs to be called by the user. If `pre_run_network` is started by the user, :func:`~pypet.brian2.network.Networ...
pypet/brian2/network.py
def pre_run_network(self, traj): """Starts a network run before the individual run. Useful if a network needs an initial run that can be shared by all individual experimental runs during parameter exploration. Needs to be called by the user. If `pre_run_network` is started by the user,...
def pre_run_network(self, traj): """Starts a network run before the individual run. Useful if a network needs an initial run that can be shared by all individual experimental runs during parameter exploration. Needs to be called by the user. If `pre_run_network` is started by the user,...
[ "Starts", "a", "network", "run", "before", "the", "individual", "run", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L627-L664
[ "def", "pre_run_network", "(", "self", ",", "traj", ")", ":", "self", ".", "pre_build", "(", "traj", ")", "self", ".", "_logger", ".", "info", "(", "'\\n------------------------\\n'", "'Pre-Running the Network\\n'", "'------------------------'", ")", "self", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkManager.run_network
Top-level simulation function, pass this to the environment Performs an individual network run during parameter exploration. `run_network` does not need to be called by the user. If this method (not this one of the NetworkManager) is passed to an :class:`~pypet.environment.Environment`...
pypet/brian2/network.py
def run_network(self, traj): """Top-level simulation function, pass this to the environment Performs an individual network run during parameter exploration. `run_network` does not need to be called by the user. If this method (not this one of the NetworkManager) is passed to an...
def run_network(self, traj): """Top-level simulation function, pass this to the environment Performs an individual network run during parameter exploration. `run_network` does not need to be called by the user. If this method (not this one of the NetworkManager) is passed to an...
[ "Top", "-", "level", "simulation", "function", "pass", "this", "to", "the", "environment" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L667-L696
[ "def", "run_network", "(", "self", ",", "traj", ")", ":", "# Check if the network was pre-built", "if", "self", ".", "_pre_built", ":", "if", "self", ".", "_pre_run", "and", "hasattr", "(", "self", ".", "_network", ",", "'restore'", ")", ":", "self", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NetworkManager._run_network
Starts a single run carried out by a NetworkRunner. Called from the public function :func:`~pypet.brian2.network.NetworkManger.run_network`. :param traj: Trajectory container
pypet/brian2/network.py
def _run_network(self, traj): """Starts a single run carried out by a NetworkRunner. Called from the public function :func:`~pypet.brian2.network.NetworkManger.run_network`. :param traj: Trajectory container """ self.build(traj) self._pretty_print_explored_parameters(...
def _run_network(self, traj): """Starts a single run carried out by a NetworkRunner. Called from the public function :func:`~pypet.brian2.network.NetworkManger.run_network`. :param traj: Trajectory container """ self.build(traj) self._pretty_print_explored_parameters(...
[ "Starts", "a", "single", "run", "carried", "out", "by", "a", "NetworkRunner", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/network.py#L714-L737
[ "def", "_run_network", "(", "self", ",", "traj", ")", ":", "self", ".", "build", "(", "traj", ")", "self", ".", "_pretty_print_explored_parameters", "(", "traj", ")", "# We need to construct a network object in case one was not pre-run", "if", "not", "self", ".", "_...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
make_filename
Function to create generic filenames based on what has been explored
examples/example_17_wrapping_an_existing_project/pypetwrap.py
def make_filename(traj): """ Function to create generic filenames based on what has been explored """ explored_parameters = traj.f_get_explored_parameters() filename = '' for param in explored_parameters.values(): short_name = param.v_name val = param.f_get() filename += '%s_%s__...
def make_filename(traj): """ Function to create generic filenames based on what has been explored """ explored_parameters = traj.f_get_explored_parameters() filename = '' for param in explored_parameters.values(): short_name = param.v_name val = param.f_get() filename += '%s_%s__...
[ "Function", "to", "create", "generic", "filenames", "based", "on", "what", "has", "been", "explored" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_17_wrapping_an_existing_project/pypetwrap.py#L23-L32
[ "def", "make_filename", "(", "traj", ")", ":", "explored_parameters", "=", "traj", ".", "f_get_explored_parameters", "(", ")", "filename", "=", "''", "for", "param", "in", "explored_parameters", ".", "values", "(", ")", ":", "short_name", "=", "param", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
wrap_automaton
Simple wrapper function for compatibility with *pypet*. We will call the original simulation functions with data extracted from ``traj``. The resulting automaton patterns wil also be stored into the trajectory. :param traj: Trajectory container for data
examples/example_17_wrapping_an_existing_project/pypetwrap.py
def wrap_automaton(traj): """ Simple wrapper function for compatibility with *pypet*. We will call the original simulation functions with data extracted from ``traj``. The resulting automaton patterns wil also be stored into the trajectory. :param traj: Trajectory container for data """ # Ma...
def wrap_automaton(traj): """ Simple wrapper function for compatibility with *pypet*. We will call the original simulation functions with data extracted from ``traj``. The resulting automaton patterns wil also be stored into the trajectory. :param traj: Trajectory container for data """ # Ma...
[ "Simple", "wrapper", "function", "for", "compatibility", "with", "*", "pypet", "*", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_17_wrapping_an_existing_project/pypetwrap.py#L34-L49
[ "def", "wrap_automaton", "(", "traj", ")", ":", "# Make initial state", "initial_state", "=", "make_initial_state", "(", "traj", ".", "initial_name", ",", "traj", ".", "ncells", ",", "traj", ".", "seed", ")", "# Run simulation", "pattern", "=", "cellular_automaton...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
main
Main *boilerplate* function to start simulation
examples/example_17_wrapping_an_existing_project/pypetwrap.py
def main(): """ Main *boilerplate* function to start simulation """ # Now let's make use of logging logger = logging.getLogger() # Create folders for data and plots folder = os.path.join(os.getcwd(), 'experiments', 'ca_patterns_pypet') if not os.path.isdir(folder): os.makedirs(folder) ...
def main(): """ Main *boilerplate* function to start simulation """ # Now let's make use of logging logger = logging.getLogger() # Create folders for data and plots folder = os.path.join(os.getcwd(), 'experiments', 'ca_patterns_pypet') if not os.path.isdir(folder): os.makedirs(folder) ...
[ "Main", "*", "boilerplate", "*", "function", "to", "start", "simulation" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_17_wrapping_an_existing_project/pypetwrap.py#L52-L106
[ "def", "main", "(", ")", ":", "# Now let's make use of logging", "logger", "=", "logging", ".", "getLogger", "(", ")", "# Create folders for data and plots", "folder", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "'experiments'...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
IteratorChain.next
Returns next element from chain. More precisely, it returns the next element of the foremost iterator. If this iterator is empty it moves iteratively along the chain of available iterators to pick the new foremost one. Raises StopIteration if there are no elements left.
pypet/utils/helpful_classes.py
def next(self): """Returns next element from chain. More precisely, it returns the next element of the foremost iterator. If this iterator is empty it moves iteratively along the chain of available iterators to pick the new foremost one. Raises StopIteration if there are no ele...
def next(self): """Returns next element from chain. More precisely, it returns the next element of the foremost iterator. If this iterator is empty it moves iteratively along the chain of available iterators to pick the new foremost one. Raises StopIteration if there are no ele...
[ "Returns", "next", "element", "from", "chain", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_classes.py#L35-L57
[ "def", "next", "(", "self", ")", ":", "while", "True", ":", "# We need this loop because some iterators may already be empty.", "# We keep on popping from the left until next succeeds and as long", "# as there are iterators available", "try", ":", "return", "next", "(", "self", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
merge_all_in_folder
Merges all files in a given folder. IMPORTANT: Does not check if there are more than 1 trajectory in a file. Always uses the last trajectory in file and ignores the other ones. Trajectories are merged according to the alphabetical order of the files, i.e. the resulting merged trajectory is found in th...
pypet/utils/trajectory_utils.py
def merge_all_in_folder(folder, ext='.hdf5', dynamic_imports=None, storage_service=None, force=False, ignore_data=(), move_data=False, delete_other_files=False, ...
def merge_all_in_folder(folder, ext='.hdf5', dynamic_imports=None, storage_service=None, force=False, ignore_data=(), move_data=False, delete_other_files=False, ...
[ "Merges", "all", "files", "in", "a", "given", "folder", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/trajectory_utils.py#L7-L77
[ "def", "merge_all_in_folder", "(", "folder", ",", "ext", "=", "'.hdf5'", ",", "dynamic_imports", "=", "None", ",", "storage_service", "=", "None", ",", "force", "=", "False", ",", "ignore_data", "=", "(", ")", ",", "move_data", "=", "False", ",", "delete_o...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
_SigintHandler._handle_sigint
Handler of SIGINT Does nothing if SIGINT is encountered once but raises a KeyboardInterrupt in case it is encountered twice. immediatly.
pypet/utils/siginthandling.py
def _handle_sigint(self, signum, frame): """Handler of SIGINT Does nothing if SIGINT is encountered once but raises a KeyboardInterrupt in case it is encountered twice. immediatly. """ if self.hit: prompt = 'Exiting immediately!' raise KeyboardIn...
def _handle_sigint(self, signum, frame): """Handler of SIGINT Does nothing if SIGINT is encountered once but raises a KeyboardInterrupt in case it is encountered twice. immediatly. """ if self.hit: prompt = 'Exiting immediately!' raise KeyboardIn...
[ "Handler", "of", "SIGINT" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/siginthandling.py#L28-L45
[ "def", "_handle_sigint", "(", "self", ",", "signum", ",", "frame", ")", ":", "if", "self", ".", "hit", ":", "prompt", "=", "'Exiting immediately!'", "raise", "KeyboardInterrupt", "(", "prompt", ")", "else", ":", "self", ".", "hit", "=", "True", "prompt", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
config_from_file
Small configuration file management function
pyecobee/__init__.py
def config_from_file(filename, config=None): ''' Small configuration file management function''' if config: # We're writing configuration try: with open(filename, 'w') as fdesc: fdesc.write(json.dumps(config)) except IOError as error: logger.except...
def config_from_file(filename, config=None): ''' Small configuration file management function''' if config: # We're writing configuration try: with open(filename, 'w') as fdesc: fdesc.write(json.dumps(config)) except IOError as error: logger.except...
[ "Small", "configuration", "file", "management", "function" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L12-L32
[ "def", "config_from_file", "(", "filename", ",", "config", "=", "None", ")", ":", "if", "config", ":", "# We're writing configuration", "try", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "fdesc", ":", "fdesc", ".", "write", "(", "json", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.request_pin
Method to request a PIN from ecobee for authorization
pyecobee/__init__.py
def request_pin(self): ''' Method to request a PIN from ecobee for authorization ''' url = 'https://api.ecobee.com/authorize' params = {'response_type': 'ecobeePin', 'client_id': self.api_key, 'scope': 'smartWrite'} try: request = requests.get(url, params=pa...
def request_pin(self): ''' Method to request a PIN from ecobee for authorization ''' url = 'https://api.ecobee.com/authorize' params = {'response_type': 'ecobeePin', 'client_id': self.api_key, 'scope': 'smartWrite'} try: request = requests.get(url, params=pa...
[ "Method", "to", "request", "a", "PIN", "from", "ecobee", "for", "authorization" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L77-L94
[ "def", "request_pin", "(", "self", ")", ":", "url", "=", "'https://api.ecobee.com/authorize'", "params", "=", "{", "'response_type'", ":", "'ecobeePin'", ",", "'client_id'", ":", "self", ".", "api_key", ",", "'scope'", ":", "'smartWrite'", "}", "try", ":", "re...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.request_tokens
Method to request API tokens from ecobee
pyecobee/__init__.py
def request_tokens(self): ''' Method to request API tokens from ecobee ''' url = 'https://api.ecobee.com/token' params = {'grant_type': 'ecobeePin', 'code': self.authorization_code, 'client_id': self.api_key} try: request = requests.post(url, params=params) ...
def request_tokens(self): ''' Method to request API tokens from ecobee ''' url = 'https://api.ecobee.com/token' params = {'grant_type': 'ecobeePin', 'code': self.authorization_code, 'client_id': self.api_key} try: request = requests.post(url, params=params) ...
[ "Method", "to", "request", "API", "tokens", "from", "ecobee" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L96-L115
[ "def", "request_tokens", "(", "self", ")", ":", "url", "=", "'https://api.ecobee.com/token'", "params", "=", "{", "'grant_type'", ":", "'ecobeePin'", ",", "'code'", ":", "self", ".", "authorization_code", ",", "'client_id'", ":", "self", ".", "api_key", "}", "...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.refresh_tokens
Method to refresh API tokens from ecobee
pyecobee/__init__.py
def refresh_tokens(self): ''' Method to refresh API tokens from ecobee ''' url = 'https://api.ecobee.com/token' params = {'grant_type': 'refresh_token', 'refresh_token': self.refresh_token, 'client_id': self.api_key} request = requests.post(url, params...
def refresh_tokens(self): ''' Method to refresh API tokens from ecobee ''' url = 'https://api.ecobee.com/token' params = {'grant_type': 'refresh_token', 'refresh_token': self.refresh_token, 'client_id': self.api_key} request = requests.post(url, params...
[ "Method", "to", "refresh", "API", "tokens", "from", "ecobee" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L117-L130
[ "def", "refresh_tokens", "(", "self", ")", ":", "url", "=", "'https://api.ecobee.com/token'", "params", "=", "{", "'grant_type'", ":", "'refresh_token'", ",", "'refresh_token'", ":", "self", ".", "refresh_token", ",", "'client_id'", ":", "self", ".", "api_key", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.get_thermostats
Set self.thermostats to a json list of thermostats from ecobee
pyecobee/__init__.py
def get_thermostats(self): ''' Set self.thermostats to a json list of thermostats from ecobee ''' url = 'https://api.ecobee.com/1/thermostat' header = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': 'Bearer ' + self.access_token} params = {'json': ('...
def get_thermostats(self): ''' Set self.thermostats to a json list of thermostats from ecobee ''' url = 'https://api.ecobee.com/1/thermostat' header = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': 'Bearer ' + self.access_token} params = {'json': ('...
[ "Set", "self", ".", "thermostats", "to", "a", "json", "list", "of", "thermostats", "from", "ecobee" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L132-L161
[ "def", "get_thermostats", "(", "self", ")", ":", "url", "=", "'https://api.ecobee.com/1/thermostat'", "header", "=", "{", "'Content-Type'", ":", "'application/json;charset=UTF-8'", ",", "'Authorization'", ":", "'Bearer '", "+", "self", ".", "access_token", "}", "param...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.write_tokens_to_file
Write api tokens to a file
pyecobee/__init__.py
def write_tokens_to_file(self): ''' Write api tokens to a file ''' config = dict() config['API_KEY'] = self.api_key config['ACCESS_TOKEN'] = self.access_token config['REFRESH_TOKEN'] = self.refresh_token config['AUTHORIZATION_CODE'] = self.authorization_code if se...
def write_tokens_to_file(self): ''' Write api tokens to a file ''' config = dict() config['API_KEY'] = self.api_key config['ACCESS_TOKEN'] = self.access_token config['REFRESH_TOKEN'] = self.refresh_token config['AUTHORIZATION_CODE'] = self.authorization_code if se...
[ "Write", "api", "tokens", "to", "a", "file" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L171-L181
[ "def", "write_tokens_to_file", "(", "self", ")", ":", "config", "=", "dict", "(", ")", "config", "[", "'API_KEY'", "]", "=", "self", ".", "api_key", "config", "[", "'ACCESS_TOKEN'", "]", "=", "self", ".", "access_token", "config", "[", "'REFRESH_TOKEN'", "...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_hvac_mode
possible hvac modes are auto, auxHeatOnly, cool, heat, off
pyecobee/__init__.py
def set_hvac_mode(self, index, hvac_mode): ''' possible hvac modes are auto, auxHeatOnly, cool, heat, off ''' body = {"selection": {"selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "thermostat": { ...
def set_hvac_mode(self, index, hvac_mode): ''' possible hvac modes are auto, auxHeatOnly, cool, heat, off ''' body = {"selection": {"selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "thermostat": { ...
[ "possible", "hvac", "modes", "are", "auto", "auxHeatOnly", "cool", "heat", "off" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L207-L217
[ "def", "set_hvac_mode", "(", "self", ",", "index", ",", "hvac_mode", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", "thermostats", "[", "index", "]", "[", "'ide...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_fan_min_on_time
The minimum time, in minutes, to run the fan each hour. Value from 1 to 60
pyecobee/__init__.py
def set_fan_min_on_time(self, index, fan_min_on_time): ''' The minimum time, in minutes, to run the fan each hour. Value from 1 to 60 ''' body = {"selection": {"selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "therm...
def set_fan_min_on_time(self, index, fan_min_on_time): ''' The minimum time, in minutes, to run the fan each hour. Value from 1 to 60 ''' body = {"selection": {"selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "therm...
[ "The", "minimum", "time", "in", "minutes", "to", "run", "the", "fan", "each", "hour", ".", "Value", "from", "1", "to", "60" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L219-L229
[ "def", "set_fan_min_on_time", "(", "self", ",", "index", ",", "fan_min_on_time", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", "thermostats", "[", "index", "]", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_fan_mode
Set fan mode. Values: auto, minontime, on
pyecobee/__init__.py
def set_fan_mode(self, index, fan_mode, cool_temp, heat_temp, hold_type="nextTransition"): ''' Set fan mode. Values: auto, minontime, on ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, ...
def set_fan_mode(self, index, fan_mode, cool_temp, heat_temp, hold_type="nextTransition"): ''' Set fan mode. Values: auto, minontime, on ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, ...
[ "Set", "fan", "mode", ".", "Values", ":", "auto", "minontime", "on" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L231-L243
[ "def", "set_fan_mode", "(", "self", ",", "index", ",", "fan_mode", ",", "cool_temp", ",", "heat_temp", ",", "hold_type", "=", "\"nextTransition\"", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"sele...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_hold_temp
Set a hold
pyecobee/__init__.py
def set_hold_temp(self, index, cool_temp, heat_temp, hold_type="nextTransition"): ''' Set a hold ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions":...
def set_hold_temp(self, index, cool_temp, heat_temp, hold_type="nextTransition"): ''' Set a hold ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions":...
[ "Set", "a", "hold" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L245-L257
[ "def", "set_hold_temp", "(", "self", ",", "index", ",", "cool_temp", ",", "heat_temp", ",", "hold_type", "=", "\"nextTransition\"", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":"...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_climate_hold
Set a climate hold - ie away, home, sleep
pyecobee/__init__.py
def set_climate_hold(self, index, climate, hold_type="nextTransition"): ''' Set a climate hold - ie away, home, sleep ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": ...
def set_climate_hold(self, index, climate, hold_type="nextTransition"): ''' Set a climate hold - ie away, home, sleep ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": ...
[ "Set", "a", "climate", "hold", "-", "ie", "away", "home", "sleep" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L259-L269
[ "def", "set_climate_hold", "(", "self", ",", "index", ",", "climate", ",", "hold_type", "=", "\"nextTransition\"", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.delete_vacation
Delete the vacation with name vacation
pyecobee/__init__.py
def delete_vacation(self, index, vacation): ''' Delete the vacation with name vacation ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": [{"type": "deleteVacation", "pa...
def delete_vacation(self, index, vacation): ''' Delete the vacation with name vacation ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": [{"type": "deleteVacation", "pa...
[ "Delete", "the", "vacation", "with", "name", "vacation" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L271-L281
[ "def", "delete_vacation", "(", "self", ",", "index", ",", "vacation", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", "thermostats", "[", "index", "]", "[", "'id...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.resume_program
Resume currently scheduled program
pyecobee/__init__.py
def resume_program(self, index, resume_all=False): ''' Resume currently scheduled program ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": [{"type": "resumeProgram", "...
def resume_program(self, index, resume_all=False): ''' Resume currently scheduled program ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": [{"type": "resumeProgram", "...
[ "Resume", "currently", "scheduled", "program" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L283-L293
[ "def", "resume_program", "(", "self", ",", "index", ",", "resume_all", "=", "False", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", "thermostats", "[", "index", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.send_message
Send a message to the thermostat
pyecobee/__init__.py
def send_message(self, index, message="Hello from python-ecobee!"): ''' Send a message to the thermostat ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": [{"type": "se...
def send_message(self, index, message="Hello from python-ecobee!"): ''' Send a message to the thermostat ''' body = {"selection": { "selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "functions": [{"type": "se...
[ "Send", "a", "message", "to", "the", "thermostat" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L295-L305
[ "def", "send_message", "(", "self", ",", "index", ",", "message", "=", "\"Hello from python-ecobee!\"", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", "thermostats", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_humidity
Set humidity level
pyecobee/__init__.py
def set_humidity(self, index, humidity): ''' Set humidity level''' body = {"selection": {"selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "thermostat": { "settings": { ...
def set_humidity(self, index, humidity): ''' Set humidity level''' body = {"selection": {"selectionType": "thermostats", "selectionMatch": self.thermostats[index]['identifier']}, "thermostat": { "settings": { ...
[ "Set", "humidity", "level" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L307-L318
[ "def", "set_humidity", "(", "self", ",", "index", ",", "humidity", ")", ":", "body", "=", "{", "\"selection\"", ":", "{", "\"selectionType\"", ":", "\"thermostats\"", ",", "\"selectionMatch\"", ":", "self", ".", "thermostats", "[", "index", "]", "[", "'ident...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_mic_mode
Enable/disable Alexa mic (only for Ecobee 4) Values: True, False
pyecobee/__init__.py
def set_mic_mode(self, index, mic_enabled): '''Enable/disable Alexa mic (only for Ecobee 4) Values: True, False ''' body = { 'selection': { 'selectionType': 'thermostats', 'selectionMatch': self.thermostats[index]['identifier']}, ...
def set_mic_mode(self, index, mic_enabled): '''Enable/disable Alexa mic (only for Ecobee 4) Values: True, False ''' body = { 'selection': { 'selectionType': 'thermostats', 'selectionMatch': self.thermostats[index]['identifier']}, ...
[ "Enable", "/", "disable", "Alexa", "mic", "(", "only", "for", "Ecobee", "4", ")", "Values", ":", "True", "False" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L320-L334
[ "def", "set_mic_mode", "(", "self", ",", "index", ",", "mic_enabled", ")", ":", "body", "=", "{", "'selection'", ":", "{", "'selectionType'", ":", "'thermostats'", ",", "'selectionMatch'", ":", "self", ".", "thermostats", "[", "index", "]", "[", "'identifier...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_occupancy_modes
Enable/disable Smart Home/Away and Follow Me modes Values: True, False
pyecobee/__init__.py
def set_occupancy_modes(self, index, auto_away=None, follow_me=None): '''Enable/disable Smart Home/Away and Follow Me modes Values: True, False ''' body = { 'selection': { 'selectionType': 'thermostats', 'selectionMatch': self.thermost...
def set_occupancy_modes(self, index, auto_away=None, follow_me=None): '''Enable/disable Smart Home/Away and Follow Me modes Values: True, False ''' body = { 'selection': { 'selectionType': 'thermostats', 'selectionMatch': self.thermost...
[ "Enable", "/", "disable", "Smart", "Home", "/", "Away", "and", "Follow", "Me", "modes", "Values", ":", "True", "False" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L336-L351
[ "def", "set_occupancy_modes", "(", "self", ",", "index", ",", "auto_away", "=", "None", ",", "follow_me", "=", "None", ")", ":", "body", "=", "{", "'selection'", ":", "{", "'selectionType'", ":", "'thermostats'", ",", "'selectionMatch'", ":", "self", ".", ...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
Ecobee.set_dst_mode
Enable/disable daylight savings Values: True, False
pyecobee/__init__.py
def set_dst_mode(self, index, dst): '''Enable/disable daylight savings Values: True, False ''' body = { 'selection': { 'selectionType': 'thermostats', 'selectionMatch': self.thermostats[index]['identifier']}, 'thermostat': ...
def set_dst_mode(self, index, dst): '''Enable/disable daylight savings Values: True, False ''' body = { 'selection': { 'selectionType': 'thermostats', 'selectionMatch': self.thermostats[index]['identifier']}, 'thermostat': ...
[ "Enable", "/", "disable", "daylight", "savings", "Values", ":", "True", "False" ]
nkgilley/python-ecobee-api
python
https://github.com/nkgilley/python-ecobee-api/blob/cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174/pyecobee/__init__.py#L353-L367
[ "def", "set_dst_mode", "(", "self", ",", "index", ",", "dst", ")", ":", "body", "=", "{", "'selection'", ":", "{", "'selectionType'", ":", "'thermostats'", ",", "'selectionMatch'", ":", "self", ".", "thermostats", "[", "index", "]", "[", "'identifier'", "]...
cc8d90d20abcb9ef5b66ec9cb035bae2f06ba174
test
future_dt_str
.
dhcpcanon/timers.py
def future_dt_str(dt, td): """.""" if isinstance(td, str): td = float(td) td = timedelta(seconds=td) future_dt = dt + td return future_dt.strftime(DT_PRINT_FORMAT)
def future_dt_str(dt, td): """.""" if isinstance(td, str): td = float(td) td = timedelta(seconds=td) future_dt = dt + td return future_dt.strftime(DT_PRINT_FORMAT)
[ "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L18-L24
[ "def", "future_dt_str", "(", "dt", ",", "td", ")", ":", "if", "isinstance", "(", "td", ",", "str", ")", ":", "td", "=", "float", "(", "td", ")", "td", "=", "timedelta", "(", "seconds", "=", "td", ")", "future_dt", "=", "dt", "+", "td", "return", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
gen_delay_selecting
Generate the delay in seconds in which the DISCOVER will be sent. [:rfc:`2131#section-4.4.1`]:: The client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup.
dhcpcanon/timers.py
def gen_delay_selecting(): """Generate the delay in seconds in which the DISCOVER will be sent. [:rfc:`2131#section-4.4.1`]:: The client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup. """ delay = float(random.randint(0, MAX_DELAY_SEL...
def gen_delay_selecting(): """Generate the delay in seconds in which the DISCOVER will be sent. [:rfc:`2131#section-4.4.1`]:: The client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup. """ delay = float(random.randint(0, MAX_DELAY_SEL...
[ "Generate", "the", "delay", "in", "seconds", "in", "which", "the", "DISCOVER", "will", "be", "sent", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L35-L48
[ "def", "gen_delay_selecting", "(", ")", ":", "delay", "=", "float", "(", "random", ".", "randint", "(", "0", ",", "MAX_DELAY_SELECTING", ")", ")", "logger", ".", "debug", "(", "'Delay to enter in SELECTING %s.'", ",", "delay", ")", "logger", ".", "debug", "(...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
gen_timeout_resend
Generate the time in seconds in which DHCPDISCOVER wil be retransmited. [:rfc:`2131#section-3.1`]:: might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds [:rfc:`2131#section-4.1`]:: For example, in a 10Mb/sec Ethernet internetwork, the delay bef...
dhcpcanon/timers.py
def gen_timeout_resend(attempts): """Generate the time in seconds in which DHCPDISCOVER wil be retransmited. [:rfc:`2131#section-3.1`]:: might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds [:rfc:`2131#section-4.1`]:: For example, in a 10Mb/sec Eth...
def gen_timeout_resend(attempts): """Generate the time in seconds in which DHCPDISCOVER wil be retransmited. [:rfc:`2131#section-3.1`]:: might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds [:rfc:`2131#section-4.1`]:: For example, in a 10Mb/sec Eth...
[ "Generate", "the", "time", "in", "seconds", "in", "which", "DHCPDISCOVER", "wil", "be", "retransmited", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L51-L75
[ "def", "gen_timeout_resend", "(", "attempts", ")", ":", "timeout", "=", "2", "**", "(", "attempts", "+", "1", ")", "+", "random", ".", "uniform", "(", "-", "1", ",", "+", "1", ")", "logger", ".", "debug", "(", "'next timeout resending will happen on %s'", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
gen_timeout_request_renew
Generate time in seconds to retransmit DHCPREQUEST. [:rfc:`2131#section-4..4.5`]:: In both RENEWING and REBINDING states, if the client receives no response to its DHCPREQUEST message, the client SHOULD wait one-half of the remaining time until T2 (in RENEWING state) and one-half o...
dhcpcanon/timers.py
def gen_timeout_request_renew(lease): """Generate time in seconds to retransmit DHCPREQUEST. [:rfc:`2131#section-4..4.5`]:: In both RENEWING and REBINDING states, if the client receives no response to its DHCPREQUEST message, the client SHOULD wait one-half of the remaining tim...
def gen_timeout_request_renew(lease): """Generate time in seconds to retransmit DHCPREQUEST. [:rfc:`2131#section-4..4.5`]:: In both RENEWING and REBINDING states, if the client receives no response to its DHCPREQUEST message, the client SHOULD wait one-half of the remaining tim...
[ "Generate", "time", "in", "seconds", "to", "retransmit", "DHCPREQUEST", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L78-L97
[ "def", "gen_timeout_request_renew", "(", "lease", ")", ":", "time_left", "=", "(", "lease", ".", "rebinding_time", "-", "lease", ".", "renewing_time", ")", "*", "RENEW_PERC", "if", "time_left", "<", "60", ":", "time_left", "=", "60", "logger", ".", "debug", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
gen_timeout_request_rebind
.
dhcpcanon/timers.py
def gen_timeout_request_rebind(lease): """.""" time_left = (lease.lease_time - lease.rebinding_time) * RENEW_PERC if time_left < 60: time_left = 60 logger.debug('Next request on rebinding will happen on %s', future_dt_str(nowutc(), time_left)) return time_left
def gen_timeout_request_rebind(lease): """.""" time_left = (lease.lease_time - lease.rebinding_time) * RENEW_PERC if time_left < 60: time_left = 60 logger.debug('Next request on rebinding will happen on %s', future_dt_str(nowutc(), time_left)) return time_left
[ "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L100-L107
[ "def", "gen_timeout_request_rebind", "(", "lease", ")", ":", "time_left", "=", "(", "lease", ".", "lease_time", "-", "lease", ".", "rebinding_time", ")", "*", "RENEW_PERC", "if", "time_left", "<", "60", ":", "time_left", "=", "60", "logger", ".", "debug", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
gen_renewing_time
Generate RENEWING time. [:rfc:`2131#section-4.4.5`]:: T1 defaults to (0.5 * duration_of_lease). T2 defaults to (0.875 * duration_of_lease). Times T1 and T2 SHOULD be chosen with some random "fuzz" around a fixed value, to avoid synchronization of client reacquisition.
dhcpcanon/timers.py
def gen_renewing_time(lease_time, elapsed=0): """Generate RENEWING time. [:rfc:`2131#section-4.4.5`]:: T1 defaults to (0.5 * duration_of_lease). T2 defaults to (0.875 * duration_of_lease). Times T1 and T2 SHOULD be chosen with some random "fuzz" around a fixed value, to avoid...
def gen_renewing_time(lease_time, elapsed=0): """Generate RENEWING time. [:rfc:`2131#section-4.4.5`]:: T1 defaults to (0.5 * duration_of_lease). T2 defaults to (0.875 * duration_of_lease). Times T1 and T2 SHOULD be chosen with some random "fuzz" around a fixed value, to avoid...
[ "Generate", "RENEWING", "time", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L110-L132
[ "def", "gen_renewing_time", "(", "lease_time", ",", "elapsed", "=", "0", ")", ":", "renewing_time", "=", "int", "(", "lease_time", ")", "*", "RENEW_PERC", "-", "elapsed", "# FIXME:80 [:rfc:`2131#section-4.4.5`]: the chosen \"fuzz\" could fingerprint", "# the implementation"...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
gen_rebinding_time
.
dhcpcanon/timers.py
def gen_rebinding_time(lease_time, elapsed=0): """.""" rebinding_time = int(lease_time) * REBIND_PERC - elapsed # FIXME:90 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint # the implementation # NOTE: here using same "fuzz" as systemd? range_fuzz = int(lease_time) - rebinding_tim...
def gen_rebinding_time(lease_time, elapsed=0): """.""" rebinding_time = int(lease_time) * REBIND_PERC - elapsed # FIXME:90 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint # the implementation # NOTE: here using same "fuzz" as systemd? range_fuzz = int(lease_time) - rebinding_tim...
[ "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/timers.py#L135-L147
[ "def", "gen_rebinding_time", "(", "lease_time", ",", "elapsed", "=", "0", ")", ":", "rebinding_time", "=", "int", "(", "lease_time", ")", "*", "REBIND_PERC", "-", "elapsed", "# FIXME:90 [:rfc:`2131#section-4.4.5`]: the chosen \"fuzz\" could fingerprint", "# the implementati...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.dict_self
Return the self object attributes not inherited as dict.
dhcpcanon/dhcpcapfsm.py
def dict_self(self): """Return the self object attributes not inherited as dict.""" return {k: v for k, v in self.__dict__.items() if k in FSM_ATTRS}
def dict_self(self): """Return the self object attributes not inherited as dict.""" return {k: v for k, v in self.__dict__.items() if k in FSM_ATTRS}
[ "Return", "the", "self", "object", "attributes", "not", "inherited", "as", "dict", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L38-L40
[ "def", "dict_self", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "self", ".", "__dict__", ".", "items", "(", ")", "if", "k", "in", "FSM_ATTRS", "}" ]
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.reset
Reset object attributes when state is INIT.
dhcpcanon/dhcpcapfsm.py
def reset(self, iface=None, client_mac=None, xid=None, scriptfile=None): """Reset object attributes when state is INIT.""" logger.debug('Reseting attributes.') if iface is None: iface = conf.iface if client_mac is None: # scapy for python 3 returns byte, not tuple...
def reset(self, iface=None, client_mac=None, xid=None, scriptfile=None): """Reset object attributes when state is INIT.""" logger.debug('Reseting attributes.') if iface is None: iface = conf.iface if client_mac is None: # scapy for python 3 returns byte, not tuple...
[ "Reset", "object", "attributes", "when", "state", "is", "INIT", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L48-L70
[ "def", "reset", "(", "self", ",", "iface", "=", "None", ",", "client_mac", "=", "None", ",", "xid", "=", "None", ",", "scriptfile", "=", "None", ")", ":", "logger", ".", "debug", "(", "'Reseting attributes.'", ")", "if", "iface", "is", "None", ":", "...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.get_timeout
Workaround to get timeout in the ATMT.timeout class method.
dhcpcanon/dhcpcapfsm.py
def get_timeout(self, state, function): """Workaround to get timeout in the ATMT.timeout class method.""" state = STATES2NAMES[state] for timeout_fn_t in self.timeout[state]: # access the function name if timeout_fn_t[1] is not None and \ timeout_fn_t[1].at...
def get_timeout(self, state, function): """Workaround to get timeout in the ATMT.timeout class method.""" state = STATES2NAMES[state] for timeout_fn_t in self.timeout[state]: # access the function name if timeout_fn_t[1] is not None and \ timeout_fn_t[1].at...
[ "Workaround", "to", "get", "timeout", "in", "the", "ATMT", ".", "timeout", "class", "method", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L106-L116
[ "def", "get_timeout", "(", "self", ",", "state", ",", "function", ")", ":", "state", "=", "STATES2NAMES", "[", "state", "]", "for", "timeout_fn_t", "in", "self", ".", "timeout", "[", "state", "]", ":", "# access the function name", "if", "timeout_fn_t", "[",...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.set_timeout
Workaround to change timeout values in the ATMT.timeout class method. self.timeout format is:: {'STATE': [ (TIMEOUT0, <function foo>), (TIMEOUT1, <function bar>)), (None, None) ], }
dhcpcanon/dhcpcapfsm.py
def set_timeout(self, state, function, newtimeout): """ Workaround to change timeout values in the ATMT.timeout class method. self.timeout format is:: {'STATE': [ (TIMEOUT0, <function foo>), (TIMEOUT1, <function bar>)), (None, None) ...
def set_timeout(self, state, function, newtimeout): """ Workaround to change timeout values in the ATMT.timeout class method. self.timeout format is:: {'STATE': [ (TIMEOUT0, <function foo>), (TIMEOUT1, <function bar>)), (None, None) ...
[ "Workaround", "to", "change", "timeout", "values", "in", "the", "ATMT", ".", "timeout", "class", "method", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L118-L146
[ "def", "set_timeout", "(", "self", ",", "state", ",", "function", ",", "newtimeout", ")", ":", "state", "=", "STATES2NAMES", "[", "state", "]", "for", "timeout_fn_t", "in", "self", ".", "timeout", "[", "state", "]", ":", "# access the function name", "if", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.send_discover
Send discover.
dhcpcanon/dhcpcapfsm.py
def send_discover(self): """Send discover.""" assert self.client assert self.current_state == STATE_INIT or \ self.current_state == STATE_SELECTING pkt = self.client.gen_discover() sendp(pkt) # FIXME:20 check that this is correct,: all or only discover? ...
def send_discover(self): """Send discover.""" assert self.client assert self.current_state == STATE_INIT or \ self.current_state == STATE_SELECTING pkt = self.client.gen_discover() sendp(pkt) # FIXME:20 check that this is correct,: all or only discover? ...
[ "Send", "discover", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L148-L161
[ "def", "send_discover", "(", "self", ")", ":", "assert", "self", ".", "client", "assert", "self", ".", "current_state", "==", "STATE_INIT", "or", "self", ".", "current_state", "==", "STATE_SELECTING", "pkt", "=", "self", ".", "client", ".", "gen_discover", "...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.select_offer
Select an offer from the offers received. [:rfc:`2131#section-4.2`]:: DHCP clients are free to use any strategy in selecting a DHCP server among those from which the client receives a DHCPOFFER. [:rfc:`2131#section-4.4.1`]:: The time over which the cli...
dhcpcanon/dhcpcapfsm.py
def select_offer(self): """Select an offer from the offers received. [:rfc:`2131#section-4.2`]:: DHCP clients are free to use any strategy in selecting a DHCP server among those from which the client receives a DHCPOFFER. [:rfc:`2131#section-4.4.1`]:: The ...
def select_offer(self): """Select an offer from the offers received. [:rfc:`2131#section-4.2`]:: DHCP clients are free to use any strategy in selecting a DHCP server among those from which the client receives a DHCPOFFER. [:rfc:`2131#section-4.4.1`]:: The ...
[ "Select", "an", "offer", "from", "the", "offers", "received", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L166-L190
[ "def", "select_offer", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Selecting offer.'", ")", "pkt", "=", "self", ".", "offers", "[", "0", "]", "self", ".", "client", ".", "handle_offer", "(", "pkt", ")" ]
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.send_request
Send request. [:rfc:`2131#section-3.1`]:: a client retransmitting as described in section 4.1 might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds .. todo:: - The maximum number of retransmitted REQUESTs is per state or in total...
dhcpcanon/dhcpcapfsm.py
def send_request(self): """Send request. [:rfc:`2131#section-3.1`]:: a client retransmitting as described in section 4.1 might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds .. todo:: - The maximum number of retransmitted REQUESTs is...
def send_request(self): """Send request. [:rfc:`2131#section-3.1`]:: a client retransmitting as described in section 4.1 might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds .. todo:: - The maximum number of retransmitted REQUESTs is...
[ "Send", "request", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L192-L241
[ "def", "send_request", "(", "self", ")", ":", "assert", "self", ".", "client", "if", "self", ".", "current_state", "==", "STATE_BOUND", ":", "pkt", "=", "self", ".", "client", ".", "gen_request_unicast", "(", ")", "else", ":", "pkt", "=", "self", ".", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.set_timers
Set renewal, rebinding times.
dhcpcanon/dhcpcapfsm.py
def set_timers(self): """Set renewal, rebinding times.""" logger.debug('setting timeouts') self.set_timeout(self.current_state, self.renewing_time_expires, self.client.lease.renewal_time) self.set_timeout(self.current_state, ...
def set_timers(self): """Set renewal, rebinding times.""" logger.debug('setting timeouts') self.set_timeout(self.current_state, self.renewing_time_expires, self.client.lease.renewal_time) self.set_timeout(self.current_state, ...
[ "Set", "renewal", "rebinding", "times", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L243-L251
[ "def", "set_timers", "(", "self", ")", ":", "logger", ".", "debug", "(", "'setting timeouts'", ")", "self", ".", "set_timeout", "(", "self", ".", "current_state", ",", "self", ".", "renewing_time_expires", ",", "self", ".", "client", ".", "lease", ".", "re...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.process_received_ack
Process a received ACK packet. Not specifiyed in [:rfc:`7844`]. Probe the offered IP in [:rfc:`2131#section-2.2.`]:: the allocating server SHOULD probe the reused address before allocating the address, e.g., with an ICMP echo request, and the client SHOULD ...
dhcpcanon/dhcpcapfsm.py
def process_received_ack(self, pkt): """Process a received ACK packet. Not specifiyed in [:rfc:`7844`]. Probe the offered IP in [:rfc:`2131#section-2.2.`]:: the allocating server SHOULD probe the reused address before allocating the address, e.g., with an IC...
def process_received_ack(self, pkt): """Process a received ACK packet. Not specifiyed in [:rfc:`7844`]. Probe the offered IP in [:rfc:`2131#section-2.2.`]:: the allocating server SHOULD probe the reused address before allocating the address, e.g., with an IC...
[ "Process", "a", "received", "ACK", "packet", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L253-L291
[ "def", "process_received_ack", "(", "self", ",", "pkt", ")", ":", "if", "isack", "(", "pkt", ")", ":", "try", ":", "self", ".", "event", "=", "self", ".", "client", ".", "handle_ack", "(", "pkt", ",", "self", ".", "time_sent_request", ")", "except", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.process_received_nak
Process a received NAK packet.
dhcpcanon/dhcpcapfsm.py
def process_received_nak(self, pkt): """Process a received NAK packet.""" if isnak(pkt): logger.info('DHCPNAK of %s from %s', self.client.client_ip, self.client.server_ip) return True return False
def process_received_nak(self, pkt): """Process a received NAK packet.""" if isnak(pkt): logger.info('DHCPNAK of %s from %s', self.client.client_ip, self.client.server_ip) return True return False
[ "Process", "a", "received", "NAK", "packet", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L293-L299
[ "def", "process_received_nak", "(", "self", ",", "pkt", ")", ":", "if", "isnak", "(", "pkt", ")", ":", "logger", ".", "info", "(", "'DHCPNAK of %s from %s'", ",", "self", ".", "client", ".", "client_ip", ",", "self", ".", "client", ".", "server_ip", ")",...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.INIT
INIT state. [:rfc:`2131#section-4.4.1`]:: The client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup .. todo:: - The initial delay is implemented, but probably is not in other implementations. Check what...
dhcpcanon/dhcpcapfsm.py
def INIT(self): """INIT state. [:rfc:`2131#section-4.4.1`]:: The client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup .. todo:: - The initial delay is implemented, but probably is not in other ...
def INIT(self): """INIT state. [:rfc:`2131#section-4.4.1`]:: The client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup .. todo:: - The initial delay is implemented, but probably is not in other ...
[ "INIT", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L309-L341
[ "def", "INIT", "(", "self", ")", ":", "# NOTE: in case INIT is reached from other state, initialize attributes", "# reset all variables.", "logger", ".", "debug", "(", "'In state: INIT'", ")", "if", "self", ".", "current_state", "is", "not", "STATE_PREINIT", ":", "self", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.BOUND
BOUND state.
dhcpcanon/dhcpcapfsm.py
def BOUND(self): """BOUND state.""" logger.debug('In state: BOUND') logger.info('(%s) state changed %s -> bound', self.client.iface, STATES2NAMES[self.current_state]) self.current_state = STATE_BOUND self.client.lease.info_lease() if self.script is not...
def BOUND(self): """BOUND state.""" logger.debug('In state: BOUND') logger.info('(%s) state changed %s -> bound', self.client.iface, STATES2NAMES[self.current_state]) self.current_state = STATE_BOUND self.client.lease.info_lease() if self.script is not...
[ "BOUND", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L356-L370
[ "def", "BOUND", "(", "self", ")", ":", "logger", ".", "debug", "(", "'In state: BOUND'", ")", "logger", ".", "info", "(", "'(%s) state changed %s -> bound'", ",", "self", ".", "client", ".", "iface", ",", "STATES2NAMES", "[", "self", ".", "current_state", "]...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.RENEWING
RENEWING state.
dhcpcanon/dhcpcapfsm.py
def RENEWING(self): """RENEWING state.""" logger.debug('In state: RENEWING') self.current_state = STATE_RENEWING if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() else: set_net(se...
def RENEWING(self): """RENEWING state.""" logger.debug('In state: RENEWING') self.current_state = STATE_RENEWING if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() else: set_net(se...
[ "RENEWING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L375-L383
[ "def", "RENEWING", "(", "self", ")", ":", "logger", ".", "debug", "(", "'In state: RENEWING'", ")", "self", ".", "current_state", "=", "STATE_RENEWING", "if", "self", ".", "script", "is", "not", "None", ":", "self", ".", "script", ".", "script_init", "(", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.REBINDING
REBINDING state.
dhcpcanon/dhcpcapfsm.py
def REBINDING(self): """REBINDING state.""" logger.debug('In state: REBINDING') self.current_state = STATE_REBINDING if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() else: set_ne...
def REBINDING(self): """REBINDING state.""" logger.debug('In state: REBINDING') self.current_state = STATE_REBINDING if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() else: set_ne...
[ "REBINDING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L386-L394
[ "def", "REBINDING", "(", "self", ")", ":", "logger", ".", "debug", "(", "'In state: REBINDING'", ")", "self", ".", "current_state", "=", "STATE_REBINDING", "if", "self", ".", "script", "is", "not", "None", ":", "self", ".", "script", ".", "script_init", "(...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.END
END state.
dhcpcanon/dhcpcapfsm.py
def END(self): """END state.""" logger.debug('In state: END') self.current_state = STATE_END if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() else: set_net(self.client.lease) ...
def END(self): """END state.""" logger.debug('In state: END') self.current_state = STATE_END if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() else: set_net(self.client.lease) ...
[ "END", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L397-L406
[ "def", "END", "(", "self", ")", ":", "logger", ".", "debug", "(", "'In state: END'", ")", "self", ".", "current_state", "=", "STATE_END", "if", "self", ".", "script", "is", "not", "None", ":", "self", ".", "script", ".", "script_init", "(", "self", "."...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.ERROR
ERROR state.
dhcpcanon/dhcpcapfsm.py
def ERROR(self): """ERROR state.""" logger.debug('In state: ERROR') self.current_state = STATE_ERROR if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() set_net(self.client.lease) raise...
def ERROR(self): """ERROR state.""" logger.debug('In state: ERROR') self.current_state = STATE_ERROR if self.script is not None: self.script.script_init(self.client.lease, self.current_state) self.script.script_go() set_net(self.client.lease) raise...
[ "ERROR", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L409-L417
[ "def", "ERROR", "(", "self", ")", ":", "logger", ".", "debug", "(", "'In state: ERROR'", ")", "self", ".", "current_state", "=", "STATE_ERROR", "if", "self", ".", "script", "is", "not", "None", ":", "self", ".", "script", ".", "script_init", "(", "self",...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.timeout_selecting
Timeout of selecting on SELECTING state. Not specifiyed in [:rfc:`7844`]. See comments in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_request`.
dhcpcanon/dhcpcapfsm.py
def timeout_selecting(self): """Timeout of selecting on SELECTING state. Not specifiyed in [:rfc:`7844`]. See comments in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_request`. """ logger.debug('C2.1: T In %s, timeout receiving response to select.', self.current_st...
def timeout_selecting(self): """Timeout of selecting on SELECTING state. Not specifiyed in [:rfc:`7844`]. See comments in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_request`. """ logger.debug('C2.1: T In %s, timeout receiving response to select.', self.current_st...
[ "Timeout", "of", "selecting", "on", "SELECTING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L432-L461
[ "def", "timeout_selecting", "(", "self", ")", ":", "logger", ".", "debug", "(", "'C2.1: T In %s, timeout receiving response to select.'", ",", "self", ".", "current_state", ")", "if", "len", "(", "self", ".", "offers", ")", ">=", "MAX_OFFERS_COLLECTED", ":", "logg...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.timeout_requesting
Timeout requesting in REQUESTING state. Not specifiyed in [:rfc:`7844`] [:rfc:`2131#section-3.1`]:: might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds
dhcpcanon/dhcpcapfsm.py
def timeout_requesting(self): """Timeout requesting in REQUESTING state. Not specifiyed in [:rfc:`7844`] [:rfc:`2131#section-3.1`]:: might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds """ logger.debug("C3.2: T. In %s, ...
def timeout_requesting(self): """Timeout requesting in REQUESTING state. Not specifiyed in [:rfc:`7844`] [:rfc:`2131#section-3.1`]:: might retransmit the DHCPREQUEST message four times, for a total delay of 60 seconds """ logger.debug("C3.2: T. In %s, ...
[ "Timeout", "requesting", "in", "REQUESTING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L464-L484
[ "def", "timeout_requesting", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"C3.2: T. In %s, timeout receiving response to request, \"", ",", "self", ".", "current_state", ")", "if", "self", ".", "discover_requests", ">=", "MAX_ATTEMPTS_REQUEST", ":", "logger", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.timeout_request_renewing
Timeout of renewing on RENEWING state. Same comments as in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_requesting`.
dhcpcanon/dhcpcapfsm.py
def timeout_request_renewing(self): """Timeout of renewing on RENEWING state. Same comments as in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_requesting`. """ logger.debug("C5.2:T In %s, timeout receiving response to request.", self.current_state) if self....
def timeout_request_renewing(self): """Timeout of renewing on RENEWING state. Same comments as in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_requesting`. """ logger.debug("C5.2:T In %s, timeout receiving response to request.", self.current_state) if self....
[ "Timeout", "of", "renewing", "on", "RENEWING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L487-L503
[ "def", "timeout_request_renewing", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"C5.2:T In %s, timeout receiving response to request.\"", ",", "self", ".", "current_state", ")", "if", "self", ".", "request_attempts", ">=", "MAX_ATTEMPTS_REQUEST", ":", "logger",...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.timeout_request_rebinding
Timeout of request rebinding on REBINDING state. Same comments as in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_requesting`.
dhcpcanon/dhcpcapfsm.py
def timeout_request_rebinding(self): """Timeout of request rebinding on REBINDING state. Same comments as in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_requesting`. """ logger.debug("C6.2:T In %s, timeout receiving response to request.", self.current_state) ...
def timeout_request_rebinding(self): """Timeout of request rebinding on REBINDING state. Same comments as in :func:`dhcpcapfsm.DHCPCAPFSM.timeout_requesting`. """ logger.debug("C6.2:T In %s, timeout receiving response to request.", self.current_state) ...
[ "Timeout", "of", "request", "rebinding", "on", "REBINDING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L506-L522
[ "def", "timeout_request_rebinding", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"C6.2:T In %s, timeout receiving response to request.\"", ",", "self", ".", "current_state", ")", "if", "self", ".", "request_attempts", ">=", "MAX_ATTEMPTS_REQUEST", ":", "logger"...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_offer
Receive offer on SELECTING state.
dhcpcanon/dhcpcapfsm.py
def receive_offer(self, pkt): """Receive offer on SELECTING state.""" logger.debug("C2. Received OFFER?, in SELECTING state.") if isoffer(pkt): logger.debug("C2: T, OFFER received") self.offers.append(pkt) if len(self.offers) >= MAX_OFFERS_COLLECTED: ...
def receive_offer(self, pkt): """Receive offer on SELECTING state.""" logger.debug("C2. Received OFFER?, in SELECTING state.") if isoffer(pkt): logger.debug("C2: T, OFFER received") self.offers.append(pkt) if len(self.offers) >= MAX_OFFERS_COLLECTED: ...
[ "Receive", "offer", "on", "SELECTING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L561-L572
[ "def", "receive_offer", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C2. Received OFFER?, in SELECTING state.\"", ")", "if", "isoffer", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C2: T, OFFER received\"", ")", "self", ".", "off...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_ack_requesting
Receive ACK in REQUESTING state.
dhcpcanon/dhcpcapfsm.py
def receive_ack_requesting(self, pkt): """Receive ACK in REQUESTING state.""" logger.debug("C3. Received ACK?, in REQUESTING state.") if self.process_received_ack(pkt): logger.debug("C3: T. Received ACK, in REQUESTING state, " "raise BOUND.") rais...
def receive_ack_requesting(self, pkt): """Receive ACK in REQUESTING state.""" logger.debug("C3. Received ACK?, in REQUESTING state.") if self.process_received_ack(pkt): logger.debug("C3: T. Received ACK, in REQUESTING state, " "raise BOUND.") rais...
[ "Receive", "ACK", "in", "REQUESTING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L578-L584
[ "def", "receive_ack_requesting", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3. Received ACK?, in REQUESTING state.\"", ")", "if", "self", ".", "process_received_ack", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3: T. Received AC...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_nak_requesting
Receive NAK in REQUESTING state.
dhcpcanon/dhcpcapfsm.py
def receive_nak_requesting(self, pkt): """Receive NAK in REQUESTING state.""" logger.debug("C3.1. Received NAK?, in REQUESTING state.") if self.process_received_nak(pkt): logger.debug("C3.1: T. Received NAK, in REQUESTING state, " "raise INIT.") r...
def receive_nak_requesting(self, pkt): """Receive NAK in REQUESTING state.""" logger.debug("C3.1. Received NAK?, in REQUESTING state.") if self.process_received_nak(pkt): logger.debug("C3.1: T. Received NAK, in REQUESTING state, " "raise INIT.") r...
[ "Receive", "NAK", "in", "REQUESTING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L590-L596
[ "def", "receive_nak_requesting", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3.1. Received NAK?, in REQUESTING state.\"", ")", "if", "self", ".", "process_received_nak", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3.1: T. Receive...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_ack_renewing
Receive ACK in RENEWING state.
dhcpcanon/dhcpcapfsm.py
def receive_ack_renewing(self, pkt): """Receive ACK in RENEWING state.""" logger.debug("C3. Received ACK?, in RENEWING state.") if self.process_received_ack(pkt): logger.debug("C3: T. Received ACK, in RENEWING state, " "raise BOUND.") raise self.B...
def receive_ack_renewing(self, pkt): """Receive ACK in RENEWING state.""" logger.debug("C3. Received ACK?, in RENEWING state.") if self.process_received_ack(pkt): logger.debug("C3: T. Received ACK, in RENEWING state, " "raise BOUND.") raise self.B...
[ "Receive", "ACK", "in", "RENEWING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L599-L605
[ "def", "receive_ack_renewing", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3. Received ACK?, in RENEWING state.\"", ")", "if", "self", ".", "process_received_ack", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3: T. Received ACK, i...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_nak_renewing
Receive NAK in RENEWING state.
dhcpcanon/dhcpcapfsm.py
def receive_nak_renewing(self, pkt): """Receive NAK in RENEWING state.""" logger.debug("C3.1. Received NAK?, in RENEWING state.") if self.process_received_nak(pkt): logger.debug("C3.1: T. Received NAK, in RENEWING state, " " raise INIT.") raise se...
def receive_nak_renewing(self, pkt): """Receive NAK in RENEWING state.""" logger.debug("C3.1. Received NAK?, in RENEWING state.") if self.process_received_nak(pkt): logger.debug("C3.1: T. Received NAK, in RENEWING state, " " raise INIT.") raise se...
[ "Receive", "NAK", "in", "RENEWING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L608-L614
[ "def", "receive_nak_renewing", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3.1. Received NAK?, in RENEWING state.\"", ")", "if", "self", ".", "process_received_nak", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3.1: T. Received NA...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_ack_rebinding
Receive ACK in REBINDING state.
dhcpcanon/dhcpcapfsm.py
def receive_ack_rebinding(self, pkt): """Receive ACK in REBINDING state.""" logger.debug("C3. Received ACK?, in REBINDING state.") if self.process_received_ack(pkt): logger.debug("C3: T. Received ACK, in REBINDING state, " "raise BOUND.") raise se...
def receive_ack_rebinding(self, pkt): """Receive ACK in REBINDING state.""" logger.debug("C3. Received ACK?, in REBINDING state.") if self.process_received_ack(pkt): logger.debug("C3: T. Received ACK, in REBINDING state, " "raise BOUND.") raise se...
[ "Receive", "ACK", "in", "REBINDING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L617-L623
[ "def", "receive_ack_rebinding", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3. Received ACK?, in REBINDING state.\"", ")", "if", "self", ".", "process_received_ack", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3: T. Received ACK,...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.receive_nak_rebinding
Receive NAK in REBINDING state.
dhcpcanon/dhcpcapfsm.py
def receive_nak_rebinding(self, pkt): """Receive NAK in REBINDING state.""" logger.debug("C3.1. Received NAK?, in RENEWING state.") if self.process_received_nak(pkt): logger.debug("C3.1: T. Received NAK, in RENEWING state, " "raise INIT.") raise s...
def receive_nak_rebinding(self, pkt): """Receive NAK in REBINDING state.""" logger.debug("C3.1. Received NAK?, in RENEWING state.") if self.process_received_nak(pkt): logger.debug("C3.1: T. Received NAK, in RENEWING state, " "raise INIT.") raise s...
[ "Receive", "NAK", "in", "REBINDING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L626-L632
[ "def", "receive_nak_rebinding", "(", "self", ",", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3.1. Received NAK?, in RENEWING state.\"", ")", "if", "self", ".", "process_received_nak", "(", "pkt", ")", ":", "logger", ".", "debug", "(", "\"C3.1: T. Received N...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
DHCPCAPFSM.on_renewing
Action on renewing on RENEWING state. Not recording lease, but restarting timers.
dhcpcanon/dhcpcapfsm.py
def on_renewing(self): """Action on renewing on RENEWING state. Not recording lease, but restarting timers. """ self.client.lease.sanitize_net_values() self.client.lease.set_times(self.time_sent_request) self.set_timers()
def on_renewing(self): """Action on renewing on RENEWING state. Not recording lease, but restarting timers. """ self.client.lease.sanitize_net_values() self.client.lease.set_times(self.time_sent_request) self.set_timers()
[ "Action", "on", "renewing", "on", "RENEWING", "state", "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcapfsm.py#L672-L680
[ "def", "on_renewing", "(", "self", ")", ":", "self", ".", "client", ".", "lease", ".", "sanitize_net_values", "(", ")", "self", ".", "client", ".", "lease", ".", "set_times", "(", "self", ".", "time_sent_request", ")", "self", ".", "set_timers", "(", ")"...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
isoffer
.
dhcpcanon/dhcpcaputils.py
def isoffer(packet): """.""" if DHCP in packet and (DHCPTypes.get(packet[DHCP].options[0][1]) == 'offer' or packet[DHCP].options[0][1] == "offer"): logger.debug('Packet is Offer.') return True return False
def isoffer(packet): """.""" if DHCP in packet and (DHCPTypes.get(packet[DHCP].options[0][1]) == 'offer' or packet[DHCP].options[0][1] == "offer"): logger.debug('Packet is Offer.') return True return False
[ "." ]
juga0/dhcpcanon
python
https://github.com/juga0/dhcpcanon/blob/9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59/dhcpcanon/dhcpcaputils.py#L19-L25
[ "def", "isoffer", "(", "packet", ")", ":", "if", "DHCP", "in", "packet", "and", "(", "DHCPTypes", ".", "get", "(", "packet", "[", "DHCP", "]", ".", "options", "[", "0", "]", "[", "1", "]", ")", "==", "'offer'", "or", "packet", "[", "DHCP", "]", ...
9f51a29e57fe93dc93fb22bb0ed12fcfe9557e59
test
Qurl.set
Assign a value, remove if it's None
qurl_templatetag/qurl.py
def set(self, name, value): """ Assign a value, remove if it's None """ clone = self._clone() if django.VERSION[0] <= 1 and django.VERSION[1] <= 4: value = value or None clone._qsl = [(q, v) for (q, v) in self._qsl if q != name] if value is not None: clone...
def set(self, name, value): """ Assign a value, remove if it's None """ clone = self._clone() if django.VERSION[0] <= 1 and django.VERSION[1] <= 4: value = value or None clone._qsl = [(q, v) for (q, v) in self._qsl if q != name] if value is not None: clone...
[ "Assign", "a", "value", "remove", "if", "it", "s", "None" ]
sophilabs/django-qurl-templatetag
python
https://github.com/sophilabs/django-qurl-templatetag/blob/8a785b112437d05cb54846b79012967fee1cb534/qurl_templatetag/qurl.py#L29-L37
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "clone", "=", "self", ".", "_clone", "(", ")", "if", "django", ".", "VERSION", "[", "0", "]", "<=", "1", "and", "django", ".", "VERSION", "[", "1", "]", "<=", "4", ":", "value", ...
8a785b112437d05cb54846b79012967fee1cb534
test
Qurl.add
Append a value to multiple value parameter.
qurl_templatetag/qurl.py
def add(self, name, value): """ Append a value to multiple value parameter. """ clone = self._clone() clone._qsl = [p for p in self._qsl if not(p[0] == name and p[1] == value)] clone._qsl.append((name, value,)) return clone
def add(self, name, value): """ Append a value to multiple value parameter. """ clone = self._clone() clone._qsl = [p for p in self._qsl if not(p[0] == name and p[1] == value)] clone._qsl.append((name, value,)) return clone
[ "Append", "a", "value", "to", "multiple", "value", "parameter", "." ]
sophilabs/django-qurl-templatetag
python
https://github.com/sophilabs/django-qurl-templatetag/blob/8a785b112437d05cb54846b79012967fee1cb534/qurl_templatetag/qurl.py#L39-L45
[ "def", "add", "(", "self", ",", "name", ",", "value", ")", ":", "clone", "=", "self", ".", "_clone", "(", ")", "clone", ".", "_qsl", "=", "[", "p", "for", "p", "in", "self", ".", "_qsl", "if", "not", "(", "p", "[", "0", "]", "==", "name", "...
8a785b112437d05cb54846b79012967fee1cb534
test
Qurl.remove
Remove a value from multiple value parameter.
qurl_templatetag/qurl.py
def remove(self, name, value): """ Remove a value from multiple value parameter. """ clone = self._clone() clone._qsl = [qb for qb in self._qsl if qb != (name, str(value))] return clone
def remove(self, name, value): """ Remove a value from multiple value parameter. """ clone = self._clone() clone._qsl = [qb for qb in self._qsl if qb != (name, str(value))] return clone
[ "Remove", "a", "value", "from", "multiple", "value", "parameter", "." ]
sophilabs/django-qurl-templatetag
python
https://github.com/sophilabs/django-qurl-templatetag/blob/8a785b112437d05cb54846b79012967fee1cb534/qurl_templatetag/qurl.py#L47-L51
[ "def", "remove", "(", "self", ",", "name", ",", "value", ")", ":", "clone", "=", "self", ".", "_clone", "(", ")", "clone", ".", "_qsl", "=", "[", "qb", "for", "qb", "in", "self", ".", "_qsl", "if", "qb", "!=", "(", "name", ",", "str", "(", "v...
8a785b112437d05cb54846b79012967fee1cb534