From b4d986e995ea89140b54133a7a729539369bcb17 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 8 Jun 2023 10:17:09 -0700 Subject: [PATCH] Add type hint for class arg. --- src/pyutils/persistent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyutils/persistent.py b/src/pyutils/persistent.py index d3674b5..18d99c7 100644 --- a/src/pyutils/persistent.py +++ b/src/pyutils/persistent.py @@ -34,7 +34,7 @@ import functools import logging import re from abc import ABC, abstractmethod -from typing import Any, Optional +from typing import Any, Optional, Type from overrides import overrides @@ -60,7 +60,7 @@ class Persistent(ABC): @classmethod @abstractmethod - def load(cls) -> Any: + def load(cls: Type) -> Any: """Load this thing from somewhere and give back an instance which will become the global singleton and which may (see below) be saved (via :meth:`save`) at program exit time. @@ -253,7 +253,7 @@ class JsonFileBasedPersistent(FileBasedPersistent): @classmethod @overrides - def load(cls) -> Any: + def load(cls: Type) -> Any: filename = cls.get_filename() if cls.should_we_load_data(filename): logger.debug("Trying to load state from %s", filename) -- 2.46.0