Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
Fix imports
Fix formatting
  • Loading branch information
arogl committed Aug 26, 2021
1 parent 0f48ccd commit ee4268d
Show file tree
Hide file tree
Showing 63 changed files with 84 additions and 125 deletions.
2 changes: 1 addition & 1 deletion beets/autotag/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import musicbrainzngs
import re
import traceback
from six.moves.urllib.parse import urljoin

from beets import logging
from beets import plugins
import beets.autotag.hooks
import beets
from beets import util
from beets import config
from urllib.parse import urljoin

VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377'

Expand Down
7 changes: 3 additions & 4 deletions beets/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import platform
import shlex
from beets.util import hidden
import six
from unidecode import unidecode
from enum import Enum

Expand Down Expand Up @@ -100,6 +99,7 @@ class FilesystemError(HumanReadableException):
via a function in this module. The `paths` field is a sequence of
pathnames involved in the operation.
"""

def __init__(self, reason, verb, paths, tb=None):
self.paths = paths
super().__init__(reason, verb, tb)
Expand Down Expand Up @@ -599,6 +599,7 @@ def unique_path(path):
if not os.path.exists(new_path):
return new_path


# Note: The Windows "reserved characters" are, of course, allowed on
# Unix. They are forbidden here because they cause problems on Samba
# shares, which are sufficiently common as to cause frequent problems.
Expand Down Expand Up @@ -736,8 +737,6 @@ def py3_path(path):
if isinstance(path, str):
return path
assert isinstance(path, bytes)
if six.PY2:
return path
return os.fsdecode(path)


Expand Down Expand Up @@ -801,7 +800,7 @@ def cpu_count():
'/usr/sbin/sysctl',
'-n',
'hw.ncpu',
]).stdout)
]).stdout)
except (ValueError, OSError, subprocess.CalledProcessError):
num = 0
else:
Expand Down
2 changes: 1 addition & 1 deletion beets/util/artresizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import re
from tempfile import NamedTemporaryFile
from six.moves.urllib.parse import urlencode
from urllib.parse import urlencode
from beets import logging
from beets import util

Expand Down
2 changes: 1 addition & 1 deletion beets/util/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"""


from six.moves import queue
import queue
from threading import Thread, Lock
import sys

Expand Down
8 changes: 4 additions & 4 deletions beetsplug/acousticbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ def _map_data_to_scheme(self, data, scheme):
# The recursive traversal.
composites = defaultdict(list)
yield from self._data_to_scheme_child(data,
scheme,
composites)
scheme,
composites)

# When composites has been populated, yield the composite attributes
# by joining their parts.
Expand All @@ -309,8 +309,8 @@ def _data_to_scheme_child(self, subdata, subscheme, composites):
if k in subdata:
if type(v) == dict:
yield from self._data_to_scheme_child(subdata[k],
v,
composites)
v,
composites)
elif type(v) == tuple:
composite_attribute, part_number = v
attribute_parts = composites[composite_attribute]
Expand Down
1 change: 0 additions & 1 deletion beetsplug/badfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import os
import errno
import sys
import six
import confuse
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand
Expand Down
9 changes: 4 additions & 5 deletions beetsplug/bareasc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from beets.plugins import BeetsPlugin
from beets.dbcore.query import StringFieldQuery
from unidecode import unidecode
import six


class BareascQuery(StringFieldQuery):
Expand Down Expand Up @@ -75,9 +74,9 @@ def unidecode_list(self, lib, opts, args):
# Copied from commands.py - list_items
if album:
for album in lib.albums(query):
bare = unidecode(six.ensure_text(str(album)))
print_(six.ensure_text(bare))
bare = unidecode(str(album))
print_(bare)
else:
for item in lib.items(query):
bare = unidecode(six.ensure_text(str(item)))
print_(six.ensure_text(bare))
bare = unidecode(str(item))
print_(bare)
1 change: 0 additions & 1 deletion beetsplug/beatport.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import json
import re
import six
from datetime import datetime, timedelta

from requests_oauthlib import OAuth1Session
Expand Down
1 change: 0 additions & 1 deletion beetsplug/bpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from beets.library import Item
from beets import dbcore
from mediafile import MediaFile
import six

