downgrade for python3.8
This commit is contained in:
parent
1e6151a5f4
commit
b6736936a7
@ -9,7 +9,7 @@ authors = [
|
|||||||
]
|
]
|
||||||
description = "Personal note taking framework."
|
description = "Personal note taking framework."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.8"
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"License :: OSI Approved :: GNU General Public License (GPL)",
|
"License :: OSI Approved :: GNU General Public License (GPL)",
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
from argparse import ArgumentTypeError
|
from argparse import ArgumentTypeError
|
||||||
from z.template import apply_template
|
from z.template import apply_template
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List, Union
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# Format: <timestamp>--<title>__<tag1>_<tag2>.<ext>
|
# Format: <timestamp>--<title>__<tag1>_<tag2>.<ext>
|
||||||
def normalize_name(name: str, tags: str, time: datetime.date | None = None, ext: str ="md"):
|
def normalize_name(name: str, tags: str, time: Union[datetime.date, None] = None, ext: str ="md"):
|
||||||
if "-" in name or "_" in name:
|
if "-" in name or "_" in name:
|
||||||
raise ArgumentTypeError("Title cannot have '-' or '_'")
|
raise ArgumentTypeError("Title cannot have '-' or '_'")
|
||||||
if "-" in name or "_" in tags:
|
if "-" in name or "_" in tags:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from z import template_funcs
|
from z import template_funcs
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List, Tuple
|
||||||
import re
|
import re
|
||||||
|
|
||||||
def read_file(p: Path, n: str):
|
def read_file(p: Path, n: str):
|
||||||
@ -9,7 +9,7 @@ def read_file(p: Path, n: str):
|
|||||||
return f.read()
|
return f.read()
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def split_template(s: str) -> (List[str], str):
|
def split_template(s: str) -> Tuple[List[str], str]:
|
||||||
return re.findall(r"{([^}]+)}", s), re.sub(r"{([^}]+)}", "{}", s)
|
return re.findall(r"{([^}]+)}", s), re.sub(r"{([^}]+)}", "{}", s)
|
||||||
|
|
||||||
def apply_template(path: Path, name: str):
|
def apply_template(path: Path, name: str):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user