-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Pylama TOML configuration.""" | ||
|
||
import toml | ||
|
||
from pylama.libs.inirama import Namespace as _Namespace | ||
|
||
|
||
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) | ||
tool = content.get("tool", {}) | ||
pylama = tool.get("pylama", {}) | ||
linters = pylama.pop("linter", {}) | ||
files = pylama.pop("files", []) | ||
|
||
for name, value in pylama.items(): | ||
self["pylama"][name] = value | ||
|
||
for linter, options in linters.items(): | ||
for name, value in options.items(): | ||
self[f"pylama:{linter}"][name] = value | ||
|
||
for file in files: | ||
path = file.pop("path", None) | ||
if path is None: | ||
continue | ||
for name, value in file.items(): | ||
self[f"pylama:{path}"][name] = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ radon >= 5.1.0 | |
mypy | ||
pylint >= 2.11.1 | ||
pylama-quotes | ||
toml | ||
vulture | ||
|
||
types-setuptools | ||
types-toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters