Browse Source

Fix whitespaces

stepshal 8 years ago
parent
commit
d9231d173a
3 changed files with 11 additions and 11 deletions
  1. 1
    1
      examples/basic_engine.py
  2. 1
    1
      utils/fabfile.py
  3. 9
    9
      utils/fetch_currencies.py

+ 1
- 1
examples/basic_engine.py View File

1
 
1
 
2
-categories = ['general'] # optional
2
+categories = ['general']  # optional
3
 
3
 
4
 
4
 
5
 def request(query, params):
5
 def request(query, params):

+ 1
- 1
utils/fabfile.py View File

89
         sudo('git clone https://github.com/asciimoo/searx')
89
         sudo('git clone https://github.com/asciimoo/searx')
90
 
90
 
91
     sudo('chown -R {user}:{user} {searx_dir}'.format(user=current_user, searx_dir=searx_dir))
91
     sudo('chown -R {user}:{user} {searx_dir}'.format(user=current_user, searx_dir=searx_dir))
92
-    put(StringIO(uwsgi_file), searx_dir+'/uwsgi.ini')
92
+    put(StringIO(uwsgi_file), searx_dir + '/uwsgi.ini')
93
     sudo('ln -s {0}/uwsgi.ini /etc/uwsgi/apps-enabled/searx.ini'.format(searx_dir))
93
     sudo('ln -s {0}/uwsgi.ini /etc/uwsgi/apps-enabled/searx.ini'.format(searx_dir))
94
 
94
 
95
     run('virtualenv {0}'.format(searx_ve_dir))
95
     run('virtualenv {0}'.format(searx_ve_dir))

+ 9
- 9
utils/fetch_currencies.py View File

10
 
10
 
11
 url_template = 'https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&{query}&props=labels%7Cdatatype%7Cclaims%7Caliases&languages=' + '|'.join(languages)
11
 url_template = 'https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&{query}&props=labels%7Cdatatype%7Cclaims%7Caliases&languages=' + '|'.join(languages)
12
 url_wmflabs_template = 'http://wdq.wmflabs.org/api?q='
12
 url_wmflabs_template = 'http://wdq.wmflabs.org/api?q='
13
-url_wikidata_search_template='http://www.wikidata.org/w/api.php?action=query&list=search&format=json&srnamespace=0&srprop=sectiontitle&{query}'
13
+url_wikidata_search_template = 'http://www.wikidata.org/w/api.php?action=query&list=search&format=json&srnamespace=0&srprop=sectiontitle&{query}'
14
 
14
 
15
 wmflabs_queries = [
15
 wmflabs_queries = [
16
-    'CLAIM[31:8142]', # all devise
16
+    'CLAIM[31:8142]',  # all devise
17
 ]
17
 ]
18
 
18
 
19
 db = {
19
 db = {
20
-    'iso4217' : {
21
-        },
22
-    'names' : {
23
-        }
20
+    'iso4217': {
21
+    },
22
+    'names': {
23
+    }
24
 }
24
 }
25
 
25
 
26
 
26
 
29
 
29
 
30
 
30
 
31
 def normalize_name(name):
31
 def normalize_name(name):
32
-    return re.sub(' +',' ', remove_accents(name.lower()).replace('-', ' '))
32
+    return re.sub(' +', ' ', remove_accents(name.lower()).replace('-', ' '))
33
 
33
 
34
 
34
 
35
 def add_currency_name(name, iso4217):
35
 def add_currency_name(name, iso4217):
51
     if iso4217_set is not None and iso4217 not in iso4217_set:
51
     if iso4217_set is not None and iso4217 not in iso4217_set:
52
         db_names[name].append(iso4217)
52
         db_names[name].append(iso4217)
53
     else:
53
     else:
54
-        db_names[name] = [ iso4217 ]
54
+        db_names[name] = [iso4217]
55
 
55
 
56
 
56
 
57
 def add_currency_label(label, iso4217, language):
57
 def add_currency_label(label, iso4217, language):
96
 
96
 
97
 
97
 
98
 def fetch_data(wikidata_ids):
98
 def fetch_data(wikidata_ids):
99
-    url = url_template.format(query=urlencode({'ids' : '|'.join(wikidata_ids)}))
99
+    url = url_template.format(query=urlencode({'ids': '|'.join(wikidata_ids)}))
100
     htmlresponse = get(url)
100
     htmlresponse = get(url)
101
     jsonresponse = json.loads(htmlresponse.content)
101
     jsonresponse = json.loads(htmlresponse.content)
102
     entities = jsonresponse.get('entities', {})
102
     entities = jsonresponse.get('entities', {})