Skip to content

Commit

Permalink
Ignore mypy 1.11 warnings in formatter
Browse files Browse the repository at this point in the history
The suggested fix on python/mypy#17550 causes
another problem that we ignore for now.
  • Loading branch information
timj committed Jul 22, 2024
1 parent 559b69f commit 97bb201
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/formatters/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _toBytes(self, inMemoryDataset: Any) -> bytes:
# mypy needs the 'not a type' check because "is_dataclass" works
# for both types and instances.
if dataclasses.is_dataclass(inMemoryDataset) and not isinstance(inMemoryDataset, type):
inMemoryDataset = dataclasses.asdict(inMemoryDataset)
inMemoryDataset = dataclasses.asdict(inMemoryDataset) # type: ignore[unreachable]
elif hasattr(inMemoryDataset, "_asdict"):
inMemoryDataset = inMemoryDataset._asdict()
return json.dumps(inMemoryDataset, ensure_ascii=False).encode()
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/formatters/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _toBytes(self, inMemoryDataset: Any) -> bytes:
# mypy needs the 'not a type' check because "is_dataclass" works
# for both types and instances.
if dataclasses.is_dataclass(inMemoryDataset) and not isinstance(inMemoryDataset, type):
inMemoryDataset = dataclasses.asdict(inMemoryDataset)
inMemoryDataset = dataclasses.asdict(inMemoryDataset) # type: ignore[unreachable]
elif hasattr(inMemoryDataset, "_asdict"):
inMemoryDataset = inMemoryDataset._asdict()

Expand Down

0 comments on commit 97bb201

Please sign in to comment.