hpcflow-new2 0.2.0a189__py3-none-any.whl → 0.2.0a190__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. hpcflow/__pyinstaller/hook-hpcflow.py +8 -6
  2. hpcflow/_version.py +1 -1
  3. hpcflow/app.py +1 -0
  4. hpcflow/data/scripts/main_script_test_hdf5_in_obj.py +1 -1
  5. hpcflow/data/scripts/main_script_test_hdf5_out_obj.py +1 -1
  6. hpcflow/sdk/__init__.py +21 -15
  7. hpcflow/sdk/app.py +2133 -770
  8. hpcflow/sdk/cli.py +281 -250
  9. hpcflow/sdk/cli_common.py +6 -2
  10. hpcflow/sdk/config/__init__.py +1 -1
  11. hpcflow/sdk/config/callbacks.py +77 -42
  12. hpcflow/sdk/config/cli.py +126 -103
  13. hpcflow/sdk/config/config.py +578 -311
  14. hpcflow/sdk/config/config_file.py +131 -95
  15. hpcflow/sdk/config/errors.py +112 -85
  16. hpcflow/sdk/config/types.py +145 -0
  17. hpcflow/sdk/core/actions.py +1054 -994
  18. hpcflow/sdk/core/app_aware.py +24 -0
  19. hpcflow/sdk/core/cache.py +81 -63
  20. hpcflow/sdk/core/command_files.py +275 -185
  21. hpcflow/sdk/core/commands.py +111 -107
  22. hpcflow/sdk/core/element.py +724 -503
  23. hpcflow/sdk/core/enums.py +192 -0
  24. hpcflow/sdk/core/environment.py +74 -93
  25. hpcflow/sdk/core/errors.py +398 -51
  26. hpcflow/sdk/core/json_like.py +540 -272
  27. hpcflow/sdk/core/loop.py +380 -334
  28. hpcflow/sdk/core/loop_cache.py +160 -43
  29. hpcflow/sdk/core/object_list.py +370 -207
  30. hpcflow/sdk/core/parameters.py +728 -600
  31. hpcflow/sdk/core/rule.py +59 -41
  32. hpcflow/sdk/core/run_dir_files.py +33 -22
  33. hpcflow/sdk/core/task.py +1546 -1325
  34. hpcflow/sdk/core/task_schema.py +240 -196
  35. hpcflow/sdk/core/test_utils.py +126 -88
  36. hpcflow/sdk/core/types.py +387 -0
  37. hpcflow/sdk/core/utils.py +410 -305
  38. hpcflow/sdk/core/validation.py +82 -9
  39. hpcflow/sdk/core/workflow.py +1192 -1028
  40. hpcflow/sdk/core/zarr_io.py +98 -137
  41. hpcflow/sdk/demo/cli.py +46 -33
  42. hpcflow/sdk/helper/cli.py +18 -16
  43. hpcflow/sdk/helper/helper.py +75 -63
  44. hpcflow/sdk/helper/watcher.py +61 -28
  45. hpcflow/sdk/log.py +83 -59
  46. hpcflow/sdk/persistence/__init__.py +8 -31
  47. hpcflow/sdk/persistence/base.py +988 -586
  48. hpcflow/sdk/persistence/defaults.py +6 -0
  49. hpcflow/sdk/persistence/discovery.py +38 -0
  50. hpcflow/sdk/persistence/json.py +408 -153
  51. hpcflow/sdk/persistence/pending.py +158 -123
  52. hpcflow/sdk/persistence/store_resource.py +37 -22
  53. hpcflow/sdk/persistence/types.py +307 -0
  54. hpcflow/sdk/persistence/utils.py +14 -11
  55. hpcflow/sdk/persistence/zarr.py +477 -420
  56. hpcflow/sdk/runtime.py +44 -41
  57. hpcflow/sdk/submission/{jobscript_info.py → enums.py} +39 -12
  58. hpcflow/sdk/submission/jobscript.py +444 -404
  59. hpcflow/sdk/submission/schedulers/__init__.py +133 -40
  60. hpcflow/sdk/submission/schedulers/direct.py +97 -71
  61. hpcflow/sdk/submission/schedulers/sge.py +132 -126
  62. hpcflow/sdk/submission/schedulers/slurm.py +263 -268
  63. hpcflow/sdk/submission/schedulers/utils.py +7 -2
  64. hpcflow/sdk/submission/shells/__init__.py +14 -15
  65. hpcflow/sdk/submission/shells/base.py +102 -29
  66. hpcflow/sdk/submission/shells/bash.py +72 -55
  67. hpcflow/sdk/submission/shells/os_version.py +31 -30
  68. hpcflow/sdk/submission/shells/powershell.py +37 -29
  69. hpcflow/sdk/submission/submission.py +203 -257
  70. hpcflow/sdk/submission/types.py +143 -0
  71. hpcflow/sdk/typing.py +163 -12
  72. hpcflow/tests/conftest.py +8 -6
  73. hpcflow/tests/schedulers/slurm/test_slurm_submission.py +5 -2
  74. hpcflow/tests/scripts/test_main_scripts.py +60 -30
  75. hpcflow/tests/shells/wsl/test_wsl_submission.py +6 -4
  76. hpcflow/tests/unit/test_action.py +86 -75
  77. hpcflow/tests/unit/test_action_rule.py +9 -4
  78. hpcflow/tests/unit/test_app.py +13 -6
  79. hpcflow/tests/unit/test_cli.py +1 -1
  80. hpcflow/tests/unit/test_command.py +71 -54
  81. hpcflow/tests/unit/test_config.py +20 -15
  82. hpcflow/tests/unit/test_config_file.py +21 -18
  83. hpcflow/tests/unit/test_element.py +58 -62
  84. hpcflow/tests/unit/test_element_iteration.py +3 -1
  85. hpcflow/tests/unit/test_element_set.py +29 -19
  86. hpcflow/tests/unit/test_group.py +4 -2
  87. hpcflow/tests/unit/test_input_source.py +116 -93
  88. hpcflow/tests/unit/test_input_value.py +29 -24
  89. hpcflow/tests/unit/test_json_like.py +44 -35
  90. hpcflow/tests/unit/test_loop.py +65 -58
  91. hpcflow/tests/unit/test_object_list.py +17 -12
  92. hpcflow/tests/unit/test_parameter.py +16 -7
  93. hpcflow/tests/unit/test_persistence.py +48 -35
  94. hpcflow/tests/unit/test_resources.py +20 -18
  95. hpcflow/tests/unit/test_run.py +8 -3
  96. hpcflow/tests/unit/test_runtime.py +2 -1
  97. hpcflow/tests/unit/test_schema_input.py +23 -15
  98. hpcflow/tests/unit/test_shell.py +3 -2
  99. hpcflow/tests/unit/test_slurm.py +8 -7
  100. hpcflow/tests/unit/test_submission.py +39 -19
  101. hpcflow/tests/unit/test_task.py +352 -247
  102. hpcflow/tests/unit/test_task_schema.py +33 -20
  103. hpcflow/tests/unit/test_utils.py +9 -11
  104. hpcflow/tests/unit/test_value_sequence.py +15 -12
  105. hpcflow/tests/unit/test_workflow.py +114 -83
  106. hpcflow/tests/unit/test_workflow_template.py +0 -1
  107. hpcflow/tests/workflows/test_jobscript.py +2 -1
  108. hpcflow/tests/workflows/test_workflows.py +18 -13
  109. {hpcflow_new2-0.2.0a189.dist-info → hpcflow_new2-0.2.0a190.dist-info}/METADATA +2 -1
  110. hpcflow_new2-0.2.0a190.dist-info/RECORD +165 -0
  111. hpcflow/sdk/core/parallel.py +0 -21
  112. hpcflow_new2-0.2.0a189.dist-info/RECORD +0 -158
  113. {hpcflow_new2-0.2.0a189.dist-info → hpcflow_new2-0.2.0a190.dist-info}/LICENSE +0 -0
  114. {hpcflow_new2-0.2.0a189.dist-info → hpcflow_new2-0.2.0a190.dist-info}/WHEEL +0 -0
  115. {hpcflow_new2-0.2.0a189.dist-info → hpcflow_new2-0.2.0a190.dist-info}/entry_points.txt +0 -0
