mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 08:56:17 +00:00
Fixed antipattern
- Remove unnecessary return statement - Remove unnecessary `del` statement from local scope - Consider merging the comparisons with 'in'
This commit is contained in:
parent
dcef74ca70
commit
8eca8ba60f
@ -51,7 +51,6 @@ def unstar_single(cls, starcls, eid):
|
||||
"""
|
||||
|
||||
delete(s for s in starcls if s.user.id == request.user.id and s.starred.id == eid)
|
||||
return None
|
||||
|
||||
|
||||
def handle_star_request(func):
|
||||
|
@ -393,7 +393,7 @@ class Scanner(Thread):
|
||||
children = []
|
||||
drive, _ = os.path.splitdrive(path)
|
||||
path = os.path.dirname(path)
|
||||
while path != drive and path != "/":
|
||||
while path not in (drive, "/"):
|
||||
folder = Folder.get(path=path)
|
||||
if folder is not None:
|
||||
break
|
||||
|
@ -166,7 +166,6 @@ class ScannerProcessingQueue(Thread):
|
||||
|
||||
scanner.prune()
|
||||
logger.debug("Freeing scanner")
|
||||
del scanner
|
||||
|
||||
def __process_regular_item(self, scanner, item):
|
||||
if item.operation & OP_MOVE:
|
||||
|
@ -67,12 +67,8 @@ class PlaylistTestCase(ApiTestBase):
|
||||
"getPlaylists", {"u": "bob", "p": "B0b"}, tag="playlists"
|
||||
)
|
||||
self.assertEqual(len(child), 2)
|
||||
self.assertTrue(
|
||||
child[0].get("owner") == "alice" or child[1].get("owner") == "alice"
|
||||
)
|
||||
self.assertTrue(
|
||||
child[0].get("owner") == "bob" or child[1].get("owner") == "bob"
|
||||
)
|
||||
self.assertTrue("alice" in (child[0].get("owner"), child[1].get("owner")))
|
||||
self.assertTrue("bob" in (child[0].get("owner"), child[1].get("owner")))
|
||||
self.assertIsNotNone(
|
||||
self._find(child, "./playlist[@owner='alice'][@public='true']")
|
||||
)
|
||||
@ -122,7 +118,7 @@ class PlaylistTestCase(ApiTestBase):
|
||||
self.assertEqual(child.get("duration"), "4")
|
||||
self.assertEqual(child[0].get("title"), "One")
|
||||
self.assertTrue(
|
||||
child[1].get("title") == "Two" or child[1].get("title") == "Three"
|
||||
child[1].get("title") in ("Two", "Three")
|
||||
) # depending on 'getPlaylists' result ordering
|
||||
|
||||
def test_create_playlist(self):
|
||||
|
@ -34,7 +34,6 @@ class Issue133TestCase(unittest.TestCase):
|
||||
scanner = Scanner()
|
||||
scanner.queue_folder("folder")
|
||||
scanner.run()
|
||||
del scanner
|
||||
|
||||
track = Track.select().first()
|
||||
self.assertNotIn("\x00", track.title)
|
||||
|
@ -32,7 +32,6 @@ class Issue139TestCase(unittest.TestCase):
|
||||
scanner = Scanner()
|
||||
scanner.queue_folder("folder")
|
||||
scanner.run()
|
||||
del scanner
|
||||
|
||||
def test_null_genre(self):
|
||||
shutil.copy("tests/assets/issue139.mp3", self.__dir)
|
||||
|
@ -40,7 +40,6 @@ class Issue148TestCase(unittest.TestCase):
|
||||
scanner = Scanner()
|
||||
scanner.queue_folder("folder")
|
||||
scanner.run()
|
||||
del scanner
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user