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
9 changes: 7 additions & 2 deletions pylama/config_toml.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"""Pylama TOML configuration."""

import toml
import sys

from pylama.libs.inirama import Namespace as _Namespace

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib


class Namespace(_Namespace):
"""Inirama-style wrapper for TOML config."""

def parse(self, source: str, update: bool = True, **params):
"""Parse TOML source as string."""
content = toml.loads(source)
content = tomllib.loads(source)
tool = content.get("tool", {})
pylama = tool.get("pylama", {})
linters = pylama.pop("linter", {})
Expand Down
3 changes: 1 addition & 2 deletions requirements/requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ radon >= 5.1.0
mypy
pylint >= 2.11.1
pylama-quotes
toml
tomli >= 1.2.3 ; python_version < "3.11"
vulture

types-setuptools
types-toml
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def parse_requirements(path: str) -> "list[str]":
extras_require=dict(
tests=parse_requirements("requirements/requirements-tests.txt"),
all=OPTIONAL_LINTERS, **{linter: [linter] for linter in OPTIONAL_LINTERS},
toml="toml>=0.10.2",
toml="tomli>=1.2.3; python_version < '3.11'",
),
)