From d8a747730de25b104bc2ed17ba0c7686ac5fbdbd Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 20 May 2022 17:57:27 +0200 Subject: [PATCH 1/3] cli: Less noisy logging from musicbrainzngs when `-v 3` --- calliope/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/calliope/cli.py b/calliope/cli.py index c2881ab..16c8df0 100644 --- a/calliope/cli.py +++ b/calliope/cli.py @@ -87,6 +87,9 @@ def cli(context, verbosity): log.addHandler(handler) log.setLevel(context.obj.verbosity_level) + # https://github.com/alastair/python-musicbrainzngs/issues/229 + logging.getLogger('musicbrainzngs').setLevel(logging.WARNING) + @cli.group(name='bandcamp', help="Query Bandcamp") @click.option('--user', help="show data for the given Bandcamp user") -- GitLab From 1898dfb51d646eb7b759194a807f9d8edf996e2e Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Thu, 19 May 2022 19:20:22 +0200 Subject: [PATCH 2/3] cache: Fix inconsistencies in CacheLookupResult type * The documentation doesn't automatically show the key names, so write those out. * Fix a place where we returned bare tuples instead of the CacheLookupResult type --- calliope/cache.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/calliope/cache.py b/calliope/cache.py index 25eb38e..94e33c8 100644 --- a/calliope/cache.py +++ b/calliope/cache.py @@ -66,6 +66,8 @@ CacheLookupResult = collections.namedtuple( ['found_timestamp', 'value']) """The result of looking for a value in a cache. +Tuple with named values: ``(found_timestamp, value)``. + If the value is found, ``found_timestamp`` will be set to the datetime of when it was stored. Otherwise, ``found_timestamp`` will be ``None``. """ @@ -206,9 +208,9 @@ class SqliteCache(Cache): else: log.debug("Timestamp is %s", row[1]) timestamp = datetime.datetime.fromisoformat(row[1]) - return (timestamp, value) + return CacheLookupResult(timestamp, value) else: - return (None, None) + return CacheLookupResult(None, None) def store(self, key, value, timestamp=None): timestamp = timestamp or datetime.datetime.now() -- GitLab From 7f1894d995837241b4f185b74afc31a2f881d95d Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 20 May 2022 18:04:14 +0200 Subject: [PATCH 3/3] Update changelog --- docs/changelog.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 968644e..e3ea750 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,16 @@ Changelog ========= +Unreleased +---------- + + * cli: Quiet 'unhandled attribute' warnings from 'musicbrainzngs' library + when `-v 3`. + :mr:`199` + * Fix some implementation gaps around + :class:`calliope.cache.CacheLookupResult`. + :mr:`199` + 7.1 --- -- GitLab