-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from 153957/ruff
Replace flake8 by ruff and add type annotations
- Loading branch information
Showing
12 changed files
with
109 additions
and
52 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
version: '3.7' | ||
services: | ||
|
||
services: | ||
pelican: | ||
image: 'python:3.11' | ||
restart: unless-stopped | ||
|
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 @@ | ||
"""Custom Pelican plugins used for this project""" |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
""" | ||
libsass | ||
"""libsass | ||
This plugin compiles sass/scss files to plain css. | ||
""" | ||
import sass | ||
|
||
from pelican import signals | ||
from pelican import Pelican, signals | ||
|
||
SETTINGS_NAME = 'LIBSASS_PATHS' | ||
|
||
|
||
def compile_sass(instance): | ||
""" | ||
Compile SASS/SCSS with libsass to CSS | ||
""" | ||
def compile_sass(instance: Pelican) -> None: | ||
"""Compile SASS/SCSS with libsass to CSS""" | ||
paths = instance.settings.get(SETTINGS_NAME, []) | ||
|
||
for input_output_paths in paths: | ||
sass.compile(dirname=input_output_paths) | ||
|
||
|
||
def register(): | ||
def register() -> None: | ||
"""Register with pelican""" | ||
signals.finalized.connect(compile_sass) |
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
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,47 @@ | ||
[tool.black] | ||
target-version = ['py311'] | ||
line-length = 120 | ||
skip-string-normalization = true | ||
|
||
[tool.ruff] | ||
line-length = 120 | ||
target-version = 'py311' | ||
format = 'github' | ||
|
||
select = [ | ||
# https://github.com/charliermarsh/ruff#supported-rules | ||
'ALL', | ||
'E111', 'E112', 'E113', 'E114', 'E115', 'E116', 'E117', | ||
'E201', 'E202', 'E203', | ||
'E211', | ||
'E221', 'E222', 'E223', 'E224', 'E225', 'E226', 'E227', 'E228', | ||
'E231', | ||
'E251', 'E252', | ||
'E261', 'E262', 'E265', 'E266', | ||
'E271', 'E272', 'E273', 'E274', 'E275', | ||
] | ||
|
||
ignore = [ | ||
'D213', # Start multi-line docstring on first line | ||
'D203', # Had to disable one of these (D211) | ||
'D400', # Do not require . at end of first line in docstring | ||
'D415', # Do not require ./!/? at end of first line in docstring | ||
'EM102', # Allow f-string in exception message | ||
'Q', # Currently use single quotes | ||
'SLF001', # Allow accessing private attributes | ||
'TRY003', # Allow long messages in exceptions | ||
] | ||
|
||
[tool.ruff.isort] | ||
lines-between-types = 1 | ||
section-order = [ | ||
'future', | ||
'standard-library', | ||
'third-party', | ||
'pelican', | ||
'first-party', | ||
'local-folder', | ||
] | ||
|
||
[tool.ruff.isort.sections] | ||
pelican = ['pelican'] |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
flake8 | ||
flake8-isort | ||
ruff |