Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small tweaks to heatmap exporter PR #1

Merged
merged 4 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .vscode/launch.json

This file was deleted.

3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

7 changes: 0 additions & 7 deletions jrnl/datatypes/NestedDict.py

This file was deleted.

1 change: 0 additions & 1 deletion jrnl/datatypes/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion jrnl/plugins/calendar_heatmap_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from jrnl.plugins.util import get_journal_frequency_nested

if TYPE_CHECKING:
from jrnl.datatypes import NestedDict
from jrnl.plugins.util import NestedDict
from jrnl.journals import Entry
from jrnl.journals import Journal

Expand Down
10 changes: 8 additions & 2 deletions jrnl/plugins/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
from collections import Counter
from typing import TYPE_CHECKING

from jrnl.datatypes import NestedDict

if TYPE_CHECKING:
from jrnl.journals import Journal


class NestedDict(dict):
"""https://stackoverflow.com/a/74873621/8740440"""

def __missing__(self, x):
self[x] = NestedDict()
return self[x]


def get_tags_count(journal: "Journal") -> set[tuple[int, str]]:
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
# Astute reader: should the following line leave you as puzzled as me the first time
Expand Down