Skip to content

Commit

Permalink
temporal: Fix bare except clauses in datetime_math.py (OSGeo#4949)
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Jan 14, 2025
1 parent 0c6e7a8 commit 4af7d72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ per-file-ignores =
# TODO: Is this really needed?
python/grass/jupyter/__init__.py: E501
python/grass/pygrass/vector/__init__.py: E402
python/grass/temporal/datetime_math.py: E722
python/grass/temporal/spatial_topology_dataset_connector.py: E722
python/grass/temporal/temporal_algebra.py: E722
# Current benchmarks/tests are changing sys.path before import.
Expand Down
4 changes: 2 additions & 2 deletions python/grass/temporal/datetime_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from dateutil import parser

has_dateutil = True
except:
except (ImportError, ModuleNotFoundError):
has_dateutil = False


Expand Down Expand Up @@ -811,7 +811,7 @@ def check_datetime_string(time_string: str, use_dateutil: bool = True):

try:
return datetime.strptime(time_string, time_format)
except:
except (ValueError, TypeError):
return _("Unable to parse time string: %s") % time_string


Expand Down

0 comments on commit 4af7d72

Please sign in to comment.