-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude hidden folders when walking through script definitions #697
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,9 +262,17 @@ def load_config_model(self, name, user, parameter_values=None, skip_invalid_para | |
def _visit_script_configs(self, visitor): | ||
configs_dir = self._script_configs_folder | ||
|
||
# We will ignore folders with this prefixes (ie: hidden folders) | ||
exclude_prefixes=('.') | ||
|
||
files = [] | ||
# Read config file from within directories too | ||
for _root, _dirs, _files in os.walk(configs_dir, topdown=True): | ||
# In place exlustion of _dirs with exlusion prefixes | ||
_dirs[:] = [_dirs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work, I'm afraid, since Basically, you need to use |
||
for _dirs in _dirs | ||
if not _dirs.startswith(exclude_prefixes)] | ||
|
||
for name in _files: | ||
files.append(os.path.join(_root, name)) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to have a list or tuple of prefixes, you have to use
('.',)
(note comma) or['.']
.But then in the check below, you will have to iterate over prefixes, rather than doing
startswith(exclude_prefixes)
immediatelyI'm fine, if you define just a single string, but please rename the variable then