Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Jun 19, 2024
1 parent 264034d commit af80626
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: check-json
- id: trailing-whitespace
exclude: README.md

- repo: https://github.com/ambv/black
rev: 23.12.0
rev: 24.4.2
hooks:
- id: black
name: Blacken
Expand All @@ -26,7 +26,7 @@ repos:
language: system

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.0
hooks:
- id: flake8
args: [--count, --show-source, --statistics]
Expand Down
1 change: 1 addition & 0 deletions optimade_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Voilà/Jupyter client for searching through OPTIMADE databases.
"""

from .informational import OptimadeClientFAQ, HeaderDescription, OptimadeLog
from .query_provider import OptimadeQueryProviderWidget
from .query_filter import OptimadeQueryFilterWidget
Expand Down
16 changes: 10 additions & 6 deletions optimade_client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ class OptimadeClientError(Exception):
def __init__(self, *args: Tuple[Any]):
LOGGER.error(
"%s raised.\nError message: %s\nAbout this exception: %s",
args[0].__class__.__name__
if args and isinstance(args[0], Exception)
else self.__class__.__name__,
(
args[0].__class__.__name__
if args and isinstance(args[0], Exception)
else self.__class__.__name__
),
str(args[0]) if args else "",
args[0].__doc__
if args and isinstance(args[0], Exception)
else self.__doc__,
(
args[0].__doc__
if args and isinstance(args[0], Exception)
else self.__doc__
),
)
super().__init__(*args)

Expand Down
1 change: 1 addition & 0 deletions optimade_client/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Logging to both file and widget"""

import logging
from logging.handlers import RotatingFileHandler
import os
Expand Down
10 changes: 4 additions & 6 deletions optimade_client/subwidgets/provider_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ def _set_child_dbs(
new_data.insert(0, ("", [(first_choice, None)]))
self.child_dbs.grouping = new_data

def _update_child_dbs(
self, data: List[dict], skip_dbs: List[str] = None
) -> Tuple[
def _update_child_dbs(self, data: List[dict], skip_dbs: List[str] = None) -> Tuple[
List[str],
List[List[Union[str, List[Tuple[str, LinksResourceAttributes]]]]],
]:
Expand Down Expand Up @@ -510,9 +508,9 @@ def _query( # pylint: disable=too-many-locals,too-many-branches,too-many-statem
queries = {key: value[0] for key, value in queries.items()}

if "filter" in queries:
queries[
"filter"
] = f"( {queries['filter']} ) AND ( {filter_value} )"
queries["filter"] = (
f"( {queries['filter']} ) AND ( {filter_value} )"
)
else:
queries["filter"] = filter_value

Expand Down
6 changes: 3 additions & 3 deletions optimade_client/subwidgets/sort_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ def _change_order(self, change: dict) -> None:
"""
descending: bool = change["new"]
self.order = Order.DESCENDING if descending else Order.ASCENDING
self.order_select.description = (
self.order_select.tooltip
) = self.order.name.capitalize()
self.order_select.description = self.order_select.tooltip = (
self.order.name.capitalize()
)
self.order_select.icon = self._get_order_icon()
self._toggle_sort_availability()

Expand Down
16 changes: 10 additions & 6 deletions optimade_client/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ class OptimadeClientWarning(Warning):
def __init__(self, *args: Tuple[Any]):
LOGGER.warning(
"%s warned.\nWarning message: %s\nAbout this warning: %s",
args[0].__class__.__name__
if args and isinstance(args[0], Exception)
else self.__class__.__name__,
(
args[0].__class__.__name__
if args and isinstance(args[0], Exception)
else self.__class__.__name__
),
str(args[0]) if args else "",
args[0].__doc__
if args and isinstance(args[0], Exception)
else self.__doc__,
(
args[0].__doc__
if args and isinstance(args[0], Exception)
else self.__doc__
),
)
super().__init__(*args)
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test root utils.py functions"""

# pylint: disable=import-error


Expand Down

0 comments on commit af80626

Please sign in to comment.