@@ -37,13 +37,10 @@ class Meta(dict):
3737 """Container class that could contain any arbitrary data to be passed into
3838 a Page Object.
3939
40- This is basically a subclass of a ``dict`` but adds some additional
41- functionalities to ensure consistent and compatible Page Objects across
42- different use cases:
43-
44- * Ensures that some params with data types that are difficult to
45- provide or pass like ``lambdas`` are checked. Otherwise, a ``ValueError``
46- is raised.
40+ This is basically a subclass of a ``dict`` that adds the ability to check
41+ if any of the assigned values are not allowed. This ensures that some input
42+ parameters with data types that are difficult to provide or pass via CLI
43+ like ``lambdas`` are checked. Otherwise, a ``ValueError`` is raised.
4744 """
4845
4946 # Any "value" that returns True for the functions here are not allowed.
@@ -62,18 +59,21 @@ class Meta(dict):
6259
6360 def __init__ (self , * args , ** kwargs ) -> None :
6461 for val in kwargs .values ():
65- self .is_restricted_value (val )
62+ self .enforce_value_restriction (val )
6663 super ().__init__ (* args , ** kwargs )
6764
6865 def __setitem__ (self , key : Any , value : Any ) -> None :
69- self .is_restricted_value (value )
66+ self .enforce_value_restriction (value )
7067 super ().__setattr__ (key , value )
7168
72- def is_restricted_value (self , value : Any ) -> None :
73- """Raises an error if a given value isn't allowed inside the meta.
69+ def enforce_value_restriction (self , value : Any ) -> None :
70+ """Raises a ``ValueError`` if a given value isn't allowed inside the meta.
71+
72+ This method is called during :class:`~.Meta` instantiation and setting
73+ new values in an existing instance.
7474
75- This behavior can be controlled by tweaking the class variable
76- :meth:`~.web_poet.page_inputs.Meta. restrictions`.
75+ This behavior can be controlled by tweaking the class variable named
76+ `` restrictions` `.
7777 """
7878 violations = []
7979
0 commit comments