repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
hydpy-dev/hydpy
hydpy/models/lland/lland_control.py
EQI1.trim
def trim(self, lower=None, upper=None): """Trim upper values in accordance with :math:`EQI2 \\leq EQI1 \\leq EQB`. >>> from hydpy.models.lland import * >>> parameterstep('1d') >>> eqb.value = 3.0 >>> eqi2.value = 1.0 >>> eqi1(0.0) >>> eqi1 eqi1(1....
python
def trim(self, lower=None, upper=None): """Trim upper values in accordance with :math:`EQI2 \\leq EQI1 \\leq EQB`. >>> from hydpy.models.lland import * >>> parameterstep('1d') >>> eqb.value = 3.0 >>> eqi2.value = 1.0 >>> eqi1(0.0) >>> eqi1 eqi1(1....
[ "def", "trim", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "if", "lower", "is", "None", ":", "lower", "=", "getattr", "(", "self", ".", "subpars", ".", "eqi2", ",", "'value'", ",", "None", ")", "if", "upper", "is"...
Trim upper values in accordance with :math:`EQI2 \\leq EQI1 \\leq EQB`. >>> from hydpy.models.lland import * >>> parameterstep('1d') >>> eqb.value = 3.0 >>> eqi2.value = 1.0 >>> eqi1(0.0) >>> eqi1 eqi1(1.0) >>> eqi1(1.0) >>> eqi1 e...
[ "Trim", "upper", "values", "in", "accordance", "with", ":", "math", ":", "EQI2", "\\\\", "leq", "EQI1", "\\\\", "leq", "EQB", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_control.py#L689-L717
arteria/django-openinghours
openinghours/forms.py
time_choices
def time_choices(): """Return digital time choices every half hour from 00:00 to 23:30.""" hours = list(range(0, 24)) times = [] for h in hours: hour = str(h).zfill(2) times.append(hour+':00') times.append(hour+':30') return list(zip(times, times))
python
def time_choices(): """Return digital time choices every half hour from 00:00 to 23:30.""" hours = list(range(0, 24)) times = [] for h in hours: hour = str(h).zfill(2) times.append(hour+':00') times.append(hour+':30') return list(zip(times, times))
[ "def", "time_choices", "(", ")", ":", "hours", "=", "list", "(", "range", "(", "0", ",", "24", ")", ")", "times", "=", "[", "]", "for", "h", "in", "hours", ":", "hour", "=", "str", "(", "h", ")", ".", "zfill", "(", "2", ")", "times", ".", "...
Return digital time choices every half hour from 00:00 to 23:30.
[ "Return", "digital", "time", "choices", "every", "half", "hour", "from", "00", ":", "00", "to", "23", ":", "30", "." ]
train
https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/forms.py#L23-L31
hydpy-dev/hydpy
hydpy/core/autodoctools.py
_add_lines
def _add_lines(specification, module): """Return autodoc commands for a basemodels docstring. Note that `collection classes` (e.g. `Model`, `ControlParameters`, `InputSequences` are placed on top of the respective section and the `contained classes` (e.g. model methods, `ControlParameter` instances, ...
python
def _add_lines(specification, module): """Return autodoc commands for a basemodels docstring. Note that `collection classes` (e.g. `Model`, `ControlParameters`, `InputSequences` are placed on top of the respective section and the `contained classes` (e.g. model methods, `ControlParameter` instances, ...
[ "def", "_add_lines", "(", "specification", ",", "module", ")", ":", "caption", "=", "_all_spec2capt", ".", "get", "(", "specification", ",", "'dummy'", ")", "if", "caption", ".", "split", "(", ")", "[", "-", "1", "]", "in", "(", "'parameters'", ",", "'...
Return autodoc commands for a basemodels docstring. Note that `collection classes` (e.g. `Model`, `ControlParameters`, `InputSequences` are placed on top of the respective section and the `contained classes` (e.g. model methods, `ControlParameter` instances, `InputSequence` instances at the bottom. Th...
[ "Return", "autodoc", "commands", "for", "a", "basemodels", "docstring", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L79-L116
hydpy-dev/hydpy
hydpy/core/autodoctools.py
autodoc_basemodel
def autodoc_basemodel(module): """Add an exhaustive docstring to the given module of a basemodel. Works onlye when all modules of the basemodel are named in the standard way, e.g. `lland_model`, `lland_control`, `lland_inputs`. """ autodoc_tuple2doc(module) namespace = module.__dict__ doc =...
python
def autodoc_basemodel(module): """Add an exhaustive docstring to the given module of a basemodel. Works onlye when all modules of the basemodel are named in the standard way, e.g. `lland_model`, `lland_control`, `lland_inputs`. """ autodoc_tuple2doc(module) namespace = module.__dict__ doc =...
[ "def", "autodoc_basemodel", "(", "module", ")", ":", "autodoc_tuple2doc", "(", "module", ")", "namespace", "=", "module", ".", "__dict__", "doc", "=", "namespace", ".", "get", "(", "'__doc__'", ")", "if", "doc", "is", "None", ":", "doc", "=", "''", "base...
Add an exhaustive docstring to the given module of a basemodel. Works onlye when all modules of the basemodel are named in the standard way, e.g. `lland_model`, `lland_control`, `lland_inputs`.
[ "Add", "an", "exhaustive", "docstring", "to", "the", "given", "module", "of", "a", "basemodel", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L128-L172
hydpy-dev/hydpy
hydpy/core/autodoctools.py
autodoc_applicationmodel
def autodoc_applicationmodel(module): """Improves the docstrings of application models when called at the bottom of the respective module. |autodoc_applicationmodel| requires, similar to |autodoc_basemodel|, that both the application model and its base model are defined in the conventional way. ...
python
def autodoc_applicationmodel(module): """Improves the docstrings of application models when called at the bottom of the respective module. |autodoc_applicationmodel| requires, similar to |autodoc_basemodel|, that both the application model and its base model are defined in the conventional way. ...
[ "def", "autodoc_applicationmodel", "(", "module", ")", ":", "autodoc_tuple2doc", "(", "module", ")", "name_applicationmodel", "=", "module", ".", "__name__", "name_basemodel", "=", "name_applicationmodel", ".", "split", "(", "'_'", ")", "[", "0", "]", "module_base...
Improves the docstrings of application models when called at the bottom of the respective module. |autodoc_applicationmodel| requires, similar to |autodoc_basemodel|, that both the application model and its base model are defined in the conventional way.
[ "Improves", "the", "docstrings", "of", "application", "models", "when", "called", "at", "the", "bottom", "of", "the", "respective", "module", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L175-L190
hydpy-dev/hydpy
hydpy/core/autodoctools.py
prepare_mainsubstituter
def prepare_mainsubstituter(): """Prepare and return a |Substituter| object for the main `__init__` file of *HydPy*.""" substituter = Substituter() for module in (builtins, numpy, datetime, unittest, doctest, inspect, io, os, sys, time, collections, itertools, subprocess, scipy, ...
python
def prepare_mainsubstituter(): """Prepare and return a |Substituter| object for the main `__init__` file of *HydPy*.""" substituter = Substituter() for module in (builtins, numpy, datetime, unittest, doctest, inspect, io, os, sys, time, collections, itertools, subprocess, scipy, ...
[ "def", "prepare_mainsubstituter", "(", ")", ":", "substituter", "=", "Substituter", "(", ")", "for", "module", "in", "(", "builtins", ",", "numpy", ",", "datetime", ",", "unittest", ",", "doctest", ",", "inspect", ",", "io", ",", "os", ",", "sys", ",", ...
Prepare and return a |Substituter| object for the main `__init__` file of *HydPy*.
[ "Prepare", "and", "return", "a", "|Substituter|", "object", "for", "the", "main", "__init__", "file", "of", "*", "HydPy", "*", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L657-L674
hydpy-dev/hydpy
hydpy/core/autodoctools.py
_number_of_line
def _number_of_line(member_tuple): """Try to return the number of the first line of the definition of a member of a module.""" member = member_tuple[1] try: return member.__code__.co_firstlineno except AttributeError: pass try: return inspect.findsource(member)[1] exc...
python
def _number_of_line(member_tuple): """Try to return the number of the first line of the definition of a member of a module.""" member = member_tuple[1] try: return member.__code__.co_firstlineno except AttributeError: pass try: return inspect.findsource(member)[1] exc...
[ "def", "_number_of_line", "(", "member_tuple", ")", ":", "member", "=", "member_tuple", "[", "1", "]", "try", ":", "return", "member", ".", "__code__", ".", "co_firstlineno", "except", "AttributeError", ":", "pass", "try", ":", "return", "inspect", ".", "fin...
Try to return the number of the first line of the definition of a member of a module.
[ "Try", "to", "return", "the", "number", "of", "the", "first", "line", "of", "the", "definition", "of", "a", "member", "of", "a", "module", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L677-L694
hydpy-dev/hydpy
hydpy/core/autodoctools.py
autodoc_module
def autodoc_module(module): """Add a short summary of all implemented members to a modules docstring. """ doc = getattr(module, '__doc__') if doc is None: doc = '' members = [] for name, member in inspect.getmembers(module): if ((not name.startswith('_')) and (ins...
python
def autodoc_module(module): """Add a short summary of all implemented members to a modules docstring. """ doc = getattr(module, '__doc__') if doc is None: doc = '' members = [] for name, member in inspect.getmembers(module): if ((not name.startswith('_')) and (ins...
[ "def", "autodoc_module", "(", "module", ")", ":", "doc", "=", "getattr", "(", "module", ",", "'__doc__'", ")", "if", "doc", "is", "None", ":", "doc", "=", "''", "members", "=", "[", "]", "for", "name", ",", "member", "in", "inspect", ".", "getmembers...
Add a short summary of all implemented members to a modules docstring.
[ "Add", "a", "short", "summary", "of", "all", "implemented", "members", "to", "a", "modules", "docstring", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L697-L722
hydpy-dev/hydpy
hydpy/core/autodoctools.py
autodoc_tuple2doc
def autodoc_tuple2doc(module): """Include tuples as `CLASSES` of `ControlParameters` and `RUN_METHODS` of `Models` into the respective docstring.""" modulename = module.__name__ for membername, member in inspect.getmembers(module): for tuplename, descr in _name2descr.items(): tuple_ ...
python
def autodoc_tuple2doc(module): """Include tuples as `CLASSES` of `ControlParameters` and `RUN_METHODS` of `Models` into the respective docstring.""" modulename = module.__name__ for membername, member in inspect.getmembers(module): for tuplename, descr in _name2descr.items(): tuple_ ...
[ "def", "autodoc_tuple2doc", "(", "module", ")", ":", "modulename", "=", "module", ".", "__name__", "for", "membername", ",", "member", "in", "inspect", ".", "getmembers", "(", "module", ")", ":", "for", "tuplename", ",", "descr", "in", "_name2descr", ".", ...
Include tuples as `CLASSES` of `ControlParameters` and `RUN_METHODS` of `Models` into the respective docstring.
[ "Include", "tuples", "as", "CLASSES", "of", "ControlParameters", "and", "RUN_METHODS", "of", "Models", "into", "the", "respective", "docstring", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L756-L780
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.consider_member
def consider_member(name_member, member, module, class_=None): """Return |True| if the given member should be added to the substitutions. If not return |False|. Some examples based on the site-package |numpy|: >>> from hydpy.core.autodoctools import Substituter >>> import numpy...
python
def consider_member(name_member, member, module, class_=None): """Return |True| if the given member should be added to the substitutions. If not return |False|. Some examples based on the site-package |numpy|: >>> from hydpy.core.autodoctools import Substituter >>> import numpy...
[ "def", "consider_member", "(", "name_member", ",", "member", ",", "module", ",", "class_", "=", "None", ")", ":", "if", "name_member", ".", "startswith", "(", "'_'", ")", ":", "return", "False", "if", "inspect", ".", "ismodule", "(", "member", ")", ":", ...
Return |True| if the given member should be added to the substitutions. If not return |False|. Some examples based on the site-package |numpy|: >>> from hydpy.core.autodoctools import Substituter >>> import numpy A constant like |nan| should be added: >>> Substituter....
[ "Return", "|True|", "if", "the", "given", "member", "should", "be", "added", "to", "the", "substitutions", ".", "If", "not", "return", "|False|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L210-L284
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.get_role
def get_role(member, cython=False): """Return the reStructuredText role `func`, `class`, or `const` best describing the given member. Some examples based on the site-package |numpy|. |numpy.clip| is a function: >>> from hydpy.core.autodoctools import Substituter >>> im...
python
def get_role(member, cython=False): """Return the reStructuredText role `func`, `class`, or `const` best describing the given member. Some examples based on the site-package |numpy|. |numpy.clip| is a function: >>> from hydpy.core.autodoctools import Substituter >>> im...
[ "def", "get_role", "(", "member", ",", "cython", "=", "False", ")", ":", "if", "inspect", ".", "isroutine", "(", "member", ")", "or", "isinstance", "(", "member", ",", "numpy", ".", "ufunc", ")", ":", "return", "'func'", "elif", "inspect", ".", "isclas...
Return the reStructuredText role `func`, `class`, or `const` best describing the given member. Some examples based on the site-package |numpy|. |numpy.clip| is a function: >>> from hydpy.core.autodoctools import Substituter >>> import numpy >>> Substituter.get_role(num...
[ "Return", "the", "reStructuredText", "role", "func", "class", "or", "const", "best", "describing", "the", "given", "member", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L287-L336
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.add_substitution
def add_substitution(self, short, medium, long, module): """Add the given substitutions both as a `short2long` and a `medium2long` mapping. Assume `variable1` is defined in the hydpy module `module1` and the short and medium descriptions are `var1` and `mod1.var1`: >>> import t...
python
def add_substitution(self, short, medium, long, module): """Add the given substitutions both as a `short2long` and a `medium2long` mapping. Assume `variable1` is defined in the hydpy module `module1` and the short and medium descriptions are `var1` and `mod1.var1`: >>> import t...
[ "def", "add_substitution", "(", "self", ",", "short", ",", "medium", ",", "long", ",", "module", ")", ":", "name", "=", "module", ".", "__name__", "if", "'builtin'", "in", "name", ":", "self", ".", "_short2long", "[", "short", "]", "=", "long", ".", ...
Add the given substitutions both as a `short2long` and a `medium2long` mapping. Assume `variable1` is defined in the hydpy module `module1` and the short and medium descriptions are `var1` and `mod1.var1`: >>> import types >>> module1 = types.ModuleType('hydpy.module1') ...
[ "Add", "the", "given", "substitutions", "both", "as", "a", "short2long", "and", "a", "medium2long", "mapping", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L338-L431
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.add_module
def add_module(self, module, cython=False): """Add the given module, its members, and their submembers. The first examples are based on the site-package |numpy|: which is passed to method |Substituter.add_module|: >>> from hydpy.core.autodoctools import Substituter >>> substitu...
python
def add_module(self, module, cython=False): """Add the given module, its members, and their submembers. The first examples are based on the site-package |numpy|: which is passed to method |Substituter.add_module|: >>> from hydpy.core.autodoctools import Substituter >>> substitu...
[ "def", "add_module", "(", "self", ",", "module", ",", "cython", "=", "False", ")", ":", "name_module", "=", "module", ".", "__name__", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "short", "=", "(", "'|%s|'", "%", "name_module", ")", "long", ...
Add the given module, its members, and their submembers. The first examples are based on the site-package |numpy|: which is passed to method |Substituter.add_module|: >>> from hydpy.core.autodoctools import Substituter >>> substituter = Substituter() >>> import numpy >>...
[ "Add", "the", "given", "module", "its", "members", "and", "their", "submembers", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L433-L511
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.add_modules
def add_modules(self, package): """Add the modules of the given package without their members.""" for name in os.listdir(package.__path__[0]): if name.startswith('_'): continue name = name.split('.')[0] short = '|%s|' % name long = ':mod:`~...
python
def add_modules(self, package): """Add the modules of the given package without their members.""" for name in os.listdir(package.__path__[0]): if name.startswith('_'): continue name = name.split('.')[0] short = '|%s|' % name long = ':mod:`~...
[ "def", "add_modules", "(", "self", ",", "package", ")", ":", "for", "name", "in", "os", ".", "listdir", "(", "package", ".", "__path__", "[", "0", "]", ")", ":", "if", "name", ".", "startswith", "(", "'_'", ")", ":", "continue", "name", "=", "name"...
Add the modules of the given package without their members.
[ "Add", "the", "modules", "of", "the", "given", "package", "without", "their", "members", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L513-L521
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.update_masters
def update_masters(self): """Update all `master` |Substituter| objects. If a |Substituter| object is passed to the constructor of another |Substituter| object, they become `master` and `slave`: >>> from hydpy.core.autodoctools import Substituter >>> sub1 = Substituter() ...
python
def update_masters(self): """Update all `master` |Substituter| objects. If a |Substituter| object is passed to the constructor of another |Substituter| object, they become `master` and `slave`: >>> from hydpy.core.autodoctools import Substituter >>> sub1 = Substituter() ...
[ "def", "update_masters", "(", "self", ")", ":", "if", "self", ".", "master", "is", "not", "None", ":", "self", ".", "master", ".", "_medium2long", ".", "update", "(", "self", ".", "_medium2long", ")", "self", ".", "master", ".", "update_masters", "(", ...
Update all `master` |Substituter| objects. If a |Substituter| object is passed to the constructor of another |Substituter| object, they become `master` and `slave`: >>> from hydpy.core.autodoctools import Substituter >>> sub1 = Substituter() >>> from hydpy.core import devicetoo...
[ "Update", "all", "master", "|Substituter|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L523-L589
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.update_slaves
def update_slaves(self): """Update all `slave` |Substituter| objects. See method |Substituter.update_masters| for further information. """ for slave in self.slaves: slave._medium2long.update(self._medium2long) slave.update_slaves()
python
def update_slaves(self): """Update all `slave` |Substituter| objects. See method |Substituter.update_masters| for further information. """ for slave in self.slaves: slave._medium2long.update(self._medium2long) slave.update_slaves()
[ "def", "update_slaves", "(", "self", ")", ":", "for", "slave", "in", "self", ".", "slaves", ":", "slave", ".", "_medium2long", ".", "update", "(", "self", ".", "_medium2long", ")", "slave", ".", "update_slaves", "(", ")" ]
Update all `slave` |Substituter| objects. See method |Substituter.update_masters| for further information.
[ "Update", "all", "slave", "|Substituter|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L591-L598
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.get_commands
def get_commands(self, source=None): """Return a string containing multiple `reStructuredText` replacements with the substitutions currently defined. Some examples based on the subpackage |optiontools|: >>> from hydpy.core.autodoctools import Substituter >>> substituter = Subst...
python
def get_commands(self, source=None): """Return a string containing multiple `reStructuredText` replacements with the substitutions currently defined. Some examples based on the subpackage |optiontools|: >>> from hydpy.core.autodoctools import Substituter >>> substituter = Subst...
[ "def", "get_commands", "(", "self", ",", "source", "=", "None", ")", ":", "commands", "=", "[", "]", "for", "key", ",", "value", "in", "self", ":", "if", "(", "source", "is", "None", ")", "or", "(", "key", "in", "source", ")", ":", "commands", "....
Return a string containing multiple `reStructuredText` replacements with the substitutions currently defined. Some examples based on the subpackage |optiontools|: >>> from hydpy.core.autodoctools import Substituter >>> substituter = Substituter() >>> from hydpy.core import opti...
[ "Return", "a", "string", "containing", "multiple", "reStructuredText", "replacements", "with", "the", "substitutions", "currently", "defined", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L600-L642
hydpy-dev/hydpy
hydpy/core/autodoctools.py
Substituter.find
def find(self, text): """Print all substitutions that include the given text string.""" for key, value in self: if (text in key) or (text in value): print(key, value)
python
def find(self, text): """Print all substitutions that include the given text string.""" for key, value in self: if (text in key) or (text in value): print(key, value)
[ "def", "find", "(", "self", ",", "text", ")", ":", "for", "key", ",", "value", "in", "self", ":", "if", "(", "text", "in", "key", ")", "or", "(", "text", "in", "value", ")", ":", "print", "(", "key", ",", "value", ")" ]
Print all substitutions that include the given text string.
[ "Print", "all", "substitutions", "that", "include", "the", "given", "text", "string", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L644-L648
hydpy-dev/hydpy
hydpy/core/printtools.py
print_progress
def print_progress(wrapped, _=None, args=None, kwargs=None): """Add print commands time to the given function informing about execution time. To show how the |print_progress| decorator works, we need to modify the functions used by |print_progress| to gain system time information available in modu...
python
def print_progress(wrapped, _=None, args=None, kwargs=None): """Add print commands time to the given function informing about execution time. To show how the |print_progress| decorator works, we need to modify the functions used by |print_progress| to gain system time information available in modu...
[ "def", "print_progress", "(", "wrapped", ",", "_", "=", "None", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "global", "_printprogress_indentation", "_printprogress_indentation", "+=", "4", "try", ":", "if", "hydpy", ".", "pub", ".", "op...
Add print commands time to the given function informing about execution time. To show how the |print_progress| decorator works, we need to modify the functions used by |print_progress| to gain system time information available in module |time|. First, we mock the functions |time.strftime| and |ti...
[ "Add", "print", "commands", "time", "to", "the", "given", "function", "informing", "about", "execution", "time", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/printtools.py#L42-L136
hydpy-dev/hydpy
hydpy/core/printtools.py
progressbar
def progressbar(iterable, length=23): """Print a simple progress bar while processing the given iterable. Function |progressbar| does print the progress bar when option `printprogress` is activted: >>> from hydpy import pub >>> pub.options.printprogress = True You can pass an iterable object....
python
def progressbar(iterable, length=23): """Print a simple progress bar while processing the given iterable. Function |progressbar| does print the progress bar when option `printprogress` is activted: >>> from hydpy import pub >>> pub.options.printprogress = True You can pass an iterable object....
[ "def", "progressbar", "(", "iterable", ",", "length", "=", "23", ")", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "printprogress", "and", "(", "len", "(", "iterable", ")", ">", "1", ")", ":", "temp_name", "=", "os", ".", "path", ".", "join...
Print a simple progress bar while processing the given iterable. Function |progressbar| does print the progress bar when option `printprogress` is activted: >>> from hydpy import pub >>> pub.options.printprogress = True You can pass an iterable object. Say you want to calculate the the sum o...
[ "Print", "a", "simple", "progress", "bar", "while", "processing", "the", "given", "iterable", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/printtools.py#L139-L248
hydpy-dev/hydpy
hydpy/exe/servertools.py
start_server
def start_server(socket, projectname, xmlfilename: str) -> None: """Start the *HydPy* server using the given socket. The folder with the given `projectname` must be available within the current working directory. The XML configuration file must be placed within the project folder unless `xmlfilename` ...
python
def start_server(socket, projectname, xmlfilename: str) -> None: """Start the *HydPy* server using the given socket. The folder with the given `projectname` must be available within the current working directory. The XML configuration file must be placed within the project folder unless `xmlfilename` ...
[ "def", "start_server", "(", "socket", ",", "projectname", ",", "xmlfilename", ":", "str", ")", "->", "None", ":", "state", ".", "initialise", "(", "projectname", ",", "xmlfilename", ")", "server", "=", "http", ".", "server", ".", "HTTPServer", "(", "(", ...
Start the *HydPy* server using the given socket. The folder with the given `projectname` must be available within the current working directory. The XML configuration file must be placed within the project folder unless `xmlfilename` is an absolute file path. The XML configuration file must be valid c...
[ "Start", "the", "*", "HydPy", "*", "server", "using", "the", "given", "socket", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1147-L1159
hydpy-dev/hydpy
hydpy/exe/servertools.py
await_server
def await_server(port, seconds): """Block the current process until either the *HydPy* server is responding on the given `port` or the given number of `seconds` elapsed. >>> from hydpy import run_subprocess, TestIO >>> with TestIO(): # doctest: +ELLIPSIS ... run_subprocess('hyd.py await_serv...
python
def await_server(port, seconds): """Block the current process until either the *HydPy* server is responding on the given `port` or the given number of `seconds` elapsed. >>> from hydpy import run_subprocess, TestIO >>> with TestIO(): # doctest: +ELLIPSIS ... run_subprocess('hyd.py await_serv...
[ "def", "await_server", "(", "port", ",", "seconds", ")", ":", "now", "=", "time", ".", "perf_counter", "(", ")", "end", "=", "now", "+", "float", "(", "seconds", ")", "while", "now", "<=", "end", ":", "try", ":", "urllib", ".", "request", ".", "url...
Block the current process until either the *HydPy* server is responding on the given `port` or the given number of `seconds` elapsed. >>> from hydpy import run_subprocess, TestIO >>> with TestIO(): # doctest: +ELLIPSIS ... run_subprocess('hyd.py await_server 8080 0.1') Invoking hyd.py with a...
[ "Block", "the", "current", "process", "until", "either", "the", "*", "HydPy", "*", "server", "is", "responding", "on", "the", "given", "port", "or", "the", "given", "number", "of", "seconds", "elapsed", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1162-L1198
hydpy-dev/hydpy
hydpy/exe/servertools.py
ServerState.initialise
def initialise(self, projectname: str, xmlfile: str) -> None: """Initialise a *HydPy* project based on the given XML configuration file agreeing with `HydPyConfigMultipleRuns.xsd`. We use the `LahnH` project and its rather complex XML configuration file `multiple_runs.xml` as an example...
python
def initialise(self, projectname: str, xmlfile: str) -> None: """Initialise a *HydPy* project based on the given XML configuration file agreeing with `HydPyConfigMultipleRuns.xsd`. We use the `LahnH` project and its rather complex XML configuration file `multiple_runs.xml` as an example...
[ "def", "initialise", "(", "self", ",", "projectname", ":", "str", ",", "xmlfile", ":", "str", ")", "->", "None", ":", "write", "=", "commandtools", ".", "print_textandtime", "write", "(", "f'Start HydPy project `{projectname}`'", ")", "hp", "=", "hydpytools", ...
Initialise a *HydPy* project based on the given XML configuration file agreeing with `HydPyConfigMultipleRuns.xsd`. We use the `LahnH` project and its rather complex XML configuration file `multiple_runs.xml` as an example (module |xmltools| provides information on interpreting this fil...
[ "Initialise", "a", "*", "HydPy", "*", "project", "based", "on", "the", "given", "XML", "configuration", "file", "agreeing", "with", "HydPyConfigMultipleRuns", ".", "xsd", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L281-L382
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.POST_evaluate
def POST_evaluate(self) -> None: """Evaluate any valid Python expression with the *HydPy* server process and get its result. Method |HydPyServer.POST_evaluate| serves to test and debug, primarily. The main documentation on module |servertools| explains its usage. """ for...
python
def POST_evaluate(self) -> None: """Evaluate any valid Python expression with the *HydPy* server process and get its result. Method |HydPyServer.POST_evaluate| serves to test and debug, primarily. The main documentation on module |servertools| explains its usage. """ for...
[ "def", "POST_evaluate", "(", "self", ")", "->", "None", ":", "for", "name", ",", "value", "in", "self", ".", "_inputs", ".", "items", "(", ")", ":", "result", "=", "eval", "(", "value", ")", "self", ".", "_outputs", "[", "name", "]", "=", "objectto...
Evaluate any valid Python expression with the *HydPy* server process and get its result. Method |HydPyServer.POST_evaluate| serves to test and debug, primarily. The main documentation on module |servertools| explains its usage.
[ "Evaluate", "any", "valid", "Python", "expression", "with", "the", "*", "HydPy", "*", "server", "process", "and", "get", "its", "result", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L918-L927
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_close_server
def GET_close_server(self) -> None: """Stop and close the *HydPy* server.""" def _close_server(): self.server.shutdown() self.server.server_close() shutter = threading.Thread(target=_close_server) shutter.deamon = True shutter.start()
python
def GET_close_server(self) -> None: """Stop and close the *HydPy* server.""" def _close_server(): self.server.shutdown() self.server.server_close() shutter = threading.Thread(target=_close_server) shutter.deamon = True shutter.start()
[ "def", "GET_close_server", "(", "self", ")", "->", "None", ":", "def", "_close_server", "(", ")", ":", "self", ".", "server", ".", "shutdown", "(", ")", "self", ".", "server", ".", "server_close", "(", ")", "shutter", "=", "threading", ".", "Thread", "...
Stop and close the *HydPy* server.
[ "Stop", "and", "close", "the", "*", "HydPy", "*", "server", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L933-L940
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_parameteritemtypes
def GET_parameteritemtypes(self) -> None: """Get the types of all current exchange items supposed to change the values of |Parameter| objects.""" for item in state.parameteritems: self._outputs[item.name] = self._get_itemtype(item)
python
def GET_parameteritemtypes(self) -> None: """Get the types of all current exchange items supposed to change the values of |Parameter| objects.""" for item in state.parameteritems: self._outputs[item.name] = self._get_itemtype(item)
[ "def", "GET_parameteritemtypes", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "parameteritems", ":", "self", ".", "_outputs", "[", "item", ".", "name", "]", "=", "self", ".", "_get_itemtype", "(", "item", ")" ]
Get the types of all current exchange items supposed to change the values of |Parameter| objects.
[ "Get", "the", "types", "of", "all", "current", "exchange", "items", "supposed", "to", "change", "the", "values", "of", "|Parameter|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L953-L957
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_conditionitemtypes
def GET_conditionitemtypes(self) -> None: """Get the types of all current exchange items supposed to change the values of |StateSequence| or |LogSequence| objects.""" for item in state.conditionitems: self._outputs[item.name] = self._get_itemtype(item)
python
def GET_conditionitemtypes(self) -> None: """Get the types of all current exchange items supposed to change the values of |StateSequence| or |LogSequence| objects.""" for item in state.conditionitems: self._outputs[item.name] = self._get_itemtype(item)
[ "def", "GET_conditionitemtypes", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "conditionitems", ":", "self", ".", "_outputs", "[", "item", ".", "name", "]", "=", "self", ".", "_get_itemtype", "(", "item", ")" ]
Get the types of all current exchange items supposed to change the values of |StateSequence| or |LogSequence| objects.
[ "Get", "the", "types", "of", "all", "current", "exchange", "items", "supposed", "to", "change", "the", "values", "of", "|StateSequence|", "or", "|LogSequence|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L959-L963
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_getitemtypes
def GET_getitemtypes(self) -> None: """Get the types of all current exchange items supposed to return the values of |Parameter| or |Sequence| objects or the time series of |IOSequence| objects.""" for item in state.getitems: type_ = self._get_itemtype(item) for na...
python
def GET_getitemtypes(self) -> None: """Get the types of all current exchange items supposed to return the values of |Parameter| or |Sequence| objects or the time series of |IOSequence| objects.""" for item in state.getitems: type_ = self._get_itemtype(item) for na...
[ "def", "GET_getitemtypes", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "getitems", ":", "type_", "=", "self", ".", "_get_itemtype", "(", "item", ")", "for", "name", ",", "_", "in", "item", ".", "yield_name2value", "(", ")", ...
Get the types of all current exchange items supposed to return the values of |Parameter| or |Sequence| objects or the time series of |IOSequence| objects.
[ "Get", "the", "types", "of", "all", "current", "exchange", "items", "supposed", "to", "return", "the", "values", "of", "|Parameter|", "or", "|Sequence|", "objects", "or", "the", "time", "series", "of", "|IOSequence|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L965-L972
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.POST_timegrid
def POST_timegrid(self) -> None: """Change the current simulation |Timegrid|.""" init = hydpy.pub.timegrids.init sim = hydpy.pub.timegrids.sim sim.firstdate = self._inputs['firstdate'] sim.lastdate = self._inputs['lastdate'] state.idx1 = init[sim.firstdate] state....
python
def POST_timegrid(self) -> None: """Change the current simulation |Timegrid|.""" init = hydpy.pub.timegrids.init sim = hydpy.pub.timegrids.sim sim.firstdate = self._inputs['firstdate'] sim.lastdate = self._inputs['lastdate'] state.idx1 = init[sim.firstdate] state....
[ "def", "POST_timegrid", "(", "self", ")", "->", "None", ":", "init", "=", "hydpy", ".", "pub", ".", "timegrids", ".", "init", "sim", "=", "hydpy", ".", "pub", ".", "timegrids", ".", "sim", "sim", ".", "firstdate", "=", "self", ".", "_inputs", "[", ...
Change the current simulation |Timegrid|.
[ "Change", "the", "current", "simulation", "|Timegrid|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L978-L985
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_parameteritemvalues
def GET_parameteritemvalues(self) -> None: """Get the values of all |ChangeItem| objects handling |Parameter| objects.""" for item in state.parameteritems: self._outputs[item.name] = item.value
python
def GET_parameteritemvalues(self) -> None: """Get the values of all |ChangeItem| objects handling |Parameter| objects.""" for item in state.parameteritems: self._outputs[item.name] = item.value
[ "def", "GET_parameteritemvalues", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "parameteritems", ":", "self", ".", "_outputs", "[", "item", ".", "name", "]", "=", "item", ".", "value" ]
Get the values of all |ChangeItem| objects handling |Parameter| objects.
[ "Get", "the", "values", "of", "all", "|ChangeItem|", "objects", "handling", "|Parameter|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1003-L1007
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_conditionitemvalues
def GET_conditionitemvalues(self) -> None: """Get the values of all |ChangeItem| objects handling |StateSequence| or |LogSequence| objects.""" for item in state.conditionitems: self._outputs[item.name] = item.value
python
def GET_conditionitemvalues(self) -> None: """Get the values of all |ChangeItem| objects handling |StateSequence| or |LogSequence| objects.""" for item in state.conditionitems: self._outputs[item.name] = item.value
[ "def", "GET_conditionitemvalues", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "conditionitems", ":", "self", ".", "_outputs", "[", "item", ".", "name", "]", "=", "item", ".", "value" ]
Get the values of all |ChangeItem| objects handling |StateSequence| or |LogSequence| objects.
[ "Get", "the", "values", "of", "all", "|ChangeItem|", "objects", "handling", "|StateSequence|", "or", "|LogSequence|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1014-L1018
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_getitemvalues
def GET_getitemvalues(self) -> None: """Get the values of all |Variable| objects observed by the current |GetItem| objects. For |GetItem| objects observing time series, |HydPyServer.GET_getitemvalues| returns only the values within the current simulation period. """ ...
python
def GET_getitemvalues(self) -> None: """Get the values of all |Variable| objects observed by the current |GetItem| objects. For |GetItem| objects observing time series, |HydPyServer.GET_getitemvalues| returns only the values within the current simulation period. """ ...
[ "def", "GET_getitemvalues", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "getitems", ":", "for", "name", ",", "value", "in", "item", ".", "yield_name2value", "(", "state", ".", "idx1", ",", "state", ".", "idx2", ")", ":", "...
Get the values of all |Variable| objects observed by the current |GetItem| objects. For |GetItem| objects observing time series, |HydPyServer.GET_getitemvalues| returns only the values within the current simulation period.
[ "Get", "the", "values", "of", "all", "|Variable|", "objects", "observed", "by", "the", "current", "|GetItem|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1025-L1035
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_load_conditionvalues
def GET_load_conditionvalues(self) -> None: """Assign the |StateSequence| or |LogSequence| object values available for the current simulation start point to the current |HydPy| instance. When the simulation start point is identical with the initialisation time point and you did not save...
python
def GET_load_conditionvalues(self) -> None: """Assign the |StateSequence| or |LogSequence| object values available for the current simulation start point to the current |HydPy| instance. When the simulation start point is identical with the initialisation time point and you did not save...
[ "def", "GET_load_conditionvalues", "(", "self", ")", "->", "None", ":", "try", ":", "state", ".", "hp", ".", "conditions", "=", "state", ".", "conditions", "[", "self", ".", "_id", "]", "[", "state", ".", "idx1", "]", "except", "KeyError", ":", "if", ...
Assign the |StateSequence| or |LogSequence| object values available for the current simulation start point to the current |HydPy| instance. When the simulation start point is identical with the initialisation time point and you did not save conditions for it beforehand, the "original" i...
[ "Assign", "the", "|StateSequence|", "or", "|LogSequence|", "object", "values", "available", "for", "the", "current", "simulation", "start", "point", "to", "the", "current", "|HydPy|", "instance", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1037-L1056
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_save_conditionvalues
def GET_save_conditionvalues(self) -> None: """Save the |StateSequence| and |LogSequence| object values of the current |HydPy| instance for the current simulation endpoint.""" state.conditions[self._id] = state.conditions.get(self._id, {}) state.conditions[self._id][state.idx2] = state.h...
python
def GET_save_conditionvalues(self) -> None: """Save the |StateSequence| and |LogSequence| object values of the current |HydPy| instance for the current simulation endpoint.""" state.conditions[self._id] = state.conditions.get(self._id, {}) state.conditions[self._id][state.idx2] = state.h...
[ "def", "GET_save_conditionvalues", "(", "self", ")", "->", "None", ":", "state", ".", "conditions", "[", "self", ".", "_id", "]", "=", "state", ".", "conditions", ".", "get", "(", "self", ".", "_id", ",", "{", "}", ")", "state", ".", "conditions", "[...
Save the |StateSequence| and |LogSequence| object values of the current |HydPy| instance for the current simulation endpoint.
[ "Save", "the", "|StateSequence|", "and", "|LogSequence|", "object", "values", "of", "the", "current", "|HydPy|", "instance", "for", "the", "current", "simulation", "endpoint", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1058-L1062
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_save_parameteritemvalues
def GET_save_parameteritemvalues(self) -> None: """Save the values of those |ChangeItem| objects which are handling |Parameter| objects.""" for item in state.parameteritems: state.parameteritemvalues[self._id][item.name] = item.value.copy()
python
def GET_save_parameteritemvalues(self) -> None: """Save the values of those |ChangeItem| objects which are handling |Parameter| objects.""" for item in state.parameteritems: state.parameteritemvalues[self._id][item.name] = item.value.copy()
[ "def", "GET_save_parameteritemvalues", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "parameteritems", ":", "state", ".", "parameteritemvalues", "[", "self", ".", "_id", "]", "[", "item", ".", "name", "]", "=", "item", ".", "val...
Save the values of those |ChangeItem| objects which are handling |Parameter| objects.
[ "Save", "the", "values", "of", "those", "|ChangeItem|", "objects", "which", "are", "handling", "|Parameter|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1064-L1068
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_savedparameteritemvalues
def GET_savedparameteritemvalues(self) -> None: """Get the previously saved values of those |ChangeItem| objects which are handling |Parameter| objects.""" dict_ = state.parameteritemvalues.get(self._id) if dict_ is None: self.GET_parameteritemvalues() else: ...
python
def GET_savedparameteritemvalues(self) -> None: """Get the previously saved values of those |ChangeItem| objects which are handling |Parameter| objects.""" dict_ = state.parameteritemvalues.get(self._id) if dict_ is None: self.GET_parameteritemvalues() else: ...
[ "def", "GET_savedparameteritemvalues", "(", "self", ")", "->", "None", ":", "dict_", "=", "state", ".", "parameteritemvalues", ".", "get", "(", "self", ".", "_id", ")", "if", "dict_", "is", "None", ":", "self", ".", "GET_parameteritemvalues", "(", ")", "el...
Get the previously saved values of those |ChangeItem| objects which are handling |Parameter| objects.
[ "Get", "the", "previously", "saved", "values", "of", "those", "|ChangeItem|", "objects", "which", "are", "handling", "|Parameter|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1070-L1078
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_save_modifiedconditionitemvalues
def GET_save_modifiedconditionitemvalues(self) -> None: """ToDo: extend functionality and add tests""" for item in state.conditionitems: state.modifiedconditionitemvalues[self._id][item.name] = \ list(item.device2target.values())[0].value
python
def GET_save_modifiedconditionitemvalues(self) -> None: """ToDo: extend functionality and add tests""" for item in state.conditionitems: state.modifiedconditionitemvalues[self._id][item.name] = \ list(item.device2target.values())[0].value
[ "def", "GET_save_modifiedconditionitemvalues", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "conditionitems", ":", "state", ".", "modifiedconditionitemvalues", "[", "self", ".", "_id", "]", "[", "item", ".", "name", "]", "=", "list...
ToDo: extend functionality and add tests
[ "ToDo", ":", "extend", "functionality", "and", "add", "tests" ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1080-L1084
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_savedmodifiedconditionitemvalues
def GET_savedmodifiedconditionitemvalues(self) -> None: """ToDo: extend functionality and add tests""" dict_ = state.modifiedconditionitemvalues.get(self._id) if dict_ is None: self.GET_conditionitemvalues() else: for name, value in dict_.items(): ...
python
def GET_savedmodifiedconditionitemvalues(self) -> None: """ToDo: extend functionality and add tests""" dict_ = state.modifiedconditionitemvalues.get(self._id) if dict_ is None: self.GET_conditionitemvalues() else: for name, value in dict_.items(): ...
[ "def", "GET_savedmodifiedconditionitemvalues", "(", "self", ")", "->", "None", ":", "dict_", "=", "state", ".", "modifiedconditionitemvalues", ".", "get", "(", "self", ".", "_id", ")", "if", "dict_", "is", "None", ":", "self", ".", "GET_conditionitemvalues", "...
ToDo: extend functionality and add tests
[ "ToDo", ":", "extend", "functionality", "and", "add", "tests" ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1086-L1093
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_save_getitemvalues
def GET_save_getitemvalues(self) -> None: """Save the values of all current |GetItem| objects.""" for item in state.getitems: for name, value in item.yield_name2value(state.idx1, state.idx2): state.getitemvalues[self._id][name] = value
python
def GET_save_getitemvalues(self) -> None: """Save the values of all current |GetItem| objects.""" for item in state.getitems: for name, value in item.yield_name2value(state.idx1, state.idx2): state.getitemvalues[self._id][name] = value
[ "def", "GET_save_getitemvalues", "(", "self", ")", "->", "None", ":", "for", "item", "in", "state", ".", "getitems", ":", "for", "name", ",", "value", "in", "item", ".", "yield_name2value", "(", "state", ".", "idx1", ",", "state", ".", "idx2", ")", ":"...
Save the values of all current |GetItem| objects.
[ "Save", "the", "values", "of", "all", "current", "|GetItem|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1095-L1099
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_savedgetitemvalues
def GET_savedgetitemvalues(self) -> None: """Get the previously saved values of all |GetItem| objects.""" dict_ = state.getitemvalues.get(self._id) if dict_ is None: self.GET_getitemvalues() else: for name, value in dict_.items(): self._outputs[nam...
python
def GET_savedgetitemvalues(self) -> None: """Get the previously saved values of all |GetItem| objects.""" dict_ = state.getitemvalues.get(self._id) if dict_ is None: self.GET_getitemvalues() else: for name, value in dict_.items(): self._outputs[nam...
[ "def", "GET_savedgetitemvalues", "(", "self", ")", "->", "None", ":", "dict_", "=", "state", ".", "getitemvalues", ".", "get", "(", "self", ".", "_id", ")", "if", "dict_", "is", "None", ":", "self", ".", "GET_getitemvalues", "(", ")", "else", ":", "for...
Get the previously saved values of all |GetItem| objects.
[ "Get", "the", "previously", "saved", "values", "of", "all", "|GetItem|", "objects", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1101-L1108
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_save_timegrid
def GET_save_timegrid(self) -> None: """Save the current simulation period.""" state.timegrids[self._id] = copy.deepcopy(hydpy.pub.timegrids.sim)
python
def GET_save_timegrid(self) -> None: """Save the current simulation period.""" state.timegrids[self._id] = copy.deepcopy(hydpy.pub.timegrids.sim)
[ "def", "GET_save_timegrid", "(", "self", ")", "->", "None", ":", "state", ".", "timegrids", "[", "self", ".", "_id", "]", "=", "copy", ".", "deepcopy", "(", "hydpy", ".", "pub", ".", "timegrids", ".", "sim", ")" ]
Save the current simulation period.
[ "Save", "the", "current", "simulation", "period", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1110-L1112
hydpy-dev/hydpy
hydpy/exe/servertools.py
HydPyServer.GET_savedtimegrid
def GET_savedtimegrid(self) -> None: """Get the previously saved simulation period.""" try: self._write_timegrid(state.timegrids[self._id]) except KeyError: self._write_timegrid(hydpy.pub.timegrids.init)
python
def GET_savedtimegrid(self) -> None: """Get the previously saved simulation period.""" try: self._write_timegrid(state.timegrids[self._id]) except KeyError: self._write_timegrid(hydpy.pub.timegrids.init)
[ "def", "GET_savedtimegrid", "(", "self", ")", "->", "None", ":", "try", ":", "self", ".", "_write_timegrid", "(", "state", ".", "timegrids", "[", "self", ".", "_id", "]", ")", "except", "KeyError", ":", "self", ".", "_write_timegrid", "(", "hydpy", ".", ...
Get the previously saved simulation period.
[ "Get", "the", "previously", "saved", "simulation", "period", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1114-L1119
hydpy-dev/hydpy
hydpy/core/variabletools.py
trim
def trim(self: 'Variable', lower=None, upper=None) -> None: """Trim the value(s) of a |Variable| instance. Usually, users do not need to apply function |trim| directly. Instead, some |Variable| subclasses implement their own `trim` methods relying on function |trim|. Model developers should implem...
python
def trim(self: 'Variable', lower=None, upper=None) -> None: """Trim the value(s) of a |Variable| instance. Usually, users do not need to apply function |trim| directly. Instead, some |Variable| subclasses implement their own `trim` methods relying on function |trim|. Model developers should implem...
[ "def", "trim", "(", "self", ":", "'Variable'", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", "->", "None", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "trimvariables", ":", "if", "lower", "is", "None", ":", "lower", "=", "self...
Trim the value(s) of a |Variable| instance. Usually, users do not need to apply function |trim| directly. Instead, some |Variable| subclasses implement their own `trim` methods relying on function |trim|. Model developers should implement individual `trim` methods for their |Parameter| or |Sequenc...
[ "Trim", "the", "value", "(", "s", ")", "of", "a", "|Variable|", "instance", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L47-L376
hydpy-dev/hydpy
hydpy/core/variabletools.py
_get_tolerance
def _get_tolerance(values): """Return some "numerical accuracy" to be expected for the given floating point value(s) (see method |trim|).""" tolerance = numpy.abs(values*1e-15) if hasattr(tolerance, '__setitem__'): tolerance[numpy.isinf(tolerance)] = 0. elif numpy.isinf(tolerance): t...
python
def _get_tolerance(values): """Return some "numerical accuracy" to be expected for the given floating point value(s) (see method |trim|).""" tolerance = numpy.abs(values*1e-15) if hasattr(tolerance, '__setitem__'): tolerance[numpy.isinf(tolerance)] = 0. elif numpy.isinf(tolerance): t...
[ "def", "_get_tolerance", "(", "values", ")", ":", "tolerance", "=", "numpy", ".", "abs", "(", "values", "*", "1e-15", ")", "if", "hasattr", "(", "tolerance", ",", "'__setitem__'", ")", ":", "tolerance", "[", "numpy", ".", "isinf", "(", "tolerance", ")", ...
Return some "numerical accuracy" to be expected for the given floating point value(s) (see method |trim|).
[ "Return", "some", "numerical", "accuracy", "to", "be", "expected", "for", "the", "given", "floating", "point", "value", "(", "s", ")", "(", "see", "method", "|trim|", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L451-L459
hydpy-dev/hydpy
hydpy/core/variabletools.py
_compare_variables_function_generator
def _compare_variables_function_generator( method_string, aggregation_func): """Return a function usable as a comparison method for class |Variable|. Pass the specific method (e.g. `__eq__`) and the corresponding operator (e.g. `==`) as strings. Also pass either |numpy.all| or |numpy.any| for...
python
def _compare_variables_function_generator( method_string, aggregation_func): """Return a function usable as a comparison method for class |Variable|. Pass the specific method (e.g. `__eq__`) and the corresponding operator (e.g. `==`) as strings. Also pass either |numpy.all| or |numpy.any| for...
[ "def", "_compare_variables_function_generator", "(", "method_string", ",", "aggregation_func", ")", ":", "def", "comparison_function", "(", "self", ",", "other", ")", ":", "\"\"\"Wrapper for comparison functions for class |Variable|.\"\"\"", "if", "self", "is", "other", ":"...
Return a function usable as a comparison method for class |Variable|. Pass the specific method (e.g. `__eq__`) and the corresponding operator (e.g. `==`) as strings. Also pass either |numpy.all| or |numpy.any| for aggregating multiple boolean values.
[ "Return", "a", "function", "usable", "as", "a", "comparison", "method", "for", "class", "|Variable|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L470-L495
hydpy-dev/hydpy
hydpy/core/variabletools.py
to_repr
def to_repr(self: Variable, values, brackets1d: Optional[bool] = False) \ -> str: """Return a valid string representation for the given |Variable| object. Function |to_repr| it thought for internal purposes only, more specifically for defining string representations of subclasses of class |...
python
def to_repr(self: Variable, values, brackets1d: Optional[bool] = False) \ -> str: """Return a valid string representation for the given |Variable| object. Function |to_repr| it thought for internal purposes only, more specifically for defining string representations of subclasses of class |...
[ "def", "to_repr", "(", "self", ":", "Variable", ",", "values", ",", "brackets1d", ":", "Optional", "[", "bool", "]", "=", "False", ")", "->", "str", ":", "prefix", "=", "f'{self.name}('", "if", "isinstance", "(", "values", ",", "str", ")", ":", "string...
Return a valid string representation for the given |Variable| object. Function |to_repr| it thought for internal purposes only, more specifically for defining string representations of subclasses of class |Variable| like the following: >>> from hydpy.core.variabletools import to_repr, Variable ...
[ "Return", "a", "valid", "string", "representation", "for", "the", "given", "|Variable|", "object", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L1930-L1997
hydpy-dev/hydpy
hydpy/core/variabletools.py
Variable.verify
def verify(self) -> None: """Raises a |RuntimeError| if at least one of the required values of a |Variable| object is |None| or |numpy.nan|. The descriptor `mask` defines, which values are considered to be necessary. Example on a 0-dimensional |Variable|: >>> from hydpy.core.va...
python
def verify(self) -> None: """Raises a |RuntimeError| if at least one of the required values of a |Variable| object is |None| or |numpy.nan|. The descriptor `mask` defines, which values are considered to be necessary. Example on a 0-dimensional |Variable|: >>> from hydpy.core.va...
[ "def", "verify", "(", "self", ")", "->", "None", ":", "nmbnan", ":", "int", "=", "numpy", ".", "sum", "(", "numpy", ".", "isnan", "(", "numpy", ".", "array", "(", "self", ".", "value", ")", "[", "self", ".", "mask", "]", ")", ")", "if", "nmbnan...
Raises a |RuntimeError| if at least one of the required values of a |Variable| object is |None| or |numpy.nan|. The descriptor `mask` defines, which values are considered to be necessary. Example on a 0-dimensional |Variable|: >>> from hydpy.core.variabletools import Variable >...
[ "Raises", "a", "|RuntimeError|", "if", "at", "least", "one", "of", "the", "required", "values", "of", "a", "|Variable|", "object", "is", "|None|", "or", "|numpy", ".", "nan|", ".", "The", "descriptor", "mask", "defines", "which", "values", "are", "considered...
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L1271-L1327
hydpy-dev/hydpy
hydpy/core/variabletools.py
Variable.average_values
def average_values(self, *args, **kwargs) -> float: """Average the actual values of the |Variable| object. For 0-dimensional |Variable| objects, the result of method |Variable.average_values| equals |Variable.value|. The following example shows this for the sloppily defined class ...
python
def average_values(self, *args, **kwargs) -> float: """Average the actual values of the |Variable| object. For 0-dimensional |Variable| objects, the result of method |Variable.average_values| equals |Variable.value|. The following example shows this for the sloppily defined class ...
[ "def", "average_values", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "float", ":", "try", ":", "if", "not", "self", ".", "NDIM", ":", "return", "self", ".", "value", "mask", "=", "self", ".", "get_submask", "(", "*", "args", ...
Average the actual values of the |Variable| object. For 0-dimensional |Variable| objects, the result of method |Variable.average_values| equals |Variable.value|. The following example shows this for the sloppily defined class `SoilMoisture`: >>> from hydpy.core.variabletools i...
[ "Average", "the", "actual", "values", "of", "the", "|Variable|", "object", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L1339-L1510
hydpy-dev/hydpy
hydpy/core/variabletools.py
Variable.get_submask
def get_submask(self, *args, **kwargs) -> masktools.CustomMask: """Get a sub-mask of the mask handled by the actual |Variable| object based on the given arguments. See the documentation on method |Variable.average_values| for further information. """ if args or kwargs: ...
python
def get_submask(self, *args, **kwargs) -> masktools.CustomMask: """Get a sub-mask of the mask handled by the actual |Variable| object based on the given arguments. See the documentation on method |Variable.average_values| for further information. """ if args or kwargs: ...
[ "def", "get_submask", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "masktools", ".", "CustomMask", ":", "if", "args", "or", "kwargs", ":", "masks", "=", "self", ".", "availablemasks", "mask", "=", "masktools", ".", "CustomMask", "...
Get a sub-mask of the mask handled by the actual |Variable| object based on the given arguments. See the documentation on method |Variable.average_values| for further information.
[ "Get", "a", "sub", "-", "mask", "of", "the", "mask", "handled", "by", "the", "actual", "|Variable|", "object", "based", "on", "the", "given", "arguments", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L1517-L1538
hydpy-dev/hydpy
hydpy/core/variabletools.py
Variable.commentrepr
def commentrepr(self) -> List[str]: """A list with comments for making string representations more informative. With option |Options.reprcomments| being disabled, |Variable.commentrepr| is empty. """ if hydpy.pub.options.reprcomments: return [f'# {line}' for ...
python
def commentrepr(self) -> List[str]: """A list with comments for making string representations more informative. With option |Options.reprcomments| being disabled, |Variable.commentrepr| is empty. """ if hydpy.pub.options.reprcomments: return [f'# {line}' for ...
[ "def", "commentrepr", "(", "self", ")", "->", "List", "[", "str", "]", ":", "if", "hydpy", ".", "pub", ".", "options", ".", "reprcomments", ":", "return", "[", "f'# {line}'", "for", "line", "in", "textwrap", ".", "wrap", "(", "objecttools", ".", "descr...
A list with comments for making string representations more informative. With option |Options.reprcomments| being disabled, |Variable.commentrepr| is empty.
[ "A", "list", "with", "comments", "for", "making", "string", "representations", "more", "informative", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L1744-L1754
wind39/spartacus
Spartacus/Report.py
AddTable
def AddTable(p_workSheet = None, p_headerDict = None, p_startColumn = 1, p_startRow = 1, p_headerHeight = None, p_data = None, p_mainTable = False, p_conditionalFormatting = None, p_tableStyleInfo = None, p_withFilters = True): """Insert a table in a given worksheet. Args: p_workSheet (openpyxl...
python
def AddTable(p_workSheet = None, p_headerDict = None, p_startColumn = 1, p_startRow = 1, p_headerHeight = None, p_data = None, p_mainTable = False, p_conditionalFormatting = None, p_tableStyleInfo = None, p_withFilters = True): """Insert a table in a given worksheet. Args: p_workSheet (openpyxl...
[ "def", "AddTable", "(", "p_workSheet", "=", "None", ",", "p_headerDict", "=", "None", ",", "p_startColumn", "=", "1", ",", "p_startRow", "=", "1", ",", "p_headerHeight", "=", "None", ",", "p_data", "=", "None", ",", "p_mainTable", "=", "False", ",", "p_c...
Insert a table in a given worksheet. Args: p_workSheet (openpyxl.worksheet.worksheet.Worksheet): the worksheet where the table will be inserted. Defaults to None. p_headerDict (collections.OrderedDict): an ordered dict that contains table header columns. Notes: ...
[ "Insert", "a", "table", "in", "a", "given", "worksheet", "." ]
train
https://github.com/wind39/spartacus/blob/622261e9c5d05c2e385d81171acb910c63aa1669/Spartacus/Report.py#L607-L1054
hydpy-dev/hydpy
hydpy/core/parametertools.py
get_controlfileheader
def get_controlfileheader( model: Union[str, 'modeltools.Model'], parameterstep: timetools.PeriodConstrArg = None, simulationstep: timetools.PeriodConstrArg = None) -> str: """Return the header of a regular or auxiliary parameter control file. The header contains the default coding info...
python
def get_controlfileheader( model: Union[str, 'modeltools.Model'], parameterstep: timetools.PeriodConstrArg = None, simulationstep: timetools.PeriodConstrArg = None) -> str: """Return the header of a regular or auxiliary parameter control file. The header contains the default coding info...
[ "def", "get_controlfileheader", "(", "model", ":", "Union", "[", "str", ",", "'modeltools.Model'", "]", ",", "parameterstep", ":", "timetools", ".", "PeriodConstrArg", "=", "None", ",", "simulationstep", ":", "timetools", ".", "PeriodConstrArg", "=", "None", ")"...
Return the header of a regular or auxiliary parameter control file. The header contains the default coding information, the import command for the given model and the actual parameter and simulation step sizes. The first example shows that, if you pass the model argument as a string, you have to take ...
[ "Return", "the", "header", "of", "a", "regular", "or", "auxiliary", "parameter", "control", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L28-L80
hydpy-dev/hydpy
hydpy/core/parametertools.py
Constants._prepare_docstrings
def _prepare_docstrings(self, frame): """Assign docstrings to the constants handled by |Constants| to make them available in the interactive mode of Python.""" if config.USEAUTODOC: filename = inspect.getsourcefile(frame) with open(filename) as file_: sour...
python
def _prepare_docstrings(self, frame): """Assign docstrings to the constants handled by |Constants| to make them available in the interactive mode of Python.""" if config.USEAUTODOC: filename = inspect.getsourcefile(frame) with open(filename) as file_: sour...
[ "def", "_prepare_docstrings", "(", "self", ",", "frame", ")", ":", "if", "config", ".", "USEAUTODOC", ":", "filename", "=", "inspect", ".", "getsourcefile", "(", "frame", ")", "with", "open", "(", "filename", ")", "as", "file_", ":", "sources", "=", "fil...
Assign docstrings to the constants handled by |Constants| to make them available in the interactive mode of Python.
[ "Assign", "docstrings", "to", "the", "constants", "handled", "by", "|Constants|", "to", "make", "them", "available", "in", "the", "interactive", "mode", "of", "Python", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L106-L118
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameters.update
def update(self) -> None: """Call method |Parameter.update| of all "secondary" parameters. Directly after initialisation, neither the primary (`control`) parameters nor the secondary (`derived`) parameters of application model |hstream_v1| are ready for usage: >>> from hydpy.m...
python
def update(self) -> None: """Call method |Parameter.update| of all "secondary" parameters. Directly after initialisation, neither the primary (`control`) parameters nor the secondary (`derived`) parameters of application model |hstream_v1| are ready for usage: >>> from hydpy.m...
[ "def", "update", "(", "self", ")", "->", "None", ":", "for", "subpars", "in", "self", ".", "secondary_subpars", ":", "for", "par", "in", "subpars", ":", "try", ":", "par", ".", "update", "(", ")", "except", "BaseException", ":", "objecttools", ".", "au...
Call method |Parameter.update| of all "secondary" parameters. Directly after initialisation, neither the primary (`control`) parameters nor the secondary (`derived`) parameters of application model |hstream_v1| are ready for usage: >>> from hydpy.models.hstream_v1 import * >>>...
[ "Call", "method", "|Parameter", ".", "update|", "of", "all", "secondary", "parameters", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L143-L188
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameters.save_controls
def save_controls(self, filepath: Optional[str] = None, parameterstep: timetools.PeriodConstrArg = None, simulationstep: timetools.PeriodConstrArg = None, auxfiler: 'auxfiletools.Auxfiler' = None): """Write the control parameters to file. ...
python
def save_controls(self, filepath: Optional[str] = None, parameterstep: timetools.PeriodConstrArg = None, simulationstep: timetools.PeriodConstrArg = None, auxfiler: 'auxfiletools.Auxfiler' = None): """Write the control parameters to file. ...
[ "def", "save_controls", "(", "self", ",", "filepath", ":", "Optional", "[", "str", "]", "=", "None", ",", "parameterstep", ":", "timetools", ".", "PeriodConstrArg", "=", "None", ",", "simulationstep", ":", "timetools", ".", "PeriodConstrArg", "=", "None", ",...
Write the control parameters to file. Usually, a control file consists of a header (see the documentation on the method |get_controlfileheader|) and the string representations of the individual |Parameter| objects handled by the `control` |SubParameters| object. The main functi...
[ "Write", "the", "control", "parameters", "to", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L190-L272
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameter._get_values_from_auxiliaryfile
def _get_values_from_auxiliaryfile(self, auxfile): """Try to return the parameter values from the auxiliary control file with the given name. Things are a little complicated here. To understand this method, you should first take a look at the |parameterstep| function. """ ...
python
def _get_values_from_auxiliaryfile(self, auxfile): """Try to return the parameter values from the auxiliary control file with the given name. Things are a little complicated here. To understand this method, you should first take a look at the |parameterstep| function. """ ...
[ "def", "_get_values_from_auxiliaryfile", "(", "self", ",", "auxfile", ")", ":", "try", ":", "frame", "=", "inspect", ".", "currentframe", "(", ")", ".", "f_back", ".", "f_back", "while", "frame", ":", "namespace", "=", "frame", ".", "f_locals", "try", ":",...
Try to return the parameter values from the auxiliary control file with the given name. Things are a little complicated here. To understand this method, you should first take a look at the |parameterstep| function.
[ "Try", "to", "return", "the", "parameter", "values", "from", "the", "auxiliary", "control", "file", "with", "the", "given", "name", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L920-L952
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameter.initinfo
def initinfo(self) -> Tuple[Union[float, int, bool], bool]: """The actual initial value of the given parameter. Some |Parameter| subclasses define another value for class attribute `INIT` than |None| to provide a default value. Let's define a parameter test class and prepare a function...
python
def initinfo(self) -> Tuple[Union[float, int, bool], bool]: """The actual initial value of the given parameter. Some |Parameter| subclasses define another value for class attribute `INIT` than |None| to provide a default value. Let's define a parameter test class and prepare a function...
[ "def", "initinfo", "(", "self", ")", "->", "Tuple", "[", "Union", "[", "float", ",", "int", ",", "bool", "]", ",", "bool", "]", ":", "init", "=", "self", ".", "INIT", "if", "(", "init", "is", "not", "None", ")", "and", "hydpy", ".", "pub", ".",...
The actual initial value of the given parameter. Some |Parameter| subclasses define another value for class attribute `INIT` than |None| to provide a default value. Let's define a parameter test class and prepare a function for initialising it and connecting the resulting instance to a...
[ "The", "actual", "initial", "value", "of", "the", "given", "parameter", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L971-L1034
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameter.get_timefactor
def get_timefactor(cls) -> float: """Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and ...
python
def get_timefactor(cls) -> float: """Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and ...
[ "def", "get_timefactor", "(", "cls", ")", "->", "float", ":", "try", ":", "parfactor", "=", "hydpy", ".", "pub", ".", "timegrids", ".", "parfactor", "except", "RuntimeError", ":", "if", "not", "(", "cls", ".", "parameterstep", "and", "cls", ".", "simulat...
Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and the current parameter step size. ...
[ "Factor", "to", "adjust", "a", "new", "value", "of", "a", "time", "-", "dependent", "parameter", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1037-L1093
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameter.apply_timefactor
def apply_timefactor(cls, values): """Change and return the given value(s) in accordance with |Parameter.get_timefactor| and the type of time-dependence of the actual parameter subclass. .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids For...
python
def apply_timefactor(cls, values): """Change and return the given value(s) in accordance with |Parameter.get_timefactor| and the type of time-dependence of the actual parameter subclass. .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids For...
[ "def", "apply_timefactor", "(", "cls", ",", "values", ")", ":", "if", "cls", ".", "TIME", "is", "True", ":", "return", "values", "*", "cls", ".", "get_timefactor", "(", ")", "if", "cls", ".", "TIME", "is", "False", ":", "return", "values", "/", "cls"...
Change and return the given value(s) in accordance with |Parameter.get_timefactor| and the type of time-dependence of the actual parameter subclass. .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids For the same conversion factor returned by method...
[ "Change", "and", "return", "the", "given", "value", "(", "s", ")", "in", "accordance", "with", "|Parameter", ".", "get_timefactor|", "and", "the", "type", "of", "time", "-", "dependence", "of", "the", "actual", "parameter", "subclass", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1100-L1152
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameter.revert_timefactor
def revert_timefactor(cls, values): """The inverse version of method |Parameter.apply_timefactor|. See the explanations on method Parameter.apply_timefactor| to understand the following examples: .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids ...
python
def revert_timefactor(cls, values): """The inverse version of method |Parameter.apply_timefactor|. See the explanations on method Parameter.apply_timefactor| to understand the following examples: .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids ...
[ "def", "revert_timefactor", "(", "cls", ",", "values", ")", ":", "if", "cls", ".", "TIME", "is", "True", ":", "return", "values", "/", "cls", ".", "get_timefactor", "(", ")", "if", "cls", ".", "TIME", "is", "False", ":", "return", "values", "*", "cls...
The inverse version of method |Parameter.apply_timefactor|. See the explanations on method Parameter.apply_timefactor| to understand the following examples: .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids >>> from hydpy.core.parametertools impor...
[ "The", "inverse", "version", "of", "method", "|Parameter", ".", "apply_timefactor|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1155-L1186
hydpy-dev/hydpy
hydpy/core/parametertools.py
Parameter.compress_repr
def compress_repr(self) -> Optional[str]: """Try to find a compressed parameter value representation and return it. |Parameter.compress_repr| raises a |NotImplementedError| when failing to find a compressed representation. .. testsetup:: >>> from hydpy import pub ...
python
def compress_repr(self) -> Optional[str]: """Try to find a compressed parameter value representation and return it. |Parameter.compress_repr| raises a |NotImplementedError| when failing to find a compressed representation. .. testsetup:: >>> from hydpy import pub ...
[ "def", "compress_repr", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "not", "hasattr", "(", "self", ",", "'value'", ")", ":", "return", "'?'", "if", "not", "self", ":", "return", "f\"{self.NDIM * '['}{self.NDIM * ']'}\"", "unique", "=", ...
Try to find a compressed parameter value representation and return it. |Parameter.compress_repr| raises a |NotImplementedError| when failing to find a compressed representation. .. testsetup:: >>> from hydpy import pub >>> del pub.timegrids For the fol...
[ "Try", "to", "find", "a", "compressed", "parameter", "value", "representation", "and", "return", "it", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1209-L1336
hydpy-dev/hydpy
hydpy/core/parametertools.py
NameParameter.compress_repr
def compress_repr(self) -> str: """Works as |Parameter.compress_repr|, but returns a string with constant names instead of constant values. See the main documentation on class |NameParameter| for further information. """ string = super().compress_repr() if string...
python
def compress_repr(self) -> str: """Works as |Parameter.compress_repr|, but returns a string with constant names instead of constant values. See the main documentation on class |NameParameter| for further information. """ string = super().compress_repr() if string...
[ "def", "compress_repr", "(", "self", ")", "->", "str", ":", "string", "=", "super", "(", ")", ".", "compress_repr", "(", ")", "if", "string", "in", "(", "'?'", ",", "'[]'", ")", ":", "return", "string", "if", "string", "is", "None", ":", "values", ...
Works as |Parameter.compress_repr|, but returns a string with constant names instead of constant values. See the main documentation on class |NameParameter| for further information.
[ "Works", "as", "|Parameter", ".", "compress_repr|", "but", "returns", "a", "string", "with", "constant", "names", "instead", "of", "constant", "values", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1431-L1451
hydpy-dev/hydpy
hydpy/core/parametertools.py
ZipParameter.compress_repr
def compress_repr(self) -> Optional[str]: """Works as |Parameter.compress_repr|, but alternatively tries to compress by following an external classification. See the main documentation on class |ZipParameter| for further information. """ string = super().compress_repr() ...
python
def compress_repr(self) -> Optional[str]: """Works as |Parameter.compress_repr|, but alternatively tries to compress by following an external classification. See the main documentation on class |ZipParameter| for further information. """ string = super().compress_repr() ...
[ "def", "compress_repr", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "string", "=", "super", "(", ")", ".", "compress_repr", "(", ")", "if", "string", "is", "not", "None", ":", "return", "string", "results", "=", "[", "]", "mask", "=", ...
Works as |Parameter.compress_repr|, but alternatively tries to compress by following an external classification. See the main documentation on class |ZipParameter| for further information.
[ "Works", "as", "|Parameter", ".", "compress_repr|", "but", "alternatively", "tries", "to", "compress", "by", "following", "an", "external", "classification", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1647-L1670
hydpy-dev/hydpy
hydpy/core/parametertools.py
SeasonalParameter.refresh
def refresh(self) -> None: """Update the actual simulation values based on the toy-value pairs. Usually, one does not need to call refresh explicitly. The "magic" methods __call__, __setattr__, and __delattr__ invoke it automatically, when required. Instantiate a 1-dimensional...
python
def refresh(self) -> None: """Update the actual simulation values based on the toy-value pairs. Usually, one does not need to call refresh explicitly. The "magic" methods __call__, __setattr__, and __delattr__ invoke it automatically, when required. Instantiate a 1-dimensional...
[ "def", "refresh", "(", "self", ")", "->", "None", ":", "if", "not", "self", ":", "self", ".", "values", "[", ":", "]", "=", "0.", "elif", "len", "(", "self", ")", "==", "1", ":", "values", "=", "list", "(", "self", ".", "_toy2values", ".", "val...
Update the actual simulation values based on the toy-value pairs. Usually, one does not need to call refresh explicitly. The "magic" methods __call__, __setattr__, and __delattr__ invoke it automatically, when required. Instantiate a 1-dimensional |SeasonalParameter| object: ...
[ "Update", "the", "actual", "simulation", "values", "based", "on", "the", "toy", "-", "value", "pairs", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1861-L1935
hydpy-dev/hydpy
hydpy/core/parametertools.py
SeasonalParameter.interp
def interp(self, date: timetools.Date) -> float: """Perform a linear value interpolation for the given `date` and return the result. Instantiate a 1-dimensional |SeasonalParameter| object: >>> from hydpy.core.parametertools import SeasonalParameter >>> class Par(SeasonalParamet...
python
def interp(self, date: timetools.Date) -> float: """Perform a linear value interpolation for the given `date` and return the result. Instantiate a 1-dimensional |SeasonalParameter| object: >>> from hydpy.core.parametertools import SeasonalParameter >>> class Par(SeasonalParamet...
[ "def", "interp", "(", "self", ",", "date", ":", "timetools", ".", "Date", ")", "->", "float", ":", "xnew", "=", "timetools", ".", "TOY", "(", "date", ")", "xys", "=", "list", "(", "self", ")", "for", "idx", ",", "(", "x_1", ",", "y_1", ")", "in...
Perform a linear value interpolation for the given `date` and return the result. Instantiate a 1-dimensional |SeasonalParameter| object: >>> from hydpy.core.parametertools import SeasonalParameter >>> class Par(SeasonalParameter): ... NDIM = 1 ... TYPE = float ...
[ "Perform", "a", "linear", "value", "interpolation", "for", "the", "given", "date", "and", "return", "the", "result", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1937-L2019
hydpy-dev/hydpy
hydpy/core/parametertools.py
RelSubweightsMixin.update
def update(self) -> None: """Update subclass of |RelSubweightsMixin| based on `refweights`.""" mask = self.mask weights = self.refweights[mask] self[~mask] = numpy.nan self[mask] = weights/numpy.sum(weights)
python
def update(self) -> None: """Update subclass of |RelSubweightsMixin| based on `refweights`.""" mask = self.mask weights = self.refweights[mask] self[~mask] = numpy.nan self[mask] = weights/numpy.sum(weights)
[ "def", "update", "(", "self", ")", "->", "None", ":", "mask", "=", "self", ".", "mask", "weights", "=", "self", ".", "refweights", "[", "mask", "]", "self", "[", "~", "mask", "]", "=", "numpy", ".", "nan", "self", "[", "mask", "]", "=", "weights"...
Update subclass of |RelSubweightsMixin| based on `refweights`.
[ "Update", "subclass", "of", "|RelSubweightsMixin|", "based", "on", "refweights", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L2476-L2481
hydpy-dev/hydpy
hydpy/core/parametertools.py
SolverParameter.alternative_initvalue
def alternative_initvalue(self) -> Union[bool, int, float]: """A user-defined value to be used instead of the value of class constant `INIT`. See the main documentation on class |SolverParameter| for more information. """ if self._alternative_initvalue is None: ...
python
def alternative_initvalue(self) -> Union[bool, int, float]: """A user-defined value to be used instead of the value of class constant `INIT`. See the main documentation on class |SolverParameter| for more information. """ if self._alternative_initvalue is None: ...
[ "def", "alternative_initvalue", "(", "self", ")", "->", "Union", "[", "bool", ",", "int", ",", "float", "]", ":", "if", "self", ".", "_alternative_initvalue", "is", "None", ":", "raise", "AttributeError", "(", "f'No alternative initial value for solver parameter '",...
A user-defined value to be used instead of the value of class constant `INIT`. See the main documentation on class |SolverParameter| for more information.
[ "A", "user", "-", "defined", "value", "to", "be", "used", "instead", "of", "the", "value", "of", "class", "constant", "INIT", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L2740-L2752
hydpy-dev/hydpy
hydpy/core/parametertools.py
TOYParameter.update
def update(self) -> None: """Reference the actual |Indexer.timeofyear| array of the |Indexer| object available in module |pub|. >>> from hydpy import pub >>> pub.timegrids = '27.02.2004', '3.03.2004', '1d' >>> from hydpy.core.parametertools import TOYParameter >>> toypar...
python
def update(self) -> None: """Reference the actual |Indexer.timeofyear| array of the |Indexer| object available in module |pub|. >>> from hydpy import pub >>> pub.timegrids = '27.02.2004', '3.03.2004', '1d' >>> from hydpy.core.parametertools import TOYParameter >>> toypar...
[ "def", "update", "(", "self", ")", "->", "None", ":", "indexarray", "=", "hydpy", ".", "pub", ".", "indexer", ".", "timeofyear", "self", ".", "shape", "=", "indexarray", ".", "shape", "self", ".", "values", "=", "indexarray" ]
Reference the actual |Indexer.timeofyear| array of the |Indexer| object available in module |pub|. >>> from hydpy import pub >>> pub.timegrids = '27.02.2004', '3.03.2004', '1d' >>> from hydpy.core.parametertools import TOYParameter >>> toyparameter = TOYParameter(None) >...
[ "Reference", "the", "actual", "|Indexer", ".", "timeofyear|", "array", "of", "the", "|Indexer|", "object", "available", "in", "module", "|pub|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L2792-L2806
arteria/django-openinghours
openinghours/utils.py
get_premises_model
def get_premises_model(): """ Support for custom company premises model with developer friendly validation. """ try: app_label, model_name = PREMISES_MODEL.split('.') except ValueError: raise ImproperlyConfigured("OPENINGHOURS_PREMISES_MODEL must be of the" ...
python
def get_premises_model(): """ Support for custom company premises model with developer friendly validation. """ try: app_label, model_name = PREMISES_MODEL.split('.') except ValueError: raise ImproperlyConfigured("OPENINGHOURS_PREMISES_MODEL must be of the" ...
[ "def", "get_premises_model", "(", ")", ":", "try", ":", "app_label", ",", "model_name", "=", "PREMISES_MODEL", ".", "split", "(", "'.'", ")", "except", "ValueError", ":", "raise", "ImproperlyConfigured", "(", "\"OPENINGHOURS_PREMISES_MODEL must be of the\"", "\" form ...
Support for custom company premises model with developer friendly validation.
[ "Support", "for", "custom", "company", "premises", "model", "with", "developer", "friendly", "validation", "." ]
train
https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/utils.py#L13-L28
arteria/django-openinghours
openinghours/utils.py
get_now
def get_now(): """ Allows to access global request and read a timestamp from query. """ if not get_current_request: return datetime.datetime.now() request = get_current_request() if request: openinghours_now = request.GET.get('openinghours-now') if openinghours_now: ...
python
def get_now(): """ Allows to access global request and read a timestamp from query. """ if not get_current_request: return datetime.datetime.now() request = get_current_request() if request: openinghours_now = request.GET.get('openinghours-now') if openinghours_now: ...
[ "def", "get_now", "(", ")", ":", "if", "not", "get_current_request", ":", "return", "datetime", ".", "datetime", ".", "now", "(", ")", "request", "=", "get_current_request", "(", ")", "if", "request", ":", "openinghours_now", "=", "request", ".", "GET", "....
Allows to access global request and read a timestamp from query.
[ "Allows", "to", "access", "global", "request", "and", "read", "a", "timestamp", "from", "query", "." ]
train
https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/utils.py#L33-L44
arteria/django-openinghours
openinghours/utils.py
get_closing_rule_for_now
def get_closing_rule_for_now(location): """ Returns QuerySet of ClosingRules that are currently valid """ now = get_now() if location: return ClosingRules.objects.filter(company=location, start__lte=now, end__gte=now) return Company.objects.fi...
python
def get_closing_rule_for_now(location): """ Returns QuerySet of ClosingRules that are currently valid """ now = get_now() if location: return ClosingRules.objects.filter(company=location, start__lte=now, end__gte=now) return Company.objects.fi...
[ "def", "get_closing_rule_for_now", "(", "location", ")", ":", "now", "=", "get_now", "(", ")", "if", "location", ":", "return", "ClosingRules", ".", "objects", ".", "filter", "(", "company", "=", "location", ",", "start__lte", "=", "now", ",", "end__gte", ...
Returns QuerySet of ClosingRules that are currently valid
[ "Returns", "QuerySet", "of", "ClosingRules", "that", "are", "currently", "valid" ]
train
https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/utils.py#L47-L58
arteria/django-openinghours
openinghours/utils.py
is_open
def is_open(location, now=None): """ Is the company currently open? Pass "now" to test with a specific timestamp. Can be used stand-alone or as a helper. """ if now is None: now = get_now() if has_closing_rule_for_now(location): return False now_time = datetime.time(now.hou...
python
def is_open(location, now=None): """ Is the company currently open? Pass "now" to test with a specific timestamp. Can be used stand-alone or as a helper. """ if now is None: now = get_now() if has_closing_rule_for_now(location): return False now_time = datetime.time(now.hou...
[ "def", "is_open", "(", "location", ",", "now", "=", "None", ")", ":", "if", "now", "is", "None", ":", "now", "=", "get_now", "(", ")", "if", "has_closing_rule_for_now", "(", "location", ")", ":", "return", "False", "now_time", "=", "datetime", ".", "ti...
Is the company currently open? Pass "now" to test with a specific timestamp. Can be used stand-alone or as a helper.
[ "Is", "the", "company", "currently", "open?", "Pass", "now", "to", "test", "with", "a", "specific", "timestamp", ".", "Can", "be", "used", "stand", "-", "alone", "or", "as", "a", "helper", "." ]
train
https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/utils.py#L69-L111
arteria/django-openinghours
openinghours/utils.py
next_time_open
def next_time_open(location): """ Returns the next possible opening hours object, or (False, None) if location is currently open or there is no such object I.e. when is the company open for the next time? """ if not is_open(location): now = get_now() now_time = datetime.time(now....
python
def next_time_open(location): """ Returns the next possible opening hours object, or (False, None) if location is currently open or there is no such object I.e. when is the company open for the next time? """ if not is_open(location): now = get_now() now_time = datetime.time(now....
[ "def", "next_time_open", "(", "location", ")", ":", "if", "not", "is_open", "(", "location", ")", ":", "now", "=", "get_now", "(", ")", "now_time", "=", "datetime", ".", "time", "(", "now", ".", "hour", ",", "now", ".", "minute", ",", "now", ".", "...
Returns the next possible opening hours object, or (False, None) if location is currently open or there is no such object I.e. when is the company open for the next time?
[ "Returns", "the", "next", "possible", "opening", "hours", "object", "or", "(", "False", "None", ")", "if", "location", "is", "currently", "open", "or", "there", "is", "no", "such", "object", "I", ".", "e", ".", "when", "is", "the", "company", "open", "...
train
https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/utils.py#L114-L148
hydpy-dev/hydpy
hydpy/models/hstream/hstream_states.py
QJoints.refweights
def refweights(self): """A |numpy| |numpy.ndarray| with equal weights for all segment junctions.. >>> from hydpy.models.hstream import * >>> parameterstep('1d') >>> states.qjoints.shape = 5 >>> states.qjoints.refweights array([ 0.2, 0.2, 0.2, 0.2, 0.2]) ...
python
def refweights(self): """A |numpy| |numpy.ndarray| with equal weights for all segment junctions.. >>> from hydpy.models.hstream import * >>> parameterstep('1d') >>> states.qjoints.shape = 5 >>> states.qjoints.refweights array([ 0.2, 0.2, 0.2, 0.2, 0.2]) ...
[ "def", "refweights", "(", "self", ")", ":", "# pylint: disable=unsubscriptable-object", "# due to a pylint bug (see https://github.com/PyCQA/pylint/issues/870)", "return", "numpy", ".", "full", "(", "self", ".", "shape", ",", "1.", "/", "self", ".", "shape", "[", "0", ...
A |numpy| |numpy.ndarray| with equal weights for all segment junctions.. >>> from hydpy.models.hstream import * >>> parameterstep('1d') >>> states.qjoints.shape = 5 >>> states.qjoints.refweights array([ 0.2, 0.2, 0.2, 0.2, 0.2])
[ "A", "|numpy|", "|numpy", ".", "ndarray|", "with", "equal", "weights", "for", "all", "segment", "junctions", ".." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/hstream/hstream_states.py#L57-L69
hydpy-dev/hydpy
hydpy/core/filetools.py
Folder2Path.add
def add(self, directory, path=None) -> None: """Add a directory and optionally its path.""" objecttools.valid_variable_identifier(directory) if path is None: path = directory setattr(self, directory, path)
python
def add(self, directory, path=None) -> None: """Add a directory and optionally its path.""" objecttools.valid_variable_identifier(directory) if path is None: path = directory setattr(self, directory, path)
[ "def", "add", "(", "self", ",", "directory", ",", "path", "=", "None", ")", "->", "None", ":", "objecttools", ".", "valid_variable_identifier", "(", "directory", ")", "if", "path", "is", "None", ":", "path", "=", "directory", "setattr", "(", "self", ",",...
Add a directory and optionally its path.
[ "Add", "a", "directory", "and", "optionally", "its", "path", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L108-L113
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.basepath
def basepath(self) -> str: """Absolute path pointing to the available working directories. >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname' >>> from hydpy impo...
python
def basepath(self) -> str: """Absolute path pointing to the available working directories. >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname' >>> from hydpy impo...
[ "def", "basepath", "(", "self", ")", "->", "str", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "self", ".", "projectdir", ",", "self", ".", "BASEDIR", ")", ")" ]
Absolute path pointing to the available working directories. >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname' >>> from hydpy import repr_, TestIO >>> with Test...
[ "Absolute", "path", "pointing", "to", "the", "available", "working", "directories", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L218-L231
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.availabledirs
def availabledirs(self) -> Folder2Path: """Names and paths of the available working directories. Available working directories are those beeing stored in the base directory of the respective |FileManager| subclass. Folders with names starting with an underscore are ignored (use ...
python
def availabledirs(self) -> Folder2Path: """Names and paths of the available working directories. Available working directories are those beeing stored in the base directory of the respective |FileManager| subclass. Folders with names starting with an underscore are ignored (use ...
[ "def", "availabledirs", "(", "self", ")", "->", "Folder2Path", ":", "directories", "=", "Folder2Path", "(", ")", "for", "directory", "in", "os", ".", "listdir", "(", "self", ".", "basepath", ")", ":", "if", "not", "directory", ".", "startswith", "(", "'_...
Names and paths of the available working directories. Available working directories are those beeing stored in the base directory of the respective |FileManager| subclass. Folders with names starting with an underscore are ignored (use this for directories handling additional data files...
[ "Names", "and", "paths", "of", "the", "available", "working", "directories", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L234-L270
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.currentdir
def currentdir(self) -> str: """Name of the current working directory containing the relevant files. To show most of the functionality of |property| |FileManager.currentdir| (unpacking zip files on the fly is explained in the documentation on function (|FileManager.zip_currentdi...
python
def currentdir(self) -> str: """Name of the current working directory containing the relevant files. To show most of the functionality of |property| |FileManager.currentdir| (unpacking zip files on the fly is explained in the documentation on function (|FileManager.zip_currentdi...
[ "def", "currentdir", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_currentdir", "is", "None", ":", "directories", "=", "self", ".", "availabledirs", ".", "folders", "if", "len", "(", "directories", ")", "==", "1", ":", "self", ".", "currentd...
Name of the current working directory containing the relevant files. To show most of the functionality of |property| |FileManager.currentdir| (unpacking zip files on the fly is explained in the documentation on function (|FileManager.zip_currentdir|), we first prepare a |FileManager| ...
[ "Name", "of", "the", "current", "working", "directory", "containing", "the", "relevant", "files", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L273-L435
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.currentpath
def currentpath(self) -> str: """Absolute path of the current working directory. >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname' >>> from hydpy import repr_, ...
python
def currentpath(self) -> str: """Absolute path of the current working directory. >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname' >>> from hydpy import repr_, ...
[ "def", "currentpath", "(", "self", ")", "->", "str", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "basepath", ",", "self", ".", "currentdir", ")" ]
Absolute path of the current working directory. >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname' >>> from hydpy import repr_, TestIO >>> with TestIO(): ...
[ "Absolute", "path", "of", "the", "current", "working", "directory", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L469-L482
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.filenames
def filenames(self) -> List[str]: """Names of the files contained in the the current working directory. Files names starting with underscores are ignored: >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' ...
python
def filenames(self) -> List[str]: """Names of the files contained in the the current working directory. Files names starting with underscores are ignored: >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' ...
[ "def", "filenames", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "sorted", "(", "fn", "for", "fn", "in", "os", ".", "listdir", "(", "self", ".", "currentpath", ")", "if", "not", "fn", ".", "startswith", "(", "'_'", ")", ")" ]
Names of the files contained in the the current working directory. Files names starting with underscores are ignored: >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectdir = 'projectname'...
[ "Names", "of", "the", "files", "contained", "in", "the", "the", "current", "working", "directory", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L485-L505
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.filepaths
def filepaths(self) -> List[str]: """Absolute path names of the files contained in the current working directory. Files names starting with underscores are ignored: >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR ...
python
def filepaths(self) -> List[str]: """Absolute path names of the files contained in the current working directory. Files names starting with underscores are ignored: >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR ...
[ "def", "filepaths", "(", "self", ")", "->", "List", "[", "str", "]", ":", "path", "=", "self", ".", "currentpath", "return", "[", "os", ".", "path", ".", "join", "(", "path", ",", "name", ")", "for", "name", "in", "self", ".", "filenames", "]" ]
Absolute path names of the files contained in the current working directory. Files names starting with underscores are ignored: >>> from hydpy.core.filetools import FileManager >>> filemanager = FileManager() >>> filemanager.BASEDIR = 'basename' >>> filemanager.projectd...
[ "Absolute", "path", "names", "of", "the", "files", "contained", "in", "the", "current", "working", "directory", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L508-L530
hydpy-dev/hydpy
hydpy/core/filetools.py
FileManager.zip_currentdir
def zip_currentdir(self) -> None: """Pack the current working directory in a `zip` file. |FileManager| subclasses allow for manual packing and automatic unpacking of working directories. The only supported format is `zip`. To avoid possible inconsistencies, origin directories and zip ...
python
def zip_currentdir(self) -> None: """Pack the current working directory in a `zip` file. |FileManager| subclasses allow for manual packing and automatic unpacking of working directories. The only supported format is `zip`. To avoid possible inconsistencies, origin directories and zip ...
[ "def", "zip_currentdir", "(", "self", ")", "->", "None", ":", "with", "zipfile", ".", "ZipFile", "(", "f'{self.currentpath}.zip'", ",", "'w'", ")", "as", "zipfile_", ":", "for", "filepath", ",", "filename", "in", "zip", "(", "self", ".", "filepaths", ",", ...
Pack the current working directory in a `zip` file. |FileManager| subclasses allow for manual packing and automatic unpacking of working directories. The only supported format is `zip`. To avoid possible inconsistencies, origin directories and zip files are removed after packing or unp...
[ "Pack", "the", "current", "working", "directory", "in", "a", "zip", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L532-L603
hydpy-dev/hydpy
hydpy/core/filetools.py
NetworkManager.load_files
def load_files(self) -> selectiontools.Selections: """Read all network files of the current working directory, structure their contents in a |selectiontools.Selections| object, and return it. """ devicetools.Node.clear_all() devicetools.Element.clear_all() selections = se...
python
def load_files(self) -> selectiontools.Selections: """Read all network files of the current working directory, structure their contents in a |selectiontools.Selections| object, and return it. """ devicetools.Node.clear_all() devicetools.Element.clear_all() selections = se...
[ "def", "load_files", "(", "self", ")", "->", "selectiontools", ".", "Selections", ":", "devicetools", ".", "Node", ".", "clear_all", "(", ")", "devicetools", ".", "Element", ".", "clear_all", "(", ")", "selections", "=", "selectiontools", ".", "Selections", ...
Read all network files of the current working directory, structure their contents in a |selectiontools.Selections| object, and return it.
[ "Read", "all", "network", "files", "of", "the", "current", "working", "directory", "structure", "their", "contents", "in", "a", "|selectiontools", ".", "Selections|", "object", "and", "return", "it", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L731-L763
hydpy-dev/hydpy
hydpy/core/filetools.py
NetworkManager.save_files
def save_files(self, selections) -> None: """Save the |Selection| objects contained in the given |Selections| instance to separate network files.""" try: currentpath = self.currentpath selections = selectiontools.Selections(selections) for selection in selecti...
python
def save_files(self, selections) -> None: """Save the |Selection| objects contained in the given |Selections| instance to separate network files.""" try: currentpath = self.currentpath selections = selectiontools.Selections(selections) for selection in selecti...
[ "def", "save_files", "(", "self", ",", "selections", ")", "->", "None", ":", "try", ":", "currentpath", "=", "self", ".", "currentpath", "selections", "=", "selectiontools", ".", "Selections", "(", "selections", ")", "for", "selection", "in", "selections", "...
Save the |Selection| objects contained in the given |Selections| instance to separate network files.
[ "Save", "the", "|Selection|", "objects", "contained", "in", "the", "given", "|Selections|", "instance", "to", "separate", "network", "files", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L765-L779
hydpy-dev/hydpy
hydpy/core/filetools.py
NetworkManager.delete_files
def delete_files(self, selections) -> None: """Delete the network files corresponding to the given selections (e.g. a |list| of |str| objects or a |Selections| object).""" try: currentpath = self.currentpath for selection in selections: name = str(selectio...
python
def delete_files(self, selections) -> None: """Delete the network files corresponding to the given selections (e.g. a |list| of |str| objects or a |Selections| object).""" try: currentpath = self.currentpath for selection in selections: name = str(selectio...
[ "def", "delete_files", "(", "self", ",", "selections", ")", "->", "None", ":", "try", ":", "currentpath", "=", "self", ".", "currentpath", "for", "selection", "in", "selections", ":", "name", "=", "str", "(", "selection", ")", "if", "name", "==", "'compl...
Delete the network files corresponding to the given selections (e.g. a |list| of |str| objects or a |Selections| object).
[ "Delete", "the", "network", "files", "corresponding", "to", "the", "given", "selections", "(", "e", ".", "g", ".", "a", "|list|", "of", "|str|", "objects", "or", "a", "|Selections|", "object", ")", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L781-L797
hydpy-dev/hydpy
hydpy/core/filetools.py
ControlManager.load_file
def load_file(self, element=None, filename=None, clear_registry=True): """Return the namespace of the given file (and eventually of its corresponding auxiliary subfiles) as a |dict|. By default, the internal registry is cleared when a control file and all its corresponding auxiliary fil...
python
def load_file(self, element=None, filename=None, clear_registry=True): """Return the namespace of the given file (and eventually of its corresponding auxiliary subfiles) as a |dict|. By default, the internal registry is cleared when a control file and all its corresponding auxiliary fil...
[ "def", "load_file", "(", "self", ",", "element", "=", "None", ",", "filename", "=", "None", ",", "clear_registry", "=", "True", ")", ":", "if", "not", "filename", ":", "filename", "=", "element", ".", "name", "type", "(", "self", ")", ".", "_workingpat...
Return the namespace of the given file (and eventually of its corresponding auxiliary subfiles) as a |dict|. By default, the internal registry is cleared when a control file and all its corresponding auxiliary files have been loaded. You can change this behaviour by passing `False` for...
[ "Return", "the", "namespace", "of", "the", "given", "file", "(", "and", "eventually", "of", "its", "corresponding", "auxiliary", "subfiles", ")", "as", "a", "|dict|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L810-L834
hydpy-dev/hydpy
hydpy/core/filetools.py
ControlManager.read2dict
def read2dict(cls, filename, info): """Read the control parameters from the given path (and its auxiliary paths, where appropriate) and store them in the given |dict| object `info`. Note that the |dict| `info` can be used to feed information into the execution of control files. ...
python
def read2dict(cls, filename, info): """Read the control parameters from the given path (and its auxiliary paths, where appropriate) and store them in the given |dict| object `info`. Note that the |dict| `info` can be used to feed information into the execution of control files. ...
[ "def", "read2dict", "(", "cls", ",", "filename", ",", "info", ")", ":", "if", "not", "filename", ".", "endswith", "(", "'.py'", ")", ":", "filename", "+=", "'.py'", "path", "=", "os", ".", "path", ".", "join", "(", "cls", ".", "_workingpath", ",", ...
Read the control parameters from the given path (and its auxiliary paths, where appropriate) and store them in the given |dict| object `info`. Note that the |dict| `info` can be used to feed information into the execution of control files. Use this method only if you are comple...
[ "Read", "the", "control", "parameters", "from", "the", "given", "path", "(", "and", "its", "auxiliary", "paths", "where", "appropriate", ")", "and", "store", "them", "in", "the", "given", "|dict|", "object", "info", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L837-L865
hydpy-dev/hydpy
hydpy/core/filetools.py
ControlManager.save_file
def save_file(self, filename, text): """Save the given text under the given control filename and the current path.""" if not filename.endswith('.py'): filename += '.py' path = os.path.join(self.currentpath, filename) with open(path, 'w', encoding="utf-8") as file_: ...
python
def save_file(self, filename, text): """Save the given text under the given control filename and the current path.""" if not filename.endswith('.py'): filename += '.py' path = os.path.join(self.currentpath, filename) with open(path, 'w', encoding="utf-8") as file_: ...
[ "def", "save_file", "(", "self", ",", "filename", ",", "text", ")", ":", "if", "not", "filename", ".", "endswith", "(", "'.py'", ")", ":", "filename", "+=", "'.py'", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "currentpath", ",", ...
Save the given text under the given control filename and the current path.
[ "Save", "the", "given", "text", "under", "the", "given", "control", "filename", "and", "the", "current", "path", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L873-L880
hydpy-dev/hydpy
hydpy/core/filetools.py
ConditionManager.load_file
def load_file(self, filename): """Read and return the content of the given file. If the current directory is not defined explicitly, the directory name is constructed with the actual simulation start date. If such an directory does not exist, it is created immediately. """ ...
python
def load_file(self, filename): """Read and return the content of the given file. If the current directory is not defined explicitly, the directory name is constructed with the actual simulation start date. If such an directory does not exist, it is created immediately. """ ...
[ "def", "load_file", "(", "self", ",", "filename", ")", ":", "_defaultdir", "=", "self", ".", "DEFAULTDIR", "try", ":", "if", "not", "filename", ".", "endswith", "(", "'.py'", ")", ":", "filename", "+=", "'.py'", "try", ":", "self", ".", "DEFAULTDIR", "...
Read and return the content of the given file. If the current directory is not defined explicitly, the directory name is constructed with the actual simulation start date. If such an directory does not exist, it is created immediately.
[ "Read", "and", "return", "the", "content", "of", "the", "given", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L889-L913
hydpy-dev/hydpy
hydpy/core/filetools.py
ConditionManager.save_file
def save_file(self, filename, text): """Save the given text under the given condition filename and the current path. If the current directory is not defined explicitly, the directory name is constructed with the actual simulation end date. If such an directory does not exist, i...
python
def save_file(self, filename, text): """Save the given text under the given condition filename and the current path. If the current directory is not defined explicitly, the directory name is constructed with the actual simulation end date. If such an directory does not exist, i...
[ "def", "save_file", "(", "self", ",", "filename", ",", "text", ")", ":", "_defaultdir", "=", "self", ".", "DEFAULTDIR", "try", ":", "if", "not", "filename", ".", "endswith", "(", "'.py'", ")", ":", "filename", "+=", "'.py'", "try", ":", "self", ".", ...
Save the given text under the given condition filename and the current path. If the current directory is not defined explicitly, the directory name is constructed with the actual simulation end date. If such an directory does not exist, it is created immediately.
[ "Save", "the", "given", "text", "under", "the", "given", "condition", "filename", "and", "the", "current", "path", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L915-L940
hydpy-dev/hydpy
hydpy/core/filetools.py
SequenceManager.load_file
def load_file(self, sequence): """Load data from an "external" data file an pass it to the given |IOSequence|.""" try: if sequence.filetype_ext == 'npy': sequence.series = sequence.adjust_series( *self._load_npy(sequence)) elif sequence...
python
def load_file(self, sequence): """Load data from an "external" data file an pass it to the given |IOSequence|.""" try: if sequence.filetype_ext == 'npy': sequence.series = sequence.adjust_series( *self._load_npy(sequence)) elif sequence...
[ "def", "load_file", "(", "self", ",", "sequence", ")", ":", "try", ":", "if", "sequence", ".", "filetype_ext", "==", "'npy'", ":", "sequence", ".", "series", "=", "sequence", ".", "adjust_series", "(", "*", "self", ".", "_load_npy", "(", "sequence", ")",...
Load data from an "external" data file an pass it to the given |IOSequence|.
[ "Load", "data", "from", "an", "external", "data", "file", "an", "pass", "it", "to", "the", "given", "|IOSequence|", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L1415-L1430
hydpy-dev/hydpy
hydpy/core/filetools.py
SequenceManager.save_file
def save_file(self, sequence, array=None): """Write the date stored in |IOSequence.series| of the given |IOSequence| into an "external" data file. """ if array is None: array = sequence.aggregate_series() try: if sequence.filetype_ext == 'nc': self...
python
def save_file(self, sequence, array=None): """Write the date stored in |IOSequence.series| of the given |IOSequence| into an "external" data file. """ if array is None: array = sequence.aggregate_series() try: if sequence.filetype_ext == 'nc': self...
[ "def", "save_file", "(", "self", ",", "sequence", ",", "array", "=", "None", ")", ":", "if", "array", "is", "None", ":", "array", "=", "sequence", ".", "aggregate_series", "(", ")", "try", ":", "if", "sequence", ".", "filetype_ext", "==", "'nc'", ":", ...
Write the date stored in |IOSequence.series| of the given |IOSequence| into an "external" data file.
[ "Write", "the", "date", "stored", "in", "|IOSequence", ".", "series|", "of", "the", "given", "|IOSequence|", "into", "an", "external", "data", "file", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L1450-L1476
hydpy-dev/hydpy
hydpy/core/filetools.py
SequenceManager.open_netcdf_reader
def open_netcdf_reader(self, flatten=False, isolate=False, timeaxis=1): """Prepare a new |NetCDFInterface| object for reading data.""" self._netcdf_reader = netcdftools.NetCDFInterface( flatten=bool(flatten), isolate=bool(isolate), timeaxis=int(timeaxis))
python
def open_netcdf_reader(self, flatten=False, isolate=False, timeaxis=1): """Prepare a new |NetCDFInterface| object for reading data.""" self._netcdf_reader = netcdftools.NetCDFInterface( flatten=bool(flatten), isolate=bool(isolate), timeaxis=int(timeaxis))
[ "def", "open_netcdf_reader", "(", "self", ",", "flatten", "=", "False", ",", "isolate", "=", "False", ",", "timeaxis", "=", "1", ")", ":", "self", ".", "_netcdf_reader", "=", "netcdftools", ".", "NetCDFInterface", "(", "flatten", "=", "bool", "(", "flatten...
Prepare a new |NetCDFInterface| object for reading data.
[ "Prepare", "a", "new", "|NetCDFInterface|", "object", "for", "reading", "data", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L1528-L1533
hydpy-dev/hydpy
hydpy/core/filetools.py
SequenceManager.open_netcdf_writer
def open_netcdf_writer(self, flatten=False, isolate=False, timeaxis=1): """Prepare a new |NetCDFInterface| object for writing data.""" self._netcdf_writer = netcdftools.NetCDFInterface( flatten=bool(flatten), isolate=bool(isolate), timeaxis=int(timeaxis))
python
def open_netcdf_writer(self, flatten=False, isolate=False, timeaxis=1): """Prepare a new |NetCDFInterface| object for writing data.""" self._netcdf_writer = netcdftools.NetCDFInterface( flatten=bool(flatten), isolate=bool(isolate), timeaxis=int(timeaxis))
[ "def", "open_netcdf_writer", "(", "self", ",", "flatten", "=", "False", ",", "isolate", "=", "False", ",", "timeaxis", "=", "1", ")", ":", "self", ".", "_netcdf_writer", "=", "netcdftools", ".", "NetCDFInterface", "(", "flatten", "=", "bool", "(", "flatten...
Prepare a new |NetCDFInterface| object for writing data.
[ "Prepare", "a", "new", "|NetCDFInterface|", "object", "for", "writing", "data", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L1572-L1577
hydpy-dev/hydpy
hydpy/models/lland/lland_model.py
calc_nkor_v1
def calc_nkor_v1(self): """Adjust the given precipitation values. Required control parameters: |NHRU| |KG| Required input sequence: |Nied| Calculated flux sequence: |NKor| Basic equation: :math:`NKor = KG \\cdot Nied` Example: >>> from hydpy.models.lla...
python
def calc_nkor_v1(self): """Adjust the given precipitation values. Required control parameters: |NHRU| |KG| Required input sequence: |Nied| Calculated flux sequence: |NKor| Basic equation: :math:`NKor = KG \\cdot Nied` Example: >>> from hydpy.models.lla...
[ "def", "calc_nkor_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "inp", "=", "self", ".", "sequences", ".", "inputs", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "f...
Adjust the given precipitation values. Required control parameters: |NHRU| |KG| Required input sequence: |Nied| Calculated flux sequence: |NKor| Basic equation: :math:`NKor = KG \\cdot Nied` Example: >>> from hydpy.models.lland import * >>> paramet...
[ "Adjust", "the", "given", "precipitation", "values", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_model.py#L13-L44
hydpy-dev/hydpy
hydpy/models/lland/lland_model.py
calc_tkor_v1
def calc_tkor_v1(self): """Adjust the given air temperature values. Required control parameters: |NHRU| |KT| Required input sequence: |TemL| Calculated flux sequence: |TKor| Basic equation: :math:`TKor = KT + TemL` Example: >>> from hydpy.models.lland ...
python
def calc_tkor_v1(self): """Adjust the given air temperature values. Required control parameters: |NHRU| |KT| Required input sequence: |TemL| Calculated flux sequence: |TKor| Basic equation: :math:`TKor = KT + TemL` Example: >>> from hydpy.models.lland ...
[ "def", "calc_tkor_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "inp", "=", "self", ".", "sequences", ".", "inputs", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "f...
Adjust the given air temperature values. Required control parameters: |NHRU| |KT| Required input sequence: |TemL| Calculated flux sequence: |TKor| Basic equation: :math:`TKor = KT + TemL` Example: >>> from hydpy.models.lland import * >>> parameters...
[ "Adjust", "the", "given", "air", "temperature", "values", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_model.py#L47-L78
hydpy-dev/hydpy
hydpy/models/lland/lland_model.py
calc_et0_v1
def calc_et0_v1(self): """Calculate reference evapotranspiration after Turc-Wendling. Required control parameters: |NHRU| |KE| |KF| |HNN| Required input sequence: |Glob| Required flux sequence: |TKor| Calculated flux sequence: |ET0| Basic equation: ...
python
def calc_et0_v1(self): """Calculate reference evapotranspiration after Turc-Wendling. Required control parameters: |NHRU| |KE| |KF| |HNN| Required input sequence: |Glob| Required flux sequence: |TKor| Calculated flux sequence: |ET0| Basic equation: ...
[ "def", "calc_et0_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "inp", "=", "self", ".", "sequences", ".", "inputs", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "fa...
Calculate reference evapotranspiration after Turc-Wendling. Required control parameters: |NHRU| |KE| |KF| |HNN| Required input sequence: |Glob| Required flux sequence: |TKor| Calculated flux sequence: |ET0| Basic equation: :math:`ET0 = KE \\cdot ...
[ "Calculate", "reference", "evapotranspiration", "after", "Turc", "-", "Wendling", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_model.py#L81-L126
hydpy-dev/hydpy
hydpy/models/lland/lland_model.py
calc_et0_wet0_v1
def calc_et0_wet0_v1(self): """Correct the given reference evapotranspiration and update the corresponding log sequence. Required control parameters: |NHRU| |KE| |WfET0| Required input sequence: |PET| Calculated flux sequence: |ET0| Updated log sequence: |...
python
def calc_et0_wet0_v1(self): """Correct the given reference evapotranspiration and update the corresponding log sequence. Required control parameters: |NHRU| |KE| |WfET0| Required input sequence: |PET| Calculated flux sequence: |ET0| Updated log sequence: |...
[ "def", "calc_et0_wet0_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "inp", "=", "self", ".", "sequences", ".", "inputs", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", ...
Correct the given reference evapotranspiration and update the corresponding log sequence. Required control parameters: |NHRU| |KE| |WfET0| Required input sequence: |PET| Calculated flux sequence: |ET0| Updated log sequence: |WET0| Basic equations: :...
[ "Correct", "the", "given", "reference", "evapotranspiration", "and", "update", "the", "corresponding", "log", "sequence", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_model.py#L129-L192
hydpy-dev/hydpy
hydpy/models/lland/lland_model.py
calc_evpo_v1
def calc_evpo_v1(self): """Calculate land use and month specific values of potential evapotranspiration. Required control parameters: |NHRU| |Lnk| |FLn| Required derived parameter: |MOY| Required flux sequence: |ET0| Calculated flux sequence: |EvPo| A...
python
def calc_evpo_v1(self): """Calculate land use and month specific values of potential evapotranspiration. Required control parameters: |NHRU| |Lnk| |FLn| Required derived parameter: |MOY| Required flux sequence: |ET0| Calculated flux sequence: |EvPo| A...
[ "def", "calc_evpo_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "der", "=", "self", ".", "parameters", ".", "derived", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", ...
Calculate land use and month specific values of potential evapotranspiration. Required control parameters: |NHRU| |Lnk| |FLn| Required derived parameter: |MOY| Required flux sequence: |ET0| Calculated flux sequence: |EvPo| Additional requirements: |...
[ "Calculate", "land", "use", "and", "month", "specific", "values", "of", "potential", "evapotranspiration", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_model.py#L195-L276
hydpy-dev/hydpy
hydpy/models/lland/lland_model.py
calc_nbes_inzp_v1
def calc_nbes_inzp_v1(self): """Calculate stand precipitation and update the interception storage accordingly. Required control parameters: |NHRU| |Lnk| Required derived parameter: |KInz| Required flux sequence: |NKor| Calculated flux sequence: |NBes| Updat...
python
def calc_nbes_inzp_v1(self): """Calculate stand precipitation and update the interception storage accordingly. Required control parameters: |NHRU| |Lnk| Required derived parameter: |KInz| Required flux sequence: |NKor| Calculated flux sequence: |NBes| Updat...
[ "def", "calc_nbes_inzp_v1", "(", "self", ")", ":", "con", "=", "self", ".", "parameters", ".", "control", ".", "fastaccess", "der", "=", "self", ".", "parameters", ".", "derived", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", "....
Calculate stand precipitation and update the interception storage accordingly. Required control parameters: |NHRU| |Lnk| Required derived parameter: |KInz| Required flux sequence: |NKor| Calculated flux sequence: |NBes| Updated state sequence: |Inzp| ...
[ "Calculate", "stand", "precipitation", "and", "update", "the", "interception", "storage", "accordingly", "." ]
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_model.py#L279-L394