fix(types): makes sures mypy is running strict

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
Aaron
2023-11-30 09:42:24 -05:00
parent 9d1b16395e
commit 9a7e0cecf0
6 changed files with 12 additions and 11 deletions

View File

@@ -19,7 +19,6 @@ from openllm_cli._sdk import (
import_model as import_model,
list_models as list_models,
start as start,
start_grpc as start_grpc,
)
from openllm_core._configuration import (
GenerationConfig as GenerationConfig,
@@ -37,7 +36,6 @@ from . import (
client as client,
exceptions as exceptions,
serialisation as serialisation,
testing as testing,
utils as utils,
)
from ._deprecated import Runner as Runner

View File

@@ -29,8 +29,7 @@ class RefResolver:
@property
def tag(self) -> str: return 'latest' if self.strategy in {'latest', 'nightly'} else repr(self.version)
__lazy = LazyModule(
__name__,
os.path.abspath('__file__'),
__name__, os.path.abspath('__file__'), #
{'_package': ['create_bento', 'build_editable', 'construct_python_options', 'construct_docker_options']},
extra_objects={'RefResolver': RefResolver}
)

View File

@@ -2,10 +2,10 @@ from typing import Optional
import attr
from openllm_core._typing_compat import LiteralContainerVersionStrategy
from openllm_core._typing_compat import LiteralVersionStrategy
from openllm_core.utils.lazy import VersionInfo
from . import _package as _package, oci as oci
from . import _package as _package
from ._package import (
build_editable as build_editable,
construct_docker_options as construct_docker_options,
@@ -17,9 +17,9 @@ from ._package import (
class RefResolver:
git_hash: str
version: VersionInfo
strategy: LiteralContainerVersionStrategy
strategy: LiteralVersionStrategy
@classmethod
def from_strategy(cls, strategy_or_version: Optional[LiteralContainerVersionStrategy] = ...) -> RefResolver: ...
def from_strategy(cls, strategy_or_version: Optional[LiteralVersionStrategy] = ...) -> RefResolver: ...
@property
def tag(self) -> str: ...

View File

@@ -1,6 +1,6 @@
import types
from contextlib import contextmanager
from typing import Optional, Sequence
from typing import Iterator, Optional, Sequence, Tuple
import transformers
@@ -21,4 +21,4 @@ def save_model(
trust_remote_code: bool,
module: str,
external_modules: Sequence[types.ModuleType],
) -> Model: ...
) -> Iterator[Tuple[Model, Sequence[types.ModuleType]]]: ...