Skip to content

Commit

Permalink
Merge pull request #115 from musicinmybrain/tomllib
Browse files Browse the repository at this point in the history
Use tomllib instead of PyPI toml on Python 3.11 and later
  • Loading branch information
15r10nk authored Sep 18, 2024
2 parents 45a6779 + 2a0c072 commit 0b95cd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies = [
"click>=8.1.4",
"executing>=2.1.0",
"rich>=13.7.1",
"toml>=0.10.2",
"types-toml>=0.10.8.7",
"toml>=0.10.2; python_version < '3.11'",
"types-toml>=0.10.8.7; python_version < '3.11'",
"typing-extensions"
]
description = "golden master/snapshot/approval testing library which puts the values right into your source code"
Expand Down
8 changes: 6 additions & 2 deletions src/inline_snapshot/_config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import os
import sys
from dataclasses import dataclass
from dataclasses import field
from pathlib import Path
from typing import List

import toml
if sys.version_info >= (3, 11):
from tomllib import loads
else:
from toml import loads


@dataclass
Expand All @@ -20,7 +24,7 @@ def read_config(path: Path) -> Config:
result = Config()
if path.exists():

data = toml.loads(path.read_text("utf-8"))
data = loads(path.read_text("utf-8"))

try:
config = data["tool"]["inline-snapshot"]
Expand Down

0 comments on commit 0b95cd5

Please sign in to comment.