summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2015-03-08 17:04:59 +0100
committerGeorg Brandl <georg@python.org>2015-03-08 17:04:59 +0100
commit3047a23a6613d74705b6373b03e8f78b82e3c1ce (patch)
treed4ab8b84dd0afb7cbf76fc749272a841d7f94544
parentb5c2279e05b3f18b660b29c8bd0989fbb8a1582a (diff)
downloadsphinx-git-3047a23a6613d74705b6373b03e8f78b82e3c1ce.tar.gz
websupport: pep8 fixes
-rw-r--r--sphinx/search/__init__.py9
-rw-r--r--sphinx/websupport/__init__.py16
-rw-r--r--sphinx/websupport/search/xapiansearch.py2
-rw-r--r--sphinx/websupport/storage/__init__.py1
-rw-r--r--sphinx/websupport/storage/sqlalchemy_db.py4
-rw-r--r--sphinx/websupport/storage/sqlalchemystorage.py16
6 files changed, 24 insertions, 24 deletions
diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py
index ebba8a371..10b125dfb 100644
--- a/sphinx/search/__init__.py
+++ b/sphinx/search/__init__.py
@@ -110,7 +110,7 @@ def parse_stop_word(source):
"""
result = set()
for line in source.splitlines():
- line = line.split('|')[0] # remove comment
+ line = line.split('|')[0] # remove comment
result.update(line.split())
return result
@@ -292,7 +292,7 @@ class IndexBuilder(object):
if otype:
# use unicode() to fire translation proxies
onames[typeindex] = (domainname, type,
- text_type(domain.get_type_name(otype)))
+ text_type(domain.get_type_name(otype)))
else:
onames[typeindex] = (domainname, type, type)
if anchor == fullname:
@@ -360,7 +360,7 @@ class IndexBuilder(object):
except KeyError:
self._stem_cache[word] = self.lang.stem(word)
return self._stem_cache[word]
- _filter = self.lang.word_filter
+ _filter = self.lang.word_filter
for word in visitor.found_title_words:
word = stem(word)
@@ -375,7 +375,6 @@ class IndexBuilder(object):
def context_for_searchtool(self):
return dict(
search_language_stemming_code = self.lang.js_stemmer_code,
- search_language_stop_words =
- jsdump.dumps(sorted(self.lang.stopwords)),
+ search_language_stop_words = jsdump.dumps(sorted(self.lang.stopwords)),
search_scorer_tool = self.js_scorer_code,
)
diff --git a/sphinx/websupport/__init__.py b/sphinx/websupport/__init__.py
index 75451e47b..8e6288756 100644
--- a/sphinx/websupport/__init__.py
+++ b/sphinx/websupport/__init__.py
@@ -32,13 +32,13 @@ class WebSupport(object):
with the web support package should occur through this class.
"""
def __init__(self,
- srcdir=None, # only required for building
- builddir='', # the dir with data/static/doctrees subdirs
- datadir=None, # defaults to builddir/data
- staticdir=None, # defaults to builddir/static
- doctreedir=None, # defaults to builddir/doctrees
- search=None, # defaults to no search
- storage=None, # defaults to SQLite in datadir
+ srcdir=None, # only required for building
+ builddir='', # the dir with data/static/doctrees subdirs
+ datadir=None, # defaults to builddir/data
+ staticdir=None, # defaults to builddir/static
+ doctreedir=None, # defaults to builddir/doctrees
+ search=None, # defaults to no search
+ storage=None, # defaults to SQLite in datadir
status=sys.stdout,
warning=sys.stderr,
moderation_callback=None,
@@ -216,7 +216,7 @@ class WebSupport(object):
'q': q,
'search_performed': True,
'search_results': results,
- 'docroot': '../', # XXX
+ 'docroot': '../', # XXX
'_': _,
}
document = {
diff --git a/sphinx/websupport/search/xapiansearch.py b/sphinx/websupport/search/xapiansearch.py
index 2d056bcce..c097e5e6e 100644
--- a/sphinx/websupport/search/xapiansearch.py
+++ b/sphinx/websupport/search/xapiansearch.py
@@ -76,6 +76,6 @@ class XapianSearch(BaseSearch):
context = self.extract_context(m.document.get_data())
results.append((m.document.get_value(self.DOC_PATH),
m.document.get_value(self.DOC_TITLE),
- ''.join(context) ))
+ ''.join(context)))
return results
diff --git a/sphinx/websupport/storage/__init__.py b/sphinx/websupport/storage/__init__.py
index 3f421a7ce..e04ac6ed5 100644
--- a/sphinx/websupport/storage/__init__.py
+++ b/sphinx/websupport/storage/__init__.py
@@ -9,6 +9,7 @@
:license: BSD, see LICENSE for details.
"""
+
class StorageBackend(object):
def pre_build(self):
"""Called immediately before the build process begins. Use this
diff --git a/sphinx/websupport/storage/sqlalchemy_db.py b/sphinx/websupport/storage/sqlalchemy_db.py
index 84cdaefcf..5603c3f27 100644
--- a/sphinx/websupport/storage/sqlalchemy_db.py
+++ b/sphinx/websupport/storage/sqlalchemy_db.py
@@ -13,7 +13,7 @@
from datetime import datetime
from sqlalchemy import Column, Integer, Text, String, Boolean, \
- ForeignKey, DateTime
+ ForeignKey, DateTime
from sqlalchemy.orm import relation, sessionmaker, aliased
from sqlalchemy.ext.declarative import declarative_base
@@ -160,7 +160,7 @@ class Comment(Base):
filter(Comment.id == parent_id).one().path
session.close()
self.node_id = parent_path.split('.')[0]
- self.path = '%s.%s' % (parent_path, self.id)
+ self.path = '%s.%s' % (parent_path, self.id)
def serializable(self, vote=0):
"""Creates a serializable representation of the comment. This is
diff --git a/sphinx/websupport/storage/sqlalchemystorage.py b/sphinx/websupport/storage/sqlalchemystorage.py
index 6a9513770..2842526c1 100644
--- a/sphinx/websupport/storage/sqlalchemystorage.py
+++ b/sphinx/websupport/storage/sqlalchemystorage.py
@@ -15,17 +15,17 @@ import sqlalchemy
from sqlalchemy.orm import aliased
from sqlalchemy.sql import func
-if sqlalchemy.__version__[:3] < '0.5':
- raise ImportError('SQLAlchemy version 0.5 or greater is required for this '
- 'storage backend; you have version %s' % sqlalchemy.__version__)
-
from sphinx.websupport.errors import CommentNotAllowedError, \
- UserNotAuthorizedError
+ UserNotAuthorizedError
from sphinx.websupport.storage import StorageBackend
from sphinx.websupport.storage.sqlalchemy_db import Base, Node, \
- Comment, CommentVote, Session
+ Comment, CommentVote, Session
from sphinx.websupport.storage.differ import CombinedHtmlDiff
+if sqlalchemy.__version__[:3] < '0.5':
+ raise ImportError('SQLAlchemy version 0.5 or greater is required for this '
+ 'storage backend; you have version %s' % sqlalchemy.__version__)
+
class SQLAlchemyStorage(StorageBackend):
"""
@@ -120,8 +120,8 @@ class SQLAlchemyStorage(StorageBackend):
func.count('*').label('comment_count')).group_by(
Comment.node_id).subquery()
nodes = session.query(Node.id, subquery.c.comment_count).outerjoin(
- (subquery, Node.id==subquery.c.node_id)).filter(
- Node.document==docname)
+ (subquery, Node.id == subquery.c.node_id)).filter(
+ Node.document == docname)
session.close()
session.commit()
return dict([(k, v or 0) for k, v in nodes])