From f2964296c5b83c225a6e148bd940a9e02eb3c82a Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Fri, 5 Apr 2019 19:19:11 -0400 Subject: [PATCH 1/3] Add flake8-comprehensions to tox.ini --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 77e5ae63..56d21272 100644 --- a/tox.ini +++ b/tox.ini @@ -50,6 +50,7 @@ per-file-ignores = deps = flake8 flake8-commas + flake8-comprehensions flake8-quotes skip_install = true commands = From b9c7eec834e6a90402b68accf99137c9444ceea2 Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Fri, 5 Apr 2019 14:34:46 -0400 Subject: [PATCH 2/3] Fix flake8-comprehensions C403 Unnecessary list comprehension --- core/transcoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/transcoder.py b/core/transcoder.py index 6dc9ce32..d4b7e2f2 100644 --- a/core/transcoder.py +++ b/core/transcoder.py @@ -713,7 +713,7 @@ def combine_vts(vts_path): def combine_cd(combine): new_files = [] - for item in set([re.match('(.+)[cC][dD][0-9].', item).groups()[0] for item in combine]): + for item in {re.match('(.+)[cC][dD][0-9].', item).groups()[0] for item in combine}: concat = '' for n in range(99): files = [file for file in combine if From 169fcaae4a565765bcb70080d376ff4bef705817 Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Fri, 5 Apr 2019 14:35:23 -0400 Subject: [PATCH 3/3] Fix flake8-comprehensions C407 Unnecessary list comprehension --- core/utils/paths.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/utils/paths.py b/core/utils/paths.py index dba119f5..fe049ae7 100644 --- a/core/utils/paths.py +++ b/core/utils/paths.py @@ -67,10 +67,10 @@ def remote_dir(path): def get_dir_size(input_path): prepend = partial(os.path.join, input_path) - return sum([ + return sum( (os.path.getsize(f) if os.path.isfile(f) else get_dir_size(f)) for f in map(prepend, os.listdir(text_type(input_path))) - ]) + ) def remove_empty_folders(path, remove_root=True):