Skip to content

Commit

Permalink
chore: update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Jul 6, 2024
1 parent 4767deb commit 95f948f
Show file tree
Hide file tree
Showing 24 changed files with 27 additions and 52 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://pre-commit.com
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -24,7 +24,7 @@ repos:
- --markdown-linebreak-ext=md

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
rev: v1.10.0
hooks:
- id: mypy
args:
Expand All @@ -33,14 +33,14 @@ repos:
- types-requests

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.4.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: v0.10.0.1
hooks:
- id: shellcheck

Expand Down
2 changes: 1 addition & 1 deletion freeze.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Package freezing for Windows. """
"""Package freezing for Windows."""

import os
import re
Expand Down
2 changes: 1 addition & 1 deletion sacad/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Smart Automatic Cover Art Downloader : search and download music album covers. """
"""Smart Automatic Cover Art Downloader : search and download music album covers."""

__version__ = "2.7.5"
__author__ = "desbma"
Expand Down
2 changes: 1 addition & 1 deletion sacad/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Command line entry point for sacad program. """
"""Command line entry point for sacad program."""

import sacad

Expand Down
3 changes: 1 addition & 2 deletions sacad/colored_logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Formatter for the logging module, coloring terminal output according to error criticity. """
"""Formatter for the logging module, coloring terminal output according to error criticity."""

import enum
import logging
Expand All @@ -11,7 +11,6 @@


class ColoredFormatter(logging.Formatter):

"""Logging formatter coloring terminal output according to error criticity."""

def format(self, record):
Expand Down
5 changes: 1 addition & 4 deletions sacad/cover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Sacad album cover. """
"""Sacad album cover."""

import asyncio
import enum
Expand Down Expand Up @@ -35,7 +35,6 @@


class CoverSourceQuality(enum.IntFlag):

"""Flags to describe cover source quality."""

# whether or not the search query matching is fuzzy (does a typo return results ?)
Expand All @@ -61,7 +60,6 @@ def isReference(self) -> bool:


class CoverImageMetadata(enum.IntFlag):

"""Flags to describe image metadata."""

NONE = 0
Expand All @@ -83,7 +81,6 @@ def is_square(x):


class CoverSourceResult:

"""Cover image returned by a source, candidate to be downloaded."""

METADATA_PEEK_SIZE_INCREMENT = 2**12
Expand Down
3 changes: 1 addition & 2 deletions sacad/http_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Common HTTP code. """
"""Common HTTP code."""

import asyncio
import logging
Expand Down Expand Up @@ -26,7 +26,6 @@ def aiohttp_socket_timeout(socket_timeout_s):


class Http:

"""Async HTTP client code."""

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion sacad/mkstemp_ctx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Additions to the tempfile module. """
"""Additions to the tempfile module."""

import contextlib
import os
Expand Down
3 changes: 1 addition & 2 deletions sacad/rate_watcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Provide a class with a context manager to help avoid overloading web servers. """
"""Provide a class with a context manager to help avoid overloading web servers."""

import asyncio
import logging
Expand All @@ -10,7 +10,6 @@


class AccessRateWatcher:

"""Access rate limiter, supporting concurrent access by threads and/or processes."""

