Skip to content

Commit 56f6667

Browse files
author
Bittor Alaña
committed
Apply Ruff formatting
1 parent 49509b5 commit 56f6667

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Tip: If you use google chrome, you can also view the print version of a page ins
3535

3636
## Code Style
3737

38-
Make sure your code *roughly* follows [PEP-8](https://www.python.org/dev/peps/pep-0008/) and keeps things consistent with the rest of the code. I recommended using [black](https://github.com/psf/black) to automatically format your code.
38+
Make sure your code *roughly* follows [PEP-8](https://www.python.org/dev/peps/pep-0008/) and keeps things consistent with the rest of the code. I recommended using [Ruff](https://github.com/astral-sh/ruff) to automatically format your code.
3939

4040
We use google-style docstrings.
4141

src/mkdocs_print_site_plugin/exclude.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
import fnmatch
99
from typing import List
1010

11-
11+
1212
import fnmatch
1313
import os
1414
from typing import List
1515

16+
1617
def exclude(path: str, exclude_patterns: List[str]) -> bool:
1718
"""
1819
Check if a path should be excluded based on a list of patterns.
19-
20+
2021
Args:
2122
path: The path to check
2223
exclude_patterns: List of glob patterns to exclude
23-
24+
2425
Returns:
2526
True if the path should be excluded, False otherwise
2627
"""
@@ -29,27 +30,27 @@ def exclude(path: str, exclude_patterns: List[str]) -> bool:
2930

3031
if not exclude_patterns:
3132
return False
32-
33+
3334
# Normalize path separators to handle both Windows and Unix paths
34-
path = path.replace('\\', '/')
35-
35+
path = path.replace("\\", "/")
36+
3637
for pattern in exclude_patterns:
3738
# Normalize pattern separators
38-
pattern = pattern.replace('\\', '/')
39-
39+
pattern = pattern.replace("\\", "/")
40+
4041
# Check for directory patterns (ending with /)
41-
if pattern.endswith('/'):
42-
if path.startswith(pattern) or path.startswith(pattern[:-1] + '/'):
42+
if pattern.endswith("/"):
43+
if path.startswith(pattern) or path.startswith(pattern[:-1] + "/"):
4344
return True
4445
# Regular glob pattern matching
4546
elif fnmatch.fnmatch(path, pattern):
4647
return True
4748
# Check if path is in a directory that matches the pattern
48-
elif '/' in path:
49-
path_parts = path.split('/')
49+
elif "/" in path:
50+
path_parts = path.split("/")
5051
for i in range(1, len(path_parts)):
51-
partial_path = '/'.join(path_parts[:i])
52+
partial_path = "/".join(path_parts[:i])
5253
if fnmatch.fnmatch(partial_path, pattern) or partial_path == pattern:
5354
return True
54-
55-
return False
55+
56+
return False

src/mkdocs_print_site_plugin/renderer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,4 @@ def _set_inner_heading_styles(self, id: str, prefix: str, level: int) -> str:
254254
"""
255255
h_level += 1
256256

257-
return result
257+
return result

0 commit comments

Comments
 (0)