Skip to content
Open
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
8 changes: 6 additions & 2 deletions kalamine/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
from pathlib import Path
from typing import Dict, List, Optional, Set, Type, TypeVar

try:
import tomllib
except ImportError:
import tomli as tomllib

import click
import tomli
import yaml

from .utils import (
Expand All @@ -32,7 +36,7 @@ def load_descriptor(file_path: Path) -> Dict:
return yaml.load(file, Loader=yaml.SafeLoader)

with file_path.open(mode="rb") as dfile:
return tomli.load(dfile)
return tomllib.load(dfile)

try:
cfg = load_descriptor(layout_path)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"click>=8.0",
"livereload",
"pyyaml",
"tomli",
"tomli;python_version<'3.11'",
"progress",
]

Expand Down
7 changes: 5 additions & 2 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
from pathlib import Path
from typing import Dict

import tomli
try:
import tomllib
except ImportError:
import tomli as tomllib


def get_layout_dict(filename: str) -> Dict:
"""Return the layout directory path."""

file_path = Path(__file__).parent.parent / f"layouts/{filename}.toml"
with file_path.open(mode="rb") as file:
return tomli.load(file)
return tomllib.load(file)