Skip to content

Commit

Permalink
Merge pull request #21 from civica-digital/fix-printing
Browse files Browse the repository at this point in the history
added changes to fix printing of json when loading all plugins
  • Loading branch information
ricalanis committed Jun 2, 2015
2 parents 2dc460a + 6c4cf3d commit 27b98bc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
4 changes: 0 additions & 4 deletions verificadora/filtercsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def detect_lines(filename):
def read_top_lines(filename, N):
with open(filename,'rb') as fp:
head = fp.readlines(N)
print(head)
return head

def name_id_generator(size=24, chars=string.ascii_uppercase + string.digits):
Expand All @@ -37,7 +36,6 @@ def generate_random_list(N,n_lines):
r_int =random.randint(1,n_lines)
r_list.append(r_int)
r_list = sorted(r_list)
print(r_list)
return r_list

def read_random_lines(filename, N,n_lines):
Expand Down Expand Up @@ -164,7 +162,6 @@ def prepare_csv(csv_requirements,filename,resource,TMP_DIR):
unit = "file"
sampling = "random"
number_units = 0
print(requirements["unit"])
try:
unit = requirements["unit"] # rows, title, file, columns
except:
Expand All @@ -173,6 +170,5 @@ def prepare_csv(csv_requirements,filename,resource,TMP_DIR):
if "sampling" in requirements: sampling = requirements["sampling"] #random, first, last
if "raw" in requirements: raw = requirements["raw"]
if "response" in requirements: raw = csv_requirements["response"]
print(filename,raw,unit,sampling,number_units)
temp_data_path = filter_data(filename, raw, unit, sampling, number_units,TMP_DIR)
return temp_data_path
4 changes: 3 additions & 1 deletion verificadora/resources.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"resources": [
"general-file-check.py",
"data-check.py"
"data-check.py",
"ISO-8601.py",
"column-check.py"
]
}
2 changes: 1 addition & 1 deletion verificadora/resources/ISO-8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def detect_columns_dates(data):
return correct_columns_string

def date_validation(data):
"""
"""
Validator: Detects if the data has dates in a ISO 8601 compatible format
:param data: data to work with.
Expand Down
1 change: 0 additions & 1 deletion verificadora/resources/column-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def has_alphanumeric_headers(filepath):
reader = csv.reader(f)
headers = next(reader)
for column_number, column_name in enumerate(headers, start=1):
print(regexp.search(column_name))
if regexp.search(column_name):
status = "Fail"
reason = """Column name {column_name} in column {column_number} has an invalid name. Please use only letters, numbers, and dashes.""".format(column_name=column_name, column_number=column_number)
Expand Down
4 changes: 2 additions & 2 deletions verificadora/verificadora.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def response_status(response_dict):
returns "Pass" otherwise.
"""

status = "Fail"
status = "Pass"
for response in response_dict.keys():
if response_dict[response]['status'] == "Pass": status = "Pass"
if response_dict[response]['status'] == "Fail": status = "Fail"
return status

def verify_morethan11ine(filename):
Expand Down

0 comments on commit 27b98bc

Please sign in to comment.