Skip to content

Commit

Permalink
Merge pull request #511 from afuetterer/pre-commit-update
Browse files Browse the repository at this point in the history
build: update pre-commit hooks
  • Loading branch information
huberrob authored Jul 23, 2024
2 parents 200945c + cbd5888 commit 87adea3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: end-of-file-fixer
exclude_types: [svg]
Expand All @@ -15,7 +15,7 @@ repos:
- id: file-contents-sorter
files: ^fuji_server\/data\/.*.txt$
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.13.0
hooks:
- id: pretty-format-ini
args: [--autofix]
Expand All @@ -24,14 +24,14 @@ repos:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
rev: v1.5.5
hooks:
- id: insert-license
types: [python]
args: [--license-filepath=docs/license_header.txt]
exclude: docs
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.5.1
hooks:
- id: ruff
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
Expand Down
6 changes: 3 additions & 3 deletions fuji_server/helper/metadata_collector_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ def parse_metadata(self):
if isinstance(rdf_response.get("@context"), list):
for ctxi, ctxt in enumerate(rdf_response.get("@context")):
if "schema.org" in ctxt:
rdf_response["@context"][
ctxi
] = "https://schema.org/docs/jsonldcontext.json"
rdf_response["@context"][ctxi] = (
"https://schema.org/docs/jsonldcontext.json"
)
if isinstance(rdf_response.get("@context"), str):
if "schema.org" in rdf_response.get("@context"):
rdf_response["@context"] = "https://schema.org/docs/jsonldcontext.json"
Expand Down
6 changes: 3 additions & 3 deletions fuji_server/helper/request_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@ def content_negotiate(self, metric_id="", ignore_html=True):
xmltree = lxml.etree.XML(self.response_content, xmlparser)
root_element = xmltree.tag
if content_truncated:
self.parse_response = (
self.response_content
) = lxml.etree.tostring(xmltree)
self.parse_response = self.response_content = (
lxml.etree.tostring(xmltree)
)
except Exception:
self.logger.warning(
"%s : Parsing XML document failed !" % metric_id
Expand Down
6 changes: 3 additions & 3 deletions fuji_server/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _deserialize(data, klass):

if klass in (int, float, str, bool):
return _deserialize_primitive(data, klass)
elif klass == object:
elif klass is object:
return _deserialize_object(data)
elif klass == datetime.date:
return deserialize_date(data)
Expand All @@ -30,9 +30,9 @@ def _deserialize(data, klass):
# if klass.__extra__ == dict:
# return _deserialize_dict(data, klass.__args__[1])
elif hasattr(klass, "__origin__"):
if klass.__origin__ == list or klass.__origin__ == list:
if klass.__origin__ is list or klass.__origin__ is list:
return _deserialize_list(data, klass.__args__[0])
if klass.__origin__ == dict:
if klass.__origin__ is dict:
return _deserialize_dict(data, klass.__args__[1])
else:
return deserialize_model(data, klass)
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,15 @@ ignore = [

[tool.ruff.lint.isort]
known-first-party = ["fuji_server", "tests"]

[tool.ruff.lint.per-file-ignores]
# Note: ruff does not understand, that the logger, which gets passed through multiple inheritance is actually
# a logger instance. It would not apply f-strings to logging messages. But let's ignore UP031 and UP032 for now.
"fuji_server/evaluators/*.py" = [
"UP031", # printf-string-formatting
"UP032" # f-string
]
"fuji_server/helper/*.py" = [
"UP031", # printf-string-formatting
"UP032" # f-string
]
1 change: 1 addition & 0 deletions tests/helper/test_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
They mock the fuji_server/data path to not override the files under fuji server
"""

import json
from typing import Any

Expand Down

0 comments on commit 87adea3

Please sign in to comment.