Skip to content

Commit 086dff8

Browse files
committed
Fixes for PR #503
1 parent b4c75f7 commit 086dff8

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

autoapi/_mapper.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ def _link_objs(value):
230230

231231
# Strip off the extra "\ "
232232
return result[:-2]
233-
233+
234+
234235
def _path_matches_patterns(path, patterns):
235236
"""Check if a path matches one of multiple patterns
236237
@@ -325,22 +326,21 @@ def find_files(patterns, dirs, ignore):
325326
for _dir in dirs: # iterate autoapi_dirs
326327
for root, subdirectories, filenames in os.walk(_dir):
327328
# skip directories if needed
328-
for sub_dir in subdirectories.copy():
329+
for sub_dir in subdirectories.copy():
329330
# iterate copy as we adapt subdirectories during loop
330-
if _path_matches_patterns(os.path.join(root, sub_dir), ignore) == True:
331+
if _path_matches_patterns(os.path.join(root, sub_dir), ignore):
331332
LOGGER.info(
332333
colorize("bold", "[AutoAPI] ")
333334
+ colorize(
334-
"darkgreen", f"Ignoring directory: {root}/{sub_dir}/")
335+
"darkgreen", f"Ignoring directory: {root}/{sub_dir}/"
336+
)
335337
)
336338
# adapt original subdirectories inplace
337339
subdirectories.remove(sub_dir)
338340
# recurse into remaining directories
339341
seen = set()
340342
for pattern, pattern_re in pattern_regexes:
341343
for filename in fnmatch.filter(filenames, pattern):
342-
skip_file = False
343-
344344
match = re.match(pattern_re, filename)
345345
norm_name = match.groups()
346346
if norm_name in seen:
@@ -351,7 +351,8 @@ def find_files(patterns, dirs, ignore):
351351
LOGGER.info(
352352
colorize("bold", "[AutoAPI] ")
353353
+ colorize(
354-
"darkgreen", f"Ignoring file: {root}/{filename}")
354+
"darkgreen", f"Ignoring file: {root}/{filename}"
355+
)
355356
)
356357
continue
357358

docs/changes/312.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Can exclude directories from being documented

docs/reference/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Customisation Options
9090

9191
Default: ``['*migrations*']``
9292

93-
A list of patterns to ignore when finding files.
93+
A list of patterns to ignore when finding directories and files to document.
9494

9595
.. confval:: autoapi_root
9696

0 commit comments

Comments
 (0)