Skip to content

Commit

Permalink
initialize _cards, otherwise any cards saved in _cards are preserved …
Browse files Browse the repository at this point in the history
…in the next call
  • Loading branch information
yueshuaing committed Aug 21, 2024
1 parent 7913c2e commit 474409c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion projectcard/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def read_cards(
filepath: Union[Collection[str], str],
filter_tags: Collection[str] = [],
recursive: bool = False,
_cards: Mapping[str, ProjectCard] = {},
_cards: Mapping[str, ProjectCard] = None,
) -> Mapping[str, ProjectCard]:
"""Reads collection of project card files by inferring the file type.
Expand All @@ -204,6 +204,9 @@ def read_cards(
"""
CardLogger.debug(f"Reading cards from {filepath}.")

if _cards is None:
_cards = {}

filter_tags = list(map(str.lower, filter_tags))
if isinstance(filepath, list) or not os.path.isfile(filepath):
_card_paths = _get_cardpath_list(
Expand Down

0 comments on commit 474409c

Please sign in to comment.