Skip to content

Commit

Permalink
Merge pull request #371 from cclauss/flake8
Browse files Browse the repository at this point in the history
Travis CI: Replace pep8 with flake8, update dependencies
  • Loading branch information
jjjake authored Sep 8, 2020
2 parents af5afe7 + c724c74 commit e175b40
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 35 deletions.
1 change: 1 addition & 0 deletions internetarchive/cli/ia.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,6 @@ def main():
else:
raise


if __name__ == '__main__':
main()
6 changes: 3 additions & 3 deletions internetarchive/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,14 @@ def dark(self, comment, priority=None, data=None, request_kwargs=None):

def review(self, title, body, stars=None):
u = '{protocol}//{host}/services/reviews.php'.format(
protocol=self.session.protocol,
host=self.session.host)
protocol=self.session.protocol,
host=self.session.host)
p = dict(identifier=self.identifier)
d = dict(title=title, body=body)
if stars:
d['stars'] = stars
a = S3Auth(self.session.access_key, self.session.secret_key)
r = self.session.post(u, params=p, data=json.dumps(d), auth=a)
r = self.session.post(u, params=p, data=json.dumps(d), auth=a)
r.raise_for_status()
return r

Expand Down
6 changes: 3 additions & 3 deletions internetarchive/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ def reraise_modify(caught_exc, append_msg, prepend=False):

def remove_none(obj):
if isinstance(obj, (list, tuple, set)):
l = type(obj)(remove_none(x) for x in obj if x)
lst = type(obj)(remove_none(x) for x in obj if x)
try:
return [dict(t) for t in {tuple(sorted(d.items())) for d in l}]
return [dict(t) for t in {tuple(sorted(d.items())) for d in lst}]
except (AttributeError, TypeError):
return l
return lst
elif isinstance(obj, dict):
return type(obj)((remove_none(k), remove_none(v))
for k, v in obj.items() if k is not None and v)
Expand Down
1 change: 0 additions & 1 deletion pex-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ docopt>=0.6.0,<0.7.0
tqdm>=4.0.0
six>=1.0.0,<2.0.0
schema>=0.4.0
total-ordering
backports.csv
24 changes: 9 additions & 15 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
[bdist_wheel]
universal = 1

[tool:pytest]
pep8ignore =
*.py E265
__init__.py E402
docs/source/conf.py ALL
ia_upload.py E128
tests/* E402
internetarchive/cli/ia_download.py E501
internetarchive/cli/ia_copy.py E128 E501
internetarchive/cli/ia_copy.py E501
internetarchive/cli/ia_move.py E501
internetarchive/cli/ia_move.py E128
pep8maxlinelength = 90
flakes-ignore =
docs/source/conf.py UnusedImport
[flake8]
ignore = E128,E722,F401,F841,W504,W605
max-complexity = 34
max-line-length = 102
per-file-ignores =
./docs/source/conf.py: E121,E122,E265
./tests/conftest.py: F811
./tests/cli/test_ia_list.py: E741
statistics = true
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from setuptools import setup
import sys
from codecs import open
import re
import ast
from ast import literal_eval
from codecs import open

from setuptools import setup

_version_re = re.compile(r'__version__\s+=\s+(.*)')

with open('internetarchive/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
version = str(literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))

with open('README.rst', 'r', 'utf-8') as f:
Expand All @@ -23,7 +22,7 @@
license='AGPL 3',
author='Jacob M. Johnson',
author_email='[email protected]',
description='A python interface to archive.org.',
description='A Python interface to archive.org.',
long_description=readme,
include_package_data=True,
zip_safe=False,
Expand All @@ -43,9 +42,7 @@
'tqdm>=4.0.0',
'six>=1.0.0,<2.0.0',
'schema>=0.4.0',
'backports.csv < 1.07;python_version<"2.7"',
'backports.csv < 1.07;python_version<"3.4"',
'total-ordering;python_version<"2.7"',
],
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand Down
7 changes: 4 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pytest>=3.3.1
pytest-pep8
responses==0.10.6
flake8>=3.8.3
pytest==4.6.9; python_version < '3.0'
pytest==6.0.1; python_version >= '3.0'
responses==0.12.0
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
envlist = py27,py35,py36,py37,py38,py39

[testenv]
# commands = py.test --pep8 {posargs}
commands = py.test {posargs}
deps = -r tests/requirements.txt
# See setup.cfg for changes to default settings
commands = flake8
pytest {posargs}

[testenv:py27]
basepython=python2.7
Expand Down

0 comments on commit e175b40

Please sign in to comment.