def __init__(
Expand Down
3 changes: 1 addition & 2 deletions sacad/recurse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Recursively search and download album covers for a music library. """
"""Recursively search and download album covers for a music library."""

import argparse
import asyncio
Expand Down Expand Up @@ -36,7 +36,6 @@

# TODO use a dataclasses.dataclass when Python < 3.7 is dropped
class Work:

"""Represent a single search & download work item."""

def __init__(self, cover_filepath, audio_filepaths, metadata):
Expand Down
2 changes: 1 addition & 1 deletion sacad/sources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" SACAD cover sources. """
"""SACAD cover sources."""

from sacad.sources.amazoncd import AmazonCdCoverSource, AmazonCdCoverSourceResult # noqa: F401
from sacad.sources.amazondigital import AmazonDigitalCoverSource, AmazonDigitalCoverSourceResult # noqa: F401
Expand Down
3 changes: 1 addition & 2 deletions sacad/sources/amazonbase.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
""" Base class for Amazon cover sources. """
"""Base class for Amazon cover sources."""

from sacad.sources.base import CoverSource


class AmazonBaseCoverSource(CoverSource):

"""Base class for Amazon cover sources."""

def __init__(self, *args, base_domain, **kwargs):
Expand Down
4 changes: 1 addition & 3 deletions sacad/sources/amazoncd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Amazon CD cover source. """
"""Amazon CD cover source."""

import collections
import urllib.parse
Expand All @@ -11,7 +11,6 @@


class AmazonCdCoverSourceResult(CoverSourceResult):

"""Amazon CD cover search result."""

def __init__(self, *args, **kwargs):
Expand All @@ -21,7 +20,6 @@ def __init__(self, *args, **kwargs):


class AmazonCdCoverSource(AmazonBaseCoverSource):

"""Cover source returning Amazon.com audio CD images."""

TLDS = ("com", "ca", "cn", "fr", "de", "co.jp", "co.uk")
Expand Down
4 changes: 1 addition & 3 deletions sacad/sources/amazondigital.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Amazon digital cover source. """
"""Amazon digital cover source."""

import collections
import operator
Expand Down Expand Up @@ -36,7 +36,6 @@


class AmazonDigitalCoverSourceResult(CoverSourceResult):

"""Amazon digital cover search result."""

def __init__(self, *args, **kwargs):
Expand All @@ -46,7 +45,6 @@ def __init__(self, *args, **kwargs):


class AmazonDigitalCoverSource(AmazonBaseCoverSource):

"""Cover source returning Amazon.com digital music images."""

BASE_URL = "https://www.amazon.com"
Expand Down
3 changes: 1 addition & 2 deletions sacad/sources/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Common code for all cover sources cover sources. """
"""Common code for all cover sources cover sources."""

import abc
import asyncio
Expand All @@ -21,7 +21,6 @@


class CoverSource(metaclass=abc.ABCMeta):

"""Base class for all cover sources."""

def __init__(
Expand Down
4 changes: 1 addition & 3 deletions sacad/sources/deezer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Deezer cover source. """
"""Deezer cover source."""

import collections
import json
Expand All @@ -9,7 +9,6 @@


class DeezerCoverSourceResult(CoverSourceResult):

"""Deezer search cover result."""

def __init__(self, *args, **kwargs):
Expand All @@ -21,7 +20,6 @@ def __init__(self, *args, **kwargs):


class DeezerCoverSource(CoverSource):

"""
Cover source using the official Deezer API.
Expand Down
4 changes: 1 addition & 3 deletions sacad/sources/discogs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Discogs cover source. """
"""Discogs cover source."""

import collections
import json
Expand All @@ -11,7 +11,6 @@


class DiscogsCoverSourceResult(CoverSourceResult):

"""Discogs search cover result."""

def __init__(self, *args, **kwargs):
Expand All @@ -24,7 +23,6 @@ def __init__(self, *args, **kwargs):


class DiscogsCoverSource(CoverSource):

"""
Cover source using the official API.
Expand Down
4 changes: 1 addition & 3 deletions sacad/sources/itunes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Itunes cover source. """
"""Itunes cover source."""

import collections
import json
Expand All @@ -9,7 +9,6 @@


class ItunesCoverSourceResult(CoverSourceResult):

"""Itunes search cover result."""

def __init__(self, *args, **kwargs):
Expand All @@ -21,7 +20,6 @@ def __init__(self, *args, **kwargs):


class ItunesCoverSource(CoverSource):

"""Itunes cover source."""

SEARCH_URL = "https://itunes.apple.com/search"
Expand Down
4 changes: 1 addition & 3 deletions sacad/sources/lastfm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" LastFM cover source. """
"""LastFM cover source."""

import collections
import os.path
Expand All @@ -10,7 +10,6 @@


class LastFmCoverSourceResult(CoverSourceResult):

"""LastFM cover search result."""

def __init__(self, *args, **kwargs):
Expand All @@ -22,7 +21,6 @@ def __init__(self, *args, **kwargs):


class LastFmCoverSource(CoverSource):

"""
Cover source using the official LastFM API.
Expand Down
3 changes: 1 addition & 2 deletions sacad/tqdm_logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Code to help using the logging module with tqdm progress bars. """
"""Code to help using the logging module with tqdm progress bars."""

import contextlib
import logging
Expand All @@ -8,7 +8,6 @@


class TqdmLoggingHandler(logging.Handler):

"""Logging handler sending messages to the tqdm write method (avoids overlap)."""

def __init__(self, tqdm, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Package setup. """
"""Package setup."""

import os
import re
Expand Down
3 changes: 1 addition & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Unit tests for main module. """
"""Unit tests for main module."""

import asyncio
import contextlib
Expand Down Expand Up @@ -74,7 +74,6 @@ async def delay_coroutine(coroutine, delay):

@unittest.skipUnless(is_internet_reachable(), "Need Internet access")
class TestSacad(unittest.TestCase):

"""Test suite for main module."""

@staticmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/rate_watcher_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Unit tests for rate watcher. """
"""Unit tests for rate watcher."""

import os
import tempfile
Expand All @@ -15,7 +15,6 @@


class TestRateWatcher(unittest.TestCase):

"""Test suite for rate watcher."""

def test_minDelayBetweenAccesses(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/recurse_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Unit tests for recurse module. """
"""Unit tests for recurse module."""

import collections
import contextlib
Expand Down Expand Up @@ -39,7 +39,6 @@ def download(url, filepath):


class TestRecursive(unittest.TestCase):

"""Test suite for recurse module."""

def __init__(self, *args, **kwargs):
Expand Down

0 comments on commit 95f948f

Please sign in to comment.