Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 15, 2024
1 parent db5b70f commit 9e9756b
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
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

0 comments on commit 9e9756b

Please sign in to comment.