diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py index 787b819916..96208dd0cf 100644 --- a/beets/autotag/hooks.py +++ b/beets/autotag/hooks.py @@ -18,7 +18,7 @@ from collections import namedtuple from functools import total_ordering import re -from typing import Dict, List, Tuple, Iterator, Union, Any, Optional,\ +from typing import Dict, List, Tuple, Iterator, Union, Any, Optional, \ Iterable, Callable, cast from beets import logging diff --git a/beets/dbcore/query.py b/beets/dbcore/query.py index 9c04dc0ee6..2e8d6eb2cc 100644 --- a/beets/dbcore/query.py +++ b/beets/dbcore/query.py @@ -108,7 +108,7 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}()" def __eq__(self, other) -> bool: - return type(self) == type(other) + return type(self) is type(other) def __hash__(self) -> int: """Minimalistic default implementation of a hash. @@ -868,7 +868,7 @@ def __hash__(self) -> int: return 0 def __eq__(self, other) -> bool: - return type(self) == type(other) + return type(self) is type(other) class MultipleSort(Sort): @@ -1014,7 +1014,7 @@ def __bool__(self) -> bool: return False def __eq__(self, other) -> bool: - return type(self) == type(other) or other is None + return type(self) is type(other) or other is None def __hash__(self) -> int: return 0 diff --git a/beets/importer.py b/beets/importer.py index 18e4bf0f12..15b5acc3d0 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -1363,7 +1363,7 @@ def _freshen_items(items): def _extend_pipeline(tasks, *stages): # Return pipeline extension for stages with list of tasks - if type(tasks) == list: + if isinstance(tasks, list): task_iter = iter(tasks) else: task_iter = tasks diff --git a/beetsplug/acousticbrainz.py b/beetsplug/acousticbrainz.py index cda0012cfa..eeb22cfdb8 100644 --- a/beetsplug/acousticbrainz.py +++ b/beetsplug/acousticbrainz.py @@ -323,11 +323,11 @@ def _data_to_scheme_child(self, subdata, subscheme, composites): """ for k, v in subscheme.items(): if k in subdata: - if type(v) == dict: + if isinstance(v, dict): yield from self._data_to_scheme_child(subdata[k], v, composites) - elif type(v) == tuple: + elif isinstance(v, tuple): composite_attribute, part_number = v attribute_parts = composites[composite_attribute] # Parts are not guaranteed to be inserted in order diff --git a/test/test_datequery.py b/test/test_datequery.py index 56664e212b..7432cffc62 100644 --- a/test/test_datequery.py +++ b/test/test_datequery.py @@ -19,7 +19,7 @@ from datetime import datetime, timedelta import unittest import time -from beets.dbcore.query import _parse_periods, DateInterval, DateQuery,\ +from beets.dbcore.query import _parse_periods, DateInterval, DateQuery, \ InvalidQueryArgumentValueError diff --git a/test/test_mbsync.py b/test/test_mbsync.py index d1c5e48b0e..443aa044ed 100644 --- a/test/test_mbsync.py +++ b/test/test_mbsync.py @@ -16,7 +16,7 @@ import unittest from unittest.mock import patch -from test.helper import TestHelper,\ +from test.helper import TestHelper, \ generate_album_info, \ generate_track_info, \ capture_log