From 602ea80490a2c949a1aa2541d26afda363e07f4e Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Sat, 2 Nov 2024 09:22:49 -0400 Subject: [PATCH] Fix more things. --- .circleci/get_data.py | 0 docs/conf.py | 3 +-- xcp_d/cli/combineqc.py | 0 xcp_d/cli/parser.py | 1 - xcp_d/cli/parser_utils.py | 20 ++++++++++---------- xcp_d/cli/run.py | 1 - xcp_d/config.py | 2 +- 7 files changed, 12 insertions(+), 15 deletions(-) mode change 100644 => 100755 .circleci/get_data.py mode change 100644 => 100755 xcp_d/cli/combineqc.py diff --git a/.circleci/get_data.py b/.circleci/get_data.py old mode 100644 new mode 100755 diff --git a/docs/conf.py b/docs/conf.py index a6b90464b..c60065d7d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,6 @@ # " for paragraphs import os import sys -from datetime import datetime import xcp_d @@ -91,7 +90,7 @@ # General information about the project. project = 'xcp_d' author = 'xcp_d team' -copyright = f'2021-{datetime.now().year}, {author}' +copyright = '2021-, {author}' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/xcp_d/cli/combineqc.py b/xcp_d/cli/combineqc.py old mode 100644 new mode 100755 diff --git a/xcp_d/cli/parser.py b/xcp_d/cli/parser.py index cade210d2..e4ad94fca 100644 --- a/xcp_d/cli/parser.py +++ b/xcp_d/cli/parser.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """The XCP-D preprocessing worklow. XCP-D preprocessing workflow diff --git a/xcp_d/cli/parser_utils.py b/xcp_d/cli/parser_utils.py index bec2c8ce9..a11dd2f55 100644 --- a/xcp_d/cli/parser_utils.py +++ b/xcp_d/cli/parser_utils.py @@ -21,9 +21,9 @@ def _int_or_auto(string, is_parser=True): error = argparse.ArgumentTypeError if is_parser else ValueError try: intarg = int(string) - except ValueError: + except ValueError as exc: msg = "Argument must be a nonnegative integer or 'auto'." - raise error(msg) + raise error(msg) from exc if intarg < 0: raise error('Int argument must be nonnegative.') @@ -38,9 +38,9 @@ def _float_or_auto(string, is_parser=True): error = argparse.ArgumentTypeError if is_parser else ValueError try: floatarg = float(string) - except ValueError: + except ValueError as exc: msg = "Argument must be a nonnegative float or 'auto'." - raise error(msg) + raise error(msg) from exc if floatarg < 0: raise error('Float argument must be nonnegative.') @@ -55,9 +55,9 @@ def _float_or_auto_or_none(string, is_parser=True): error = argparse.ArgumentTypeError if is_parser else ValueError try: floatarg = float(string) - except ValueError: + except ValueError as exc: msg = f"Argument must be a nonnegative float, 'all', or 'none', not '{string}'." - raise error(msg) + raise error(msg) from exc if floatarg < 0: raise error('Float argument must be nonnegative.') @@ -68,8 +68,8 @@ def _restricted_float(x): """From https://stackoverflow.com/a/12117065/2589328.""" try: x = float(x) - except ValueError: - raise argparse.ArgumentTypeError(f'{x} not a floating-point literal') + except ValueError as exc: + raise argparse.ArgumentTypeError(f'{x} not a floating-point literal') from exc if x < 0.0 or x > 1.0: raise argparse.ArgumentTypeError(f'{x} not in range [0.0, 1.0]') @@ -120,8 +120,8 @@ def _bids_filter(value, parser): if Path(value).exists(): try: return loads(Path(value).read_text(), object_hook=_filter_pybids_none_any) - except JSONDecodeError: - raise parser.error(f'JSON syntax error in: <{value}>.') + except JSONDecodeError as exc: + raise parser.error(f'JSON syntax error in: <{value}>.') from exc else: raise parser.error(f'Path does not exist: <{value}>.') diff --git a/xcp_d/cli/run.py b/xcp_d/cli/run.py index 8d57faf74..5e6eed0bd 100644 --- a/xcp_d/cli/run.py +++ b/xcp_d/cli/run.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """The XCP-D postprocessing worklow. XCP-D postprocessing workflow diff --git a/xcp_d/config.py b/xcp_d/config.py index 01a025f9d..bab748d4b 100644 --- a/xcp_d/config.py +++ b/xcp_d/config.py @@ -214,7 +214,7 @@ class _Config: """An abstract class forbidding instantiation.""" - _paths = tuple() + _paths = () def __init__(self): """Avert instantiation."""