import csv
import fnmatch
import os.path
-import pkg_resources
import sys
from sqlalchemy.orm.attributes import instrumentation_registry
from pokedex.db import metadata
import pokedex.db.tables as tables
+from pokedex.defaults import get_default_csv_dir
def _get_table_names(metadata, patterns):
print_start, print_status, print_done = _get_verbose_prints(verbose)
- if not directory:
- directory = pkg_resources.resource_filename('pokedex', 'data/csv')
+ if directory is None:
+ directory = get_default_csv_dir()
table_names = _get_table_names(metadata, tables)
table_objs = [metadata.tables[name] for name in table_names]
session.commit()
new_rows[:] = []
- progress = "{0}%".format(100 * csvfile.tell() // csvsize)
+ progress = "%d%%" % (100 * csvfile.tell() // csvsize)
print_status(progress)
for csvs in reader:
if not directory:
- directory = pkg_resources.resource_filename('pokedex', 'data/csv')
+ directory = get_default_csv_dir()
table_names = _get_table_names(metadata, tables)
table_names.sort()