@@ -1,81 +1,86 @@
1
+ from __future__ import annotations
1
2
  import sys
3
+ from pathlib import Path
4
+ from typing import TYPE_CHECKING
2
5
  import pytest
3
6
  import requests
4
7
 
5
8
  from hpcflow.app import app as hf
6
- from hpcflow.sdk.core.errors import InputValueDuplicateSequenceAddress
7
9
  from hpcflow.sdk.core.test_utils import P1_parameter_cls as P1
8
10
 
11
+ if TYPE_CHECKING:
12
+ from hpcflow.sdk.core.parameters import Parameter
13
+
9
14
 
10
15
  @pytest.fixture
11
- def null_config(tmp_path):
16
+ def null_config(tmp_path: Path):
12
17
  if not hf.is_config_loaded:
13
18
  hf.load_config(config_dir=tmp_path)
14
19
 
15
20
 
16
21
  @pytest.fixture
17
- def param_p1(null_config):
22
+ def param_p1(null_config) -> Parameter:
18
23
  return hf.Parameter("p1")
19
24
 
20
25
 
21
- def test_fix_trailing_path_delimiter(param_p1):
26
+ def test_fix_trailing_path_delimiter(param_p1: Parameter):
22
27
  iv1 = hf.InputValue(parameter=param_p1, value=101, path="a.")
