Skip to content
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

code cleanup #1793

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pdf_build_src/process_markdowns.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def correct_tables(root_path, debug=False):
for i, new_line in enumerate(content):
if i == start_line:
new_content.pop()
if i >= start_line and i < end_line:
if start_line <= i < end_line:
new_content.append("|".join(table[count]) + " \n")
count += 1
elif i == end_line:
Expand Down
3 changes: 1 addition & 2 deletions tools/add_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def emoji_map(reverse=False) -> dict[str, str]:
"tutorial": ":check_mark_button:",
"maintenance": ":construction:",
"financial": ":dollar_banknote:",
"infra": ":metro:",
}


Expand Down Expand Up @@ -333,7 +332,7 @@ def update_tributors(
"""ALLCONTRIB"""


def load_allcontrib(allcontrib_file: Path) -> None:
def load_allcontrib(allcontrib_file: Path) -> dict:
"""Load `.all-contributorsrc` file."""
with open(allcontrib_file, "r", encoding="utf8") as input_file:
return json.load(input_file)
Expand Down
2 changes: 1 addition & 1 deletion tools/mkdocs_macros_bids/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def make_metadata_table(field_info, src_path=None):

Parameters
----------
field_names : dict
field_info : dict
A list of the field names.
Field names correspond to filenames in the "metadata" directory of the
schema.
Expand Down
2 changes: 1 addition & 1 deletion tools/schemacode/bidsschematools/render/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def make_entity_table(schema, tablefmt="github", src_path=None, **kwargs):

Parameters
----------
schema_path : str
schema : str
Directory containing schema, which is stored in yaml files.
tablefmt : string, optional
The target table format. The default is "github" (GitHub format).
Expand Down
4 changes: 0 additions & 4 deletions tools/schemacode/bidsschematools/render/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,6 @@ def render_text(schema, key: str, src_path=None):
schema : dict
The BIDS schema.

object : str
The object to render the description for:
possible values correspond to the keys in schema["objects"].

key : str
The key of the object to render the description for:
possible values correspond to the keys in schema["objects"][object]
Expand Down
2 changes: 1 addition & 1 deletion tools/schemacode/bidsschematools/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def flatten_enums(namespace, inplace=True):

Parameters
----------
schema : dict
namespace : dict
Schema in dictionary form to be flattened.

Returns
Expand Down
16 changes: 12 additions & 4 deletions tools/schemacode/bidsschematools/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@

def _get_paths(
bids_paths,
pseudofile_suffixes=[],
pseudofile_suffixes=None,
dummy_paths=False,
exclude_files=[],
exclude_files=None,
):
"""
Get all paths from a list of directories, excluding hidden subdirectories from distribution.
Expand Down Expand Up @@ -166,6 +166,11 @@
first.
"""

if exclude_files is None:
exclude_files = []

Check warning on line 170 in tools/schemacode/bidsschematools/validator.py

View check run for this annotation

Codecov / codecov/patch

tools/schemacode/bidsschematools/validator.py#L170

Added line #L170 was not covered by tests
if pseudofile_suffixes is None:
pseudofile_suffixes = []

Check warning on line 172 in tools/schemacode/bidsschematools/validator.py

View check run for this annotation

Codecov / codecov/patch

tools/schemacode/bidsschematools/validator.py#L172

Added line #L172 was not covered by tests

path_list = []
bidsignore_list = []
bids_root_found = False
Expand Down Expand Up @@ -387,7 +392,7 @@

Parameters
----------
bids_paths : list or str
paths_list : list or str
A string pointing to a BIDS directory for which paths should be validated, or a list
of strings pointing to individual files or subdirectories which *all* reside within
one and only one BIDS directory root (i.e. nested datasets should be validated
Expand Down Expand Up @@ -548,7 +553,7 @@
report_path=False,
suppress_errors=False,
accept_non_bids_dir=False,
exclude_files=[],
exclude_files=None,
):
"""
Validate paths according to BIDS schema.
Expand Down Expand Up @@ -604,6 +609,9 @@
https://github.com/bids-standard/bids-specification/pull/969#issuecomment-1132119492
"""

if exclude_files is None:
exclude_files = []

if isinstance(in_paths, str):
in_paths = [in_paths]

Expand Down