Skip to content

Commit

Permalink
fix: improve types
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <[email protected]>
  • Loading branch information
mr-cal committed Sep 30, 2024
1 parent a161e44 commit 321b36e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions snapcraft/models/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""Assertion models."""

import numbers
from collections import abc
from typing import Any, Literal

import pydantic
Expand All @@ -41,10 +42,10 @@ def _to_string(data: Any) -> Any:
if isinstance(data, str):
return data

if isinstance(data, dict):
if isinstance(data, abc.Mapping):
return {_to_string(key): _to_string(value) for key, value in data.items()}

if isinstance(data, list):
if isinstance(data, abc.Collection):
return [_to_string(i) for i in data]

if isinstance(data, (numbers.Number, bool)):
Expand Down

0 comments on commit 321b36e

Please sign in to comment.