diff --git a/cgi-bin/server.py b/cgi-bin/server.py index 701d1dd..4c7a443 100755 --- a/cgi-bin/server.py +++ b/cgi-bin/server.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -9,10 +8,15 @@ # Distributed under terms of the GNU AGPLv3 license. from supysonic.web import create_application + app = create_application() -if __name__ == '__main__': - if app: - import sys - app.run(host = sys.argv[1] if len(sys.argv) > 1 else None, port = int(sys.argv[2]) if len(sys.argv) > 2 else 5000, debug = True) +if __name__ == "__main__": + if app: + import sys + app.run( + host=sys.argv[1] if len(sys.argv) > 1 else None, + port=int(sys.argv[2]) if len(sys.argv) > 2 else 5000, + debug=True, + ) diff --git a/setup.py b/setup.py index 738b92d..0bdfc07 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/supysonic/__init__.py b/supysonic/__init__.py index 5317c5d..d9bb7bc 100644 --- a/supysonic/__init__.py +++ b/supysonic/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/api/annotation.py b/supysonic/api/annotation.py index 3a8e736..dae6fd8 100644 --- a/supysonic/api/annotation.py +++ b/supysonic/api/annotation.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -25,7 +23,7 @@ from .exceptions import AggregateException, GenericError, MissingParameter, NotF def star_single(cls, eid): - """ Stars an entity + """Stars an entity :param cls: entity class, Folder, Artist, Album or Track :param eid: id of the entity to star @@ -47,7 +45,7 @@ def star_single(cls, eid): def unstar_single(cls, eid): - """ Unstars an entity + """Unstars an entity :param cls: entity class, Folder, Artist, Album or Track :param eid: id of the entity to unstar diff --git a/supysonic/api/chat.py b/supysonic/api/chat.py index b40f0e8..f5faa7a 100644 --- a/supysonic/api/chat.py +++ b/supysonic/api/chat.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/api/errors.py b/supysonic/api/errors.py index f04973e..7842524 100644 --- a/supysonic/api/errors.py +++ b/supysonic/api/errors.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/api/exceptions.py b/supysonic/api/exceptions.py index 401726b..6a1a80e 100644 --- a/supysonic/api/exceptions.py +++ b/supysonic/api/exceptions.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -30,7 +28,7 @@ class GenericError(SubsonicAPIException): api_code = 0 def __init__(self, message, *args, **kwargs): - super(GenericError, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.message = message @@ -41,14 +39,14 @@ class ServerError(GenericError): class UnsupportedParameter(GenericError): def __init__(self, parameter, *args, **kwargs): message = "Unsupported parameter '{}'".format(parameter) - super(UnsupportedParameter, self).__init__(message, *args, **kwargs) + super().__init__(message, *args, **kwargs) class MissingParameter(SubsonicAPIException): api_code = 10 def __init__(self, *args, **kwargs): - super(MissingParameter, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.message = "A required parameter is missing." @@ -90,13 +88,13 @@ class NotFound(SubsonicAPIException): api_code = 70 def __init__(self, entity, *args, **kwargs): - super(NotFound, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.message = "{} not found".format(entity) class AggregateException(SubsonicAPIException): def __init__(self, exceptions, *args, **kwargs): - super(AggregateException, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.exceptions = [] for exc in exceptions: @@ -114,7 +112,7 @@ class AggregateException(SubsonicAPIException): if len(self.exceptions) == 1: return self.exceptions[0].get_response() - codes = set(exc.api_code for exc in self.exceptions) + codes = {exc.api_code for exc in self.exceptions} errors = [ dict(code=exc.api_code, message=exc.message) for exc in self.exceptions ] diff --git a/supysonic/api/formatters.py b/supysonic/api/formatters.py index de01099..2321b96 100644 --- a/supysonic/api/formatters.py +++ b/supysonic/api/formatters.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -13,7 +11,7 @@ from xml.etree import ElementTree from . import API_VERSION -class BaseFormatter(object): +class BaseFormatter: def make_response(self, elem, data): raise NotImplementedError() @@ -93,12 +91,12 @@ class JSONPFormatter(JSONBaseFormatter): class XMLFormatter(BaseFormatter): def __dict2xml(self, elem, dictionary): """Convert a dict structure to xml. The game is trivial. Nesting uses the [] parenthesis. - ex. { 'musicFolder': {'id': 1234, 'name': "sss" } } - ex. { 'musicFolder': [{'id': 1234, 'name': "sss" }, {'id': 456, 'name': "aaa" }]} - ex. { 'musicFolders': {'musicFolder' : [{'id': 1234, 'name': "sss" }, {'id': 456, 'name': "aaa" }] } } - ex. { 'index': [{'name': 'A', 'artist': [{'id': '517674445', 'name': 'Antonello Venditti'}] }] } - ex. {"subsonic-response": { "musicFolders": {"musicFolder": [{ "id": 0,"name": "Music"}]}, - "status": "ok","version": "1.7.0","xmlns": "http://subsonic.org/restapi"}} + ex. { 'musicFolder': {'id': 1234, 'name': "sss" } } + ex. { 'musicFolder': [{'id': 1234, 'name': "sss" }, {'id': 456, 'name': "aaa" }]} + ex. { 'musicFolders': {'musicFolder' : [{'id': 1234, 'name': "sss" }, {'id': 456, 'name': "aaa" }] } } + ex. { 'index': [{'name': 'A', 'artist': [{'id': '517674445', 'name': 'Antonello Venditti'}] }] } + ex. {"subsonic-response": { "musicFolders": {"musicFolder": [{ "id": 0,"name": "Music"}]}, + "status": "ok","version": "1.7.0","xmlns": "http://subsonic.org/restapi"}} """ if not isinstance(dictionary, dict): raise TypeError("Expecting a dict") diff --git a/supysonic/api/jukebox.py b/supysonic/api/jukebox.py index 02fcef4..63276d6 100644 --- a/supysonic/api/jukebox.py +++ b/supysonic/api/jukebox.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/api/media.py b/supysonic/api/media.py index 50a7bc6..28e7477 100644 --- a/supysonic/api/media.py +++ b/supysonic/api/media.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -332,7 +330,7 @@ def lyrics(): logger.debug("Found lyrics file: " + lyrics_path) try: - with open(lyrics_path, "rt") as f: + with open(lyrics_path) as f: lyrics = f.read() except UnicodeError: # Lyrics file couldn't be decoded. Rather than displaying an error, try with the potential next files or diff --git a/supysonic/api/playlists.py b/supysonic/api/playlists.py index 056a2de..bb0b60f 100644 --- a/supysonic/api/playlists.py +++ b/supysonic/api/playlists.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/api/radio.py b/supysonic/api/radio.py index 65e7fc3..e035d75 100644 --- a/supysonic/api/radio.py +++ b/supysonic/api/radio.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/api/search.py b/supysonic/api/search.py index 1e67524..a15a6b6 100644 --- a/supysonic/api/search.py +++ b/supysonic/api/search.py @@ -86,7 +86,14 @@ def old_search(): @api.route("/search2.view", methods=["GET", "POST"]) def new_search(): query = request.values["query"] - artist_count, artist_offset, album_count, album_offset, song_count, song_offset = map( + ( + artist_count, + artist_offset, + album_count, + album_offset, + song_count, + song_offset, + ) = map( request.values.get, [ "artistCount", @@ -131,7 +138,14 @@ def new_search(): @api.route("/search3.view", methods=["GET", "POST"]) def search_id3(): query = request.values["query"] - artist_count, artist_offset, album_count, album_offset, song_count, song_offset = map( + ( + artist_count, + artist_offset, + album_count, + album_offset, + song_count, + song_offset, + ) = map( request.values.get, [ "artistCount", diff --git a/supysonic/api/system.py b/supysonic/api/system.py index 95a9027..b8c724a 100644 --- a/supysonic/api/system.py +++ b/supysonic/api/system.py @@ -1,4 +1,3 @@ -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/supysonic/api/unsupported.py b/supysonic/api/unsupported.py index 0a76c1f..99c0174 100644 --- a/supysonic/api/unsupported.py +++ b/supysonic/api/unsupported.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/cache.py b/supysonic/cache.py index 88e620e..939ac79 100644 --- a/supysonic/cache.py +++ b/supysonic/cache.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -38,7 +36,7 @@ CacheEntry = namedtuple("CacheEntry", ["size", "expires"]) NULL_ENTRY = CacheEntry(0, 0) -class Cache(object): +class Cache: """Provides a common interface for caching files to disk""" # Modeled after werkzeug.contrib.cache.FileSystemCache diff --git a/supysonic/cli.py b/supysonic/cli.py index 52eb469..e40db65 100755 --- a/supysonic/cli.py +++ b/supysonic/cli.py @@ -33,7 +33,7 @@ class TimedProgressDisplay: def __call__(self, name, scanned): if time.time() - self.__last_display > self.__interval: - progress = "Scanning '{0}': {1} files scanned".format(name, scanned) + progress = "Scanning '{}': {} files scanned".format(name, scanned) self.__stdout.write("\b" * self.__last_len) self.__stdout.write(progress) self.__stdout.flush() @@ -188,7 +188,7 @@ class SupysonicCLI(cmd.Cmd): self.write_line("Name\t\tPath\n----\t\t----") self.write_line( "\n".join( - "{0: <16}{1}".format(f.name, f.path) + "{: <16}{}".format(f.name, f.path) for f in Folder.select(lambda f: f.root) ) ) @@ -354,7 +354,7 @@ class SupysonicCLI(cmd.Cmd): self.write_line("----\t\t-----\t-------\t-----") self.write_line( "\n".join( - "{0: <16}{1}\t{2}\t{3}".format( + "{: <16}{}\t{}\t{}".format( u.name, "*" if u.admin else "", "*" if u.jukebox else "", u.mail ) for u in User.select() @@ -393,16 +393,16 @@ class SupysonicCLI(cmd.Cmd): else: if admin: user.admin = True - self.write_line("Granted '{0}' admin rights".format(name)) + self.write_line("Granted '{}' admin rights".format(name)) elif noadmin: user.admin = False - self.write_line("Revoked '{0}' admin rights".format(name)) + self.write_line("Revoked '{}' admin rights".format(name)) if jukebox: user.jukebox = True - self.write_line("Granted '{0}' jukebox rights".format(name)) + self.write_line("Granted '{}' jukebox rights".format(name)) elif nojukebox: user.jukebox = False - self.write_line("Revoked '{0}' jukebox rights".format(name)) + self.write_line("Revoked '{}' jukebox rights".format(name)) @db_session def user_changepass(self, name, password): diff --git a/supysonic/config.py b/supysonic/config.py index d86d09d..3d913b2 100644 --- a/supysonic/config.py +++ b/supysonic/config.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -21,7 +19,7 @@ def get_current_config(): return current_config or DefaultConfig() -class DefaultConfig(object): +class DefaultConfig: DEBUG = False tempdir = os.path.join(tempfile.gettempdir(), "supysonic") @@ -67,7 +65,7 @@ class IniConfig(DefaultConfig): ] def __init__(self, paths): - super(IniConfig, self).__init__() + super().__init__() parser = RawConfigParser() parser.read(paths) diff --git a/supysonic/covers.py b/supysonic/covers.py index 3c1ed38..2b06ed6 100644 --- a/supysonic/covers.py +++ b/supysonic/covers.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -27,7 +25,7 @@ NAMING_SCORE_RULES = ( ) -class CoverFile(object): +class CoverFile: __clean_regex = re.compile(r"[^a-z]") @staticmethod @@ -63,7 +61,7 @@ def is_valid_cover(path): warnings.simplefilter("ignore") with Image.open(path): return True - except IOError: + except OSError: return False diff --git a/supysonic/daemon/__init__.py b/supysonic/daemon/__init__.py index 9833732..d8a67e5 100644 --- a/supysonic/daemon/__init__.py +++ b/supysonic/daemon/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 - # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/daemon/__main__.py b/supysonic/daemon/__main__.py index fd3fc9b..b15b5b2 100755 --- a/supysonic/daemon/__main__.py +++ b/supysonic/daemon/__main__.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/supysonic/daemon/client.py b/supysonic/daemon/client.py index 9f3b096..46540b8 100644 --- a/supysonic/daemon/client.py +++ b/supysonic/daemon/client.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -16,7 +14,7 @@ from ..utils import get_secret_key __all__ = ["DaemonClient"] -class DaemonCommand(object): +class DaemonCommand: def apply(self, connection, daemon): raise NotImplementedError() @@ -102,7 +100,7 @@ class JukeboxCommand(DaemonCommand): connection.send(rv) -class DaemonCommandResult(object): +class DaemonCommandResult: pass @@ -128,7 +126,7 @@ class JukeboxResult(DaemonCommandResult): self.playlist = () -class DaemonClient(object): +class DaemonClient: def __init__(self, address=None): self.__address = address or get_current_config().DAEMON["socket"] self.__key = get_secret_key("daemon_key") @@ -138,7 +136,7 @@ class DaemonClient(object): raise DaemonUnavailableError("No daemon address set") try: return Client(address=self.__address, authkey=self.__key) - except IOError: + except OSError: raise DaemonUnavailableError( "Couldn't connect to daemon at {}".format(self.__address) ) diff --git a/supysonic/daemon/exceptions.py b/supysonic/daemon/exceptions.py index 3be86df..608e5c4 100644 --- a/supysonic/daemon/exceptions.py +++ b/supysonic/daemon/exceptions.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/daemon/server.py b/supysonic/daemon/server.py index fa2d07b..989825c 100644 --- a/supysonic/daemon/server.py +++ b/supysonic/daemon/server.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -26,7 +24,7 @@ __all__ = ["Daemon"] logger = logging.getLogger(__name__) -class Daemon(object): +class Daemon: def __init__(self, config): self.__config = config self.__listener = None diff --git a/supysonic/db.py b/supysonic/db.py index 77e1c73..2f81797 100755 --- a/supysonic/db.py +++ b/supysonic/db.py @@ -46,7 +46,7 @@ def sqlite_case_insensitive_like(db, connection): cursor.execute("PRAGMA case_sensitive_like = OFF") -class PathMixin(object): +class PathMixin: @classmethod def get(cls, *args, **kwargs): if kwargs: @@ -529,7 +529,7 @@ class Playlist(db.Entity): id=str(self.id), name=self.name if self.user.id == user.id - else "[%s] %s" % (self.user.name, self.name), + else "[{}] {}".format(self.user.name, self.name), owner=self.user.name, public=self.public, songCount=len(tracks), diff --git a/supysonic/frontend/__init__.py b/supysonic/frontend/__init__.py index 92c05bb..1378c4c 100644 --- a/supysonic/frontend/__init__.py +++ b/supysonic/frontend/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/frontend/folder.py b/supysonic/frontend/folder.py index 3bef1cb..1ab340e 100644 --- a/supysonic/frontend/folder.py +++ b/supysonic/frontend/folder.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/frontend/playlist.py b/supysonic/frontend/playlist.py index eaef8fe..ff6920b 100644 --- a/supysonic/frontend/playlist.py +++ b/supysonic/frontend/playlist.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/jukebox.py b/supysonic/jukebox.py index 2b8c49c..7de6f54 100644 --- a/supysonic/jukebox.py +++ b/supysonic/jukebox.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -22,7 +20,7 @@ from .db import Track logger = logging.getLogger(__name__) -class Jukebox(object): +class Jukebox: def __init__(self, cmd): self.__cmd = shlex.split(cmd) self.__playlist = [] diff --git a/supysonic/lastfm.py b/supysonic/lastfm.py index 8f260b5..acdf83b 100644 --- a/supysonic/lastfm.py +++ b/supysonic/lastfm.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/managers/__init__.py b/supysonic/managers/__init__.py index f87fa98..3ad5e49 100644 --- a/supysonic/managers/__init__.py +++ b/supysonic/managers/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/managers/folder.py b/supysonic/managers/folder.py index 36862e9..84573db 100644 --- a/supysonic/managers/folder.py +++ b/supysonic/managers/folder.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/scanner.py b/supysonic/scanner.py index c3f6a04..f56ff88 100644 --- a/supysonic/scanner.py +++ b/supysonic/scanner.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -26,14 +24,14 @@ from .db import RatingFolder, RatingTrack logger = logging.getLogger(__name__) -class StatsDetails(object): +class StatsDetails: def __init__(self): self.artists = 0 self.albums = 0 self.tracks = 0 -class Stats(object): +class Stats: def __init__(self): self.scanned = 0 self.added = StatsDetails() @@ -66,7 +64,7 @@ class Scanner(Thread): on_folder_end=None, on_done=None, ): - super(Scanner, self).__init__() + super().__init__() if extensions is not None and not isinstance(extensions, list): raise TypeError("Invalid extensions type") diff --git a/supysonic/schema/migration/mysql/20171230.py b/supysonic/schema/migration/mysql/20171230.py index 9b467a0..aece82b 100644 --- a/supysonic/schema/migration/mysql/20171230.py +++ b/supysonic/schema/migration/mysql/20171230.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -# vim:fenc=utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -45,10 +42,10 @@ def process_table(connection, table, fields, nullable_fields=()): sql = "UPDATE {0} SET {1}=%s WHERE {1}=%s".format(table, field) c.executemany(sql, map(lambda v: (UUID(v).bytes, v), values)) for field in fields: - sql = "ALTER TABLE {0} MODIFY {1} BINARY(16) NOT NULL".format(table, field) + sql = "ALTER TABLE {} MODIFY {} BINARY(16) NOT NULL".format(table, field) c.execute(sql) for field in nullable_fields: - sql = "ALTER TABLE {0} MODIFY {1} BINARY(16)".format(table, field) + sql = "ALTER TABLE {} MODIFY {} BINARY(16)".format(table, field) c.execute(sql) connection.commit() diff --git a/supysonic/schema/migration/postgres/20180317.py b/supysonic/schema/migration/postgres/20180317.py index 416aa97..5f9216f 100644 --- a/supysonic/schema/migration/postgres/20180317.py +++ b/supysonic/schema/migration/postgres/20180317.py @@ -20,17 +20,17 @@ def process_table(connection, table): c = connection.cursor() c.execute( - r"ALTER TABLE {0} ADD COLUMN path_hash BYTEA NOT NULL DEFAULT E'\\0000'".format( + r"ALTER TABLE {} ADD COLUMN path_hash BYTEA NOT NULL DEFAULT E'\\0000'".format( table ) ) hashes = dict() - c.execute("SELECT path FROM {0}".format(table)) + c.execute("SELECT path FROM {}".format(table)) for row in c.fetchall(): hashes[row[0]] = hashlib.sha1(row[0].encode("utf-8")).digest() c.executemany( - "UPDATE {0} SET path_hash=%s WHERE path=%s".format(table), + "UPDATE {} SET path_hash=%s WHERE path=%s".format(table), [(bytes(h), p) for p, h in hashes.items()], ) diff --git a/supysonic/schema/migration/sqlite/20171230.py b/supysonic/schema/migration/sqlite/20171230.py index 7871614..6f48054 100644 --- a/supysonic/schema/migration/sqlite/20171230.py +++ b/supysonic/schema/migration/sqlite/20171230.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -# vim:fenc=utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/schema/migration/sqlite/20180317.py b/supysonic/schema/migration/sqlite/20180317.py index df97ac2..5888cc9 100644 --- a/supysonic/schema/migration/sqlite/20180317.py +++ b/supysonic/schema/migration/sqlite/20180317.py @@ -17,14 +17,14 @@ def process_table(connection, table): c = connection.cursor() c.execute( - "ALTER TABLE {0} ADD COLUMN path_hash BLOB NOT NULL DEFAULT ROWID".format(table) + "ALTER TABLE {} ADD COLUMN path_hash BLOB NOT NULL DEFAULT ROWID".format(table) ) hashes = dict() - for row in c.execute("SELECT path FROM {0}".format(table)): + for row in c.execute("SELECT path FROM {}".format(table)): hashes[row[0]] = hashlib.sha1(row[0].encode("utf-8")).digest() c.executemany( - "UPDATE {0} SET path_hash=? WHERE path=?".format(table), + "UPDATE {} SET path_hash=? WHERE path=?".format(table), [(bytes(h), p) for p, h in hashes.items()], ) diff --git a/supysonic/utils.py b/supysonic/utils.py index 09dec7b..266da2b 100644 --- a/supysonic/utils.py +++ b/supysonic/utils.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/supysonic/watcher.py b/supysonic/watcher.py index 9b8c194..956b088 100644 --- a/supysonic/watcher.py +++ b/supysonic/watcher.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -36,13 +34,11 @@ class SupysonicWatcherEventHandler(PatternMatchingEventHandler): patterns = list(map(lambda e: "*." + e.lower(), extensions.split())) + list( map(lambda e: "*" + e, covers.EXTENSIONS) ) - super(SupysonicWatcherEventHandler, self).__init__( - patterns=patterns, ignore_directories=True - ) + super().__init__(patterns=patterns, ignore_directories=True) def dispatch(self, event): try: - super(SupysonicWatcherEventHandler, self).dispatch(event) + super().dispatch(event) except Exception as e: # pragma: nocover logger.critical(e) @@ -85,7 +81,7 @@ class SupysonicWatcherEventHandler(PatternMatchingEventHandler): self.queue.put(event.dest_path, op, src_path=event.src_path) -class Event(object): +class Event: def __init__(self, path, operation, **kwargs): if operation & (OP_SCAN | OP_REMOVE) == (OP_SCAN | OP_REMOVE): raise Exception("Flags SCAN and REMOVE both set") # pragma: nocover @@ -131,7 +127,7 @@ class Event(object): class ScannerProcessingQueue(Thread): def __init__(self, delay): - super(ScannerProcessingQueue, self).__init__() + super().__init__() self.__timeout = delay self.__cond = Condition() @@ -254,7 +250,7 @@ class ScannerProcessingQueue(Thread): return None -class SupysonicWatcher(object): +class SupysonicWatcher: def __init__(self, config): self.__delay = config.DAEMON["wait_delay"] self.__handler = SupysonicWatcherEventHandler(config.BASE["scanner_extensions"]) diff --git a/supysonic/web.py b/supysonic/web.py index 7bc7282..2d05149 100644 --- a/supysonic/web.py +++ b/supysonic/web.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/__init__.py b/tests/__init__.py index 7ef23e2..36ba151 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/api/__init__.py b/tests/api/__init__.py index 3713050..b67211d 100644 --- a/tests/api/__init__.py +++ b/tests/api/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/api/apitestbase.py b/tests/api/apitestbase.py index ea75c2a..bad1c68 100644 --- a/tests/api/apitestbase.py +++ b/tests/api/apitestbase.py @@ -22,7 +22,7 @@ class ApiTestBase(TestBase): __with_api__ = True def setUp(self): - super(ApiTestBase, self).setUp() + super().setUp() xsd = etree.parse("tests/assets/subsonic-rest-api-1.10.2.xsd") self.schema = etree.XMLSchema(xsd) diff --git a/tests/api/test_album_songs.py b/tests/api/test_album_songs.py index c69a897..56598c0 100644 --- a/tests/api/test_album_songs.py +++ b/tests/api/test_album_songs.py @@ -21,7 +21,7 @@ class AlbumSongsTestCase(ApiTestBase): # Let's just check paramter validation and ensure coverage def setUp(self): - super(AlbumSongsTestCase, self).setUp() + super().setUp() with db_session: folder = Folder(name="Root", root=True, path="tests/assets") diff --git a/tests/api/test_annotation.py b/tests/api/test_annotation.py index 3a2120c..1f5099d 100644 --- a/tests/api/test_annotation.py +++ b/tests/api/test_annotation.py @@ -18,7 +18,7 @@ from .apitestbase import ApiTestBase class AnnotationTestCase(ApiTestBase): def setUp(self): - super(AnnotationTestCase, self).setUp() + super().setUp() with db_session: root = Folder(name="Root", root=True, path="tests") diff --git a/tests/api/test_api_setup.py b/tests/api/test_api_setup.py index 9a91f15..1166323 100644 --- a/tests/api/test_api_setup.py +++ b/tests/api/test_api_setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -22,7 +21,7 @@ class ApiSetupTestCase(TestBase): __with_api__ = True def setUp(self): - super(ApiSetupTestCase, self).setUp() + super().setUp() self._patch_client() def __basic_auth_get(self, username, password): diff --git a/tests/api/test_browse.py b/tests/api/test_browse.py index 273eab5..47321f0 100644 --- a/tests/api/test_browse.py +++ b/tests/api/test_browse.py @@ -20,7 +20,7 @@ from .apitestbase import ApiTestBase class BrowseTestCase(ApiTestBase): def setUp(self): - super(BrowseTestCase, self).setUp() + super().setUp() with db_session: Folder(root=True, name="Empty root", path="/tmp") diff --git a/tests/api/test_chat.py b/tests/api/test_chat.py index 60f158f..5c33f07 100644 --- a/tests/api/test_chat.py +++ b/tests/api/test_chat.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/api/test_lyrics.py b/tests/api/test_lyrics.py index 96ac17c..362bfcd 100644 --- a/tests/api/test_lyrics.py +++ b/tests/api/test_lyrics.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -21,7 +20,7 @@ from .apitestbase import ApiTestBase class LyricsTestCase(ApiTestBase): def setUp(self): - super(LyricsTestCase, self).setUp() + super().setUp() with db_session: folder = Folder( diff --git a/tests/api/test_media.py b/tests/api/test_media.py index e8847e0..0d1a528 100644 --- a/tests/api/test_media.py +++ b/tests/api/test_media.py @@ -22,7 +22,7 @@ from .apitestbase import ApiTestBase class MediaTestCase(ApiTestBase): def setUp(self): - super(MediaTestCase, self).setUp() + super().setUp() with db_session: folder = Folder( @@ -61,7 +61,7 @@ class MediaTestCase(ApiTestBase): artist=artist, album=album, path=os.path.abspath( - "tests/assets/formats/silence.{0}".format(self.formats[i]) + "tests/assets/formats/silence.{}".format(self.formats[i]) ), root_folder=folder, folder=folder, diff --git a/tests/api/test_playlist.py b/tests/api/test_playlist.py index 327d01d..76f9e66 100644 --- a/tests/api/test_playlist.py +++ b/tests/api/test_playlist.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -19,7 +18,7 @@ from .apitestbase import ApiTestBase class PlaylistTestCase(ApiTestBase): def setUp(self): - super(PlaylistTestCase, self).setUp() + super().setUp() with db_session: root = Folder(root=True, name="Root folder", path="tests/assets") diff --git a/tests/api/test_radio.py b/tests/api/test_radio.py index f01ef29..c079567 100644 --- a/tests/api/test_radio.py +++ b/tests/api/test_radio.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -19,7 +18,7 @@ from .apitestbase import ApiTestBase class RadioStationTestCase(ApiTestBase): def setUp(self): - super(RadioStationTestCase, self).setUp() + super().setUp() @db_session def assertRadioStationCountEqual(self, count): diff --git a/tests/api/test_response_helper.py b/tests/api/test_response_helper.py index 4ea9806..9cae201 100644 --- a/tests/api/test_response_helper.py +++ b/tests/api/test_response_helper.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -18,10 +17,10 @@ from supysonic.api.formatters import JSONFormatter, JSONPFormatter, XMLFormatter from ..testbase import TestBase -class UnwrapperMixin(object): +class UnwrapperMixin: def make_response(self, elem, data): with self.request_context(): - rv = super(UnwrapperMixin, self).make_response(elem, data) + rv = super().make_response(elem, data) return rv.get_data(as_text=True) @staticmethod @@ -34,7 +33,7 @@ class UnwrapperMixin(object): class ResponseHelperJsonTestCase(TestBase, UnwrapperMixin.create_from(JSONFormatter)): def make_response(self, elem, data): - rv = super(ResponseHelperJsonTestCase, self).make_response(elem, data) + rv = super().make_response(elem, data) return flask.json.loads(rv) def process_and_extract(self, d): @@ -117,7 +116,7 @@ class ResponseHelperJsonpTestCase(TestBase, UnwrapperMixin.create_from(JSONPForm class ResponseHelperXMLTestCase(TestBase, UnwrapperMixin.create_from(XMLFormatter)): def make_response(self, elem, data): - xml = super(ResponseHelperXMLTestCase, self).make_response(elem, data) + xml = super().make_response(elem, data) xml = xml.replace('xmlns="http://subsonic.org/restapi"', "") root = ElementTree.fromstring(xml) return root @@ -131,7 +130,7 @@ class ResponseHelperXMLTestCase(TestBase, UnwrapperMixin.create_from(XMLFormatte self.assertDictEqual(elem.attrib, d) def test_root(self): - xml = super(ResponseHelperXMLTestCase, self).make_response("tag", {}) + xml = super().make_response("tag", {}) self.assertIn("")) diff --git a/tests/api/test_search.py b/tests/api/test_search.py index 1c96ee0..3854b8b 100644 --- a/tests/api/test_search.py +++ b/tests/api/test_search.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -20,7 +19,7 @@ from .apitestbase import ApiTestBase class SearchTestCase(ApiTestBase): def setUp(self): - super(SearchTestCase, self).setUp() + super().setUp() with db_session: root = Folder(root=True, name="Root folder", path="tests/assets") diff --git a/tests/api/test_system.py b/tests/api/test_system.py index bc9dfeb..72d640a 100644 --- a/tests/api/test_system.py +++ b/tests/api/test_system.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/api/test_transcoding.py b/tests/api/test_transcoding.py index a79057e..ba68762 100644 --- a/tests/api/test_transcoding.py +++ b/tests/api/test_transcoding.py @@ -22,7 +22,7 @@ from .apitestbase import ApiTestBase class TranscodingTestCase(ApiTestBase): def setUp(self): - super(TranscodingTestCase, self).setUp() + super().setUp() with db_session: folder = FolderManager.add("Folder", "tests/assets/folder") diff --git a/tests/base/__init__.py b/tests/base/__init__.py index 3a67717..3633340 100644 --- a/tests/base/__init__.py +++ b/tests/base/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/base/test_cache.py b/tests/base/test_cache.py index 13fe2b8..dc047b6 100644 --- a/tests/base/test_cache.py +++ b/tests/base/test_cache.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -74,8 +73,7 @@ class CacheTestCase(unittest.TestCase): val = [b"0", b"12", b"345", b"6789"] def gen(): - for b in val: - yield b + yield from val t = [] for x in cache.set_generated("key", gen): @@ -160,8 +158,7 @@ class CacheTestCase(unittest.TestCase): def gen(): # Cause a TypeError halfway through - for b in [b"0", b"12", object(), b"345", b"6789"]: - yield b + yield from [b"0", b"12", object(), b"345", b"6789"] with self.assertRaises(TypeError): for x in cache.set_generated("key", gen): @@ -174,8 +171,7 @@ class CacheTestCase(unittest.TestCase): cache = Cache(self.__dir, 20) def gen(): - for b in [b"0", b"12", b"345", b"6789"]: - yield b + yield from [b"0", b"12", b"345", b"6789"] g1 = cache.set_generated("key", gen) g2 = cache.set_generated("key", gen) diff --git a/tests/base/test_cli.py b/tests/base/test_cli.py index c093ccb..297e7ff 100644 --- a/tests/base/test_cli.py +++ b/tests/base/test_cli.py @@ -42,7 +42,7 @@ class CLITestCase(unittest.TestCase): os.remove(self.__db[1]) def __add_folder(self, name, path): - self.__cli.onecmd("folder add {0} {1}".format(name, shlex.quote(path))) + self.__cli.onecmd("folder add {} {}".format(name, shlex.quote(path))) def test_folder_add(self): with tempfile.TemporaryDirectory() as d: diff --git a/tests/base/test_config.py b/tests/base/test_config.py index 4340401..a48684c 100644 --- a/tests/base/test_config.py +++ b/tests/base/test_config.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/base/test_db.py b/tests/base/test_db.py index 51187af..1778881 100644 --- a/tests/base/test_db.py +++ b/tests/base/test_db.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/base/test_lastfm.py b/tests/base/test_lastfm.py index 9ade280..b5d8c43 100644 --- a/tests/base/test_lastfm.py +++ b/tests/base/test_lastfm.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -21,7 +20,7 @@ class LastFmTestCase(unittest.TestCase): logging.getLogger("supysonic.lastfm").addHandler(logging.NullHandler()) lastfm = LastFm({"api_key": "key", "secret": "secret"}, None) - rv = lastfm._LastFm__api_request(False, method="dummy", accents=u"àéèùö") + rv = lastfm._LastFm__api_request(False, method="dummy", accents="àéèùö") self.assertIsInstance(rv, dict) diff --git a/tests/base/test_scanner.py b/tests/base/test_scanner.py index 9b43553..4ebde72 100644 --- a/tests/base/test_scanner.py +++ b/tests/base/test_scanner.py @@ -42,7 +42,7 @@ class ScannerTestCase(unittest.TestCase): with tempfile.NamedTemporaryFile( dir=os.path.dirname(track.path), delete=False ) as tf: - with io.open(track.path, "rb") as f: + with open(track.path, "rb") as f: tf.write(f.read()) try: yield tf.name diff --git a/tests/base/test_secret.py b/tests/base/test_secret.py index dbbe925..0fd3874 100644 --- a/tests/base/test_secret.py +++ b/tests/base/test_secret.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/base/test_watcher.py b/tests/base/test_watcher.py index 08aa411..9b70403 100644 --- a/tests/base/test_watcher.py +++ b/tests/base/test_watcher.py @@ -28,7 +28,7 @@ class WatcherTestConfig(TestConfig): DAEMON = {"wait_delay": 0.5, "log_file": "/dev/null", "log_level": "DEBUG"} def __init__(self, db_uri): - super(WatcherTestConfig, self).__init__(False, False) + super().__init__(False, False) self.BASE["database_uri"] = db_uri @@ -64,7 +64,7 @@ class WatcherTestBase(unittest.TestCase): class WatcherTestCase(WatcherTestBase): def setUp(self): - super(WatcherTestCase, self).setUp() + super().setUp() self.__dir = tempfile.mkdtemp() with db_session: FolderManager.add("Folder", self.__dir) @@ -73,7 +73,7 @@ class WatcherTestCase(WatcherTestBase): def tearDown(self): self._stop() shutil.rmtree(self.__dir) - super(WatcherTestCase, self).tearDown() + super().tearDown() @staticmethod def _tempname(): diff --git a/tests/frontend/__init__.py b/tests/frontend/__init__.py index 1aad44b..0208f63 100644 --- a/tests/frontend/__init__.py +++ b/tests/frontend/__init__.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/frontend/frontendtestbase.py b/tests/frontend/frontendtestbase.py index a05a96c..8d23eaf 100644 --- a/tests/frontend/frontendtestbase.py +++ b/tests/frontend/frontendtestbase.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -14,7 +12,7 @@ class FrontendTestBase(TestBase): __with_webui__ = True def setUp(self): - super(FrontendTestBase, self).setUp() + super().setUp() self._patch_client() def _login(self, username, password): diff --git a/tests/frontend/test_folder.py b/tests/frontend/test_folder.py index c0ca1ea..af00998 100644 --- a/tests/frontend/test_folder.py +++ b/tests/frontend/test_folder.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/frontend/test_login.py b/tests/frontend/test_login.py index d2c1d3c..01524f1 100644 --- a/tests/frontend/test_login.py +++ b/tests/frontend/test_login.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/frontend/test_playlist.py b/tests/frontend/test_playlist.py index 3c403fa..6dbd67d 100644 --- a/tests/frontend/test_playlist.py +++ b/tests/frontend/test_playlist.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -19,7 +18,7 @@ from .frontendtestbase import FrontendTestBase class PlaylistTestCase(FrontendTestBase): def setUp(self): - super(PlaylistTestCase, self).setUp() + super().setUp() with db_session: folder = Folder(name="Root", path="tests/assets", root=True) diff --git a/tests/frontend/test_user.py b/tests/frontend/test_user.py index ae361bc..d94918e 100644 --- a/tests/frontend/test_user.py +++ b/tests/frontend/test_user.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. @@ -20,7 +19,7 @@ from .frontendtestbase import FrontendTestBase class UserTestCase(FrontendTestBase): def setUp(self): - super(UserTestCase, self).setUp() + super().setUp() with db_session: self.users = {u.name: u.id for u in User.select()} diff --git a/tests/issue101.py b/tests/issue101.py index 189b0ca..d7ce8ca 100644 --- a/tests/issue101.py +++ b/tests/issue101.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/issue129.py b/tests/issue129.py index 8eb2930..2db00a6 100644 --- a/tests/issue129.py +++ b/tests/issue129.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # @@ -21,7 +19,7 @@ from .testbase import TestBase class Issue129TestCase(TestBase): def setUp(self): - super(Issue129TestCase, self).setUp() + super().setUp() with db_session: folder = FolderManager.add("folder", os.path.abspath("tests/assets/folder")) diff --git a/tests/issue133.py b/tests/issue133.py index 076d75b..7c77619 100644 --- a/tests/issue133.py +++ b/tests/issue133.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/issue139.py b/tests/issue139.py index c888e34..46fcead 100644 --- a/tests/issue139.py +++ b/tests/issue139.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/managers/__init__.py b/tests/managers/__init__.py index b547c90..efe761b 100644 --- a/tests/managers/__init__.py +++ b/tests/managers/__init__.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/managers/test_manager_folder.py b/tests/managers/test_manager_folder.py index 27a3b2e..7ecb950 100644 --- a/tests/managers/test_manager_folder.py +++ b/tests/managers/test_manager_folder.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 # # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. diff --git a/tests/managers/test_manager_user.py b/tests/managers/test_manager_user.py index f9a3b63..c30a38f 100644 --- a/tests/managers/test_manager_user.py +++ b/tests/managers/test_manager_user.py @@ -71,7 +71,7 @@ class UserManagerTestCase(unittest.TestCase): ("d68c95a91ed7773aa57c7c044d2309a5bf1da2e7", "pepper"), ) self.assertEqual( - func(u"éèàïô", "ABC+"), ("b639ba5217b89c906019d89d5816b407d8730898", "ABC+") + func("éèàïô", "ABC+"), ("b639ba5217b89c906019d89d5816b407d8730898", "ABC+") ) @db_session diff --git a/tests/testbase.py b/tests/testbase.py index 4879ed1..3b78d9d 100644 --- a/tests/testbase.py +++ b/tests/testbase.py @@ -32,7 +32,7 @@ class TestConfig(DefaultConfig): } def __init__(self, with_webui, with_api): - super(TestConfig, self).__init__() + super().__init__() for cls in reversed(inspect.getmro(self.__class__)): for attr, value in cls.__dict__.items(): @@ -47,7 +47,7 @@ class TestConfig(DefaultConfig): self.WEBAPP.update({"mount_webui": with_webui, "mount_api": with_api}) -class MockResponse(object): +class MockResponse: def __init__(self, response): self.__status_code = response.status_code self.__data = response.get_data(as_text=True) diff --git a/tests/utils.py b/tests/utils.py index a095571..1b214d2 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # diff --git a/tests/with_net.py b/tests/with_net.py index dda1cd9..64a268c 100644 --- a/tests/with_net.py +++ b/tests/with_net.py @@ -1,5 +1,3 @@ -# coding: utf-8 -# # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. #