mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-04 14:46:03 +00:00
Another fix for mypy 1.12
This commit is contained in:
parent
46c610525c
commit
a81fd3b1c2
1 changed files with 4 additions and 3 deletions
|
|
@ -2,6 +2,7 @@
|
|||
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import errno
|
||||
import inspect
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
|
|
@ -287,7 +288,7 @@ class FileTransmissionCommand:
|
|||
val = getattr(self, k.name)
|
||||
if not keep_defaults and val == k.default:
|
||||
continue
|
||||
if issubclass(k.type, Enum):
|
||||
if inspect.isclass(k.type) and issubclass(k.type, Enum):
|
||||
val = val.name
|
||||
ans[k.name] = val
|
||||
return ans
|
||||
|
|
@ -310,7 +311,7 @@ class FileTransmissionCommand:
|
|||
found = True
|
||||
yield nts[name]
|
||||
yield '='
|
||||
if issubclass(k.type, Enum):
|
||||
if inspect.isclass(k.type) and issubclass(k.type, Enum):
|
||||
yield val.name
|
||||
elif k.type is bytes:
|
||||
yield base64_encode(val)
|
||||
|
|
@ -337,7 +338,7 @@ class FileTransmissionCommand:
|
|||
field = fmap.get(key)
|
||||
if field is None:
|
||||
return
|
||||
if issubclass(field.type, Enum):
|
||||
if inspect.isclass(field.type) and issubclass(field.type, Enum):
|
||||
setattr(ans, field.name, field.type[str(val, "utf-8")])
|
||||
elif field.type is bytes:
|
||||
setattr(ans, field.name, base64_decode(val))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue