diff options
| -rw-r--r-- | .travis.yml | 3 | ||||
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | setup.py | 6 | ||||
| -rw-r--r-- | test/test_validations.py | 6 | ||||
| -rw-r--r-- | wikiget/dl.py | 27 | ||||
| -rw-r--r-- | wikiget/wikiget.py | 6 |
6 files changed, 24 insertions, 28 deletions
diff --git a/.travis.yml b/.travis.yml index e9adf84..c1ca29c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,11 @@ language: python dist: xenial python: - - '3.5' - '3.6' - '3.7' - '3.8' - '3.9' - - '3.10' + - '3.10-dev' install: - pip install -U pip - pip install . @@ -7,7 +7,7 @@ Something like wget for downloading a file from MediaWiki sites (like Wikipedia or Wikimedia Commons) using only the file name or the URL of its description page. -Requires Python 3.5+. Get it with `pip install --user wikiget`. +Requires Python 3.6+. Get it with `pip install --user wikiget`. ## Usage @@ -95,7 +95,7 @@ executable script. Unit tests can be run with `python setup.py test`. ## License -Copyright (C) 2018, 2019, 2020 Cody Logan and contributors +Copyright (C) 2018-2021 Cody Logan and contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1,5 +1,5 @@ # wikiget - CLI tool for downloading files from Wikimedia sites -# Copyright (C) 2018, 2019, 2020 Cody Logan +# Copyright (C) 2018-2021 Cody Logan # SPDX-License-Identifier: GPL-3.0-or-later # # Wikiget is free software: you can redistribute it and/or modify @@ -51,10 +51,10 @@ setup( 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: Internet', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Multimedia', @@ -63,7 +63,7 @@ setup( 'Topic :: Multimedia :: Video', 'Topic :: Utilities', ], - python_requires='>=3.5', + python_requires='>=3.6', install_requires=['mwclient>=0.10.0', 'requests', 'tqdm'], setup_requires=['pytest-runner'], tests_require=['pytest', 'pytest-cov'], diff --git a/test/test_validations.py b/test/test_validations.py index f2d2611..5b7d4fc 100644 --- a/test/test_validations.py +++ b/test/test_validations.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # wikiget - CLI tool for downloading files from Wikimedia sites -# Copyright (C) 2018, 2019, 2020 Cody Logan +# Copyright (C) 2018-2021 Cody Logan # SPDX-License-Identifier: GPL-3.0-or-later # # Wikiget is free software: you can redistribute it and/or modify @@ -88,6 +88,4 @@ def test_verify_hash(tmp_path): tmp_file = tmp_path / file_name tmp_file.write_text(file_contents) - # Convert tmp_file from PosixPath to string so this test works with - # Python 3.5 (see https://stackoverflow.com/a/42694113). - assert verify_hash(str(tmp_file)) == file_sha1 + assert verify_hash(tmp_file) == file_sha1 diff --git a/wikiget/dl.py b/wikiget/dl.py index 6cbe8df..0ac8fec 100644 --- a/wikiget/dl.py +++ b/wikiget/dl.py @@ -1,5 +1,5 @@ # wikiget - CLI tool for downloading files from Wikimedia sites -# Copyright (C) 2018, 2019, 2020 Cody Logan and contributors +# Copyright (C) 2018-2021 Cody Logan and contributors # SPDX-License-Identifier: GPL-3.0-or-later # # Wikiget is free software: you can redistribute it and/or modify @@ -49,7 +49,7 @@ def download(dl, args): filename = file_match.group(2) else: # no file extension and/or prefix, probably an article - print("Could not parse input '{}' as a file. ".format(filename)) + print(f"Could not parse input '{filename}' as a file. ") sys.exit(1) filename = unquote(filename) # remove URL encoding for special characters @@ -57,11 +57,11 @@ def download(dl, args): dest = args.output or filename if args.verbose >= 2: - print('User agent: {}'.format(USER_AGENT)) + print(f'User agent: {USER_AGENT}') # connect to site and identify ourselves if args.verbose >= 1: - print('Site name: {}'.format(site_name)) + print(f'Site name: {site_name}') try: site = Site(site_name, path=args.path, clients_useragent=USER_AGENT) if args.username and args.password: @@ -111,18 +111,18 @@ def download(dl, args): file_sha1 = file.imageinfo['sha1'] if args.verbose >= 1: - print("Info: downloading '{}' " - "({} bytes) from {}".format(filename, file_size, site.host), + print(f"Info: downloading '{filename}' " + f"({file_size} bytes) from {site.host}", end='') if args.output: - print(" to '{}'".format(dest)) + print(f" to '{dest}'") else: print('\n', end='') - print('Info: {}'.format(file_url)) + print(f'Info: {file_url}') if os.path.isfile(dest) and not args.force: - print("File '{}' already exists, skipping download " - "(use -f to ignore)".format(dest)) + print(f"File '{dest}' already exists, skipping download " + "(use -f to ignore)") else: try: fd = open(dest, 'wb') @@ -151,8 +151,8 @@ def download(dl, args): dl_sha1 = verify_hash(dest) if args.verbose >= 1: - print('Info: downloaded file SHA1 is {}'.format(dl_sha1)) - print('Info: server file SHA1 is {}'.format(file_sha1)) + print(f'Info: downloaded file SHA1 is {dl_sha1}') + print(f'Info: server file SHA1 is {file_sha1}') if dl_sha1 == file_sha1: if args.verbose >= 1: print('Info: hashes match!') @@ -163,6 +163,5 @@ def download(dl, args): else: # no file information returned - print("Target '{}' does not appear to be a valid file." - .format(filename)) + print(f"Target '{filename}' does not appear to be a valid file.") sys.exit(1) diff --git a/wikiget/wikiget.py b/wikiget/wikiget.py index 03f2890..d24087e 100644 --- a/wikiget/wikiget.py +++ b/wikiget/wikiget.py @@ -1,5 +1,5 @@ # wikiget - CLI tool for downloading files from Wikimedia sites -# Copyright (C) 2018, 2019, 2020 Cody Logan and contributors +# Copyright (C) 2018-2021 Cody Logan and contributors # SPDX-License-Identifier: GPL-3.0-or-later # # Wikiget is free software: you can redistribute it and/or modify @@ -49,7 +49,7 @@ def main(): prefix, or the URL of its file description page """) parser.add_argument('-V', '--version', action='version', - version='%(prog)s {}'.format(wikiget_version)) + version=f'%(prog)s {wikiget_version}') message_options = parser.add_mutually_exclusive_group() message_options.add_argument('-q', '--quiet', help='suppress warning messages', @@ -91,7 +91,7 @@ def main(): # batch download mode input_file = args.FILE if args.verbose >= 1: - print("Info: using batch file '{}'".format(input_file)) + print(f"Info: using batch file '{input_file}'") try: fd = open(input_file, 'r') except IOError as e: |
