diff --git a/docs/source/conf.py b/docs/source/conf.py index 6cc41bed..7fd1b4f1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # diff --git a/src/wily/__main__.py b/src/wily/__main__.py index d89f8a0c..e83be651 100644 --- a/src/wily/__main__.py +++ b/src/wily/__main__.py @@ -1,4 +1,3 @@ -# -*- coding: UTF-8 -*- """Main command line.""" import click diff --git a/src/wily/archivers/__init__.py b/src/wily/archivers/__init__.py index e440c6de..833de7c1 100644 --- a/src/wily/archivers/__init__.py +++ b/src/wily/archivers/__init__.py @@ -25,7 +25,7 @@ class Revision: deleted_files: List[str] -class BaseArchiver(object): +class BaseArchiver: """Abstract Archiver Class.""" def revisions(self, path: str, max_revisions: int) -> List[Revision]: diff --git a/src/wily/cache.py b/src/wily/cache.py index bf11593f..6206eda3 100644 --- a/src/wily/cache.py +++ b/src/wily/cache.py @@ -35,7 +35,7 @@ def exists(config): return False index_path = pathlib.Path(config.cache_path) / "index.json" if index_path.exists(): - with open(index_path, "r") as out: + with open(index_path) as out: index = json.load(out) if index["version"] != __version__: # TODO: Inspect the versions properly. @@ -216,7 +216,7 @@ def get_default_metrics(config): o = resolve_operator(operator) if o.cls.default_metric_index is not None: metric = o.cls.metrics[o.cls.default_metric_index] - default_metrics.append("{0}.{1}".format(o.cls.name, metric.name)) + default_metrics.append(f"{o.cls.name}.{metric.name}") return default_metrics diff --git a/src/wily/commands/diff.py b/src/wily/commands/diff.py index 4798acb3..77815d64 100644 --- a/src/wily/commands/diff.py +++ b/src/wily/commands/diff.py @@ -145,12 +145,12 @@ def diff(config, files, metrics, changes_only=True, detail=True, revision=None): ) ) else: - metrics_data.append("{0:n} -> {1:n}".format(current, new)) + metrics_data.append(f"{current:n} -> {new:n}") else: if current == "-" and new == "-": metrics_data.append("-") else: - metrics_data.append("{0} -> {1}".format(current, new)) + metrics_data.append(f"{current} -> {new}") if has_changes or not changes_only: results.append((file, *metrics_data)) else: diff --git a/src/wily/config.py b/src/wily/config.py index f838ee6c..9de1aa1b 100644 --- a/src/wily/config.py +++ b/src/wily/config.py @@ -39,7 +39,7 @@ def generate_cache_path(path): @dataclass -class WilyConfig(object): +class WilyConfig: """ Wily configuration. diff --git a/src/wily/lang.py b/src/wily/lang.py index 38828db3..d5625b77 100644 --- a/src/wily/lang.py +++ b/src/wily/lang.py @@ -1,5 +1,4 @@ """Language/i18n support for the CLI.""" -# -*- coding: UTF-8 -*- import gettext import os diff --git a/src/wily/operators/__init__.py b/src/wily/operators/__init__.py index 2c0737b5..88a3d659 100644 --- a/src/wily/operators/__init__.py +++ b/src/wily/operators/__init__.py @@ -37,7 +37,7 @@ class OperatorLevel(Enum): Object = 2 -class BaseOperator(object): +class BaseOperator: """Abstract Operator Class.""" """Name of the operator.""" diff --git a/src/wily/state.py b/src/wily/state.py index 9bb38ee2..cfa34417 100644 --- a/src/wily/state.py +++ b/src/wily/state.py @@ -14,7 +14,7 @@ @dataclass -class IndexedRevision(object): +class IndexedRevision: """Union of revision and the operators executed.""" revision: Revision @@ -108,7 +108,7 @@ def store(self, config, archiver, stats): return cache.store(config, archiver, self.revision, stats) -class Index(object): +class Index: """The index of the wily cache.""" operators = None @@ -206,7 +206,7 @@ def save(self): cache.store_archiver_index(self.config, self.archiver, data) -class State(object): +class State: """ The wily process state. diff --git a/test/integration/test_build.py b/test/integration/test_build.py index 368d4d19..e24a5abd 100644 --- a/test/integration/test_build.py +++ b/test/integration/test_build.py @@ -11,7 +11,7 @@ import pytest from click.testing import CliRunner from git import Repo, Actor -from mock import patch +from unittest.mock import patch import wily.__main__ as main from wily.archivers import ALL_ARCHIVERS diff --git a/test/integration/test_graph.py b/test/integration/test_graph.py index e584ff64..2ab6015c 100644 --- a/test/integration/test_graph.py +++ b/test/integration/test_graph.py @@ -1,5 +1,5 @@ import sys -from mock import patch +from unittest.mock import patch import tempfile from click.testing import CliRunner diff --git a/test/unit/test_archivers.py b/test/unit/test_archivers.py index b9927f69..51655d3e 100644 --- a/test/unit/test_archivers.py +++ b/test/unit/test_archivers.py @@ -1,19 +1,19 @@ import pathlib import pytest -from mock import patch +from unittest.mock import patch import wily.archivers import wily.archivers.git as git import wily.config -class MockAuthor(object): +class MockAuthor: name = "Mr Test" email = "test@test.com" -class MockStats(object): +class MockStats: files = {} @@ -21,7 +21,7 @@ class MockStats(object): TEST_STATS = MockStats() -class MockCommit(object): +class MockCommit: name_rev = "1234 bbb" author = TEST_AUTHOR committed_date = "1/1/1990" @@ -33,11 +33,11 @@ def __init__(self, message): self.message = message -class MockHead(object): +class MockHead: is_detached = False -class MockRepo(object): +class MockRepo: active_branch = "master" bare = False _is_dirty = False diff --git a/test/unit/test_build_unit.py b/test/unit/test_build_unit.py index c7e76561..5f2fdbc2 100644 --- a/test/unit/test_build_unit.py +++ b/test/unit/test_build_unit.py @@ -1,5 +1,5 @@ import pytest -from mock import patch +from unittest.mock import patch import wily.commands.build as build from wily.config import DEFAULT_CONFIG diff --git a/test/unit/test_cli.py b/test/unit/test_cli.py index f6957c1c..b952f656 100644 --- a/test/unit/test_cli.py +++ b/test/unit/test_cli.py @@ -1,7 +1,7 @@ import pytest from click.testing import CliRunner -from mock import patch +from unittest.mock import patch from pathlib import Path import wily.__main__ as main diff --git a/test/unit/test_cyclomatic.py b/test/unit/test_cyclomatic.py index a40e23ef..dab50b31 100644 --- a/test/unit/test_cyclomatic.py +++ b/test/unit/test_cyclomatic.py @@ -1,12 +1,12 @@ """ Tests for the cyclomatic complexity operator's ability to handle bad data from radon. """ -import mock +from unittest import mock import wily.operators.cyclomatic from wily.config import DEFAULT_CONFIG -class MockCC(object): +class MockCC: results = {}