Fix typing issues

This commit is contained in:
Timmy Welch 2024-05-21 18:22:30 -07:00
parent 2897611006
commit f712952b87
6 changed files with 9 additions and 9 deletions

View File

@ -41,6 +41,6 @@ repos:
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: [types-setuptools, types-requests, settngs>=0.10.0]
additional_dependencies: [types-setuptools, types-requests, settngs>=0.10.3]
ci:
skip: [mypy]

View File

@ -300,7 +300,7 @@ def validate_commandline_settings(config: settngs.Config[ct_ns], parser: settngs
)
config[0].Runtime_Options__no_gui = any(
(config[0].Commands__command, config[0].Runtime_Options__no_gui, config[0].Commands__copy)
(config[0].Commands__command != Action.gui, config[0].Runtime_Options__no_gui, config[0].Commands__copy)
)
if platform.system() == "Windows" and config[0].Runtime_Options__glob:

View File

@ -2,7 +2,7 @@ from __future__ import annotations
import logging
import os
from typing import cast
from typing import Any, cast
import settngs
@ -84,7 +84,7 @@ def validate_archive_settings(config: settngs.Config[ct_ns]) -> settngs.Config[c
def validate_talker_settings(config: settngs.Config[ct_ns], talkers: dict[str, ComicTalker]) -> settngs.Config[ct_ns]:
# Apply talker settings from config file
cfg = settngs.normalize_config(config, True, True)
cfg = cast(settngs.Config[dict[str, Any]], settngs.normalize_config(config, True, True))
for talker in list(talkers.values()):
try:
cfg[0][group_for_plugin(talker)] = talker.parse_settings(cfg[0][group_for_plugin(talker)])

View File

@ -57,7 +57,7 @@ class MetadataFormatter(string.Formatter):
return ""
return cast(str, super().format_field(value, format_spec))
def convert_field(self, value: Any, conversion: str) -> str:
def convert_field(self, value: Any, conversion: str | None) -> str:
if conversion == "u":
return str(value).upper()
if conversion == "l":
@ -146,7 +146,7 @@ class MetadataFormatter(string.Formatter):
obj = self.none_replacement(obj, replacement, r)
# do any conversion on the resulting object
obj = self.convert_field(obj, conversion) # type: ignore
obj = self.convert_field(obj, conversion)
# expand the format spec, if needed
format_spec, _ = self._vformat(

View File

@ -313,7 +313,7 @@ def get_config_from_tab(tab: TalkerTab, definitions: settngs.Group) -> dict[str,
value = typ(value)
# Warn if the resulting type isn't the guessed type
guessed_type = setting._guess_type()
guessed_type, _ = setting._guess_type()
if (
value is not None
and guessed_type not in (None, "Any")
@ -385,7 +385,7 @@ def generate_source_option_tabs(
dest_created = set()
for option in config.definitions[group_for_plugin(talker)].v.values():
guessed_type = option._guess_type()
guessed_type, _ = option._guess_type()
# Skip destinations that have already been created
if option.dest in dest_created:

View File

@ -48,7 +48,7 @@ install_requires =
pyyaml
rapidfuzz>=2.12.0
requests==2.*
settngs==0.10.2
settngs==0.10.3
text2digits
typing-extensions>=4.3.0
wordninja