-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flake8 and fix whitespace problems
- Loading branch information
1 parent
3ea6f05
commit 0124f7c
Showing
6 changed files
with
70 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[flake8] | ||
ignore = | ||
# Module imported but unused | ||
F401, | ||
# Line too long | ||
E501, | ||
# Indentation contains tabs | ||
W191, | ||
ZZZZ # allow comma on last entry | ||
select = | ||
# Missing whitespace around modulo | ||
E228, | ||
# Blank line at end of file | ||
W391, | ||
# Block comment should start with '# ' | ||
E265, | ||
# Whitespace before '(' | ||
E211, | ||
# Trailing whitespace | ||
W291, | ||
# Multiple spaces after operator | ||
E222, | ||
# Multiple imports on one line | ||
E401, | ||
# Indentation contains mixed spaces and tabs | ||
E101, | ||
ZZZZ # allow comma on last entry | ||
filename = *.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
#Uses Python3 | ||
import urllib.request, json, sys | ||
# Uses Python3 | ||
import urllib.request | ||
import json | ||
import sys | ||
|
||
#Get JSON file | ||
# Get JSON file | ||
data = urllib.request.urlopen("127.0.0.1:9000/api/search.json?q=%s" % (sys.argv[1])) | ||
|
||
#Read and parse JSON | ||
# Read and parse JSON | ||
data = data.read().decode('utf-8') | ||
data = json.loads(data) | ||
|
||
#Print out tweets | ||
for tweet in data["statuses"]: | ||
print(tweet["text"]) | ||
# Print out tweets | ||
for tweet in data["statuses"]: | ||
print(tweet["text"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
#!/usr/bin/python | ||
#!/usr/bin/python | ||
import os | ||
import requests | ||
|
||
|
||
def print_response_from_file(file_name, path): | ||
current_file = open(path + file_name, 'r', encoding="utf8") | ||
for line in current_file: | ||
response = requests.get("http://127.0.0.1:9000/api/search.json?q=" + line) | ||
x = response.json() | ||
try: | ||
print(x['statuses']) | ||
except Exception as e: | ||
print(e) | ||
current_file = open(path + file_name, 'r', encoding="utf8") | ||
for line in current_file: | ||
response = requests.get("http://127.0.0.1:9000/api/search.json?q=" + line) | ||
x = response.json() | ||
try: | ||
print(x['statuses']) | ||
except Exception as e: | ||
print(e) | ||
|
||
|
||
def print_all_files_lines_in_defined_directory(path): | ||
for fn in os.listdir(path): | ||
if fn == 'README.txt': | ||
pass | ||
elif fn.endswith(".txt"): | ||
print_response_from_file(fn, path) | ||
else: | ||
pass | ||
for fn in os.listdir(path): | ||
if fn == 'README.txt': | ||
pass | ||
elif fn.endswith(".txt"): | ||
print_response_from_file(fn, path) | ||
else: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
print_all_files_lines_in_defined_directory('../test/queries/') | ||
print_all_files_lines_in_defined_directory('../test/queries/') |