Skip to content

Commit

Permalink
User ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
leifwar committed Sep 27, 2023
1 parent 84af135 commit e1853b4
Show file tree
Hide file tree
Showing 24 changed files with 776 additions and 1,874 deletions.
60 changes: 18 additions & 42 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,24 @@
---
default_language_version:
python: python3
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: debug-statements
- id: detect-private-key
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/hadialqattan/pycln
rev: v2.2.2
- id: check-json
- id: check-merge-conflict
- id: debug-statements
- id: detect-private-key
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
hooks:
- id: pycln
args: [--all]
- repo: https://github.com/psf/black
rev: 23.7.0
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- pyflakes
- pycodestyle
- flake8-bugbear
- flake8-comprehensions
- flake8-eradicate
- flake8-mutable
- flake8-simplify
- flake8-builtins
- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
rev: v1.0.6
hooks:
- id: python-bandit-vulnerability-check
args: [-ll, -ii, --exclude, ./.venv/*, --recursive, .]
pass_filenames: false
always_run: true
- id: black
8 changes: 4 additions & 4 deletions cimsparql/async_sparql_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Optional
from typing import Any

import httpx
from SPARQLWrapper import JSON, SPARQLWrapper
Expand All @@ -21,11 +21,11 @@


class AsyncSparqlWrapper(SPARQLWrapper):
def __init__(self, *args, **kwargs):
self.ca_bundle: Optional[str] = kwargs.pop("ca_bundle", None)
def __init__(self, *args: Any, **kwargs: dict[str, Any]) -> None:
self.ca_bundle: str | None = kwargs.pop("ca_bundle", None)
super().__init__(*args, **kwargs)

async def queryAndConvert(self) -> dict:
async def queryAndConvert(self) -> dict: # noqa N802
if self.returnFormat != JSON:
raise NotImplementedError("Async client only support JSON return format")

Expand Down
7 changes: 4 additions & 3 deletions cimsparql/data_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime as dt
from typing import ClassVar

import pandas as pd
import pandera as pa
Expand All @@ -8,7 +9,7 @@
class JsonSchemaOut(pa.SchemaModel):
class Config:
to_format = "json"
to_format_kwargs = {"orient": "table"}
to_format_kwargs: ClassVar[dict[str, str]] = {"orient": "table"}
coerce = True


Expand Down Expand Up @@ -103,8 +104,8 @@ class SynchronousMachinesSchema(NamedMarketResourceSchema):
station_group: Series[str] = pa.Field(nullable=True)
station_group_name: Series[str] = pa.Field(nullable=True)
station: Series[str] = pa.Field()
maxP: Series[float] = pa.Field(nullable=True)
minP: Series[float] = pa.Field(nullable=True)
maxP: Series[float] = pa.Field(nullable=True) # noqa N815
minP: Series[float] = pa.Field(nullable=True) # noqa N815
MO: Series[float] = pa.Field(nullable=True)
bidzone: Series[str] = pa.Field(nullable=True)
sn: Series[float] = pa.Field()
Expand Down
Loading

0 comments on commit e1853b4

Please sign in to comment.