Browse files

flake8 compliance

  • Loading branch information...
1 parent 0d4d04e commit ac08b9fd245a45571a21194ccad098b58e4c5268 @jtauber jtauber committed Jul 20, 2014
Showing with 28 additions and 31 deletions.
  1. +8 −9 docs/conf.py
  2. +1 −1 reminders/models.py
  3. +5 −5 reminders/templatetags/reminders_tags.py
  4. +3 −2 reminders/urls.py
  5. +5 −5 reminders/views.py
  6. +6 −9 setup.py
View
17 docs/conf.py
@@ -1,4 +1,5 @@
-import sys, os
+import os
+import sys
extensions = []
templates_path = []
@@ -12,14 +13,12 @@
pygments_style = 'sphinx'
html_theme = 'default'
htmlhelp_basename = '%sdoc' % project
-latex_documents = [
- ('index', '%s.tex' % project, u'%s Documentation' % project,
- copyright_holder, 'manual'),
-]
-man_pages = [
- ('index', project, u'%s Documentation' % project,
- [copyright_holder], 1)
-]
+latex_documents = [(
+ 'index', '%s.tex' % project, u'%s Documentation' % project, copyright_holder, 'manual'
+)]
+man_pages = [(
+ 'index', project, u'%s Documentation' % project, [copyright_holder], 1
+)]
sys.path.insert(0, os.pardir)
m = __import__(package)
View
2 reminders/models.py
@@ -6,7 +6,7 @@
class Dismissal(models.Model):
-
+
user = models.ForeignKey(User, related_name="reminder_dismissals")
label = models.CharField(max_length=200)
dismissed_at = models.DateTimeField(default=datetime.datetime.now)
View
10 reminders/templatetags/reminders_tags.py
@@ -37,17 +37,17 @@ def is_dismissed(label, dismissal_type, request):
class RemindersNode(template.Node):
-
+
@classmethod
def handle_token(cls, parser, token):
bits = token.split_contents()
if len(bits) != 3:
raise template.TemplateSyntaxError
- return cls(as_var = bits[2])
-
+ return cls(as_var=bits[2])
+
def __init__(self, as_var):
self.as_var = as_var
-
+
def render(self, context):
request = context["request"]
reminders = []
@@ -78,7 +78,7 @@ def reminders(parser, token):
"""
Usage::
{% reminders as var %}
-
+
Returns a list of reminders
"""
return RemindersNode.handle_token(parser, token)
View
5 reminders/urls.py
@@ -1,6 +1,7 @@
-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url
-urlpatterns = patterns("",
+urlpatterns = patterns(
+ "",
url(r"^dismiss/(?P<label>.+)/$", "reminders.views.dismiss", name="reminders_dismiss"),
)
View
10 reminders/views.py
@@ -5,15 +5,15 @@
def dismiss(request, label):
-
+
if request.method != "POST":
return HttpResponseNotAllowed(["POST"])
-
+
if label not in settings.REMINDERS:
return Http404()
-
+
dismiss_type = settings.REMINDERS[label].get("dismissable", "session")
-
+
if dismiss_type == "session":
request.session[label] = "dismissed"
status = 200
@@ -22,5 +22,5 @@ def dismiss(request, label):
status = 200
else:
status = 409
-
+
return HttpResponse(status=status)
View
15 setup.py
@@ -30,7 +30,8 @@ def find_package_data(
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
- show_ignored=False):
+ show_ignored=False
+):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
@@ -66,8 +67,7 @@ def find_package_data(
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
- if (fnmatchcase(name, pattern)
- or fn.lower() == pattern.lower()):
+ if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
@@ -76,8 +76,7 @@ def find_package_data(
break
if bad_name:
continue
- if (os.path.isfile(os.path.join(fn, "__init__.py"))
- and not prefix):
+ if os.path.isfile(os.path.join(fn, "__init__.py")) and not prefix:
if not package:
new_package = name
else:
@@ -89,8 +88,7 @@ def find_package_data(
# is a file
bad_name = False
for pattern in exclude:
- if (fnmatchcase(name, pattern)
- or fn.lower() == pattern.lower()):
+ if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print >> sys.stderr, (
@@ -99,7 +97,7 @@ def find_package_data(
break
if bad_name:
continue
- out.setdefault(package, []).append(prefix+name)
+ out.setdefault(package, []).append(prefix + name)
return out
@@ -134,4 +132,3 @@ def find_package_data(
],
zip_safe=False,
)
-

0 comments on commit ac08b9f

Please sign in to comment.