gguf-py : flake8 fixes

This commit is contained in:
Francis Couture-Harpin 2024-05-08 23:20:51 -04:00
parent 6f8d280073
commit 59f5a27fc5
2 changed files with 5 additions and 6 deletions

View file

@ -65,7 +65,7 @@ class Model:
model_arch: gguf.MODEL_ARCH model_arch: gguf.MODEL_ARCH
def __init__(self, dir_model: Path, ftype: int, fname_out: Path, is_big_endian: bool, use_temp_file: bool, eager: bool): def __init__(self, dir_model: Path, ftype: int, fname_out: Path, is_big_endian: bool, use_temp_file: bool, eager: bool):
if type(self) == Model: if type(self) is Model:
raise TypeError(f"{type(self).__name__!r} should not be directly instantiated") raise TypeError(f"{type(self).__name__!r} should not be directly instantiated")
self.dir_model = dir_model self.dir_model = dir_model
self.ftype = ftype self.ftype = ftype

View file

@ -2,12 +2,11 @@ from __future__ import annotations
from abc import ABC, ABCMeta, abstractmethod from abc import ABC, ABCMeta, abstractmethod
import logging import logging
from typing import Any, Callable, Iterable, SupportsIndex from typing import Any, Callable
from collections import deque from collections import deque
import numpy as np import numpy as np
from numpy.typing import DTypeLike, NDArray from numpy.typing import DTypeLike
from numpy._typing import _ShapeLike
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -132,7 +131,7 @@ class LazyBase(ABC, metaclass=LazyMeta):
assert isinstance(res, cls) assert isinstance(res, cls)
res = res._meta res = res._meta
# allow operations to override the dtype # allow operations to override the dtype
if meta_noop != True: if meta_noop is not True:
res = cls.meta_with_dtype(res, meta_noop) res = cls.meta_with_dtype(res, meta_noop)
if isinstance(res, cls._tensor_type): if isinstance(res, cls._tensor_type):
@ -193,7 +192,7 @@ class LazyBase(ABC, metaclass=LazyMeta):
@classmethod @classmethod
def from_eager(cls, t: Any) -> Any: def from_eager(cls, t: Any) -> Any:
if type(t) == cls: if type(t) is cls:
# already eager # already eager
return t return t
elif isinstance(t, cls._tensor_type): elif isinstance(t, cls._tensor_type):