Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plexapi/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ def _onError(self, *args): # pragma: no cover
This is to support compatibility with current and previous releases of websocket-client.
"""
err = args[-1]
log.error('AlertListener Error: %s' % err)
log.error('AlertListener Error: %s', err)
4 changes: 2 additions & 2 deletions plexapi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def __getattribute__(self, attr):
clsname = self.__class__.__name__
title = self.__dict__.get('title', self.__dict__.get('name'))
objname = "%s '%s'" % (clsname, title) if title else clsname
log.debug("Reloading %s for attr '%s'" % (objname, attr))
log.debug("Reloading %s for attr '%s'", objname, attr)
# Reload and return the value
self.reload()
return super(PlexPartialObject, self).__getattribute__(attr)
Expand Down Expand Up @@ -501,7 +501,7 @@ def delete(self):
return self._server.query(self.key, method=self._server._session.delete)
except BadRequest: # pragma: no cover
log.error('Failed to delete %s. This could be because you '
'havnt allowed items to be deleted' % self.key)
'have not allowed items to be deleted', self.key)
raise

def history(self, maxresults=9999999, mindate=None):
Expand Down
2 changes: 1 addition & 1 deletion plexapi/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def _cleanSearchFilter(self, category, value, libtype=None):
result = set()
choices = self.listChoices(category, libtype)
lookup = {c.title.lower(): unquote(unquote(c.key)) for c in choices}
allowed = set(c.key for c in choices)
allowed = {c.key for c in choices}
for item in value:
item = str((item.id or item.tag) if isinstance(item, media.MediaTag) else item).lower()
# find most logical choice(s) to use in url
Expand Down
4 changes: 2 additions & 2 deletions plexapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _loadData(self, data):

def all(self):
""" Returns a list of all :class:`~plexapi.settings.Setting` objects available. """
return list(v for id, v in sorted(self._settings.items()))
return [v for id, v in sorted(self._settings.items())]

def get(self, id):
""" Return the :class:`~plexapi.settings.Setting` object with the specified id. """
Expand Down Expand Up @@ -102,7 +102,7 @@ class Setting(PlexObject):
group (str): Group name this setting is categorized as.
enumValues (list,dict): List or dictionary of valis values for this setting.
"""
_bool_cast = lambda x: True if x == 'true' or x == '1' else False
_bool_cast = lambda x: bool(x == 'true' or x == '1')
_bool_str = lambda x: str(x).lower()
TYPES = {
'bool': {'type': bool, 'cast': _bool_cast, 'tostr': _bool_str},
Expand Down
2 changes: 1 addition & 1 deletion plexapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def threaded(callback, listargs):
threads[-1].setDaemon(True)
threads[-1].start()
while not job_is_done_event.is_set():
if all([not t.is_alive() for t in threads]):
if all(not t.is_alive() for t in threads):
break
time.sleep(0.05)

Expand Down
6 changes: 0 additions & 6 deletions tests/test_history.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# -*- coding: utf-8 -*-
from datetime import datetime

import pytest
from plexapi.exceptions import BadRequest, NotFound

from . import conftest as utils


def test_history_Movie(movie):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_video_Movie_upload_select_remove_subtitle(movie, subtitle):
assert subname in subtitles

subtitleSelection = movie.subtitleStreams()[0]
parts = [part for part in movie.iterParts()]
parts = list(movie.iterParts())
parts[0].setDefaultSubtitleStream(subtitleSelection)
movie.reload()

Expand Down
4 changes: 2 additions & 2 deletions tools/plex-backupwatched.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _iter_items(section):

def backup_watched(plex, opts):
""" Backup watched status to the specified filepath. """
data = defaultdict(lambda: dict())
data = defaultdict(lambda: {})
for section in _iter_sections(plex, opts):
print('Fetching watched status for %s..' % section.title)
skey = section.title.lower()
Expand All @@ -70,7 +70,7 @@ def restore_watched(plex, opts):
with open(opts.filepath, 'r') as handle:
source = json.load(handle)
# Find the differences
differences = defaultdict(lambda: dict())
differences = defaultdict(lambda: {})
for section in _iter_sections(plex, opts):
print('Finding differences in %s..' % section.title)
skey = section.title.lower()
Expand Down