projects
/
zzz-pokedex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
364a2d0
)
Stubbed in a simple lookup command. #15
author
Eevee
<git@veekun.com>
Thu, 23 Jul 2009 06:44:06 +0000
(23:44 -0700)
committer
Eevee
<git@veekun.com>
Thu, 23 Jul 2009 06:44:53 +0000
(23:44 -0700)
pokedex/__init__.py
patch
|
blob
|
history
diff --git
a/pokedex/__init__.py
b/pokedex/__init__.py
index
02b8ce5
..
3908d8d
100644
(file)
--- a/
pokedex/__init__.py
+++ b/
pokedex/__init__.py
@@
-5,6
+5,7
@@
from sqlalchemy.exc import IntegrityError
import sqlalchemy.types
from .db import connect, metadata, tables as tables_module
import sqlalchemy.types
from .db import connect, metadata, tables as tables_module
+from pokedex.lookup import lookup as pokedex_lookup
def main():
if len(sys.argv) <= 1:
def main():
if len(sys.argv) <= 1:
@@
-159,11
+160,21
@@
def csvexport(engine_uri, directory='.'):
writer.writerow(csvs)
writer.writerow(csvs)
+def lookup(engine_uri, name):
+ # XXX don't require uri! somehow
+ session = connect(engine_uri)
+
+ results = pokedex_lookup(session, name)
+ print "Matched:"
+ for object, matchiness in results:
+ print object.__tablename__, object.name, "(%.03f)" % matchiness
+
def help():
print u"""pokedex -- a command-line Pokédex interface
help Displays this message.
def help():
print u"""pokedex -- a command-line Pokédex interface
help Displays this message.
+ lookup {uri} [name] Look up something in the Pokédex.
These commands are only useful for developers:
csvimport {uri} [dir] Import data from a set of CSVs to the database
These commands are only useful for developers:
csvimport {uri} [dir] Import data from a set of CSVs to the database