diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c712ea..373c00b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,39 +1,40 @@ default_language_version: - python: python3 + python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: "v4.5.0" hooks: - - id: check-added-large-files - - id: check-docstring-first - - id: check-executables-have-shebangs - - id: check-merge-conflict - - id: check-symlinks - - id: check-yaml - args: - - "--allow-multiple-documents" - # https://github.com/pre-commit/pre-commit-hooks/issues/273 - - "--unsafe" - - id: detect-private-key - - id: mixed-line-ending - - id: debug-statements - - id: trailing-whitespace - args: [--markdown-linebreak-ext=md] # Do not process Markdown files. - - id: end-of-file-fixer - - id: check-ast - - id: check-builtin-literals - - id: check-docstring-first - - id: check-toml + - id: check-added-large-files + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + args: + - "--allow-multiple-documents" + # https://github.com/pre-commit/pre-commit-hooks/issues/273 + - "--unsafe" + - id: detect-private-key + - id: mixed-line-ending + - id: debug-statements + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] # Do not process Markdown files. + - id: end-of-file-fixer + - id: check-ast + - id: check-builtin-literals + - id: check-docstring-first + - id: check-toml - repo: https://github.com/PyCQA/flake8 rev: "7.0.0" hooks: - id: flake8 - additional_dependencies: [ - "git+https://github.com/RedHatQE/flake8-plugins.git", - "flake8-mutable", - ] + additional_dependencies: + [ + "git+https://github.com/RedHatQE/flake8-plugins.git", + "flake8-mutable", + ] - repo: https://github.com/Yelp/detect-secrets rev: v1.4.0 @@ -56,3 +57,10 @@ repos: rev: 37.264.0 hooks: - id: renovate-config-validator + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.9.0 + hooks: + - id: mypy + exclude: ^(tests/) + additional_dependencies: [types-all] diff --git a/pyhelper_utils/general.py b/pyhelper_utils/general.py index 7b2c580..5ea8e80 100644 --- a/pyhelper_utils/general.py +++ b/pyhelper_utils/general.py @@ -2,7 +2,7 @@ from time import sleep from functools import wraps from logging import Logger -from typing import Any +from typing import Any, Optional def tts(ts: Any) -> int: @@ -22,9 +22,9 @@ def tts(ts: Any) -> int: Returns: int: Time in seconds """ - try: - time_and_unit = re.match(r"(?P