MCPcopy Create free account
hub / github.com/google-deepmind/chex / NestedClass

Class NestedClass

chex/_src/dataclass_test.py:119–138  ·  view source on GitHub ↗

Nested class.

Source from the content-addressed store, hash-verified

117 raise RuntimeError('Class.some_method() was called.')
118
119 class NestedClass:
120 """Nested class."""
121
122 k_any: Any
123 k_int: int
124 k_str: str
125 k_arr: np.ndarray
126 k_dclass_with_map: Class
127 k_dclass_no_map: ClassWithoutMap
128 k_dict_factory: dict = dataclasses.field( # pylint:disable=g-bare-generic,invalid-field-call
129 default_factory=lambda: dict(x='x', y='y'))
130 k_default: str = 'default_str'
131 k_non_init: int = dataclasses.field(default=1, init=False) # pylint:disable=g-bare-generic,invalid-field-call
132 k_init_only: dataclasses.InitVar[int] = 10
133
134 def some_method(self, *args):
135 raise RuntimeError('NestedClassWithMap.some_method() was called.')
136
137 def __post_init__(self, k_init_only):
138 self.k_non_init = self.k_int * k_init_only
139
140 if test_type == 'chex':
141 cls = chex_dataclass(Class, mappable_dataclass=True)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…