Chapter 3 Video 2
Title: Factory fixtures
Description: The current condition meant to determine whether or not to read a CSV or JSON file will lead to always trying to read CSV files.
See PR #1. The _specify_type function is a bit confusing in that it seems to be communicating that it's able to find a file based on its filename or file type, when in reality it only needs to do a search for a given filename and use the appropriate file processor to read the file based on the file's type.
Example
def _specify_file(filename):
files = os.listdir(city_list_location)
for f in files:
if filename == f:
if filename.endswith('.json'):
data = data_processor.json_reader(city_list_location + f)
elif filename.endswith('.csv'):
data = data_processor.csv_reader(city_list_location + f)
return data