Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: "22.1.0"
rev: "24.10.0"
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: "5.10.1"
rev: "5.13.2"
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: "4.0.1"
rev: "7.1.1"
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.931"
rev: "v1.13.0"
hooks:
- id: mypy
files: ^sphinx_github_changelog/
args: ["--ignore-missing-imports", "--scripts-are-modules"]

- repo: https://github.com/asottile/pyupgrade
rev: "v2.31.0"
rev: "v3.19.0"
hooks:
- id: pyupgrade

- repo: https://github.com/PyCQA/doc8
rev: "0.10.1"
rev: "v1.1.2"
hooks:
- id: doc8
3 changes: 2 additions & 1 deletion septentrion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from other modules to get the information it needs, then format it and display
it.
"""

import functools
import logging
import os
Expand Down Expand Up @@ -60,7 +61,7 @@ class CommaSeparatedMultipleString(StringParamType):
envvar_list_splitter = ","

def split_envvar_value(self, rv: str):
values = super(CommaSeparatedMultipleString, self).split_envvar_value(rv)
values = super().split_envvar_value(rv)
return tuple(value.strip() for value in values)


Expand Down
3 changes: 2 additions & 1 deletion septentrion/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This is the code around settings loading. For a definition of
the settings, see cli.py (for now)
"""

import configparser
import logging
import pathlib
Expand Down Expand Up @@ -68,7 +69,7 @@ def read_default_configuration_files() -> Tuple[str, pathlib.Path]:


def read_configuration_file(path: pathlib.Path) -> str:
with open(path, "r") as handler:
with open(path) as handler:
logger.info(f"Reading configuration from {path}")
return handler.read()

Expand Down
1 change: 1 addition & 0 deletions septentrion/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This is where the migration plan is computed, by merging information
from the existing files (septentrion.files) and from the db (septentrion.db)
"""

import logging
from typing import Any, Dict, Iterable, Optional

Expand Down
2 changes: 1 addition & 1 deletion septentrion/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def execute(
conn.commit()


class Query(object):
class Query:
def __init__(
self,
settings: configuration.Settings,
Expand Down
3 changes: 1 addition & 2 deletions septentrion/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,4 @@ def list_migrations_and_paths(

def file_lines_generator(path: pathlib.Path):
with open(path) as f:
for line in f:
yield line
yield from f
3 changes: 1 addition & 2 deletions septentrion/migration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import io
import logging
import pathlib
Expand Down Expand Up @@ -192,6 +191,6 @@ def create_fake_entries(

def run_script(settings: configuration.Settings, path: pathlib.Path) -> None:
logger.info("Running SQL file %s", path)
with io.open(path, "r", encoding="utf8") as f:
with open(path, encoding="utf8") as f:
script = runner.Script(settings=settings, file_handler=f, path=path)
script.run()
2 changes: 1 addition & 1 deletion septentrion/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
colorama.init()


class Stylist(object):
class Stylist:
styles: Dict[str, str] = {
"reset": colorama.Style.RESET_ALL,
"title": colorama.Fore.CYAN + colorama.Style.BRIGHT,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _run_script(script):
path = tmp_path / "script.sql"
path.write_text(script)

with io.open(path, "r", encoding="utf8") as f:
with open(path, encoding="utf8") as f:
script = Script(settings, f, path)
script.run()

Expand Down Expand Up @@ -65,7 +65,7 @@ def test_run_integer_in_settings(db, settings_factory, env, tmp_path):
settings.PORT = 5432
path = tmp_path / "script.sql"
path.write_text("SELECT 1;")
with io.open(path, "r", encoding="utf8") as f:
with open(path, encoding="utf8") as f:
script = Script(settings, f, path)
script.run()

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def test_load_configuration_files_value(caplog, conf, expected, has_warning):

def test_load_configuration_files_value_from_file(caplog, mocker):
with open(
pathlib.Path(__file__).parents[2] / "tests/test_data/config_file.ini", "r"
) as f:
pathlib.Path(__file__).parents[2] / "tests/test_data/config_file.ini") as f:
configuration.load_configuration_files(value=f)


Expand Down
Loading