@@ -233,7 +233,7 @@ class CheckedSession(Session, AbstractCheckedSession, metaclass=ModelMetaclass):
233
233
234
234
See Also
235
235
--------
236
- Session, Parameters
236
+ Session, CheckedParameters
237
237
238
238
Examples
239
239
--------
@@ -467,7 +467,7 @@ def dict(self, exclude: Set[str] = None):
467
467
del d [name ]
468
468
return d
469
469
470
- class Parameters (CheckedSession ):
470
+ class CheckedParameters (CheckedSession ):
471
471
"""
472
472
Same as py:class:`CheckedSession` but declared variables cannot be modified after initialization.
473
473
@@ -493,7 +493,7 @@ class Parameters(CheckedSession):
493
493
Content of file 'parameters.py'
494
494
495
495
>>> from larray import *
496
- >>> class ModelParameters( Parameters):
496
+ >>> class Parameters(CheckedParameters ):
497
497
... # --- declare variables with fixed values ---
498
498
... # The given values can never be changed
499
499
... FIRST_YEAR = 2020
@@ -509,14 +509,14 @@ class Parameters(CheckedSession):
509
509
510
510
>>> # instantiation --> create an instance of the ModelVariables class
511
511
>>> # all variables declared without value must be set
512
- >>> P = ModelParameters (variant_name='variant_1')
512
+ >>> P = Parameters (variant_name='variant_1')
513
513
>>> # once an instance is create, its variables can be accessed but not modified
514
514
>>> P.variant_name
515
515
'variant_1'
516
516
>>> P.variant_name = 'new_variant' # doctest: +NORMALIZE_WHITESPACE
517
517
Traceback (most recent call last):
518
518
...
519
- TypeError: Cannot change the value of the variable 'variant_name' since 'ModelParameters '
519
+ TypeError: Cannot change the value of the variable 'variant_name' since 'Parameters '
520
520
is immutable and does not support item assignment
521
521
"""
522
522
class Config :
@@ -533,7 +533,7 @@ def __init__(self, *args, **kwargs):
533
533
raise NotImplementedError ("CheckedSession class cannot be instantiated "
534
534
"because pydantic is not installed" )
535
535
536
- class Parameters (object ):
536
+ class CheckedParameters (object ):
537
537
def __init__ (self , * args , ** kwargs ):
538
- raise NotImplementedError ("Parameters class cannot be instantiated "
538
+ raise NotImplementedError ("CheckedParameters class cannot be instantiated "
539
539
"because pydantic is not installed" )
0 commit comments