Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed E227 pep8 warnings

  • Loading branch information...
commit 499cd912ca36597df737df73c8f91ffab36c83d9 1 parent b289fcf
@timgraham timgraham authored
View
10 django/template/defaultfilters.py
@@ -814,11 +814,11 @@ def filesizeformat(bytes):
filesize_number_format = lambda value: formats.number_format(round(value, 1), 1)
- KB = 1<<10
- MB = 1<<20
- GB = 1<<30
- TB = 1<<40
- PB = 1<<50
+ KB = 1 << 10
+ MB = 1 << 20
+ GB = 1 << 30
+ TB = 1 << 40
+ PB = 1 << 50
if bytes < KB:
value = ungettext("%(size)d byte", "%(size)d bytes", bytes) % {'size': bytes}
View
2  django/utils/jslex.py
@@ -41,7 +41,7 @@ def __init__(self, states, first):
groupid = "t%d" % tok.id
self.toks[groupid] = tok
parts.append("(?P<%s>%s)" % (groupid, tok.regex))
- self.regexes[state] = re.compile("|".join(parts), re.MULTILINE|re.VERBOSE)
+ self.regexes[state] = re.compile("|".join(parts), re.MULTILINE | re.VERBOSE)
self.state = first
View
2  django/utils/text.py
@@ -22,7 +22,7 @@
capfirst = allow_lazy(capfirst, six.text_type)
# Set up regular expressions
-re_words = re.compile(r'<.*?>|((?:\w[-\w]*|&.*?;)+)', re.U|re.S)
+re_words = re.compile(r'<.*?>|((?:\w[-\w]*|&.*?;)+)', re.U | re.S)
re_tag = re.compile(r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>', re.S)
View
2  setup.cfg
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py
-ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,F401,F403,W601
+ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E231,E261,E301,F401,F403,W601
[metadata]
license-file = LICENSE
View
6 tests/aggregation_regress/tests.py
@@ -1062,7 +1062,7 @@ def test_negated_aggregation(self):
pk__in=Author.objects.annotate(book_cnt=Count('book')).filter(book_cnt=2)
).order_by('name')
expected_results = [a.name for a in expected_results]
- qs = Author.objects.annotate(book_cnt=Count('book')).exclude(Q(book_cnt=2)|Q(book_cnt=2)).order_by('name')
+ qs = Author.objects.annotate(book_cnt=Count('book')).exclude(Q(book_cnt=2) | Q(book_cnt=2)).order_by('name')
self.assertQuerysetEqual(
qs,
expected_results,
@@ -1071,7 +1071,7 @@ def test_negated_aggregation(self):
def test_name_filters(self):
qs = Author.objects.annotate(Count('book')).filter(
- Q(book__count__exact=2)|Q(name='Adrian Holovaty')
+ Q(book__count__exact=2) | Q(name='Adrian Holovaty')
).order_by('name')
self.assertQuerysetEqual(
qs,
@@ -1084,7 +1084,7 @@ def test_name_expressions(self):
# Note that Adrian's age is 34 in the fixtures, and he has one book
# so both conditions match one author.
qs = Author.objects.annotate(Count('book')).filter(
- Q(name='Peter Norvig')|Q(age=F('book__count') + 33)
+ Q(name='Peter Norvig') | Q(age=F('book__count') + 33)
).order_by('name')
self.assertQuerysetEqual(
qs,
View
44 tests/queries/tests.py
@@ -134,7 +134,7 @@ def test_ticket2306(self):
['<Item: one>']
)
self.assertQuerysetEqual(
- Item.objects.filter(Q(tags=self.t1)).filter(Q(creator__name='fred')|Q(tags=self.t2)),
+ Item.objects.filter(Q(tags=self.t1)).filter(Q(creator__name='fred') | Q(tags=self.t2)),
['<Item: one>']
)
@@ -146,7 +146,7 @@ def test_ticket2306(self):
[]
)
self.assertQuerysetEqual(
- Item.objects.filter(Q(tags=self.t1), Q(creator__name='fred')|Q(tags=self.t2)),
+ Item.objects.filter(Q(tags=self.t1), Q(creator__name='fred') | Q(tags=self.t2)),
[]
)
@@ -203,7 +203,7 @@ def test_ticket6074(self):
# (which would match everything).
self.assertQuerysetEqual(Author.objects.filter(Q(id__in=[])), [])
self.assertQuerysetEqual(
- Author.objects.filter(Q(id__in=[])|Q(id__in=[])),
+ Author.objects.filter(Q(id__in=[]) | Q(id__in=[])),
[]
)
@@ -337,7 +337,7 @@ def test_tickets_5324_6704(self):
# values (Author -> ExtraInfo, in the following), it should never be
# promoted to a left outer join. So the following query should only
# involve one "left outer" join (Author -> Item is 0-to-many).
- qs = Author.objects.filter(id=self.a1.id).filter(Q(extra__note=self.n1)|Q(item__note=self.n3))
+ qs = Author.objects.filter(id=self.a1.id).filter(Q(extra__note=self.n1) | Q(item__note=self.n3))
self.assertEqual(
len([x[2] for x in qs.query.alias_map.values() if x[2] == query.LOUTER and qs.query.alias_refcount[x[1]]]),
1
@@ -474,7 +474,7 @@ def test_tickets_2874_3002(self):
def test_ticket3037(self):
self.assertQuerysetEqual(
- Item.objects.filter(Q(creator__name='a3', name='two')|Q(creator__name='a4', name='four')),
+ Item.objects.filter(Q(creator__name='a3', name='two') | Q(creator__name='a4', name='four')),
['<Item: four>']
)
@@ -536,11 +536,11 @@ def test_ticket6154(self):
# Multiple filter statements are joined using "AND" all the time.
self.assertQuerysetEqual(
- Author.objects.filter(id=self.a1.id).filter(Q(extra__note=self.n1)|Q(item__note=self.n3)),
+ Author.objects.filter(id=self.a1.id).filter(Q(extra__note=self.n1) | Q(item__note=self.n3)),
['<Author: a1>']
)
self.assertQuerysetEqual(
- Author.objects.filter(Q(extra__note=self.n1)|Q(item__note=self.n3)).filter(id=self.a1.id),
+ Author.objects.filter(Q(extra__note=self.n1) | Q(item__note=self.n3)).filter(id=self.a1.id),
['<Author: a1>']
)
@@ -830,23 +830,23 @@ def test_ticket8439(self):
# Complex combinations of conjunctions, disjunctions and nullable
# relations.
self.assertQuerysetEqual(
- Author.objects.filter(Q(item__note__extrainfo=self.e2)|Q(report=self.r1, name='xyz')),
+ Author.objects.filter(Q(item__note__extrainfo=self.e2) | Q(report=self.r1, name='xyz')),
['<Author: a2>']
)
self.assertQuerysetEqual(
- Author.objects.filter(Q(report=self.r1, name='xyz')|Q(item__note__extrainfo=self.e2)),
+ Author.objects.filter(Q(report=self.r1, name='xyz') | Q(item__note__extrainfo=self.e2)),
['<Author: a2>']
)
self.assertQuerysetEqual(
- Annotation.objects.filter(Q(tag__parent=self.t1)|Q(notes__note='n1', name='a1')),
+ Annotation.objects.filter(Q(tag__parent=self.t1) | Q(notes__note='n1', name='a1')),
['<Annotation: a1>']
)
xx = ExtraInfo.objects.create(info='xx', note=self.n3)
self.assertQuerysetEqual(
- Note.objects.filter(Q(extrainfo__author=self.a1)|Q(extrainfo=xx)),
+ Note.objects.filter(Q(extrainfo__author=self.a1) | Q(extrainfo=xx)),
['<Note: n1>', '<Note: n3>']
)
- q = Note.objects.filter(Q(extrainfo__author=self.a1)|Q(extrainfo=xx)).query
+ q = Note.objects.filter(Q(extrainfo__author=self.a1) | Q(extrainfo=xx)).query
self.assertEqual(
len([x[2] for x in q.alias_map.values() if x[2] == q.LOUTER and q.alias_refcount[x[1]]]),
1
@@ -872,11 +872,11 @@ def test_exclude(self):
Item.objects.exclude(tags__name='t4'),
[repr(i) for i in Item.objects.filter(~Q(tags__name='t4'))])
self.assertQuerysetEqual(
- Item.objects.exclude(Q(tags__name='t4')|Q(tags__name='t3')),
- [repr(i) for i in Item.objects.filter(~(Q(tags__name='t4')|Q(tags__name='t3')))])
+ Item.objects.exclude(Q(tags__name='t4') | Q(tags__name='t3')),
+ [repr(i) for i in Item.objects.filter(~(Q(tags__name='t4') | Q(tags__name='t3')))])
self.assertQuerysetEqual(
- Item.objects.exclude(Q(tags__name='t4')|~Q(tags__name='t3')),
- [repr(i) for i in Item.objects.filter(~(Q(tags__name='t4')|~Q(tags__name='t3')))])
+ Item.objects.exclude(Q(tags__name='t4') | ~Q(tags__name='t3')),
+ [repr(i) for i in Item.objects.filter(~(Q(tags__name='t4') | ~Q(tags__name='t3')))])
def test_nested_exclude(self):
self.assertQuerysetEqual(
@@ -1318,7 +1318,7 @@ def test_combine_join_reuse(self):
Report.objects.create(name='r4', creator=self.a1)
q1 = Author.objects.filter(report__name='r5')
q2 = Author.objects.filter(report__name='r4').filter(report__name='r1')
- combined = q1|q2
+ combined = q1 | q2
self.assertEqual(str(combined.query).count('JOIN'), 2)
self.assertEqual(len(combined), 1)
self.assertEqual(combined[0].name, 'a1')
@@ -1606,11 +1606,11 @@ def test_ticket5261(self):
['<Note: n1>', '<Note: n2>']
)
self.assertQuerysetEqual(
- Note.objects.filter(~Q()|~Q()),
+ Note.objects.filter(~Q() | ~Q()),
['<Note: n1>', '<Note: n2>']
)
self.assertQuerysetEqual(
- Note.objects.exclude(~Q()&~Q()),
+ Note.objects.exclude(~Q() & ~Q()),
['<Note: n1>', '<Note: n2>']
)
@@ -1692,18 +1692,18 @@ def test_ticket7872(self):
LeafA.objects.create(data='first')
self.assertQuerysetEqual(LeafA.objects.all(), ['<LeafA: first>'])
self.assertQuerysetEqual(
- LeafA.objects.filter(Q(data='first')|Q(join__b__data='second')),
+ LeafA.objects.filter(Q(data='first') | Q(join__b__data='second')),
['<LeafA: first>']
)
def test_ticket8283(self):
# Checking that applying filters after a disjunction works correctly.
self.assertQuerysetEqual(
- (ExtraInfo.objects.filter(note=self.n1)|ExtraInfo.objects.filter(info='e2')).filter(note=self.n1),
+ (ExtraInfo.objects.filter(note=self.n1) | ExtraInfo.objects.filter(info='e2')).filter(note=self.n1),
['<ExtraInfo: e1>']
)
self.assertQuerysetEqual(
- (ExtraInfo.objects.filter(info='e2')|ExtraInfo.objects.filter(note=self.n1)).filter(note=self.n1),
+ (ExtraInfo.objects.filter(info='e2') | ExtraInfo.objects.filter(note=self.n1)).filter(note=self.n1),
['<ExtraInfo: e1>']
)
Please sign in to comment.
Something went wrong with that request. Please try again.