projects
/
zzz-pokedex.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Form groups, rst => markdown
[zzz-pokedex.git]
/
pokedex
/
db
/
load.py
diff --git
a/pokedex/db/load.py
b/pokedex/db/load.py
index
d5502ea
..
df0d0f1
100644
(file)
--- a/
pokedex/db/load.py
+++ b/
pokedex/db/load.py
@@
-2,7
+2,6
@@
import csv
import fnmatch
import os.path
import csv
import fnmatch
import os.path
-import pkg_resources
import sys
from sqlalchemy.orm.attributes import instrumentation_registry
import sys
from sqlalchemy.orm.attributes import instrumentation_registry
@@
-11,6
+10,7
@@
import sqlalchemy.types
from pokedex.db import metadata
import pokedex.db.tables as tables
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):
def _get_table_names(metadata, patterns):
@@
-121,8
+121,8
@@
def load(session, tables=[], directory=None, drop_tables=False, verbose=False):
print_start, print_status, print_done = _get_verbose_prints(verbose)
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]
table_names = _get_table_names(metadata, tables)
table_objs = [metadata.tables[name] for name in table_names]
@@
-179,7
+179,7
@@
def load(session, tables=[], directory=None, drop_tables=False, verbose=False):
session.commit()
new_rows[:] = []
session.commit()
new_rows[:] = []
- progress = "
{0}%".format
(100 * csvfile.tell() // csvsize)
+ progress = "
%d%%" %
(100 * csvfile.tell() // csvsize)
print_status(progress)
for csvs in reader:
print_status(progress)
for csvs in reader:
@@
-276,7
+276,7
@@
def dump(session, tables=[], directory=None, verbose=False):
if not directory:
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()
table_names = _get_table_names(metadata, tables)
table_names.sort()