Skip to content

Commit e42adf6

Browse files
Arm backend: Make compile_spec validate function private
The function is only used internally and is not part of the public API. Make it private by renaming it to _validate(). Change-Id: I00f0d0a5f7437f303942030f27515c642135ef58 Signed-off-by: Sebastian Larsson <sebastian.larsson@arm.com>
1 parent 379e661 commit e42adf6

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

backends/arm/common/arm_compile_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def from_list(cls, compile_specs: list[CompileSpec]): # noqa: C901
135135
pipeline_config=pipeline_config,
136136
)
137137
cls._from_list_hook(compile_spec, unknown_specs)
138-
compile_spec.validate()
138+
compile_spec._validate()
139139
return compile_spec
140140

141141
@classmethod
@@ -144,7 +144,7 @@ def _from_list_hook(cls, compile_spec, specs: dict[str, str]): # noqa: B027
144144
pass
145145

146146
@abstractmethod
147-
def validate(self):
147+
def _validate(self):
148148
"""Throws an error if the compile spec is not valid."""
149149

150150
def to_list(self):

backends/arm/ethosu/compile_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(
119119
)
120120
tosa_spec = self._tosa_spec_for_target(target_lower)
121121
self._set_compile_specs(tosa_spec, compiler_flags)
122-
self.validate()
122+
self._validate()
123123

124124
def to_list(self):
125125
"""Return compile specs including the encoded Ethos-U target."""
@@ -132,7 +132,7 @@ def _from_list_hook(cls, compile_spec, specs: dict[str, str]):
132132
"""Restore target-specific metadata from serialized compile specs."""
133133
compile_spec.target = specs.get(cls._TARGET_KEY, None)
134134

135-
def validate(self):
135+
def _validate(self):
136136
"""Validate the configuration against supported Ethos-U settings."""
137137
if len(self.compiler_flags) == 0:
138138
raise ValueError(

backends/arm/scripts/docgen/docgen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def generate_ethos_u_docs():
135135
"""Generates documentation for the Ethos-U components in the backend."""
136136
compilespec_string = get_class_docstring(
137137
EthosUCompileSpec,
138-
("DebugMode", "to_list", "from_list", "validate"),
138+
("DebugMode", "to_list", "from_list"),
139139
)
140140
partitioner_string = get_class_docstring(EthosUPartitioner)
141141
quantizer_string = get_class_docstring(
@@ -190,7 +190,7 @@ def generate_vgf_docs():
190190
"""Generates documentation for the VGF components in the backend."""
191191
compilespec_string = get_class_docstring(
192192
VgfCompileSpec,
193-
("DebugMode", "to_list", "from_list", "validate"),
193+
("DebugMode", "to_list", "from_list"),
194194
)
195195
partitioner_string = get_class_docstring(VgfPartitioner)
196196
quantizer_string = get_class_docstring(

backends/arm/tosa/compile_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def __init__(self, tosa_spec: TosaSpecification | str):
2323
if isinstance(tosa_spec, str):
2424
tosa_spec = TosaSpecification.create_from_string(tosa_spec)
2525
self._set_compile_specs(tosa_spec, [])
26-
self.validate()
26+
self._validate()
2727

28-
def validate(self):
28+
def _validate(self):
2929
"""Ensure that no unsupported compiler flags were supplied."""
3030
if len(self.compiler_flags) != 0:
3131
raise ValueError(

backends/arm/vgf/compile_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def __init__(
4343
if compiler_flags is None:
4444
compiler_flags = []
4545
self._set_compile_specs(tosa_spec, compiler_flags)
46-
self.validate()
46+
self._validate()
4747

48-
def validate(self):
48+
def _validate(self):
4949
"""Validate the configuration against VGF-supported TOSA profiles."""
5050
tosa_version = self.tosa_spec.version # type: ignore[attr-defined]
5151
tosa_profiles = self.tosa_spec.profiles # type: ignore[attr-defined]

0 commit comments

Comments
 (0)