Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#27) pokedex#26: "switch between results and metadata"
- Loading branch information
1 parent
0820412
commit bfd4abf
Showing
5 changed files
with
31 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import json | ||
from dataclasses import asdict, dataclass | ||
from typing import Any, Dict, List, Type, Union | ||
|
||
JSON = Union[Dict[str, Any], List[Any], int, str, float, bool, Type[None]] | ||
|
||
|
||
@dataclass | ||
class Report: | ||
persisted: dict | ||
|
||
def __str__(self) -> JSON: | ||
def __str__(self) -> str: | ||
summary = dict(asdict(self), count=len(self.persisted)) | ||
return json.dumps(summary, indent=4) |