Skip to content

Commit

Permalink
Tweak type annotations for pylint update
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvealerts committed Sep 25, 2023
1 parent e777b52 commit 7d0c848
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/modlunky2/levels/level_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass
from collections import OrderedDict
from typing import ClassVar, Generic, Optional, TextIO, TypeVar
from typing import ClassVar, Generic, Optional, TextIO, TypeVar, cast

from modlunky2.levels.utils import (
DirectivePrefixes,
Expand Down Expand Up @@ -115,7 +115,8 @@ def clean_value(self):
return

if self.name == "size":
value = tuple(self.value.split())
# The cast is for pylint, which doesn't recognize the narrowing of isinstance
value = tuple(cast(self.value, str).split())
if len(value) != 2:
raise ValueError("Directive `size` expects 2 values.")
elif self.name == "liquid_gravity":
Expand Down
4 changes: 2 additions & 2 deletions src/modlunky2/mem/memrauder/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class _StructField:
@dataclass(frozen=True)
class DataclassStruct(MemType[T]):
path: FieldPath
dataclass: T
dataclass: Type[T]

struct_fields: Dict[str, _StructField] = dataclasses.field(init=False)

Expand Down Expand Up @@ -358,7 +358,7 @@ def __str__(self):
@dataclass(frozen=True)
class ScalarCType(BiMemType[T]):
path: FieldPath
py_type: T
py_type: Type[T]
c_type: type

# Dict doesn't work correctly, presumably c_foo isn't hashable
Expand Down

0 comments on commit 7d0c848

Please sign in to comment.