23
28
  iv2 = hf.InputValue(parameter=param_p1, value=101, path="a")
24
29
  assert iv1.path == iv2.path
25
30
 
26
31
 
27
- def test_fix_single_path_delimiter(param_p1):
32
+ def test_fix_single_path_delimiter(param_p1: Parameter):
28
33
  iv1 = hf.InputValue(parameter=param_p1, value=101, path=".")
29
34
  iv2 = hf.InputValue(parameter=param_p1, value=101)
30
35
  assert iv1.path == iv2.path
31
36
 
32
37
 
33
- def test_normalised_path_without_path(param_p1):
38
+ def test_normalised_path_without_path(param_p1: Parameter):
34
39
  iv1 = hf.InputValue(parameter=param_p1, value=101)
35
40
  assert iv1.normalised_path == "inputs.p1"
36
41
 
37
42
 
38
- def test_normalised_path_with_single_element_path(param_p1):
43
+ def test_normalised_path_with_single_element_path(param_p1: Parameter):
39
44
  iv1 = hf.InputValue(parameter=param_p1, value=101, path="a")
40
45
  assert iv1.normalised_path == "inputs.p1.a"
41
46
 
42
47
 
43
- def test_normalised_path_with_multi_element_path(param_p1):
48
+ def test_normalised_path_with_multi_element_path(param_p1: Parameter):
44
49
  iv1 = hf.InputValue(parameter=param_p1, value=101, path="a.b")
45
50
  assert iv1.normalised_path == "inputs.p1.a.b"
46
51
 
47
52
 
48
- def test_normalised_path_with_empty_path(param_p1):
53
+ def test_normalised_path_with_empty_path(param_p1: Parameter):
49
54
  iv1 = hf.InputValue(parameter=param_p1, value=101, path="")
50
55
  assert iv1.normalised_path == "inputs.p1"
51
56
 
52
57
 
53
- def test_resource_spec_get_param_path(null_config):
58
+ def test_resource_spec_get_param_path(null_config) -> None:
54
59
  rs1 = hf.ResourceSpec()
55
60
  assert rs1.normalised_path == "resources.any"
56
61
 
57
62
 
58
- def test_resource_spec_get_param_path_scope_any_with_single_kwarg(null_config):
63
+ def test_resource_spec_get_param_path_scope_any_with_single_kwarg(null_config) -> None:
59
64
  rs1 = hf.ResourceSpec(scratch="local")
60
65
  assert rs1.normalised_path == "resources.any"
61
66
 
62
67
 
63
- def test_resources_spec_get_param_path_scope_main(null_config):
68
+ def test_resources_spec_get_param_path_scope_main(null_config) -> None:
64
69
  rs1 = hf.ResourceSpec(scope=hf.ActionScope.main())
65
70
  assert rs1.normalised_path == "resources.main"
66
71
 
67
72
 
68
- def test_resources_spec_get_param_path_scope_with_kwargs(null_config):
73
+ def test_resources_spec_get_param_path_scope_with_kwargs(null_config) -> None:
69
74
  rs1 = hf.ResourceSpec(scope=hf.ActionScope.input_file_generator(file="file1"))
70
75
  assert rs1.normalised_path == "resources.input_file_generator[file=file1]"
71
76
 
72
77
 
73
- def test_resources_spec_get_param_path_scope_with_no_kwargs(null_config):
78
+ def test_resources_spec_get_param_path_scope_with_no_kwargs(null_config) -> None:
74
79
  rs1 = hf.ResourceSpec(scope=hf.ActionScope.input_file_generator())
75
80
  assert rs1.normalised_path == "resources.input_file_generator"
76
81
 
77
82
 
78
- def test_input_value_from_json_like_class_method_attribute_is_set(null_config):
83
+ def test_input_value_from_json_like_class_method_attribute_is_set(null_config) -> None:
79
84
  parameter_typ = "p1"
80
85
  cls_method = "from_data"
81
86
  json_like = {"parameter": f"{parameter_typ}::{cls_method}", "value": 101}
@@ -84,7 +89,7 @@ def test_input_value_from_json_like_class_method_attribute_is_set(null_config):
84
89
  assert inp_val.value_class_method == cls_method
85
90
 
86
91
 
87
- def test_value_sequence_from_json_like_class_method_attribute_is_set(null_config):
92
+ def test_value_sequence_from_json_like_class_method_attribute_is_set(null_config) -> None:
88
93
  parameter_typ = "p1"
89
94
  cls_method = "from_data"
