From 16e6ff98c904ef0ec8b03ba3ce6e1eb00204c328 Mon Sep 17 00:00:00 2001 From: Giovanni Pizzi Date: Tue, 11 Jan 2022 19:23:52 +0100 Subject: [PATCH] FIX: mypy dependency problem and revert unnecessary file rename (#132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the version of mypy and of the SQLAlchemy dependency (the latter was needed to avoid some INTERNAL ERRORs when running mypy): - [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.1.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v4.1.0) - [github.com/asottile/pyupgrade: v2.29.1 → v2.31.0](https://github.com/asottile/pyupgrade/compare/v2.29.1...v2.31.0) - [github.com/pre-commit/mirrors-mypy: v0.910-1 → v0.930](https://github.com/pre-commit/mirrors-mypy/compare/v0.910-1...v0.930) This also reverts commit 9eda5b8e8c6b4aa72a8cb36418382f9ea20cf307. --- .pre-commit-config.yaml | 8 ++++---- disk_objectstore/container.py | 2 +- disk_objectstore/{db.py => database.py} | 0 performance-benchmarks/validation-calls/performance.txt | 2 +- tests/concurrent_tests/periodic_worker.py | 2 +- tests/test_container.py | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) rename disk_objectstore/{db.py => database.py} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a88a9f..dce4dbe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ exclude: &exclude_files > repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: check-json - id: check-yaml @@ -55,7 +55,7 @@ repos: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v2.29.1 + rev: v2.31.0 hooks: - id: pyupgrade args: [--py37-plus] @@ -78,10 +78,10 @@ repos: - pytest==6.2.4 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910-1 + rev: v0.931 hooks: - id: mypy additional_dependencies: - - "sqlalchemy[mypy]==1.4.22" + - "sqlalchemy[mypy]==1.4.29" - typing-extensions files: ^(disk_objectstore/.*py)$ diff --git a/disk_objectstore/container.py b/disk_objectstore/container.py index 0f6009a..63f9b8f 100644 --- a/disk_objectstore/container.py +++ b/disk_objectstore/container.py @@ -37,7 +37,7 @@ from sqlalchemy.sql import func from sqlalchemy.sql.expression import delete, select, text, update -from .db import Obj, get_session +from .database import Obj, get_session from .exceptions import InconsistentContent, NotExistent, NotInitialised from .utils import ( CallbackStreamWrapper, diff --git a/disk_objectstore/db.py b/disk_objectstore/database.py similarity index 100% rename from disk_objectstore/db.py rename to disk_objectstore/database.py diff --git a/performance-benchmarks/validation-calls/performance.txt b/performance-benchmarks/validation-calls/performance.txt index 169c0c5..bd32bc6 100644 --- a/performance-benchmarks/validation-calls/performance.txt +++ b/performance-benchmarks/validation-calls/performance.txt @@ -3,7 +3,7 @@ from sqlalchemy import func from tqdm import tqdm -from disk_objectstore.db import Obj +from disk_objectstore.database import Obj from disk_objectstore import Container from disk_objectstore.utils import PackedObjectReader, StreamDecompresser, get_hash c = Container('test-newrepo-sdb/') diff --git a/tests/concurrent_tests/periodic_worker.py b/tests/concurrent_tests/periodic_worker.py index 00c1854..d2c5ac3 100755 --- a/tests/concurrent_tests/periodic_worker.py +++ b/tests/concurrent_tests/periodic_worker.py @@ -23,7 +23,7 @@ from sqlalchemy.sql.expression import select from disk_objectstore.container import Container, NotExistent, ObjectType -from disk_objectstore.db import Obj +from disk_objectstore.database import Obj MAX_RETRIES_NO_PERM = 1000 diff --git a/tests/test_container.py b/tests/test_container.py index 4bfbd66..da1b1df 100644 --- a/tests/test_container.py +++ b/tests/test_container.py @@ -14,7 +14,7 @@ import pytest import disk_objectstore.exceptions as exc -from disk_objectstore import CompressMode, Container, ObjectType, db, utils +from disk_objectstore import CompressMode, Container, ObjectType, database, utils COMPRESSION_ALGORITHMS_TO_TEST = ["zlib+1", "zlib+9"] @@ -2233,9 +2233,9 @@ def test_validate_overlapping_packed(temp_container): # pylint: disable=invalid assert not any(errors.values()) # Change the offset of the second object so that it's overlapping - temp_container._get_cached_session().query(db.Obj).filter( - db.Obj.hashkey == hashkey_second - ).update({db.Obj.offset: db.Obj.offset - 1}) + temp_container._get_cached_session().query(database.Obj).filter( + database.Obj.hashkey == hashkey_second + ).update({database.Obj.offset: database.Obj.offset - 1}) errors = temp_container.validate() problems = errors.pop("overlapping_packed")