Selaa lähdekoodia

Merge pull request #34 from Aigeruth/pep8

Improves PEP8 compatibility.
Adam Tauber 11 vuotta sitten
vanhempi
commit
b8d836e445

+ 4
- 4
searx/engines/__init__.py Näytä tiedosto

17
 '''
17
 '''
18
 
18
 
19
 from os.path import realpath, dirname, splitext, join
19
 from os.path import realpath, dirname, splitext, join
20
+import sys
20
 from imp import load_source
21
 from imp import load_source
21
-import grequests
22
 from itertools import izip_longest, chain
22
 from itertools import izip_longest, chain
23
 from operator import itemgetter
23
 from operator import itemgetter
24
 from urlparse import urlparse
24
 from urlparse import urlparse
25
-from searx import settings
26
-from searx.utils import gen_useragent
27
-import sys
28
 from datetime import datetime
25
 from datetime import datetime
26
+import grequests
29
 from flask.ext.babel import gettext
27
 from flask.ext.babel import gettext
28
+from searx import settings
29
+from searx.utils import gen_useragent
30
 
30
 
31
 engine_dir = dirname(realpath(__file__))
31
 engine_dir = dirname(realpath(__file__))
32
 
32
 

+ 1
- 1
searx/engines/bing.py Näytä tiedosto

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

+ 1
- 1
searx/engines/dailymotion.py Näytä tiedosto

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

+ 1
- 1
searx/engines/deviantart.py Näytä tiedosto

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

+ 1
- 1
searx/engines/piratebay.py Näytä tiedosto

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

+ 1
- 1
searx/engines/stackoverflow.py Näytä tiedosto

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

+ 1
- 1
searx/engines/vimeo.py Näytä tiedosto

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

+ 1
- 1
searx/engines/yahoo.py Näytä tiedosto

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

+ 2
- 1
searx/engines/youtube.py Näytä tiedosto

3
 
3
 
4
 categories = ['videos']
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
 paging = True
9
 paging = True
9
 
10
 

+ 2
- 3
searx/tests/test_robot.py Näytä tiedosto

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

+ 2
- 4
searx/tests/test_webapp.py Näytä tiedosto

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

+ 9
- 13
searx/webapp.py Näytä tiedosto

21
 import cStringIO
21
 import cStringIO
22
 import os
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
 from searx import settings, searx_dir
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
 from searx.languages import language_codes
34
 from searx.languages import language_codes
37
 
35
 
38
-from flask.ext.babel import Babel
39
-
40
 
36
 
41
 app = Flask(
37
 app = Flask(
42
     __name__,
38
     __name__,