Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tuneit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
tuneit
Commits
5399178d
Commit
5399178d
authored
Mar 14, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add wildcard pattern support to FileSearcher using fnmatch
parent
da38af10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
searcher.py
src/settings/searcher.py
+6
-5
No files found.
src/settings/searcher.py
View file @
5399178d
import
os
import
fnmatch
from
.backends
import
FileBackend
...
...
@@ -82,13 +83,13 @@ class FileSearcher(Searcher):
result
.
extend
([
os
.
path
.
join
(
root
,
f
)
for
f
in
files
if
f
.
endswith
(
self
.
pattern
)
if
f
nmatch
.
fnmatch
(
f
,
self
.
pattern
)
and
not
self
.
is_excluded
(
os
.
path
.
join
(
root
,
f
))
])
else
:
if
os
.
path
.
isfile
(
base_path
)
and
base_path
.
endswith
(
self
.
pattern
)
:
if
not
self
.
is_excluded
(
base_path
):
if
os
.
path
.
isfile
(
base_path
):
filename
=
os
.
path
.
basename
(
base_path
)
if
fnmatch
.
fnmatch
(
filename
,
self
.
pattern
)
and
not
self
.
is_excluded
(
base_path
):
result
.
append
(
base_path
)
else
:
try
:
...
...
@@ -96,7 +97,7 @@ class FileSearcher(Searcher):
os
.
path
.
join
(
base_path
,
f
)
for
f
in
os
.
listdir
(
base_path
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
base_path
,
f
))
and
f
.
endswith
(
self
.
pattern
)
and
f
nmatch
.
fnmatch
(
f
,
self
.
pattern
)
and
not
self
.
is_excluded
(
os
.
path
.
join
(
base_path
,
f
))
])
except
PermissionError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment