Skip to content

Commit 3672b9d

Browse files
committed
move prefix_path arg to CppPathIncFilter
1 parent e931974 commit 3672b9d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

elixir/filters/cpppathinc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from typing import List
23
from .utils import Filter, FilterContext, encode_number, decode_number, extension_matches
34

45
# Filters for cpp includes like these:
@@ -8,8 +9,10 @@
89
# If we make references to other projects, we could
910
# end up with links to headers which are outside the project
1011
# Example: u-boot/v2023.10/source/env/embedded.c#L16
12+
# prefix_path: a list of paths, will be used to replace the prefix path during the untransform_formatted_code step
1113
class CppPathIncFilter(Filter):
12-
def __init__(self, *args, **kwargs):
14+
def __init__(self, prefix_path: List[str] = ["include"], *args, **kwargs):
15+
self.prefix_path = prefix_path
1316
super().__init__(*args, **kwargs)
1417
self.cpppathinc = []
1518

elixir/filters/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ class FilterContext:
2828
# up to the filter, but it's important to be careful to not break formatting.
2929
# The second part runs on HTML, replacing markings left by the first part with HTML code.
3030
# path_exceptions: list of regexes, disables filter if path of the filtered file matches a regex from the list
31-
# prefix_path: a list of paths, will be used to replace the prefix path during the untransform_formatted_code step
3231
class Filter:
33-
def __init__(self, path_exceptions: List[str] = [], prefix_path: List[str] = ["include"]):
32+
def __init__(self, path_exceptions: List[str] = []):
3433
self.path_exceptions = path_exceptions
35-
self.prefix_path = prefix_path
3634

3735
# Return True if filter can be applied to file with path
3836
def check_if_applies(self, ctx: FilterContext) -> bool:

0 commit comments

Comments
 (0)