From 1c55509b0c2200b1444d0bc71ad3d1e9369d1fb8 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sat, 21 Jul 2018 15:24:03 +0200 Subject: [PATCH] do the pep8 dance --- drive-download | 11 +++++++---- setup.cfg | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 setup.cfg diff --git a/drive-download b/drive-download index 805f5f5..ca3313c 100755 --- a/drive-download +++ b/drive-download @@ -7,7 +7,6 @@ if sys.version_info < (3, 3): sys.stderr.write("Sorry, requires at least Python 3.3\n") sys.exit(1) - import collections import os import pickle @@ -15,6 +14,7 @@ import shlex from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive + try: with open(os.path.expanduser('~/.local/share/drive-download/seen.pickle'), 'rb') as f: seen = pickle.load(f) @@ -26,15 +26,16 @@ gauth.CommandLineAuth() drive = GoogleDrive(gauth) + def folder_id(folder_name): query = "title = '%s'" % folder_name file1 = drive.ListFile({'q': query}).GetList()[0] assert file1['mimeType'] == 'application/vnd.google-apps.folder' return file1['id'] -file_list = drive.ListFile( - {'q': "'%s' in parents and trashed=false" % folder_id(FOLDER)} -).GetList() + +file_query = "'%s' in parents and trashed=false" % folder_id(FOLDER) +file_list = drive.ListFile({'q': file_query}).GetList() file_names = [f['title'] for f in file_list] file_names_dupes = [f for f, count in collections.Counter(file_names).items() if count > 1] @@ -60,3 +61,5 @@ for file1 in file_list: else: print("{} exists locally!".format(shlex.quote(local_filename))) sys.exit(2) + +# vim:tw=100: diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9aa46c9 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[pep8] +ignore = E402 +max-line-length = 100