PROTOCOL_VERSION = '0.16.0'
BUFSIZE = 1024
Expand Down
5 changes: 2 additions & 3 deletions beetsplug/bpd/gstplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"""


import six
import sys
import time
from six.moves import _thread
import _thread
import os
import copy
from six.moves import urllib
import urllib
from beets import ui

import gi
Expand Down
6 changes: 3 additions & 3 deletions beetsplug/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def str2fmt(s):
res = {'fromnchars': len(m.group('fromyear')),
'tonchars': len(m.group('toyear'))}
res['fmt'] = "{}%s{}{}{}".format(m.group('bef'),
m.group('sep'),
'%s' if res['tonchars'] else '',
m.group('after'))
m.group('sep'),
'%s' if res['tonchars'] else '',
m.group('after'))
return res


Expand Down
2 changes: 1 addition & 1 deletion beetsplug/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(self):
'formats': {
'aac': {
'command': 'ffmpeg -i $source -y -vn -acodec aac '
'-aq 1 $dest',
'-aq 1 $dest',
'extension': 'm4a',
},
'alac': {
Expand Down
1 change: 0 additions & 1 deletion beetsplug/deezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import collections

import six
import unidecode
import requests

Expand Down
6 changes: 3 additions & 3 deletions beetsplug/discogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from discogs_client import Release, Master, Client
from discogs_client.exceptions import DiscogsAPIError
from requests.exceptions import ConnectionError
from six.moves import http_client
import http.client
import beets
import re
import time
Expand All @@ -40,7 +40,7 @@
API_SECRET = 'plxtUTqoCzwxZpqdPysCwGuBSmZNdZVy'

# Exceptions that discogs_client should really handle but does not.
CONNECTION_ERRORS = (ConnectionError, socket.error, http_client.HTTPException,
CONNECTION_ERRORS = (ConnectionError, socket.error, http.client.HTTPException,
ValueError, # JSON decoding raises a ValueError.
DiscogsAPIError)

Expand Down Expand Up @@ -505,7 +505,7 @@ def add_merged_subtracks(tracklist, subtracks):
if self.config['index_tracks']:
for subtrack in subtracks:
subtrack['title'] = '{}: {}'.format(
index_track['title'], subtrack['title'])
index_track['title'], subtrack['title'])
tracklist.extend(subtracks)
else:
# Merge the subtracks, pick a title, and append the new track.
Expand Down
1 change: 0 additions & 1 deletion beetsplug/duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""

import shlex
import six

from beets.plugins import BeetsPlugin
from beets.ui import decargs, print_, Subcommand, UserError
Expand Down
1 change: 0 additions & 1 deletion beetsplug/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import yaml
from tempfile import NamedTemporaryFile
import os
import six
import shlex


Expand Down
4 changes: 1 addition & 3 deletions beetsplug/embyupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import hashlib
import requests

from six.moves.urllib.parse import urlencode
from six.moves.urllib.parse import urljoin, parse_qs, urlsplit, urlunsplit

from urllib.parse import urlencode, urljoin, parse_qs, urlsplit, urlunsplit
from beets import config
from beets.plugins import BeetsPlugin

Expand Down
1 change: 0 additions & 1 deletion beetsplug/fetchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from beets.util import sorted_walk
from beets.util import syspath, bytestring_path, py3_path
import confuse
import six

CONTENT_TYPES = {
'image/jpeg': [b'jpg', b'jpeg'],
Expand Down
1 change: 0 additions & 1 deletion beetsplug/fromfilename.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from beets.util import displayable_path
import os
import re
import six


# Filename field extraction patterns.
Expand Down
5 changes: 3 additions & 2 deletions beetsplug/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def format(self, format_string, *args, **kwargs):
format_string = format_string.decode(self._coding)

return super().format(format_string, *args,
**kwargs)
**kwargs)

def convert_field(self, value, conversion):
"""Converts the provided value given a conversion type.
Expand All @@ -58,7 +58,7 @@ def convert_field(self, value, conversion):
See string.Formatter.convert_field.
"""
converted = super().convert_field(value,
conversion)
conversion)

if isinstance(converted, bytes):
return converted.decode(self._coding)
Expand All @@ -68,6 +68,7 @@ def convert_field(self, value, conversion):

class HookPlugin(BeetsPlugin):
"""Allows custom commands to be run when an event is emitted by beets"""

def __init__(self):
super().__init__()

Expand Down
4 changes: 2 additions & 2 deletions beetsplug/importadded.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def record_if_inplace(self, task, session):

def record_reimported(self, task, session):
self.reimported_item_ids = {item.id for item, replaced_items
in task.replaced_items.items()
if replaced_items}
in task.replaced_items.items()
if replaced_items}
self.replaced_album_paths = set(task.replaced_albums.keys())

def write_file_mtime(self, path, mtime):
Expand Down
1 change: 0 additions & 1 deletion beetsplug/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from beets.plugins import BeetsPlugin
from beets import config
import six

FUNC_NAME = '__INLINE_FUNC__'

Expand Down
1 change: 0 additions & 1 deletion beetsplug/kodiupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import requests
from beets import config
from beets.plugins import BeetsPlugin
import six


def update_kodi(host, port, user, password):
Expand Down
4 changes: 1 addition & 3 deletions beetsplug/lastgenre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# included in all copies or substantial portions of the Software.


import six

"""Gets genres for imported music based on Last.fm tags.
Uses a provided whitelist file to determine which tags are valid genres.
Expand Down Expand Up @@ -266,7 +264,7 @@ def _last_lookup(self, entity, method, *args):
return None

key = '{}.{}'.format(entity,
'-'.join(str(a) for a in args))
'-'.join(str(a) for a in args))
if key in self._genre_cache:
return self._genre_cache[key]
else:
Expand Down
9 changes: 4 additions & 5 deletions beetsplug/lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import unicodedata
from unidecode import unidecode
import warnings
import six
from six.moves import urllib
import urllib

try:
import bs4
Expand All @@ -47,7 +46,7 @@
# PY3: HTMLParseError was removed in 3.5 as strict mode
# was deprecated in 3.3.
# https://docs.python.org/3.3/library/html.parser.html
from six.moves.html_parser import HTMLParseError
from html.parser import HTMLParseError
except ImportError:
class HTMLParseError(Exception):
pass
Expand Down Expand Up @@ -864,8 +863,8 @@ def appendrest(self, directory, item):
title_str = ":index:`%s`" % item.title.strip()
block = '| ' + item.lyrics.replace('\n', '\n| ')
self.rest += "{}\n{}\n\n{}\n\n".format(title_str,
'~' * len(title_str),
block)
'~' * len(title_str),
block)

def writerest(self, directory):
"""Write self.rest to a ReST file
Expand Down
1 change: 0 additions & 1 deletion beetsplug/mbsubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"""



from beets.autotag import Recommendation
from beets.plugins import BeetsPlugin
from beets.ui.commands import PromptChoice
Expand Down
1 change: 0 additions & 1 deletion beetsplug/metasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from confuse import ConfigValueError
from beets import ui
from beets.plugins import BeetsPlugin
import six


METASYNC_MODULE = 'beetsplug.metasync'
Expand Down
Loading

0 comments on commit ee4268d

Please sign in to comment.