Make mypy happy
This commit is contained in:
parent
3b89c686e6
commit
3bee1857f7
8 changed files with 19 additions and 24 deletions
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
|
||||
class ThemeFile(Enum):
|
||||
dark: str = 'dark-theme.auto.conf'
|
||||
light: str = 'light-theme.auto.conf'
|
||||
no_preference: str = 'no-preference-theme.auto.conf'
|
||||
dark = 'dark-theme.auto.conf'
|
||||
light = 'light-theme.auto.conf'
|
||||
no_preference = 'no-preference-theme.auto.conf'
|
||||
|
||||
|
||||
class ThemeColors:
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ def add_dir(ftc: FileTransmissionCommand) -> None:
|
|||
sr = os.stat(path, follow_symlinks=False)
|
||||
read_ok = os.access(path, os.R_OK, follow_symlinks=False)
|
||||
except OSError as err:
|
||||
errname = errno.errorcode.get(err.errno, 'EFAIL')
|
||||
errname = errno.errorcode.get(err.errno, 'EFAIL') if err.errno is not None else 'EFAIL'
|
||||
yield TransmissionError(file_id=spec_id, code=errname, msg='Failed to read spec')
|
||||
continue
|
||||
if not read_ok:
|
||||
|
|
@ -1222,7 +1222,7 @@ def handle_send_confirmation(self, confirmed: bool, cmd_id: str) -> None:
|
|||
def send_fail_on_os_error(self, err: OSError, msg: str, ar: Union[ActiveSend, ActiveReceive], file_id: str = '') -> None:
|
||||
if not ar.send_errors:
|
||||
return
|
||||
errname = errno.errorcode.get(err.errno, 'EFAIL')
|
||||
errname = errno.errorcode.get(err.errno, 'EFAIL') if err.errno is not None else 'EFAIL'
|
||||
self.send_status_response(code=errname, msg=msg, request_id=ar.id, file_id=file_id)
|
||||
|
||||
def active_file(self, rid: str = '', file_id: str = '') -> DestFile:
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
|
||||
class Type(IntEnum):
|
||||
boolean: int = 1
|
||||
index: int = 2
|
||||
hidden: int = 3
|
||||
boolean = 1
|
||||
index = 2
|
||||
hidden = 3
|
||||
|
||||
|
||||
class FeatureDefinition(NamedTuple):
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import shutil
|
||||
from collections.abc import Container, Iterable, Iterator, Sequence
|
||||
from contextlib import suppress
|
||||
from typing import Any, NamedTuple, Optional
|
||||
from typing import Any, NamedTuple, Optional, TypedDict
|
||||
|
||||
from .boss import Boss
|
||||
from .child import Child
|
||||
|
|
@ -20,11 +20,6 @@
|
|||
from .utils import get_editor, log_error, resolve_custom_file, which
|
||||
from .window import CwdRequest, CwdRequestType, Watchers, Window
|
||||
|
||||
try:
|
||||
from typing import TypedDict
|
||||
except ImportError:
|
||||
TypedDict = dict
|
||||
|
||||
|
||||
class LaunchSpec(NamedTuple):
|
||||
opts: LaunchCLIOptions
|
||||
|
|
|
|||
|
|
@ -118,9 +118,9 @@ def remove_icon(self, key: str) -> None:
|
|||
|
||||
|
||||
class Urgency(Enum):
|
||||
Low: int = 0
|
||||
Normal: int = 1
|
||||
Critical: int = 2
|
||||
Low = 0
|
||||
Normal = 1
|
||||
Critical = 2
|
||||
|
||||
|
||||
class PayloadType(Enum):
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ class SingleInstanceData(TypedDict):
|
|||
|
||||
|
||||
class OverlayType(Enum):
|
||||
transient: str = 'transient'
|
||||
main: str = 'main'
|
||||
transient = 'transient'
|
||||
main = 'main'
|
||||
|
||||
|
||||
class ParsedShortcut(NamedTuple):
|
||||
|
|
|
|||
|
|
@ -123,10 +123,10 @@
|
|||
|
||||
|
||||
class CwdRequestType(Enum):
|
||||
current: int = auto()
|
||||
last_reported: int = auto()
|
||||
oldest: int = auto()
|
||||
root: int = auto()
|
||||
current = auto()
|
||||
last_reported = auto()
|
||||
oldest = auto()
|
||||
root = auto()
|
||||
|
||||
|
||||
class CwdRequest:
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ def __init__(self, path: str):
|
|||
def __len__(self) -> int:
|
||||
return self._total
|
||||
|
||||
def read(self, size: int = -1) -> bytes:
|
||||
def read(self, size: Optional[int] = -1) -> bytes:
|
||||
data = io.FileIO.read(self, size)
|
||||
if data:
|
||||
self.report_progress(len(data))
|
||||
|
|
|
|||
Loading…
Reference in a new issue