From 59f5a27fc51b46c6802e996b03b29d4c88cec7be Mon Sep 17 00:00:00 2001 From: Francis Couture-Harpin Date: Wed, 8 May 2024 23:20:51 -0400 Subject: [PATCH] gguf-py : flake8 fixes --- convert-hf-to-gguf.py | 2 +- gguf-py/gguf/lazy.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index 64dd5dd99..fd5417667 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -65,7 +65,7 @@ class Model: 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): - if type(self) == Model: + if type(self) is Model: raise TypeError(f"{type(self).__name__!r} should not be directly instantiated") self.dir_model = dir_model self.ftype = ftype diff --git a/gguf-py/gguf/lazy.py b/gguf-py/gguf/lazy.py index de1e6e851..650bea11c 100644 --- a/gguf-py/gguf/lazy.py +++ b/gguf-py/gguf/lazy.py @@ -2,12 +2,11 @@ from __future__ import annotations from abc import ABC, ABCMeta, abstractmethod import logging -from typing import Any, Callable, Iterable, SupportsIndex +from typing import Any, Callable from collections import deque import numpy as np -from numpy.typing import DTypeLike, NDArray -from numpy._typing import _ShapeLike +from numpy.typing import DTypeLike logger = logging.getLogger(__name__) @@ -132,7 +131,7 @@ class LazyBase(ABC, metaclass=LazyMeta): assert isinstance(res, cls) res = res._meta # allow operations to override the dtype - if meta_noop != True: + if meta_noop is not True: res = cls.meta_with_dtype(res, meta_noop) if isinstance(res, cls._tensor_type): @@ -193,7 +192,7 @@ class LazyBase(ABC, metaclass=LazyMeta): @classmethod def from_eager(cls, t: Any) -> Any: - if type(t) == cls: + if type(t) is cls: # already eager return t elif isinstance(t, cls._tensor_type):