Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions torchx/specs/file_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ def _validate_arg_def(


class TorchxReturnValidator(TorchxFunctionValidator):

def __init__(self, supported_return_type: str) -> None:
super().__init__()
self._supported_return_type = supported_return_type

def _get_return_annotation(
self, app_specs_func_def: ast.FunctionDef
) -> Optional[str]:
Expand All @@ -203,7 +208,7 @@ def validate(self, app_specs_func_def: ast.FunctionDef) -> List[LinterMessage]:
* AppDef
* specs.AppDef
"""
supported_return_annotation = "AppDef"
supported_return_annotation = self._supported_return_type
return_annotation = self._get_return_annotation(app_specs_func_def)
linter_errors = []
if not return_annotation:
Expand Down Expand Up @@ -252,7 +257,7 @@ def __init__(
if validators is None:
self.validators: List[TorchxFunctionValidator] = [
TorchxFunctionArgsValidator(),
TorchxReturnValidator(),
TorchxReturnValidator("AppDef"),
]
else:
self.validators = validators
Expand Down