90
95
  json_like = {
@@ -99,28 +104,28 @@ def test_value_sequence_from_json_like_class_method_attribute_is_set(null_config
99
104
  assert val_seq.value_class_method == cls_method
100
105
 
101
106
 
102
- def test_path_attributes(null_config):
107
+ def test_path_attributes(null_config) -> None:
103
108
  inp = hf.InputValue(parameter="p1", value=101, path="a.b")
104
109
  assert inp.labelled_type == "p1"
105
110
  assert inp.normalised_path == "inputs.p1.a.b"
106
111
  assert inp.normalised_inputs_path == "p1.a.b"
107
112
 
108
113
 
109
- def test_path_attributes_with_label_arg(null_config):
114
+ def test_path_attributes_with_label_arg(null_config) -> None:
110
115
  inp = hf.InputValue(parameter="p1", value=101, path="a.b", label="1")
111
116
  assert inp.labelled_type == "p1[1]"
112
117
  assert inp.normalised_path == "inputs.p1[1].a.b"
113
118
  assert inp.normalised_inputs_path == "p1[1].a.b"
114
119
 
115
120
 
116
- def test_path_attributes_with_label_arg_cast(null_config):
121
+ def test_path_attributes_with_label_arg_cast(null_config) -> None:
117
122
  inp = hf.InputValue(parameter="p1", value=101, path="a.b", label=1)
118
123
  assert inp.labelled_type == "p1[1]"
119
124
  assert inp.normalised_path == "inputs.p1[1].a.b"
120
125
  assert inp.normalised_inputs_path == "p1[1].a.b"
121
126
 
122
127
 
123
- def test_from_json_like(null_config):
128
+ def test_from_json_like(null_config) -> None:
124
129
  inp = hf.InputValue.from_json_like(
125
130
  json_like={"parameter": "p1", "value": 101},
126
131
  shared_data=hf.template_components,
@@ -130,7 +135,7 @@ def test_from_json_like(null_config):
130
135
  assert inp.label == ""
131
136
 
132
137
 
133
- def test_from_json_like_with_label(null_config):
138
+ def test_from_json_like_with_label(null_config) -> None:
134
139
  inp = hf.InputValue.from_json_like(
135
140
  json_like={"parameter": "p1[1]", "value": 101},
136
141
  shared_data=hf.template_components,
@@ -140,12 +145,12 @@ def test_from_json_like_with_label(null_config):
140
145
  assert inp.label == "1"
141
146
 
142
147
 
143
- def test_value_is_dict_check_success(null_config):
148
+ def test_value_is_dict_check_success(null_config) -> None:
144
149
  # Parameter("p1c") has an associated `ParameterValue` class, so data should be a dict:
145
150
  hf.InputValue("p1c", {"a": 101})
146
151
 
147
152
 
148
- def test_value_is_dict_check_raise(null_config):
153
+ def test_value_is_dict_check_raise(null_config) -> None:
149
154
  # Parameter("p1c") has an associated `ParameterValue` class so data should be a dict:
150
155
  with pytest.raises(ValueError):
151
156
  hf.InputValue("p1c", 101)
@@ -165,7 +170,7 @@ def test_value_is_dict_check_no_raise_if_sub_parameter(null_config):
165
170
  "retrieving demo data from GitHub."
166
171
  ),
167
172
  )
168
- def test_demo_data_value(null_config):
173
+ def test_demo_data_value(null_config) -> None:
169
174
  name = "text_file.txt"
170
175
  assert hf.InputValue("p1", value=f"<<demo_data_file:{name}>>").value == str(
171
176
  hf.demo_data_cache_dir.joinpath(name)
@@ -1,7 +1,9 @@
1
+ # mypy: disable-error-code="annotation-unchecked"
2
+ from __future__ import annotations
1
3
  from dataclasses import dataclass
2
4
  import enum
3
5
  from types import SimpleNamespace
4
- from typing import Optional, Any
6
+ from typing import Any
5
7
 
6
8
  import pytest
7
9
 
@@ -9,6 +11,10 @@ from hpcflow.app import app as hf
9
11
  from hpcflow.sdk.core.json_like import BaseJSONLike, ChildObjectSpec
10
12
  from hpcflow.sdk.core.object_list import ObjectList
11
13
 
14
+ # BE AWARE THAT MYPY CANNOT CORRECTLY TYPE-CHECK THIS FILE AT ALL.
15
+ # It fails massively due to all the classes inside functions being passed to other functions.
16
+ # Omitting the types makes it ignore them all, which us for the best.
17
+
12
18
 
13
19
  @pytest.fixture
14
20
  def null_config(tmp_path):
@@ -87,16 +93,17 @@ def test_BaseJSONLike_child_object_class_namespace_via_obj(null_config):
87
93
 
88
94
 
89
95
  def test_BaseJSONLike_child_object_class_namespace_via_name_and_dict_namespace(
90
- BaseJSONLikeSubClass,
96
+ BaseJSONLikeSubClass: type[BaseJSONLike],
91
97
  ):
92
98
  """Child object class passed as a name and namespace passed as a dict."""
99
+ T: type = BaseJSONLikeSubClass # Workaround for python/mypy#14458
93
100
 
94
101
  @dataclass
95
- class ObjB(BaseJSONLikeSubClass):
102
+ class ObjB(T):
96
103
  c: int
97
104
 
98
105
  @dataclass
99
- class ObjA(BaseJSONLikeSubClass):
106
+ class ObjA(T):
100
107
  _child_objects = (
101
108
  ChildObjectSpec(
102
109
  name="b",
@@ -118,16 +125,17 @@ def test_BaseJSONLike_child_object_class_namespace_via_name_and_dict_namespace(
118
125
 
119
126
 
120
127
  def test_BaseJSONLike_child_object_class_namespace_via_name_and_func_locals(
121
- BaseJSONLikeSubClass,
128
+ BaseJSONLikeSubClass: type[BaseJSONLike],
122
129
  ):
123
130
  """Child object class passed as a name and namespace passed as function locals."""
131
+ T: type = BaseJSONLikeSubClass # Workaround for python/mypy#14458
124
132
 
125
133
  @dataclass
126
- class ObjB(BaseJSONLikeSubClass):
134
+ class ObjB(T):
127
135
  c: int
128
136
 
129
137
  @dataclass
130
- class ObjA(BaseJSONLikeSubClass):
138
+ class ObjA(T):
131
139
  _child_objects = (
132
140
  ChildObjectSpec(
133
141
  name="b",
@@ -149,16 +157,17 @@ def test_BaseJSONLike_child_object_class_namespace_via_name_and_func_locals(
149
157
 
150
158
 
151
159
  def test_BaseJSONLike_child_object_class_namespace_via_name_and_SimpleNamespace(
152
- BaseJSONLikeSubClass,
160
+ BaseJSONLikeSubClass: type[BaseJSONLike],
153
161
  ):
154
162
  """Child object class passed as a name and namespace passed as a SimpleNamespace."""
163
+ T: type = BaseJSONLikeSubClass # Workaround for python/mypy#14458
155
164
 
156
165
  @dataclass
157
- class ObjB(BaseJSONLikeSubClass):
166
+ class ObjB(T):
158
167
  c: int
159
168
 
160
169
  @dataclass
161
- class ObjA(BaseJSONLikeSubClass):
170
+ class ObjA(T):
162
171
  _child_objects = (
163
172
  ChildObjectSpec(
164
173
  name="b",
@@ -549,12 +558,12 @@ def test_from_json_like_with_parent_ref(null_config):
549
558
  class ObjB(BaseJSONLike):
550
559
  name: str
551
560
  c: int
552
- obj_A: Optional[Any] = None
561
+ obj_A: Any = None
553
562
 
554
563
  def __eq__(self, other):
555
- if self.name == other.name and self.c == other.c:
556
- return True
557
- return False
564
+ if not isinstance(other, self.__class__):
565
+ return False
566
+ return self.name == other.name and self.c == other.c
558
567
 
559
568
  @dataclass
560
569
  class ObjA(BaseJSONLike):
@@ -572,14 +581,14 @@ def test_from_json_like_with_parent_ref(null_config):
572
581
  self._set_parent_refs()
573
582
 
574
583
  def __eq__(self, other):
575
- if (
584
+ if not isinstance(other, self.__class__):
585
+ return False
586
+ return (
576
587
  self.a == other.a
577
588
  and self.b == other.b
578
589
  and self.b.obj_A is self
579
590
  and other.b.obj_A is other
580
- ):
581
- return True
582
- return False
591
+ )
583
592
 
584
593
  js_1 = {
585
594
  "a": 1,
@@ -600,12 +609,12 @@ def test_json_like_round_trip_with_parent_ref(null_config):
600
609
  class ObjB(BaseJSONLike):
601
610
  name: str
602
611
  c: int
603
- obj_A: Optional[Any] = None
612
+ obj_A: Any = None
604
613
 
605
614
  def __eq__(self, other):
606
- if self.name == other.name and self.c == other.c:
607
- return True
608
- return False
615
+ if not isinstance(other, self.__class__):
616
+ return False
617
+ return self.name == other.name and self.c == other.c
609
618
 
610
619
  @dataclass
611
620
  class ObjA(BaseJSONLike):
@@ -620,14 +629,14 @@ def test_json_like_round_trip_with_parent_ref(null_config):
620
629
  b: float
621
630
 
622
631
  def __eq__(self, other):
623
- if (
632
+ if not isinstance(other, self.__class__):
633
+ return False
634
+ return (
624
635
  self.a == other.a
625
636
  and self.b == other.b
626
637
  and self.b.obj_A is self
627
638
  and other.b.obj_A is other
628
- ):
629
- return True
630
- return False
639
+ )
631
640
 
632
641
  js_1 = {
633
642
  "a": 1,
@@ -658,7 +667,7 @@ def test_from_json_like_optional_attr(null_config):
658
667
  ),
659
668
  )
660
669
  a: int
661
- b: Optional[Any] = None
670
+ b: Any = None
662
671
 
663
672
  js_in = {"a": 9, "b": None}
664
673
  objA = ObjA.from_json_like(js_in)
@@ -683,7 +692,7 @@ def test_from_json_like_optional_attr_with_is_multiple_both_none(null_config):
683
692
  ),
684
693
  )
685
694
  a: int
686
- b: Optional[Any] = None
695
+ b: Any = None
687
696
 
688
697
  js_in = {
689
698
  "a": 9,
@@ -711,7 +720,7 @@ def test_from_json_like_optional_attr_with_is_multiple_one_none(null_config):
711
720
  ),
712
721
  )
713
722
  a: int
714
- b: Optional[Any] = None
723
+ b: Any = None
715
724
 
716
725
  js_in = {
717
726
  "a": 9,
@@ -743,7 +752,7 @@ def test_from_json_like_optional_attr_with_is_multiple_one_none_and_shared_data_
743
752
  ),
744
753
  )
745
754
  a: int
746
- b: Optional[Any] = None
755
+ b: Any = None
747
756
 
748
757
  dcts = [
749
758
  {"name": "c1", "c": 2},
@@ -782,7 +791,7 @@ def test_from_json_like_optional_attr_with_is_multiple_all_none_and_shared_data_
782
791
  ),
783
792
  )
784
793
  a: int
785
- b: Optional[Any] = None
794
+ b: Any = None
786
795
 
787
796
  dcts = [
788
797
  {"name": "c1", "c": 2},
@@ -819,7 +828,7 @@ def test_from_json_like_optional_attr_with_shared_data_name(null_config):
819
828
  ),
820
829
  )
821
830
  a: int
822
- b: Optional[Any] = None
831
+ b: Any = None
823
832
 
824
833
  dcts = [
825
834
  {"name": "c1", "c": 2},
@@ -848,7 +857,7 @@ def test_from_json_like_optional_attr_with_enum(null_config):
848
857
  class ObjA(BaseJSONLikeSubClass):
849
858
  _child_objects = (ChildObjectSpec(name="b", class_obj=MyEnum, is_enum=True),)
850
859
  a: int
851
- b: Optional[Any] = None
860
+ b: Any = None
852
861
 
853
862
  js_in = {
854
863
  "a": 9,
@@ -1079,7 +1088,7 @@ def test_from_json_like_with_is_multiple_and_shared_data_dict_lookup(null_config
1079
1088
  class ObjB(BaseJSONLikeSubClass):
1080
1089
  name: str
1081
1090
  c: int
1082
- _hash_value: Optional[str] = None
1091
+ _hash_value: str | None = None
1083
1092
 
1084
1093
  @dataclass
1085
1094
  class ObjA(BaseJSONLikeSubClass):
@@ -1205,7 +1214,7 @@ def test_to_json_like_with_child_ref(null_config):
1205
1214
  class ObjB(BaseJSONLike):
1206
1215
  name: str
1207
1216
  c: int
1208
- obj_A: Optional[Any] = None
1217
+ obj_A: Any = None
1209
1218
 
1210
1219
  @dataclass
1211
1220
  class ObjA(BaseJSONLike):