Преглед на файлове

Merge pull request #34 from Aigeruth/pep8

Improves PEP8 compatibility.
Adam Tauber преди 11 години
родител
ревизия
b8d836e445

+ 4
- 4
searx/engines/__init__.py Целия файл

@@ -17,16 +17,16 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
17 17
 '''
18 18
 
19 19
 from os.path import realpath, dirname, splitext, join
20
+import sys
20 21
 from imp import load_source
21
-import grequests
22 22
 from itertools import izip_longest, chain
23 23
 from operator import itemgetter
24 24
 from urlparse import urlparse
25
-from searx import settings
26
-from searx.utils import gen_useragent
27
-import sys
28 25
 from datetime import datetime
26
+import grequests
29 27
 from flask.ext.babel import gettext
28
+from searx import settings
29
+from searx.utils import gen_useragent
30 30
 
31 31
 engine_dir = dirname(realpath(__file__))
32 32
 

+ 1
- 1
searx/engines/bing.py Целия файл

@@ -1,6 +1,6 @@
1
-from lxml import html
2 1
 from urllib import urlencode
3 2
 from cgi import escape
3
+from lxml import html
4 4
 
5 5
 base_url = 'http://www.bing.com/'
6 6
 search_string = 'search?{query}&first={offset}'

+ 1
- 1
searx/engines/dailymotion.py Целия файл

@@ -1,6 +1,6 @@
1 1
 from urllib import urlencode
2
-from lxml import html
3 2
 from json import loads
3
+from lxml import html
4 4
 
5 5
 categories = ['videos']
6 6
 locale = 'en_US'

+ 1
- 1
searx/engines/deviantart.py Целия файл

@@ -1,6 +1,6 @@
1 1
 from urllib import urlencode
2
-from lxml import html
3 2
 from urlparse import urljoin
3
+from lxml import html
4 4
 
5 5
 categories = ['images']
6 6
 

+ 1
- 1
searx/engines/piratebay.py Целия файл

@@ -1,7 +1,7 @@
1
-from lxml import html
2 1
 from urlparse import urljoin
3 2
 from cgi import escape
4 3
 from urllib import quote
4
+from lxml import html
5 5
 
6 6
 categories = ['videos', 'music']
7 7
 

+ 1
- 1
searx/engines/stackoverflow.py Целия файл

@@ -1,7 +1,7 @@
1
-from lxml import html
2 1
 from urlparse import urljoin
3 2
 from cgi import escape
4 3
 from urllib import urlencode
4
+from lxml import html
5 5
 
6 6
 categories = ['it']
7 7
 

+ 1
- 1
searx/engines/vimeo.py Целия файл

@@ -1,7 +1,7 @@
1 1
 from urllib import urlencode
2 2
 from HTMLParser import HTMLParser
3
-from xpath import extract_text
4 3
 from lxml import html
4
+from xpath import extract_text
5 5
 
6 6
 base_url = 'http://vimeo.com'
7 7
 search_url = base_url + '/search?{query}'

+ 1
- 1
searx/engines/yahoo.py Целия файл

@@ -1,8 +1,8 @@
1 1
 #!/usr/bin/env python
2 2
 
3 3
 from urllib import urlencode
4
-from searx.engines.xpath import extract_text, extract_url
5 4
 from lxml import html
5
+from searx.engines.xpath import extract_text, extract_url
6 6
 
7 7
 categories = ['general']
8 8
 search_url = 'http://search.yahoo.com/search?{query}&b={offset}'

+ 2
- 1
searx/engines/youtube.py Целия файл

@@ -3,7 +3,8 @@ from urllib import urlencode
3 3
 
4 4
 categories = ['videos']
5 5
 
6
-search_url = 'https://gdata.youtube.com/feeds/api/videos?alt=json&{query}&start-index={index}&max-results=25'  # noqa
6
+search_url = ('https://gdata.youtube.com/feeds/api/videos'
7
+              '?alt=json&{query}&start-index={index}&max-results=25')  # noqa
7 8
 
8 9
 paging = True
9 10
 

+ 2
- 3
searx/tests/test_robot.py Целия файл

@@ -1,12 +1,11 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
+import os
4
+import unittest2 as unittest
3 5
 from plone.testing import layered
4 6
 from robotsuite import RobotTestSuite
5 7
 from searx.testing import SEARXROBOTLAYER
6 8
 
7
-import os
8
-import unittest2 as unittest
9
-
10 9
 
11 10
 def test_suite():
12 11
     suite = unittest.TestSuite()

+ 2
- 4
searx/tests/test_webapp.py Целия файл

@@ -1,12 +1,10 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
+import json
4
+from urlparse import ParseResult
3 5
 from mock import patch
4 6
 from searx import webapp
5 7
 from searx.testing import SearxTestCase
6
-from urlparse import ParseResult
7
-
8
-
9
-import json
10 8
 
11 9
 
12 10
 class ViewsTestCase(SearxTestCase):

+ 9
- 13
searx/webapp.py Целия файл

@@ -21,22 +21,18 @@ import json
21 21
 import cStringIO
22 22
 import os
23 23
 
24
-from flask import Flask, request, render_template
25
-from flask import url_for, Response, make_response, redirect
26
-from flask import send_from_directory
27
-
24
+from flask import (
25
+    Flask, request, render_template, url_for, Response, make_response,
26
+    redirect, send_from_directory
27
+)
28
+from flask.ext.babel import Babel
28 29
 from searx import settings, searx_dir
29
-from searx.engines import search
30
-from searx.engines import categories
31
-from searx.engines import engines
32
-from searx.engines import get_engines_stats
33
-from searx.engines import engine_shortcuts
34
-from searx.utils import UnicodeWriter
35
-from searx.utils import highlight_content, html_to_text
30
+from searx.engines import (
31
+    search, categories, engines, get_engines_stats, engine_shortcuts
32
+)
33
+from searx.utils import UnicodeWriter, highlight_content, html_to_text
36 34
 from searx.languages import language_codes
37 35
 
38
-from flask.ext.babel import Babel
39
-
40 36
 
41 37
 app = Flask(
42 38
     __name__,