Removed type annotation on FrigateConfig's parse

I'd like to keep them, but then mypy complains about some fundamental
errors with how the pydantic model is structured. I'd like to fix it,
but I'd rather work towards moving some of this config to the database.
This commit is contained in:
George Tsiamasiotis 2024-09-22 12:08:13 +03:00
parent bcdacb3fae
commit 62955c9c8a

View File

@ -1743,12 +1743,12 @@ class FrigateConfig(FrigateBaseModel):
return v return v
@classmethod @classmethod
def parse_file(cls, config_path, **kwargs) -> Self: def parse_file(cls, config_path, **kwargs):
with open(config_path) as f: with open(config_path) as f:
return FrigateConfig.parse(f, **kwargs) return FrigateConfig.parse(f, **kwargs)
@classmethod @classmethod
def parse(cls, config, *, is_json=None, **context) -> Self: def parse(cls, config, *, is_json=None, **context):
# If config is a file, read its contents. # If config is a file, read its contents.
if hasattr(config, "read"): if hasattr(config, "read"):
fname = getattr(config, "name", None) fname = getattr(config, "name", None)
@ -1780,5 +1780,5 @@ class FrigateConfig(FrigateBaseModel):
return cls.model_validate(obj, context=context) return cls.model_validate(obj, context=context)
@classmethod @classmethod
def parse_yaml(cls, config_yaml, **context) -> Self: def parse_yaml(cls, config_yaml, **context):
return cls.parse(config_yaml, is_json=False, **context) return cls.parse(config_yaml, is_json=False, **context)