File tree 6 files changed +70
-38
lines changed
6 files changed +70
-38
lines changed Original file line number Diff line number Diff line change
1
+ [flake8]
2
+ ignore =
3
+ # Module imported but unused
4
+ F401,
5
+ # Line too long
6
+ E501,
7
+ # Indentation contains tabs
8
+ W191,
9
+ ZZZZ # allow comma on last entry
10
+ select =
11
+ # Missing whitespace around modulo
12
+ E228,
13
+ # Blank line at end of file
14
+ W391,
15
+ # Block comment should start with '# '
16
+ E265,
17
+ # Whitespace before '('
18
+ E211,
19
+ # Trailing whitespace
20
+ W291,
21
+ # Multiple spaces after operator
22
+ E222,
23
+ # Multiple imports on one line
24
+ E401,
25
+ # Indentation contains mixed spaces and tabs
26
+ E101,
27
+ ZZZZ # allow comma on last entry
28
+ filename = *.py
Original file line number Diff line number Diff line change 4
4
env :
5
5
global :
6
6
- secure : DbveaxDMtEP+/Er6ktKCP+P42uDU8xXWRBlVGaqVNU3muaRmmZtj8ngAARxfzY0f9amlJlCavqkEIAumQl9BYKPWIra28ylsLNbzAoCIi8alf9WLgddKwVWsTcZo9+UYocuY6UivJVkofycfFJ1blw/83dWMG0/TiW6s/SrwoDw=
7
+ install :
8
+ - pip install --user flake8
7
9
script :
8
10
- " ./gradle_init.sh"
9
11
- gradle assemble
10
12
- " ./gradle_clean.sh"
11
13
- ant
12
14
- bin/start.sh
15
+ # Run flake8
16
+ - flake8 bin
13
17
before_script :
14
18
- pip install --user codecov
15
- install : true
16
19
after_success :
17
20
- sh .utility/push-javadoc-to-gh-pages.sh
18
21
- bash <(curl -s https://codecov.io/bash)
Original file line number Diff line number Diff line change 8
8
query = "http://127.0.0.1:9000/api/search.json?q={}" .format (searchTerm )
9
9
10
10
try :
11
- fetchData = urllib .urlopen (query ).read ()
11
+ fetchData = urllib .urlopen (query ).read ()
12
12
except Exception , e :
13
- print "! Sorry, something went wrong:"
14
- print "! Error: %s" % e
15
- sys .exit (1 )
13
+ print "! Sorry, something went wrong:"
14
+ print "! Error: %s" % e
15
+ sys .exit (1 )
16
16
17
17
statuses = json .loads (fetchData ).get ("statuses" )
18
18
texts = [tweet .get ("text" ) for tweet in statuses ]
19
19
20
20
for text in texts :
21
- print text
22
-
21
+ print text
Original file line number Diff line number Diff line change 1
- #Returns all tweet text lines related to fossasia
1
+ # Returns all tweet text lines related to fossasia
2
2
import urllib
3
3
from urllib import request
4
4
import html
9
9
search_term = sys .argv [1 ]
10
10
query = "http://loklak.org/api/search.json?q={}" .format (search_term )
11
11
12
- #get file and decode
12
+ # Get file and decode
13
13
try :
14
14
json_data = urllib .request .Request (query )
15
15
with urllib .request .urlopen (json_data ) as data :
16
16
data1 = str (data .read ().decode ('utf-8' ))
17
17
non_bmp_map = dict .fromkeys (range (0x10000 , sys .maxunicode + 1 ), 0xfffd )
18
18
data1 = data1 .translate (non_bmp_map )
19
19
except Exception as e :
20
- print ("! Sorry, something went wrong:" )
21
- print ("! Error: %s" % e )
22
- sys .exit (1 )
20
+ print ("! Sorry, something went wrong:" )
21
+ print ("! Error: %s" % e )
22
+ sys .exit (1 )
23
23
24
- #output tweets
24
+ # Output tweets
25
25
statuses = json .loads (data1 ).get ("statuses" )
26
26
texts = [tweet .get ("text" ) for tweet in statuses ]
27
27
28
28
for text in texts :
29
- print (text )
29
+ print (text )
Original file line number Diff line number Diff line change 1
- #Uses Python3
2
- import urllib .request , json , sys
1
+ # Uses Python3
2
+ import urllib .request
3
+ import json
4
+ import sys
3
5
4
- #Get JSON file
6
+ # Get JSON file
5
7
data = urllib .request .urlopen ("127.0.0.1:9000/api/search.json?q=%s" % (sys .argv [1 ]))
6
8
7
- #Read and parse JSON
9
+ # Read and parse JSON
8
10
data = data .read ().decode ('utf-8' )
9
11
data = json .loads (data )
10
12
11
- #Print out tweets
12
- for tweet in data ["statuses" ]:
13
- print (tweet ["text" ])
13
+ # Print out tweets
14
+ for tweet in data ["statuses" ]:
15
+ print (tweet ["text" ])
Original file line number Diff line number Diff line change 1
- #!/usr/bin/python
1
+ #!/usr/bin/python
2
2
import os
3
3
import requests
4
4
5
5
6
6
def print_response_from_file (file_name , path ):
7
- current_file = open (path + file_name , 'r' , encoding = "utf8" )
8
- for line in current_file :
9
- response = requests .get ("http://127.0.0.1:9000/api/search.json?q=" + line )
10
- x = response .json ()
11
- try :
12
- print (x ['statuses' ])
13
- except Exception as e :
14
- print (e )
7
+ current_file = open (path + file_name , 'r' , encoding = "utf8" )
8
+ for line in current_file :
9
+ response = requests .get ("http://127.0.0.1:9000/api/search.json?q=" + line )
10
+ x = response .json ()
11
+ try :
12
+ print (x ['statuses' ])
13
+ except Exception as e :
14
+ print (e )
15
15
16
16
17
17
def print_all_files_lines_in_defined_directory (path ):
18
- for fn in os .listdir (path ):
19
- if fn == 'README.txt' :
20
- pass
21
- elif fn .endswith (".txt" ):
22
- print_response_from_file (fn , path )
23
- else :
24
- pass
18
+ for fn in os .listdir (path ):
19
+ if fn == 'README.txt' :
20
+ pass
21
+ elif fn .endswith (".txt" ):
22
+ print_response_from_file (fn , path )
23
+ else :
24
+ pass
25
25
26
26
27
27
if __name__ == "__main__" :
28
- print_all_files_lines_in_defined_directory ('../test/queries/' )
28
+ print_all_files_lines_in_defined_directory ('../test/queries/' )
You can’t perform that action at this time.
0 commit comments