Skip to content

Commit

Permalink
flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Sep 12, 2013
1 parent 43dde55 commit e650e3b
Show file tree
Hide file tree
Showing 34 changed files with 120 additions and 336 deletions.
2 changes: 1 addition & 1 deletion celery/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .encoding import safe_str, str_t
from .term import colored

__all__ = ['ColorFormatter', 'LoggingProxy' 'base_logger',
__all__ = ['ColorFormatter', 'LoggingProxy', 'base_logger',
'set_in_sighandler', 'in_sighandler', 'get_logger',
'get_task_logger', 'mlevel', 'ensure_process_aware_logger',
'get_multiprocessing_logger', 'reset_multiprocessing_logger']
Expand Down
1 change: 0 additions & 1 deletion celery/utils/timer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"""
from __future__ import absolute_import

import atexit
import heapq
import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion celery/worker/autoreload.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
_ProcessEvent = object # noqa

__all__ = [
'WorkerComponent', 'Autoreloader', 'Monitor' 'BaseMonitor',
'WorkerComponent', 'Autoreloader', 'Monitor', 'BaseMonitor',
'StatMonitor', 'KQueueMonitor', 'InotifyMonitor', 'file_hash',
]

Expand Down
2 changes: 1 addition & 1 deletion celery/worker/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class buffer_t(object): # noqa
pass

__all__ = [
'Consumer', 'Conneciton', 'Events', 'Heart', 'Control',
'Consumer', 'Connection', 'Events', 'Heart', 'Control',
'Tasks', 'Evloop', 'Agent', 'Mingle', 'Gossip', 'dump_body',
]

Expand Down
4 changes: 2 additions & 2 deletions docs/_ext/applyxrefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
testing = False

DONT_TOUCH = (
'./index.txt',
)
'./index.txt',
)


def target_name(fn):
Expand Down
8 changes: 2 additions & 6 deletions docs/_ext/celerydocs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from docutils import nodes

from sphinx.environment import NoUri
from sphinx.util.nodes import make_refnode

APPATTRS = {
"amqp": "celery.app.amqp.AMQP",
Expand Down Expand Up @@ -65,9 +64,7 @@ def get_abbr(pre, rest, type):
return ABBR_EMPTY.get(type, DEFAULT_EMPTY), rest, ABBR_EMPTY



def resolve(S, type):
is_appattr = False
if S.startswith('@'):
S = S.lstrip('@-')
try:
Expand All @@ -91,9 +88,8 @@ def basename(module_fqdn):
def modify_textnode(T, newtarget, node, src_dict, type):
src = node.children[0].rawsource
return nodes.Text(
typeify(basename(T), type) if '~' in src
else typeify(shorten(T, newtarget,
src_dict), type),
(typeify(basename(T), type) if '~' in src
else typeify(shorten(T, newtarget, src_dict), type)),
src,
)

Expand Down
5 changes: 3 additions & 2 deletions docs/_ext/literals_to_xrefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ def fixliterals(fname):
replace_type in ("class", "func", "meth"):
default = default[:-2]
replace_value = input(
colorize("Text <target> [", fg="yellow") + default + \
colorize("]: ", fg="yellow")).strip()
colorize("Text <target> [", fg="yellow") +
default + colorize("]: ", fg="yellow"),
).strip()
if not replace_value:
replace_value = default
new.append(":%s:`%s`" % (replace_type, replace_value))
Expand Down
9 changes: 5 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@
GITHUB_PROJECT = 'celery/celery'
GITHUB_BRANCH = 'master'


def linkcode_resolve(domain, info):
if domain != 'py' or not info['module']:
return
filename = info['module'].replace('.', '/')
return LINKCODE_URL.format(
proj=GITHUB_PROJECT,
branch=GITHUB_BRANCH,
filename=FILENAME,
filename=filename,
)

html_show_sphinx = False
Expand Down Expand Up @@ -116,8 +117,8 @@ def linkcode_resolve(domain, info):
html_use_index = True

latex_documents = [
('index', 'Celery.tex', 'Celery Documentation',
'Ask Solem & Contributors', 'manual'),
('index', 'Celery.tex', 'Celery Documentation',
'Ask Solem & Contributors', 'manual'),
]

html_theme = "celery"
Expand All @@ -135,7 +136,7 @@ def linkcode_resolve(domain, info):
issuetracker_project = "celery/celery"
issuetracker_issue_pattern = r'[Ii]ssue #(\d+)'

# -- Options for Epub output ---------------------------------------------------
# -- Options for Epub output -------------------------------------------

# Bibliographic Dublin Core info.
epub_title = 'Celery Manual, Version {0}'.format(version)
Expand Down
1 change: 0 additions & 1 deletion examples/celery_http_gateway/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
Expand Down
7 changes: 5 additions & 2 deletions examples/celery_http_gateway/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.conf.urls.defaults import *
from django.conf.urls.defaults import ( # noqa
url, patterns, include, handler404, handler500,
)

from djcelery import views as celery_views

Expand All @@ -8,7 +10,8 @@
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^apply/(?P<task_name>.+?)/', celery_views.apply),
url(r'^hello/', celery_views.task_view(hello_world)),
url(r'^(?P<task_id>[\w\d\-]+)/done/?$', celery_views.is_task_successful,
Expand Down
2 changes: 1 addition & 1 deletion examples/django/demoapp/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.db import models
from django.db import models # noqa

# Create your models here.
20 changes: 11 additions & 9 deletions examples/django/proj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
# Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'ENGINE': 'django.db.backends.',
'NAME': '', # path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost.
# Not used with sqlite3.
'PORT': '', # Set to empty string for default.
# Not used with sqlite3.
}
}

Expand Down Expand Up @@ -74,7 +77,6 @@
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
Expand All @@ -84,7 +86,6 @@
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
Expand All @@ -103,7 +104,8 @@
WSGI_APPLICATION = 'proj.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Put strings here, like "/home/html/django_templates"
# or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
Expand Down
7 changes: 5 additions & 2 deletions examples/django/proj/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from django.conf.urls import patterns, include, url
from django.conf.urls import ( # noqa
patterns, include, url, handler404, handler500,
)

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
urlpatterns = patterns(
'',
# Examples:
# url(r'^$', 'proj.views.home', name='home'),
# url(r'^proj/', include('proj.foo.urls')),
Expand Down
5 changes: 3 additions & 2 deletions examples/eventlet/bulk_task_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def apply_async(self, task, args, kwargs, callback=None, **options):
return receipt

def _run(self):
self._producers = [spawn_n(self._producer)
for _ in range(self.size)]
self._producers = [
spawn_n(self._producer) for _ in range(self.size)
]

def _producer(self):
connection = current_app.connection()
Expand Down
3 changes: 1 addition & 2 deletions examples/eventlet/webcrawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@


import re
import time

try:
from urllib.parse import urlsplit
except ImportError:
from urlparse import urlsplit
from urlparse import urlsplit # noqa

import requests

Expand Down
2 changes: 1 addition & 1 deletion examples/gevent/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def urlopen(url):
print('Opening: {0}'.format(url))
try:
_response = requests.get(url)
requests.get(url)
except Exception as exc:
print('Exception for {0}: {1!r}'.format(url, exc))
return url, 0
Expand Down
1 change: 0 additions & 1 deletion examples/httpexample/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
Expand Down
9 changes: 6 additions & 3 deletions examples/httpexample/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from django.conf.urls.defaults import *
from django.conf.urls.defaults import ( # noqa
url, patterns, include, handler500, handler404,
)
from . import views

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
url(r'^multiply/', views.multiply, name='multiply'),
urlpatterns = patterns(
'',
url(r'^multiply/', views.multiply, name='multiply'),
)
13 changes: 8 additions & 5 deletions examples/resultgraph/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
# ... A_callback.subtask()), countdown=1)


from celery import chord, task, subtask
from celery import chord, group, task, subtask, uuid
from celery.result import AsyncResult, ResultSet
from collections import deque


@task()
def add(x, y):
return x + y
Expand All @@ -42,8 +43,10 @@ def B_callback(urls, id):

@task()
def B(id):
return chord(make_request.s(id, '{0} {1!r}'.format(id, i))
for i in range(10))(B_callback.s(id))
return chord(
make_request.s(id, '{0} {1!r}'.format(id, i))
for i in range(10)
)(B_callback.s(id))


@task()
Expand Down Expand Up @@ -71,8 +74,8 @@ def joinall(R, timeout=None, propagate=True):


@task()
def unlock_graph(result, callback, interval=1, propagate=False,
max_retries=None):
def unlock_graph(result, callback,
interval=1, propagate=False, max_retries=None):
if result.ready():
second_level_res = result.get()
if second_level_res.ready():
Expand Down
1 change: 1 addition & 0 deletions examples/tutorial/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

celery = Celery('tasks', broker='amqp://')


@celery.task()
def add(x, y):
return x + y
Expand Down
6 changes: 3 additions & 3 deletions extra/release/attribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def find_missing_authors(seen):
known = [author(line) for line in authors.readlines()]

seen_authors = set(filter(proper_name, (t[0] for t in seen)))
seen_emails = set(t[1] for t in seen)
known_authors = set(t[0] for t in known)
known_emails = set(t[1] for t in known)
# maybe later?:
# seen_emails = set(t[1] for t in seen)
# known_emails = set(t[1] for t in known)

pprint(seen_authors - known_authors)


if __name__ == "__main__":
find_missing_authors([author(line) for line in fileinput.input()])

1 change: 1 addition & 0 deletions extra/release/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class CPPVersion(VersionFile):
"c": CPPVersion,
"h": CPPVersion}


def filetype_to_type(filename):
_, _, suffix = filename.rpartition(".")
return _filetype_to_type[suffix](filename)
Expand Down
16 changes: 10 additions & 6 deletions extra/release/verify_config_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,23 @@ def is_ignored(setting, option):
def find_undocumented_settings(directive='.. setting:: '):
settings = dict(flatten(NAMESPACES))
all = set(settings)
documented = set(line.strip()[len(directive):].strip()
for line in _input()
if line.strip().startswith(directive))
documented = set(
line.strip()[len(directive):].strip() for line in _input()
if line.strip().startswith(directive)
)
return [setting for setting in all ^ documented
if not is_ignored(setting, settings[setting])]
if not is_ignored(setting, settings[setting])]


if __name__ == '__main__':
sep = '\n * '
missing = find_undocumented_settings()
if missing:
print('Error: found undocumented settings:{0}{1}'.format(
sep, sep.join(sorted(missing))), file=stderr)
print(
'Error: found undocumented settings:{0}{1}'.format(
sep, sep.join(sorted(missing))),
file=stderr,
)
exit(1)
print('OK: Configuration reference complete :-)')
exit(0)
Loading

0 comments on commit e650e3b

Please sign in to comment.