mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
move NestedDict to utils file
This commit is contained in:
parent
8546cc9d1c
commit
0c5270224a
3 changed files with 7 additions and 10 deletions
|
@ -1,7 +0,0 @@
|
||||||
"""https://stackoverflow.com/a/74873621/8740440"""
|
|
||||||
|
|
||||||
|
|
||||||
class NestedDict(dict):
|
|
||||||
def __missing__(self, x):
|
|
||||||
self[x] = NestedDict()
|
|
||||||
return self[x]
|
|
|
@ -1 +0,0 @@
|
||||||
from .NestedDict import NestedDict
|
|
|
@ -4,12 +4,17 @@
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from jrnl.datatypes import NestedDict
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from jrnl.journals import Journal
|
from jrnl.journals import Journal
|
||||||
|
|
||||||
|
|
||||||
|
"""https://stackoverflow.com/a/74873621/8740440"""
|
||||||
|
class NestedDict(dict):
|
||||||
|
def __missing__(self, x):
|
||||||
|
self[x] = NestedDict()
|
||||||
|
return self[x]
|
||||||
|
|
||||||
|
|
||||||
def get_tags_count(journal: "Journal") -> set[tuple[int, str]]:
|
def get_tags_count(journal: "Journal") -> set[tuple[int, str]]:
|
||||||
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
|
"""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
|
# Astute reader: should the following line leave you as puzzled as me the first time
|
||||||
|
|
Loading…
Add table
Reference in a new issue