From ef5d7e2920a4153e3c908b091655d580fdb989cc Mon Sep 17 00:00:00 2001 From: bagel897 Date: Wed, 31 Jan 2024 22:27:37 -0600 Subject: [PATCH] update pre-commit --- .pre-commit-config.yaml | 6 +++--- docs/conf.py | 1 + rope/base/project.py | 1 + rope/contrib/autoimport/sqlite.py | 6 +++--- rope/refactor/move.py | 2 +- ropetest/contrib/autoimporttest.py | 5 +++-- ropetest/refactor/extracttest.py | 4 ++-- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 875269763..d24a9b8e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,20 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-added-large-files - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 24.1.1 hooks: - id: black name: black check (Python) - repo: https://github.com/pycqa/isort - rev: 5.11.3 + rev: 5.13.2 hooks: - id: isort name: Sort imports (Python) diff --git a/docs/conf.py b/docs/conf.py index d50a9cbcf..9313fcb16 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,6 +12,7 @@ # import os import sys + sys.path.insert(0, os.path.abspath("..")) diff --git a/rope/base/project.py b/rope/base/project.py index 067a74037..84ea237d1 100644 --- a/rope/base/project.py +++ b/rope/base/project.py @@ -1,4 +1,5 @@ from __future__ import annotations + import contextlib import json import os diff --git a/rope/contrib/autoimport/sqlite.py b/rope/contrib/autoimport/sqlite.py index 2af7baab6..ceee25980 100644 --- a/rope/contrib/autoimport/sqlite.py +++ b/rope/contrib/autoimport/sqlite.py @@ -2,15 +2,15 @@ import contextlib import json -from hashlib import sha256 -import secrets import re +import secrets import sqlite3 import sys import warnings from collections import OrderedDict from concurrent.futures import Future, ProcessPoolExecutor, as_completed from datetime import datetime +from hashlib import sha256 from itertools import chain from pathlib import Path from threading import local @@ -21,8 +21,8 @@ from rope.base.resources import Resource from rope.contrib.autoimport import models from rope.contrib.autoimport.defs import ( - ModuleFile, Alias, + ModuleFile, Name, NameType, Package, diff --git a/rope/refactor/move.py b/rope/refactor/move.py index 0ce59dab0..4240288d9 100644 --- a/rope/refactor/move.py +++ b/rope/refactor/move.py @@ -8,7 +8,7 @@ from __future__ import annotations import typing -from typing import Optional, List, Union +from typing import List, Optional, Union from rope.base import ( codeanalyze, diff --git a/ropetest/contrib/autoimporttest.py b/ropetest/contrib/autoimporttest.py index d72f3f23f..d2f481daa 100644 --- a/ropetest/contrib/autoimporttest.py +++ b/ropetest/contrib/autoimporttest.py @@ -171,9 +171,10 @@ def test_skipping_directories_not_accessible_because_of_permission_error(self): # The single thread test takes much longer than the multithread test but is easier to debug single_thread = False self.importer.generate_modules_cache(single_thread=single_thread) - + # Create a temporary directory and set permissions to 000 - import tempfile, sys + import sys + import tempfile with tempfile.TemporaryDirectory() as dir: import os os.chmod(dir, 0o000) diff --git a/ropetest/refactor/extracttest.py b/ropetest/refactor/extracttest.py index e8c2fc206..4b34d58d3 100644 --- a/ropetest/refactor/extracttest.py +++ b/ropetest/refactor/extracttest.py @@ -1149,7 +1149,7 @@ def xxx_test_raising_exception_on_function_parens(self): end = code.rindex(")") + 1 with self.assertRaises(rope.base.exceptions.RefactoringError): self.do_extract_method(code, start, end, "new_func") - + def test_raising_exception_on_incomplete_block(self): code = dedent("""\ if True: @@ -1177,7 +1177,7 @@ def test_raising_exception_on_incomplete_block_3(self): code = dedent("""\ if True: a = 1 - + b = 2 """) start = code.index("if")