sphinx build 2012-02-13 00:14:24+01:00

This commit is contained in:
Petr Viktorin 2012-02-13 00:14:24 +01:00
parent e392d282c7
commit 58cf7d14ed
32 changed files with 2945 additions and 9214 deletions

View file

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 20fbb3c1f25faf227aa89dc7ec78651b
config: 646af3bec0e0a7be5a0d8b9116f40b74
tags: fbb0d17656682115ca4d033fb2f83ba1

View file

@ -7,7 +7,7 @@ Quick startup with Ubuntu/Debian-like systems
Run the following from an empty directory::
$ sudo apt-get install git python python-pip python-sqlalchemy
$ git clone git://git.veekun.com/pokedex.git
$ git clone git://github.com/veekun/pokedex.git
$ pip install -E env -e pokedex
$ source env/bin/activate
(env)$ pokedex setup -v
@ -75,7 +75,6 @@ In env/bin, there are three interesting files:
* pokedex: The pokedex program
* python: A copy of Python that knows about pokedex and its prerequisites.
Using the system python won't work.
* activate: Typing ``source env/bin/activate`` in a shell will put
pokedex and our bin/python on the $PATH, and generally set things up to work
with them. Your prompt will change to let you know of this. You can end such

View file

@ -3,28 +3,31 @@ The pokédex tables
.. module:: pokedex.db.tables
All the tables listed here are classes defined with SQLAlchemy's
The :mod:`pokedex.db.tables` module defines all of the tables in the Pokédex.
They are all defined with SQLAlchemy's
:mod:`~sqlalchemy.ext.declarative` extension.
To introspect the tables programmatically, you can use the following:
.. data:: mapped_classes
A list of all the classes you see below.
.. data:: metadata
The SQLAlchemy :class:`~sqlalchemy.schema.MetaData` containing all the
tables.
.. data:: mapped_classes
A list of all the classes you see below.
Each of these classes has a ``translation_classes`` attribute: a potentially
Each of the classes has a ``translation_classes`` attribute: a potentially
empty list of translation classes. See :mod:`pokedex.db.multilang` for how
these work.
Many tables have these columns:
- **id**: An integer primary key. Sometimes it's semantically meaningful, most
often it isn't.
often it isn't.
- **identifier**: A string identifier of the class, and the preferred way to
access individual items.
access individual items.
- **name**: A name (uses the multilang functionality)
Pokémon
@ -42,7 +45,6 @@ Moves
.. dex-table:: Move
.. dex-table:: MoveEffect
.. dex-table:: MoveMeta
.. dex-table:: MoveVersion
Items
-----
@ -104,7 +106,6 @@ Enum tables
.. dex-table:: EvolutionTrigger
.. dex-table:: GrowthRate
.. dex-table:: ItemCategory
.. dex-table:: ItemFlag
.. dex-table:: ItemFlingEffect
.. dex-table:: ItemPocket
.. dex-table:: MoveBattleStyle
@ -123,6 +124,7 @@ Changelogs
.. dex-table:: AbilityChangelog
.. dex-table:: MoveEffectChangelog
.. dex-table:: MoveChangelog
Flavor text
-----------
@ -137,6 +139,7 @@ Association tables
.. dex-table:: BerryFlavor
.. dex-table:: EncounterConditionValueMap
.. dex-table:: ItemFlag
.. dex-table:: ItemFlagMap
.. dex-table:: Machine
.. dex-table:: MoveFlag

View file

@ -4,5 +4,3 @@ The database schema
.. toctree::
main-tables
enumerations
associations

View file

@ -33,243 +33,161 @@ The object :func:`~pokedex.db.connect` gives you is actually a
full power of SQLAlchemy for working with the data. We'll cover some basics
here, but if you intend to do some serious work, do read SQLAlchemy's docs.
XXX: write the rest of this
Pokédex tables
--------------
.. commented out old stuff
Data in the pokédex is organized in tables, defined in
:mod:`pokedex.db.tables`.
There is quite a few or them. To get you started, here are a few common ones:
Pokédex tables
--------------
* :class:`~pokedex.db.tables.PokemonSpecies`
* :class:`~pokedex.db.tables.Move`
* :class:`~pokedex.db.tables.Item`
* :class:`~pokedex.db.tables.Type`
Data in the pokédex is organized in tables, defined in
:mod:`pokedex.db.tables`.
There is quite a few or them. To get you started, here are a few common ones:
Getting things
--------------
* :class:`~pokedex.db.tables.Pokemon` (includes some alternate forms)
* :class:`~pokedex.db.tables.Move`
* :class:`~pokedex.db.tables.Item`
* :class:`~pokedex.db.tables.Type`
If you know what you want from the pokédex, you can use the
:func:`pokedex.db.util.get` function. It looks up a thing in a table, based on
its identifier, name, or ID, and returns it.
Getting things
--------------
.. testcode::
If you know what you want from the pokédex, you can use the
:func:`pokedex.db.util.get` function. It looks up a thing in a table, based on
its identifier, name, or ID, and returns it.
def print_pokemon(pokemon):
print u'{0.name}, the {0.genus} Pokemon'.format(pokemon)
.. testcode::
print_pokemon(util.get(session, tables.PokemonSpecies, identifier='eevee'))
print_pokemon(util.get(session, tables.PokemonSpecies, name=u'Ho-Oh'))
print_pokemon(util.get(session, tables.PokemonSpecies, id=50))
def print_pokemon(pokemon):
print u'{0.name}, the {0.genus} Pokemon'.format(pokemon)
def print_item(item):
print u'{0.name}: ${0.cost}'.format(item)
print_pokemon(util.get(session, tables.PokemonSpecies, identifier='eevee'))
print_pokemon(util.get(session, tables.PokemonSpecies, name=u'Ho-Oh'))
print_pokemon(util.get(session, tables.PokemonSpecies, id=50))
print_item(util.get(session, tables.Item, identifier='great-ball'))
print_item(util.get(session, tables.Item, name='Potion'))
print_item(util.get(session, tables.Item, id=30))
def print_item(item):
print u'{0.name}: ${0.cost}'.format(item)
.. testoutput::
print_item(util.get(session, tables.Item, identifier='great-ball'))
print_item(util.get(session, tables.Item, name='Potion'))
print_item(util.get(session, tables.Item, id=30))
Eevee, the Evolution Pokemon
Ho-Oh, the Rainbow Pokemon
Diglett, the Mole Pokemon
Great Ball: $600
Potion: $300
Fresh Water: $200
.. testoutput::
Querying
--------
Eevee, the Evolution Pokemon
Ho-Oh, the Rainbow Pokemon
Diglett, the Mole Pokemon
Great Ball: $600
Potion: $300
Fresh Water: $200
So, how do you get data from the session? You use the session's
:meth:`~sqlalchemy.orm.session.Session.query` method, and give it a pokédex
Table as an argument. This will give you a :class:`SQLAlchemy query
<sqlalchemy.orm.query.Query>`.
.. :
Simple lists
------------
Ordering
^^^^^^^^
.. note::
As always with SQL, you should not rely on query results being in some
particular order unless you have ordered the query first. This means that
you'll want to sort just about every query you will make.
These functions are only included for convenience in experiments and simple
scripts.
If you want to do something specific, please query the pokédex as explained
in the following sections.
For example, you can get a list of all pokémon species, sorted by their
:attr:`~pokedex.db.tables.PokemonSpecies.id`, like so:
If you want to get a simple list of pokémon without needing to worry about
things like the different forms and sorting the list, you can use the
:func:`pokedex.util.simple.pokemon` function.
.. testcode::
.. testcode::
for pokemon in session.query(tables.PokemonSpecies).order_by(tables.PokemonSpecies.id):
print pokemon.name
from pokedex.util import simple
for pokemon in simple.pokemon(session):
print u'{0.name}, the {0.species} Pokemon'.format(pokemon)
.. testoutput::
.. testoutput::
Bulbasaur
Ivysaur
Venusaur
Charmander
Charmeleon
...
Keldeo
Meloetta
Genesect
Bulbasaur, the Seed Pokemon
Ivysaur, the Seed Pokemon
...
Meloetta, the Melody Pokemon
Genesect, the Paleozoic Pokemon
Or to order by :attr:`~pokedex.db.tables.PokemonSpecies.name`:
Similar functions exist for :func:`~pokedex.util.simple.moves`,
:func:`~pokedex.util.simple.items` and :func:`~pokedex.util.simple.types`.
.. testcode::
All of these give you quick simple lists, basically something a pokédex would
show you. They filter out things you probably won't need (such as Shadow moves
or duplicate Pokémon moves), and sort the results in some sane way, but they
can't guess your needs exactly, and their guesses might change in future
versions.
If you want to do some serious work with the pokédex, read on.
for pokemon in session.query(tables.PokemonSpecies).order_by(tables.PokemonSpecies.name):
print pokemon.name
Querying
--------
.. testoutput::
So, how do you get data from the session? You use the session's
:meth:`~sqlalchemy.orm.session.Session.query` method, and give it a pokédex
Table as an argument. This will give you a :class:`SQLAlchemy query
<sqlalchemy.orm.query.Query>`.
Abomasnow
...
Zweilous
To get you started, we'll cover some common query operations below. If you
need to do more, consult the `SQLAlchemy documentation`_.
Ordering
^^^^^^^^
Filtering
^^^^^^^^^
As always with SQL, you should not rely on query results being in some
particular order unless you have ordered the query first. This means that
you'll likely want to sort every query you will make.
Another major operation on queries is filtering, using the query's
:meth:`~sqlalchemy.orm.query.Query.filter` or
:meth:`~sqlalchemy.orm.query.Query.filter_by` methods:
For example, you can get a list of all pokémon, sorted by their
:attr:`~pokedex.db.tables.Pokemon.order`, like so:
.. testcode::
.. testcode::
for move in session.query(tables.Move).filter(tables.Move.power > 200):
print move.name
for pokemon in session.query(tables.Pokemon).order_by(tables.Pokemon.order):
print pokemon.name
.. testoutput::
.. testoutput::
Explosion
Bulbasaur
Ivysaur
Venusaur
Charmander
Charmeleon
...
Pichu
Pikachu
Raichu
...
Keldeo
Aria Meloetta
Pirouette Meloetta
Genesect
Joining
^^^^^^^
Ordering by name
****************
The final operation we'll cover here is joining other tables to the query,
using the query's :meth:`~sqlalchemy.orm.query.Query.join`.
You will usually want to join on a relationship, such as in the following
example:
Since the pokédex can be used in other languages than English, working with
texts such as names is sometimes tricky.
.. testcode::
The “name” attribute is actually a relation that uses the connection's
default language to select an appropriate translation. It usually works the
same way as a normal attribute, but ordering is an exception to this:
query = session.query(tables.Move)
query = query.join(tables.Move.type)
query = query.filter(tables.Type.identifier == 'grass')
query = query.filter(tables.Move.power >= 100)
query = query.order_by(tables.Move.power)
query = query.order_by(tables.Move.name)
.. testcode::
print 'The most powerful Grass-type moves:'
for move in query:
print u'{0.name} ({0.power})'.format(move)
for pokemon in session.query(tables.Pokemon).order_by(tables.Pokemon.name):
print pokemon.name
.. testoutput::
.. testoutput::
The most powerful Grass-type moves:
Petal Dance (120)
Power Whip (120)
Seed Flare (120)
SolarBeam (120)
Wood Hammer (120)
Leaf Storm (140)
Frenzy Plant (150)
Traceback (most recent call last):
...
ArgumentError: SQL expression object or string expected.
That concludes our brief tutorial.
If you need to do more, consult the `SQLAlchemy documentation`_.
This means that to order by name, you either have to explicitly join the
translation table and sort by that, or use
:func:`pokedex.db.util.order_by_name`:
API documentation
-----------------
.. autofunction:: pokedex.db.connect
.. testcode::
See :class:`sqlalchemy.orm.session.Session` for more documentation on the
returned object.
from pokedex.db import util
for pokemon in util.order_by_name(session.query(tables.Pokemon), tables.Pokemon):
print pokemon.name
.. autofunction:: pokedex.db.util.get
.. testoutput::
Abomasnow
...
Zweilous
Filtering
^^^^^^^^^
Another major operation on queries is filtering, using the query's
:meth:`~sqlalchemy.orm.query.Query.filter` or
:meth:`~sqlalchemy.orm.query.Query.filter_by` methods:
.. testcode::
for move in session.query(tables.Move).filter(tables.Move.power > 200):
print move.name
.. testoutput::
Explosion
Joining
^^^^^^^
The final operation we'll cover here is joining other tables to the query,
using the query's :meth:`~sqlalchemy.orm.query.Query.join`.
You will usually want to join on a relationship, such as in the following
example:
.. testcode::
query = session.query(tables.Move)
query = query.join(tables.Move.type)
query = query.filter(tables.Type.identifier == 'grass')
query = query.filter(tables.Move.power >= 100)
query = query.order_by(tables.Move.power)
query = util.order_by_name(query, tables.Move)
print 'The most powerful Grass moves:'
for move in query:
print u'{0.name} ({0.power})'.format(move)
.. testoutput::
The most powerful Grass moves:
Petal Dance (120)
Power Whip (120)
Seed Flare (120)
SolarBeam (120)
Wood Hammer (120)
Leaf Storm (140)
Frenzy Plant (150)
API documentation
-----------------
.. autofunction:: pokedex.db.connect
See :class:`sqlalchemy.orm.session.Session` for more documentation on the
returned object.
.. autofunction:: pokedex.db.util.get
.. autofunction:: pokedex.db.util.order_by_name
Simple lists
^^^^^^^^^^^^
.. autofunction:: pokedex.util.simple.pokemon
.. autofunction:: pokedex.util.simple.moves
.. autofunction:: pokedex.util.simple.items
.. autofunction:: pokedex.util.simple.types
.. _Python: http://www.python.org
.. _SQLAlchemy: http://www.sqlalchemy.org
.. _`SQLAlchemy documentation`: http://www.sqlalchemy.org/docs/orm/tutorial.html
.. _Python: http://www.python.org
.. _SQLAlchemy: http://www.sqlalchemy.org
.. _`SQLAlchemy documentation`: http://www.sqlalchemy.org/docs/orm/tutorial.html

BIN
_static/ajax-loader.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View file

@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -79,6 +79,14 @@ div.sphinxsidebar input {
font-size: 1em;
}
div.sphinxsidebar input[type="text"] {
width: 170px;
}
div.sphinxsidebar input[type="submit"] {
width: 30px;
}
img {
border: 0;
}
@ -213,12 +221,29 @@ p.rubric {
font-weight: bold;
}
img.align-left, .figure.align-left, object.align-left {
clear: left;
float: left;
margin-right: 1em;
}
img.align-right, .figure.align-right, object.align-right {
clear: right;
float: right;
margin-left: 1em;
}
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left;
}
.align-center {
clear: both;
text-align: center;
}
@ -395,7 +420,7 @@ dl.glossary dt {
}
.footnote:target {
background-color: #ffa
background-color: #ffa;
}
.line-block {
@ -422,10 +447,16 @@ dl.glossary dt {
font-style: oblique;
}
abbr, acronym {
border-bottom: dotted 1px;
cursor: help;
}
/* -- code displays --------------------------------------------------------- */
pre {
overflow: auto;
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
td.linenos pre {
@ -506,4 +537,4 @@ span.eqno {
#top-link {
display: none;
}
}
}

BIN
_static/comment-bright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
_static/comment-close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
_static/comment.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- default theme.
*
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -114,6 +114,7 @@ div.sphinxsidebar input {
}
/* -- hyperlink styles ------------------------------------------------------ */
a {

View file

@ -2,9 +2,9 @@
* doctools.js
* ~~~~~~~~~~~
*
* Sphinx JavaScript utilties for all documentation.
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -185,9 +185,9 @@ var Documentation = {
body.highlightText(this.toLowerCase(), 'highlighted');
});
}, 10);
$('<li class="highlight-link"><a href="javascript:Documentation.' +
'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>')
.appendTo($('.sidebar .this-page-menu'));
$('<p class="highlight-link"><a href="javascript:Documentation.' +
'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')
.appendTo($('#searchbox'));
}
},
@ -213,7 +213,7 @@ var Documentation = {
* helper function to hide the search marks again
*/
hideSearchWords : function() {
$('.sidebar .this-page-menu li.highlight-link').fadeOut(300);
$('#searchbox .highlight-link').fadeOut(300);
$('span.highlighted').removeClass('highlighted');
},

BIN
_static/down-pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

BIN
_static/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

8308
_static/jquery.js vendored

File diff suppressed because it is too large Load diff

View file

@ -1,61 +1,62 @@
.hll { background-color: #ffffcc }
.c { color: #408090; font-style: italic } /* Comment */
.err { border: 1px solid #FF0000 } /* Error */
.k { color: #007020; font-weight: bold } /* Keyword */
.o { color: #666666 } /* Operator */
.cm { color: #408090; font-style: italic } /* Comment.Multiline */
.cp { color: #007020 } /* Comment.Preproc */
.c1 { color: #408090; font-style: italic } /* Comment.Single */
.cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
.gd { color: #A00000 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #FF0000 } /* Generic.Error */
.gh { color: #000080; font-weight: bold } /* Generic.Heading */
.gi { color: #00A000 } /* Generic.Inserted */
.go { color: #303030 } /* Generic.Output */
.gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.gt { color: #0040D0 } /* Generic.Traceback */
.kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
.kp { color: #007020 } /* Keyword.Pseudo */
.kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
.kt { color: #902000 } /* Keyword.Type */
.m { color: #208050 } /* Literal.Number */
.s { color: #4070a0 } /* Literal.String */
.na { color: #4070a0 } /* Name.Attribute */
.nb { color: #007020 } /* Name.Builtin */
.nc { color: #0e84b5; font-weight: bold } /* Name.Class */
.no { color: #60add5 } /* Name.Constant */
.nd { color: #555555; font-weight: bold } /* Name.Decorator */
.ni { color: #d55537; font-weight: bold } /* Name.Entity */
.ne { color: #007020 } /* Name.Exception */
.nf { color: #06287e } /* Name.Function */
.nl { color: #002070; font-weight: bold } /* Name.Label */
.nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
.nt { color: #062873; font-weight: bold } /* Name.Tag */
.nv { color: #bb60d5 } /* Name.Variable */
.ow { color: #007020; font-weight: bold } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mf { color: #208050 } /* Literal.Number.Float */
.mh { color: #208050 } /* Literal.Number.Hex */
.mi { color: #208050 } /* Literal.Number.Integer */
.mo { color: #208050 } /* Literal.Number.Oct */
.sb { color: #4070a0 } /* Literal.String.Backtick */
.sc { color: #4070a0 } /* Literal.String.Char */
.sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
.s2 { color: #4070a0 } /* Literal.String.Double */
.se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
.sh { color: #4070a0 } /* Literal.String.Heredoc */
.si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
.sx { color: #c65d09 } /* Literal.String.Other */
.sr { color: #235388 } /* Literal.String.Regex */
.s1 { color: #4070a0 } /* Literal.String.Single */
.ss { color: #517918 } /* Literal.String.Symbol */
.bp { color: #007020 } /* Name.Builtin.Pseudo */
.vc { color: #bb60d5 } /* Name.Variable.Class */
.vg { color: #bb60d5 } /* Name.Variable.Global */
.vi { color: #bb60d5 } /* Name.Variable.Instance */
.il { color: #208050 } /* Literal.Number.Integer.Long */
.highlight .hll { background-color: #ffffcc }
.highlight { background: #eeffcc; }
.highlight .c { color: #408090; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #007020 } /* Comment.Preproc */
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #303030 } /* Generic.Output */
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #007020 } /* Keyword.Pseudo */
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #902000 } /* Keyword.Type */
.highlight .m { color: #208050 } /* Literal.Number */
.highlight .s { color: #4070a0 } /* Literal.String */
.highlight .na { color: #4070a0 } /* Name.Attribute */
.highlight .nb { color: #007020 } /* Name.Builtin */
.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
.highlight .no { color: #60add5 } /* Name.Constant */
.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #007020 } /* Name.Exception */
.highlight .nf { color: #06287e } /* Name.Function */
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #bb60d5 } /* Name.Variable */
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #208050 } /* Literal.Number.Float */
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
.highlight .sc { color: #4070a0 } /* Literal.String.Char */
.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
.highlight .sx { color: #c65d09 } /* Literal.String.Other */
.highlight .sr { color: #235388 } /* Literal.String.Regex */
.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */

View file

@ -1,10 +1,10 @@
/*
* searchtools.js
* ~~~~~~~~~~~~~~
* searchtools.js_t
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilties for the full-text search.
*
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -36,10 +36,11 @@ jQuery.makeSearchSummary = function(text, keywords, hlwords) {
return rv;
}
/**
* Porter Stemmer
*/
var PorterStemmer = function() {
var Stemmer = function() {
var step2list = {
ational: 'ate',
@ -300,20 +301,20 @@ var Search = {
},
query : function(query) {
var stopwords = ['and', 'then', 'into', 'it', 'as', 'are', 'in',
'if', 'for', 'no', 'there', 'their', 'was', 'is',
'be', 'to', 'that', 'but', 'they', 'not', 'such',
'with', 'by', 'a', 'on', 'these', 'of', 'will',
'this', 'near', 'the', 'or', 'at'];
var stopwords = ["and","then","into","it","as","are","in","if","for","no","there","their","was","is","be","to","that","but","they","not","such","with","by","a","on","these","of","will","this","near","the","or","at"];
// stem the searchterms and add them to the correct list
var stemmer = new PorterStemmer();
// Stem the searchterms and add them to the correct list
var stemmer = new Stemmer();
var searchterms = [];
var excluded = [];
var hlterms = [];
var tmp = query.split(/\s+/);
var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null;
var objectterms = [];
for (var i = 0; i < tmp.length; i++) {
if (tmp[i] != "") {
objectterms.push(tmp[i].toLowerCase());
}
if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
tmp[i] == "") {
// skip this "word"
@ -344,9 +345,6 @@ var Search = {
var filenames = this._index.filenames;
var titles = this._index.titles;
var terms = this._index.terms;
var objects = this._index.objects;
var objtypes = this._index.objtypes;
var objnames = this._index.objnames;
var fileMap = {};
var files = null;
// different result priorities
@ -357,40 +355,19 @@ var Search = {
$('#search-progress').empty();
// lookup as object
if (object != null) {
for (var prefix in objects) {
for (var name in objects[prefix]) {
var fullname = (prefix ? prefix + '.' : '') + name;
if (fullname.toLowerCase().indexOf(object) > -1) {
match = objects[prefix][name];
descr = objnames[match[1]] + _(', in ') + titles[match[0]];
// XXX the generated anchors are not generally correct
// XXX there may be custom prefixes
result = [filenames[match[0]], fullname, '#'+fullname, descr];
switch (match[2]) {
case 1: objectResults.push(result); break;
case 0: importantResults.push(result); break;
case 2: unimportantResults.push(result); break;
}
}
}
}
for (var i = 0; i < objectterms.length; i++) {
var others = [].concat(objectterms.slice(0,i),
objectterms.slice(i+1, objectterms.length))
var results = this.performObjectSearch(objectterms[i], others);
// Assume first word is most likely to be the object,
// other words more likely to be in description.
// Therefore put matches for earlier words first.
// (Results are eventually used in reverse order).
objectResults = results[0].concat(objectResults);
importantResults = results[1].concat(importantResults);
unimportantResults = results[2].concat(unimportantResults);
}
// sort results descending
objectResults.sort(function(a, b) {
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
});
importantResults.sort(function(a, b) {
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
});
unimportantResults.sort(function(a, b) {
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
});
// perform the search on the required terms
for (var i = 0; i < searchterms.length; i++) {
var word = searchterms[i];
@ -489,7 +466,7 @@ var Search = {
listItem.slideDown(5, function() {
displayNextItem();
});
});
}, "text");
} else {
// no source available, just display title
Search.output.append(listItem);
@ -510,9 +487,74 @@ var Search = {
}
}
displayNextItem();
},
performObjectSearch : function(object, otherterms) {
var filenames = this._index.filenames;
var objects = this._index.objects;
var objnames = this._index.objnames;
var titles = this._index.titles;
var importantResults = [];
var objectResults = [];
var unimportantResults = [];
for (var prefix in objects) {
for (var name in objects[prefix]) {
var fullname = (prefix ? prefix + '.' : '') + name;
if (fullname.toLowerCase().indexOf(object) > -1) {
var match = objects[prefix][name];
var objname = objnames[match[1]][2];
var title = titles[match[0]];
// If more than one term searched for, we require other words to be
// found in the name/title/description
if (otherterms.length > 0) {
var haystack = (prefix + ' ' + name + ' ' +
objname + ' ' + title).toLowerCase();
var allfound = true;
for (var i = 0; i < otherterms.length; i++) {
if (haystack.indexOf(otherterms[i]) == -1) {
allfound = false;
break;
}
}
if (!allfound) {
continue;
}
}
var descr = objname + _(', in ') + title;
anchor = match[3];
if (anchor == '')
anchor = fullname;
else if (anchor == '-')
anchor = objnames[match[1]][1] + '-' + fullname;
result = [filenames[match[0]], fullname, '#'+anchor, descr];
switch (match[2]) {
case 1: objectResults.push(result); break;
case 0: importantResults.push(result); break;
case 2: unimportantResults.push(result); break;
}
}
}
}
// sort results descending
objectResults.sort(function(a, b) {
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
});
importantResults.sort(function(a, b) {
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
});
unimportantResults.sort(function(a, b) {
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
});
return [importantResults, objectResults, unimportantResults]
}
}
$(document).ready(function() {
Search.init();
});
});

View file

@ -16,7 +16,7 @@
* Once the browser is closed the cookie is deleted and the position
* reset to the default (expanded).
*
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@ -29,6 +29,9 @@ $(function() {
var sidebar = $('.sphinxsidebar');
var sidebarwrapper = $('.sphinxsidebarwrapper');
// for some reason, the document has no sidebar; do not run into errors
if (!sidebar.length) return;
// original margin-left of the bodywrapper and width of the sidebar
// with the sidebar expanded
var bw_margin_expanded = bodywrapper.css('margin-left');
@ -91,6 +94,7 @@ $(function() {
'<div id="sidebarbutton"><span>&laquo;</span></div>'
);
var sidebarbutton = $('#sidebarbutton');
light_color = sidebarbutton.css('background-color');
// find the height of the viewport to center the '<<' in the page
var viewport_height;
if (window.innerHeight)
@ -144,4 +148,4 @@ $(function() {
add_sidebar_button();
var sidebarbutton = $('#sidebarbutton');
set_position_from_cookie();
});
});

View file

@ -1,3 +1,10 @@
// Underscore.js 0.5.5
// (c) 2009 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the terms of the MIT license.
// Portions of Underscore are inspired by or borrowed from Prototype.js,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore/
(function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.5";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e<f;e++)c.call(d,
a[e],e,a);else{var g=b.keys(a);f=g.length;for(e=0;e<f;e++)c.call(d,a[g[e]],g[e],a)}}catch(h){if(h!=m)throw h;}return a};b.map=function(a,c,d){if(a&&b.isFunction(a.map))return a.map(c,d);var e=[];b.each(a,function(f,g,h){e.push(c.call(d,f,g,h))});return e};b.reduce=function(a,c,d,e){if(a&&b.isFunction(a.reduce))return a.reduce(b.bind(d,e),c);b.each(a,function(f,g,h){c=d.call(e,c,f,g,h)});return c};b.reduceRight=function(a,c,d,e){if(a&&b.isFunction(a.reduceRight))return a.reduceRight(b.bind(d,e),c);
var f=b.clone(b.toArray(a)).reverse();b.each(f,function(g,h){c=d.call(e,c,g,h,a)});return c};b.detect=function(a,c,d){var e;b.each(a,function(f,g,h){if(c.call(d,f,g,h)){e=f;b.breakLoop()}});return e};b.select=function(a,c,d){if(a&&b.isFunction(a.filter))return a.filter(c,d);var e=[];b.each(a,function(f,g,h){c.call(d,f,g,h)&&e.push(f)});return e};b.reject=function(a,c,d){var e=[];b.each(a,function(f,g,h){!c.call(d,f,g,h)&&e.push(f)});return e};b.all=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.every))return a.every(c,

BIN
_static/up-pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

BIN
_static/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

808
_static/websupport.js Normal file
View file

@ -0,0 +1,808 @@
/*
* websupport.js
* ~~~~~~~~~~~~~
*
* sphinx.websupport utilties for all documentation.
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
(function($) {
$.fn.autogrow = function() {
return this.each(function() {
var textarea = this;
$.fn.autogrow.resize(textarea);
$(textarea)
.focus(function() {
textarea.interval = setInterval(function() {
$.fn.autogrow.resize(textarea);
}, 500);
})
.blur(function() {
clearInterval(textarea.interval);
});
});
};
$.fn.autogrow.resize = function(textarea) {
var lineHeight = parseInt($(textarea).css('line-height'), 10);
var lines = textarea.value.split('\n');
var columns = textarea.cols;
var lineCount = 0;
$.each(lines, function() {
lineCount += Math.ceil(this.length / columns) || 1;
});
var height = lineHeight * (lineCount + 1);
$(textarea).css('height', height);
};
})(jQuery);
(function($) {
var comp, by;
function init() {
initEvents();
initComparator();
}
function initEvents() {
$('a.comment-close').live("click", function(event) {
event.preventDefault();
hide($(this).attr('id').substring(2));
});
$('a.vote').live("click", function(event) {
event.preventDefault();
handleVote($(this));
});
$('a.reply').live("click", function(event) {
event.preventDefault();
openReply($(this).attr('id').substring(2));
});
$('a.close-reply').live("click", function(event) {
event.preventDefault();
closeReply($(this).attr('id').substring(2));
});
$('a.sort-option').live("click", function(event) {
event.preventDefault();
handleReSort($(this));
});
$('a.show-proposal').live("click", function(event) {
event.preventDefault();
showProposal($(this).attr('id').substring(2));
});
$('a.hide-proposal').live("click", function(event) {
event.preventDefault();
hideProposal($(this).attr('id').substring(2));
});
$('a.show-propose-change').live("click", function(event) {
event.preventDefault();
showProposeChange($(this).attr('id').substring(2));
});
$('a.hide-propose-change').live("click", function(event) {
event.preventDefault();
hideProposeChange($(this).attr('id').substring(2));
});
$('a.accept-comment').live("click", function(event) {
event.preventDefault();
acceptComment($(this).attr('id').substring(2));
});
$('a.delete-comment').live("click", function(event) {
event.preventDefault();
deleteComment($(this).attr('id').substring(2));
});
$('a.comment-markup').live("click", function(event) {
event.preventDefault();
toggleCommentMarkupBox($(this).attr('id').substring(2));
});
}
/**
* Set comp, which is a comparator function used for sorting and
* inserting comments into the list.
*/
function setComparator() {
// If the first three letters are "asc", sort in ascending order
// and remove the prefix.
if (by.substring(0,3) == 'asc') {
var i = by.substring(3);
comp = function(a, b) { return a[i] - b[i]; };
} else {
// Otherwise sort in descending order.
comp = function(a, b) { return b[by] - a[by]; };
}
// Reset link styles and format the selected sort option.
$('a.sel').attr('href', '#').removeClass('sel');
$('a.by' + by).removeAttr('href').addClass('sel');
}
/**
* Create a comp function. If the user has preferences stored in
* the sortBy cookie, use those, otherwise use the default.
*/
function initComparator() {
by = 'rating'; // Default to sort by rating.
// If the sortBy cookie is set, use that instead.
if (document.cookie.length > 0) {
var start = document.cookie.indexOf('sortBy=');
if (start != -1) {
start = start + 7;
var end = document.cookie.indexOf(";", start);
if (end == -1) {
end = document.cookie.length;
by = unescape(document.cookie.substring(start, end));
}
}
}
setComparator();
}
/**
* Show a comment div.
*/
function show(id) {
$('#ao' + id).hide();
$('#ah' + id).show();
var context = $.extend({id: id}, opts);
var popup = $(renderTemplate(popupTemplate, context)).hide();
popup.find('textarea[name="proposal"]').hide();
popup.find('a.by' + by).addClass('sel');
var form = popup.find('#cf' + id);
form.submit(function(event) {
event.preventDefault();
addComment(form);
});
$('#s' + id).after(popup);
popup.slideDown('fast', function() {
getComments(id);
});
}
/**
* Hide a comment div.
*/
function hide(id) {
$('#ah' + id).hide();
$('#ao' + id).show();
var div = $('#sc' + id);
div.slideUp('fast', function() {
div.remove();
});
}
/**
* Perform an ajax request to get comments for a node
* and insert the comments into the comments tree.
*/
function getComments(id) {
$.ajax({
type: 'GET',
url: opts.getCommentsURL,
data: {node: id},
success: function(data, textStatus, request) {
var ul = $('#cl' + id);
var speed = 100;
$('#cf' + id)
.find('textarea[name="proposal"]')
.data('source', data.source);
if (data.comments.length === 0) {
ul.html('<li>No comments yet.</li>');
ul.data('empty', true);
} else {
// If there are comments, sort them and put them in the list.
var comments = sortComments(data.comments);
speed = data.comments.length * 100;
appendComments(comments, ul);
ul.data('empty', false);
}
$('#cn' + id).slideUp(speed + 200);
ul.slideDown(speed);
},
error: function(request, textStatus, error) {
showError('Oops, there was a problem retrieving the comments.');
},
dataType: 'json'
});
}
/**
* Add a comment via ajax and insert the comment into the comment tree.
*/
function addComment(form) {
var node_id = form.find('input[name="node"]').val();
var parent_id = form.find('input[name="parent"]').val();
var text = form.find('textarea[name="comment"]').val();
var proposal = form.find('textarea[name="proposal"]').val();
if (text == '') {
showError('Please enter a comment.');
return;
}
// Disable the form that is being submitted.
form.find('textarea,input').attr('disabled', 'disabled');
// Send the comment to the server.
$.ajax({
type: "POST",
url: opts.addCommentURL,
dataType: 'json',
data: {
node: node_id,
parent: parent_id,
text: text,
proposal: proposal
},
success: function(data, textStatus, error) {
// Reset the form.
if (node_id) {
hideProposeChange(node_id);
}
form.find('textarea')
.val('')
.add(form.find('input'))
.removeAttr('disabled');
var ul = $('#cl' + (node_id || parent_id));
if (ul.data('empty')) {
$(ul).empty();
ul.data('empty', false);
}
insertComment(data.comment);
var ao = $('#ao' + node_id);
ao.find('img').attr({'src': opts.commentBrightImage});
if (node_id) {
// if this was a "root" comment, remove the commenting box
// (the user can get it back by reopening the comment popup)
$('#ca' + node_id).slideUp();
}
},
error: function(request, textStatus, error) {
form.find('textarea,input').removeAttr('disabled');
showError('Oops, there was a problem adding the comment.');
}
});
}
/**
* Recursively append comments to the main comment list and children
* lists, creating the comment tree.
*/
function appendComments(comments, ul) {
$.each(comments, function() {
var div = createCommentDiv(this);
ul.append($(document.createElement('li')).html(div));
appendComments(this.children, div.find('ul.comment-children'));
// To avoid stagnating data, don't store the comments children in data.
this.children = null;
div.data('comment', this);
});
}
/**
* After adding a new comment, it must be inserted in the correct
* location in the comment tree.
*/
function insertComment(comment) {
var div = createCommentDiv(comment);
// To avoid stagnating data, don't store the comments children in data.
comment.children = null;
div.data('comment', comment);
var ul = $('#cl' + (comment.node || comment.parent));
var siblings = getChildren(ul);
var li = $(document.createElement('li'));
li.hide();
// Determine where in the parents children list to insert this comment.
for(i=0; i < siblings.length; i++) {
if (comp(comment, siblings[i]) <= 0) {
$('#cd' + siblings[i].id)
.parent()
.before(li.html(div));
li.slideDown('fast');
return;
}
}
// If we get here, this comment rates lower than all the others,
// or it is the only comment in the list.
ul.append(li.html(div));
li.slideDown('fast');
}
function acceptComment(id) {
$.ajax({
type: 'POST',
url: opts.acceptCommentURL,
data: {id: id},
success: function(data, textStatus, request) {
$('#cm' + id).fadeOut('fast');
$('#cd' + id).removeClass('moderate');
},
error: function(request, textStatus, error) {
showError('Oops, there was a problem accepting the comment.');
}
});
}
function deleteComment(id) {
$.ajax({
type: 'POST',
url: opts.deleteCommentURL,
data: {id: id},
success: function(data, textStatus, request) {
var div = $('#cd' + id);
if (data == 'delete') {
// Moderator mode: remove the comment and all children immediately
div.slideUp('fast', function() {
div.remove();
});
return;
}
// User mode: only mark the comment as deleted
div
.find('span.user-id:first')
.text('[deleted]').end()
.find('div.comment-text:first')
.text('[deleted]').end()
.find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id +
', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id)
.remove();
var comment = div.data('comment');
comment.username = '[deleted]';
comment.text = '[deleted]';
div.data('comment', comment);
},
error: function(request, textStatus, error) {
showError('Oops, there was a problem deleting the comment.');
}
});
}
function showProposal(id) {
$('#sp' + id).hide();
$('#hp' + id).show();
$('#pr' + id).slideDown('fast');
}
function hideProposal(id) {
$('#hp' + id).hide();
$('#sp' + id).show();
$('#pr' + id).slideUp('fast');
}
function showProposeChange(id) {
$('#pc' + id).hide();
$('#hc' + id).show();
var textarea = $('#pt' + id);
textarea.val(textarea.data('source'));
$.fn.autogrow.resize(textarea[0]);
textarea.slideDown('fast');
}
function hideProposeChange(id) {
$('#hc' + id).hide();
$('#pc' + id).show();
var textarea = $('#pt' + id);
textarea.val('').removeAttr('disabled');
textarea.slideUp('fast');
}
function toggleCommentMarkupBox(id) {
$('#mb' + id).toggle();
}
/** Handle when the user clicks on a sort by link. */
function handleReSort(link) {
var classes = link.attr('class').split(/\s+/);
for (var i=0; i<classes.length; i++) {
if (classes[i] != 'sort-option') {
by = classes[i].substring(2);
}
}
setComparator();
// Save/update the sortBy cookie.
var expiration = new Date();
expiration.setDate(expiration.getDate() + 365);
document.cookie= 'sortBy=' + escape(by) +
';expires=' + expiration.toUTCString();
$('ul.comment-ul').each(function(index, ul) {
var comments = getChildren($(ul), true);
comments = sortComments(comments);
appendComments(comments, $(ul).empty());
});
}
/**
* Function to process a vote when a user clicks an arrow.
*/
function handleVote(link) {
if (!opts.voting) {
showError("You'll need to login to vote.");
return;
}
var id = link.attr('id');
if (!id) {
// Didn't click on one of the voting arrows.
return;
}
// If it is an unvote, the new vote value is 0,
// Otherwise it's 1 for an upvote, or -1 for a downvote.
var value = 0;
if (id.charAt(1) != 'u') {
value = id.charAt(0) == 'u' ? 1 : -1;
}
// The data to be sent to the server.
var d = {
comment_id: id.substring(2),
value: value
};
// Swap the vote and unvote links.
link.hide();
$('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id)
.show();
// The div the comment is displayed in.
var div = $('div#cd' + d.comment_id);
var data = div.data('comment');
// If this is not an unvote, and the other vote arrow has
// already been pressed, unpress it.
if ((d.value !== 0) && (data.vote === d.value * -1)) {
$('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide();
$('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show();
}
// Update the comments rating in the local data.
data.rating += (data.vote === 0) ? d.value : (d.value - data.vote);
data.vote = d.value;
div.data('comment', data);
// Change the rating text.
div.find('.rating:first')
.text(data.rating + ' point' + (data.rating == 1 ? '' : 's'));
// Send the vote information to the server.
$.ajax({
type: "POST",
url: opts.processVoteURL,
data: d,
error: function(request, textStatus, error) {
showError('Oops, there was a problem casting that vote.');
}
});
}
/**
* Open a reply form used to reply to an existing comment.
*/
function openReply(id) {
// Swap out the reply link for the hide link
$('#rl' + id).hide();
$('#cr' + id).show();
// Add the reply li to the children ul.
var div = $(renderTemplate(replyTemplate, {id: id})).hide();
$('#cl' + id)
.prepend(div)
// Setup the submit handler for the reply form.
.find('#rf' + id)
.submit(function(event) {
event.preventDefault();
addComment($('#rf' + id));
closeReply(id);
})
.find('input[type=button]')
.click(function() {
closeReply(id);
});
div.slideDown('fast', function() {
$('#rf' + id).find('textarea').focus();
});
}
/**
* Close the reply form opened with openReply.
*/
function closeReply(id) {
// Remove the reply div from the DOM.
$('#rd' + id).slideUp('fast', function() {
$(this).remove();
});
// Swap out the hide link for the reply link
$('#cr' + id).hide();
$('#rl' + id).show();
}
/**
* Recursively sort a tree of comments using the comp comparator.
*/
function sortComments(comments) {
comments.sort(comp);
$.each(comments, function() {
this.children = sortComments(this.children);
});
return comments;
}
/**
* Get the children comments from a ul. If recursive is true,
* recursively include childrens' children.
*/
function getChildren(ul, recursive) {
var children = [];
ul.children().children("[id^='cd']")
.each(function() {
var comment = $(this).data('comment');
if (recursive)
comment.children = getChildren($(this).find('#cl' + comment.id), true);
children.push(comment);
});
return children;
}
/** Create a div to display a comment in. */
function createCommentDiv(comment) {
if (!comment.displayed && !opts.moderator) {
return $('<div class="moderate">Thank you! Your comment will show up '
+ 'once it is has been approved by a moderator.</div>');
}
// Prettify the comment rating.
comment.pretty_rating = comment.rating + ' point' +
(comment.rating == 1 ? '' : 's');
// Make a class (for displaying not yet moderated comments differently)
comment.css_class = comment.displayed ? '' : ' moderate';
// Create a div for this comment.
var context = $.extend({}, opts, comment);
var div = $(renderTemplate(commentTemplate, context));
// If the user has voted on this comment, highlight the correct arrow.
if (comment.vote) {
var direction = (comment.vote == 1) ? 'u' : 'd';
div.find('#' + direction + 'v' + comment.id).hide();
div.find('#' + direction + 'u' + comment.id).show();
}
if (opts.moderator || comment.text != '[deleted]') {
div.find('a.reply').show();
if (comment.proposal_diff)
div.find('#sp' + comment.id).show();
if (opts.moderator && !comment.displayed)
div.find('#cm' + comment.id).show();
if (opts.moderator || (opts.username == comment.username))
div.find('#dc' + comment.id).show();
}
return div;
}
/**
* A simple template renderer. Placeholders such as <%id%> are replaced
* by context['id'] with items being escaped. Placeholders such as <#id#>
* are not escaped.
*/
function renderTemplate(template, context) {
var esc = $(document.createElement('div'));
function handle(ph, escape) {
var cur = context;
$.each(ph.split('.'), function() {
cur = cur[this];
});
return escape ? esc.text(cur || "").html() : cur;
}
return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
return handle(arguments[2], arguments[1] == '%' ? true : false);
});
}
/** Flash an error message briefly. */
function showError(message) {
$(document.createElement('div')).attr({'class': 'popup-error'})
.append($(document.createElement('div'))
.attr({'class': 'error-message'}).text(message))
.appendTo('body')
.fadeIn("slow")
.delay(2000)
.fadeOut("slow");
}
/** Add a link the user uses to open the comments popup. */
$.fn.comment = function() {
return this.each(function() {
var id = $(this).attr('id').substring(1);
var count = COMMENT_METADATA[id];
var title = count + ' comment' + (count == 1 ? '' : 's');
var image = count > 0 ? opts.commentBrightImage : opts.commentImage;
var addcls = count == 0 ? ' nocomment' : '';
$(this)
.append(
$(document.createElement('a')).attr({
href: '#',
'class': 'sphinx-comment-open' + addcls,
id: 'ao' + id
})
.append($(document.createElement('img')).attr({
src: image,
alt: 'comment',
title: title
}))
.click(function(event) {
event.preventDefault();
show($(this).attr('id').substring(2));
})
)
.append(
$(document.createElement('a')).attr({
href: '#',
'class': 'sphinx-comment-close hidden',
id: 'ah' + id
})
.append($(document.createElement('img')).attr({
src: opts.closeCommentImage,
alt: 'close',
title: 'close'
}))
.click(function(event) {
event.preventDefault();
hide($(this).attr('id').substring(2));
})
);
});
};
var opts = {
processVoteURL: '/_process_vote',
addCommentURL: '/_add_comment',
getCommentsURL: '/_get_comments',
acceptCommentURL: '/_accept_comment',
deleteCommentURL: '/_delete_comment',
commentImage: '/static/_static/comment.png',
closeCommentImage: '/static/_static/comment-close.png',
loadingImage: '/static/_static/ajax-loader.gif',
commentBrightImage: '/static/_static/comment-bright.png',
upArrow: '/static/_static/up.png',
downArrow: '/static/_static/down.png',
upArrowPressed: '/static/_static/up-pressed.png',
downArrowPressed: '/static/_static/down-pressed.png',
voting: false,
moderator: false
};
if (typeof COMMENT_OPTIONS != "undefined") {
opts = jQuery.extend(opts, COMMENT_OPTIONS);
}
var popupTemplate = '\
<div class="sphinx-comments" id="sc<%id%>">\
<p class="sort-options">\
Sort by:\
<a href="#" class="sort-option byrating">best rated</a>\
<a href="#" class="sort-option byascage">newest</a>\
<a href="#" class="sort-option byage">oldest</a>\
</p>\
<div class="comment-header">Comments</div>\
<div class="comment-loading" id="cn<%id%>">\
loading comments... <img src="<%loadingImage%>" alt="" /></div>\
<ul id="cl<%id%>" class="comment-ul"></ul>\
<div id="ca<%id%>">\
<p class="add-a-comment">Add a comment\
(<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
<div class="comment-markup-box" id="mb<%id%>">\
reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
<tt>``code``</tt>, \
code blocks: <tt>::</tt> and an indented block after blank line</div>\
<form method="post" id="cf<%id%>" class="comment-form" action="">\
<textarea name="comment" cols="80"></textarea>\
<p class="propose-button">\
<a href="#" id="pc<%id%>" class="show-propose-change">\
Propose a change &#9657;\
</a>\
<a href="#" id="hc<%id%>" class="hide-propose-change">\
Propose a change &#9663;\
</a>\
</p>\
<textarea name="proposal" id="pt<%id%>" cols="80"\
spellcheck="false"></textarea>\
<input type="submit" value="Add comment" />\
<input type="hidden" name="node" value="<%id%>" />\
<input type="hidden" name="parent" value="" />\
</form>\
</div>\
</div>';
var commentTemplate = '\
<div id="cd<%id%>" class="sphinx-comment<%css_class%>">\
<div class="vote">\
<div class="arrow">\
<a href="#" id="uv<%id%>" class="vote" title="vote up">\
<img src="<%upArrow%>" />\
</a>\
<a href="#" id="uu<%id%>" class="un vote" title="vote up">\
<img src="<%upArrowPressed%>" />\
</a>\
</div>\
<div class="arrow">\
<a href="#" id="dv<%id%>" class="vote" title="vote down">\
<img src="<%downArrow%>" id="da<%id%>" />\
</a>\
<a href="#" id="du<%id%>" class="un vote" title="vote down">\
<img src="<%downArrowPressed%>" />\
</a>\
</div>\
</div>\
<div class="comment-content">\
<p class="tagline comment">\
<span class="user-id"><%username%></span>\
<span class="rating"><%pretty_rating%></span>\
<span class="delta"><%time.delta%></span>\
</p>\
<div class="comment-text comment"><#text#></div>\
<p class="comment-opts comment">\
<a href="#" class="reply hidden" id="rl<%id%>">reply &#9657;</a>\
<a href="#" class="close-reply" id="cr<%id%>">reply &#9663;</a>\
<a href="#" id="sp<%id%>" class="show-proposal">proposal &#9657;</a>\
<a href="#" id="hp<%id%>" class="hide-proposal">proposal &#9663;</a>\
<a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\
<span id="cm<%id%>" class="moderation hidden">\
<a href="#" id="ac<%id%>" class="accept-comment">accept</a>\
</span>\
</p>\
<pre class="proposal" id="pr<%id%>">\
<#proposal_diff#>\
</pre>\
<ul class="comment-children" id="cl<%id%>"></ul>\
</div>\
<div class="clearleft"></div>\
</div>\
</div>';
var replyTemplate = '\
<li>\
<div class="reply-div" id="rd<%id%>">\
<form id="rf<%id%>">\
<textarea name="comment" cols="80"></textarea>\
<input type="submit" value="Add reply" />\
<input type="button" value="Cancel" />\
<input type="hidden" name="parent" value="<%id%>" />\
<input type="hidden" name="node" value="" />\
</form>\
</div>\
</li>';
$(document).ready(function() {
init();
});
})(jQuery);
$(document).ready(function() {
// add comment anchors for all paragraphs that are commentable
$('.sphinx-has-comment').comment();
// highlight search words in search results
$("div.context").each(function() {
var params = $.getQueryParameters();
var terms = (params.q) ? params.q[0].split(/\s+/) : [];
var result = $(this);
$.each(terms, function() {
result.highlightText(this.toLowerCase(), 'highlighted');
});
});
// directly open comment window if requested
var anchor = document.location.hash;
if (anchor.substring(0, 9) == '#comment-') {
$('#ao' + anchor.substring(9)).click();
document.location.hash = '#s' + anchor.substring(9);
}
});

View file

@ -1,15 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index &mdash; pokedex v0.1 documentation</title>
<title>Index &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -22,7 +27,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="index.html" />
<link rel="top" title="pokedex 0.1 documentation" href="index.html" />
</head>
<body>
<div class="related">
@ -34,7 +39,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -44,204 +49,511 @@
<div class="body">
<h1 id="index">Index</h1>
<h1 id="index">Index</h1>
<div class="genindex-jumpbox">
<a href="#A"><strong>A</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#N"><strong>N</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> | <a href="#V"><strong>V</strong></a>
</div>
<div class="genindex-jumpbox">
<a href="#A"><strong>A</strong></a>
| <a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#V"><strong>V</strong></a>
</div>
<h2 id="A">A</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Ability">Ability (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.AbilityChangelog">AbilityChangelog (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.AbilityFlavorText">AbilityFlavorText (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Ability">Ability (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.AbilityChangelog">AbilityChangelog (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.AbilityFlavorText">AbilityFlavorText (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Item.appears_underground">appears_underground (pokedex.db.tables.Item attribute)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="B">B</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Berry">Berry (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.BerryFirmness">BerryFirmness (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.BerryFlavor">BerryFlavor (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Berry">Berry (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.BerryFirmness">BerryFirmness (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.BerryFlavor">BerryFlavor (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Pokemon.better_damage_class">better_damage_class (pokedex.db.tables.Pokemon attribute)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="C">C</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.ContestCombo">ContestCombo (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ContestEffect">ContestEffect (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.ContestType">ContestType (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="usage.html#pokedex.db.connect">connect() (in module pokedex.db)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ContestCombo">ContestCombo (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.ContestEffect">ContestEffect (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ContestType">ContestType (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="E">E</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.EggGroup">EggGroup (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.Encounter">Encounter (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterCondition">EncounterCondition (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterConditionValue">EncounterConditionValue (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterConditionValueMap">EncounterConditionValueMap (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterMethod">EncounterMethod (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterSlot">EncounterSlot (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.EvolutionChain">EvolutionChain (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.EvolutionTrigger">EvolutionTrigger (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.Experience">Experience (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.EggGroup">EggGroup (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Encounter">Encounter (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterCondition">EncounterCondition (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterConditionValue">EncounterConditionValue (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterConditionValueMap">EncounterConditionValueMap (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterMethod">EncounterMethod (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.EncounterSlot">EncounterSlot (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.EvolutionChain">EvolutionChain (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.EvolutionTrigger">EvolutionTrigger (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Experience">Experience (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="G">G</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Generation">Generation (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.GrowthRate">GrowthRate (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Generation">Generation (mapped class)</a>
</dt>
<dt><a href="usage.html#pokedex.db.util.get">get() (in module pokedex.db.util)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.GrowthRate">GrowthRate (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="I">I</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Item">Item (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemCategory">ItemCategory (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlag">ItemFlag (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlagMap">ItemFlagMap (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlavorText">ItemFlavorText (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlingEffect">ItemFlingEffect (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemGameIndex">ItemGameIndex (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemPocket">ItemPocket (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Machine.is_hm">is_hm (pokedex.db.tables.Machine attribute)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Nature.is_neutral">is_neutral (pokedex.db.tables.Nature attribute)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Item">Item (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemCategory">ItemCategory (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlag">ItemFlag (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlagMap">ItemFlagMap (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlavorText">ItemFlavorText (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemFlingEffect">ItemFlingEffect (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemGameIndex">ItemGameIndex (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.ItemPocket">ItemPocket (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="L">L</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Language">Language (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.Location">Location (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.LocationArea">LocationArea (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.LocationAreaEncounterRate">LocationAreaEncounterRate (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.LocationGameIndex">LocationGameIndex (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Language">Language (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Location">Location (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.LocationArea">LocationArea (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.LocationAreaEncounterRate">LocationAreaEncounterRate (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.LocationGameIndex">LocationGameIndex (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="M">M</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Machine">Machine (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.mapped_classes">mapped_classes (in module pokedex.db.tables)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.metadata">metadata (in module pokedex.db.tables)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.Move">Move (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveBattleStyle">MoveBattleStyle (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveDamageClass">MoveDamageClass (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveEffect">MoveEffect (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveEffectChangelog">MoveEffectChangelog (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveFlag">MoveFlag (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.MoveFlagMap">MoveFlagMap (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveFlavorText">MoveFlavorText (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMeta">MoveMeta (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMetaAilment">MoveMetaAilment (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMetaCategory">MoveMetaCategory (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMetaStatChange">MoveMetaStatChange (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveTarget">MoveTarget (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveVersion">MoveVersion (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Machine">Machine (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.mapped_classes">mapped_classes (in module pokedex.db.tables)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.metadata">metadata (in module pokedex.db.tables)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Move">Move (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveBattleStyle">MoveBattleStyle (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveChangelog">MoveChangelog (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveDamageClass">MoveDamageClass (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveEffect">MoveEffect (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveEffectChangelog">MoveEffectChangelog (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.MoveFlag">MoveFlag (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveFlagMap">MoveFlagMap (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveFlavorText">MoveFlavorText (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMeta">MoveMeta (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMetaAilment">MoveMetaAilment (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMetaCategory">MoveMetaCategory (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveMetaStatChange">MoveMetaStatChange (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.MoveTarget">MoveTarget (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="N">N</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Nature">Nature (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.NatureBattleStylePreference">NatureBattleStylePreference (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.NaturePokeathlonStat">NaturePokeathlonStat (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Pokemon.name">name (pokedex.db.tables.Pokemon attribute)</a>
</dt>
<dd><dl>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonForm.name">(pokedex.db.tables.PokemonForm attribute)</a>
</dt>
</dl></dd>
<dt><a href="main-tables.html#pokedex.db.tables.Nature">Nature (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.NatureBattleStylePreference">NatureBattleStylePreference (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.NaturePokeathlonStat">NaturePokeathlonStat (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="P">P</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.PokeathlonStat">PokeathlonStat (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.Pokedex">Pokedex (mapped class)</a></dt>
<dt><a href="main-tables.html#module-pokedex.db.tables">pokedex.db.tables (module)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.Pokemon">Pokemon (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonAbility">PokemonAbility (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonColor">PokemonColor (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonDexNumber">PokemonDexNumber (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonEggGroup">PokemonEggGroup (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonEvolution">PokemonEvolution (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonForm">PokemonForm (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonFormPokeathlonStat">PokemonFormPokeathlonStat (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonGameIndex">PokemonGameIndex (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonHabitat">PokemonHabitat (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonItem">PokemonItem (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonMove">PokemonMove (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonMoveMethod">PokemonMoveMethod (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonShape">PokemonShape (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonSpecies">PokemonSpecies (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonSpeciesFlavorText">PokemonSpeciesFlavorText (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonStat">PokemonStat (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonType">PokemonType (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.PokeathlonStat">PokeathlonStat (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Pokedex">Pokedex (mapped class)</a>
</dt>
<dt><a href="main-tables.html#module-pokedex.db.tables">pokedex.db.tables (module)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Pokemon">Pokemon (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonAbility">PokemonAbility (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonColor">PokemonColor (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonDexNumber">PokemonDexNumber (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonEggGroup">PokemonEggGroup (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonEvolution">PokemonEvolution (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonForm">PokemonForm (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonFormPokeathlonStat">PokemonFormPokeathlonStat (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonGameIndex">PokemonGameIndex (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonHabitat">PokemonHabitat (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonItem">PokemonItem (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonMove">PokemonMove (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonMoveMethod">PokemonMoveMethod (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonShape">PokemonShape (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonSpecies">PokemonSpecies (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonSpeciesFlavorText">PokemonSpeciesFlavorText (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonStat">PokemonStat (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.PokemonType">PokemonType (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="R">R</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Region">Region (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Region">Region (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="S">S</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Stat">Stat (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.StatHint">StatHint (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.SuperContestCombo">SuperContestCombo (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.SuperContestEffect">SuperContestEffect (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Stat">Stat (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.Pokemon.stat">stat() (pokedex.db.tables.Pokemon method)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.StatHint">StatHint (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.SuperContestCombo">SuperContestCombo (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.SuperContestEffect">SuperContestEffect (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="T">T</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Type">Type (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.TypeEfficacy">TypeEfficacy (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Type">Type (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.TypeEfficacy">TypeEfficacy (mapped class)</a>
</dt>
</dl></td>
</tr></table>
<h2 id="V">V</h2>
<table width="100%" class="indextable genindextable"><tr>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Version">Version (mapped class)</a></dt>
<dt><a href="main-tables.html#pokedex.db.tables.VersionGroup">VersionGroup (mapped class)</a></dt>
</dl></td>
<td width="33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.VersionGroupRegion">VersionGroupRegion (mapped class)</a></dt>
</dl></td>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.Version">Version (mapped class)</a>
</dt>
<dt><a href="main-tables.html#pokedex.db.tables.VersionGroup">VersionGroup (mapped class)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="main-tables.html#pokedex.db.tables.VersionGroupRegion">VersionGroupRegion (mapped class)</a>
</dt>
</dl></td>
</tr></table>
@ -257,7 +569,7 @@
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
@ -280,11 +592,11 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>

View file

@ -3,13 +3,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The pokedex documentation &mdash; pokedex v0.1 documentation</title>
<title>The pokedex documentation &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -22,7 +25,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="#" />
<link rel="top" title="pokedex 0.1 documentation" href="#" />
<link rel="next" title="Installing the pokedex library" href="installing.html" />
</head>
<body>
@ -38,7 +41,7 @@
<li class="right" >
<a href="installing.html" title="Installing the pokedex library"
accesskey="N">next</a> |</li>
<li><a href="#">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="#">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -63,6 +66,10 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="usage.html">Using pokedex</a><ul>
<li class="toctree-l2"><a class="reference internal" href="usage.html#connecting">Connecting</a></li>
<li class="toctree-l2"><a class="reference internal" href="usage.html#pokedex-tables">Pokédex tables</a></li>
<li class="toctree-l2"><a class="reference internal" href="usage.html#getting-things">Getting things</a></li>
<li class="toctree-l2"><a class="reference internal" href="usage.html#querying">Querying</a></li>
<li class="toctree-l2"><a class="reference internal" href="usage.html#api-documentation">API documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="schema.html">The database schema</a><ul>
@ -105,7 +112,7 @@
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
@ -131,11 +138,11 @@
<li class="right" >
<a href="installing.html" title="Installing the pokedex library"
>next</a> |</li>
<li><a href="#">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="#">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>

View file

@ -3,13 +3,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installing the pokedex library &mdash; pokedex v0.1 documentation</title>
<title>Installing the pokedex library &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -22,7 +25,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="index.html" />
<link rel="top" title="pokedex 0.1 documentation" href="index.html" />
<link rel="next" title="Using pokedex" href="usage.html" />
<link rel="prev" title="The pokedex documentation" href="index.html" />
</head>
@ -42,7 +45,7 @@
<li class="right" >
<a href="index.html" title="The pokedex documentation"
accesskey="P">previous</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -57,7 +60,7 @@
<h2>Quick startup with Ubuntu/Debian-like systems<a class="headerlink" href="#quick-startup-with-ubuntu-debian-like-systems" title="Permalink to this headline"></a></h2>
<p>Run the following from an empty directory:</p>
<div class="highlight-python"><pre>$ sudo apt-get install git python python-pip python-sqlalchemy
$ git clone git://git.veekun.com/pokedex.git
$ git clone git://github.com/veekun/pokedex.git
$ pip install -E env -e pokedex
$ source env/bin/activate
(env)$ pokedex setup -v
@ -111,8 +114,7 @@ data), and env (a <a class="reference external" href="http://www.virtualenv.org/
<p>In env/bin, there are three interesting files:</p>
<ul class="simple">
<li>pokedex: The pokedex program</li>
<li>python: A copy of Python that knows about pokedex and its prerequisites.
Using the system python won&#8217;t work.</li>
<li>python: A copy of Python that knows about pokedex and its prerequisites.</li>
<li>activate: Typing <tt class="docutils literal"><span class="pre">source</span> <span class="pre">env/bin/activate</span></tt> in a shell will put
pokedex and our bin/python on the $PATH, and generally set things up to work
with them. Your prompt will change to let you know of this. You can end such
@ -215,7 +217,7 @@ use it, so naturally he can&#8217;t write instructions for it.</td></tr>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
@ -244,11 +246,11 @@ use it, so naturally he can&#8217;t write instructions for it.</td></tr>
<li class="right" >
<a href="index.html" title="The pokedex documentation"
>previous</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -3,13 +3,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Python Module Index &mdash; pokedex v0.1 documentation</title>
<title>Python Module Index &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -22,7 +25,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="index.html" />
<link rel="top" title="pokedex 0.1 documentation" href="index.html" />
@ -37,7 +40,7 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -55,11 +58,11 @@
<table class="indextable modindextable" cellspacing="0" cellpadding="2">
<tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
<tr class="cap"><td></td><td><a name="cap-p">
<strong>p</strong></a></td><td></td></tr>
<tr class="cap" id="cap-p"><td></td><td>
<strong>p</strong></td><td></td></tr>
<tr>
<td><img src="_static/minus.png" id="toggle-1"
class="toggler" style="display: none" alt="-" /></td>
<td><img src="_static/minus.png" class="toggler"
id="toggle-1" style="display: none" alt="-" /></td>
<td>
<tt class="xref">pokedex</tt></td><td>
<em></em></td></tr>
@ -79,7 +82,7 @@
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
@ -102,11 +105,11 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>

View file

@ -3,13 +3,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The database schema &mdash; pokedex v0.1 documentation</title>
<title>The database schema &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -22,7 +25,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="index.html" />
<link rel="top" title="pokedex 0.1 documentation" href="index.html" />
<link rel="next" title="The pokédex tables" href="main-tables.html" />
<link rel="prev" title="Using pokedex" href="usage.html" />
</head>
@ -42,7 +45,7 @@
<li class="right" >
<a href="usage.html" title="Using pokedex"
accesskey="P">previous</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -68,7 +71,6 @@
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-move">Move</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-moveeffect">MoveEffect</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-movemeta">MoveMeta</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-moveversion">MoveVersion</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="main-tables.html#items">Items</a><ul>
@ -121,7 +123,6 @@
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-evolutiontrigger">EvolutionTrigger</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-growthrate">GrowthRate</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-itemcategory">ItemCategory</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-itemflag">ItemFlag</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-itemflingeffect">ItemFlingEffect</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-itempocket">ItemPocket</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-movebattlestyle">MoveBattleStyle</a></li>
@ -139,6 +140,7 @@
<li class="toctree-l2"><a class="reference internal" href="main-tables.html#changelogs">Changelogs</a><ul>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-abilitychangelog">AbilityChangelog</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-moveeffectchangelog">MoveEffectChangelog</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-movechangelog">MoveChangelog</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="main-tables.html#flavor-text">Flavor text</a><ul>
@ -151,6 +153,7 @@
<li class="toctree-l2"><a class="reference internal" href="main-tables.html#association-tables">Association tables</a><ul>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-berryflavor">BerryFlavor</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-encounterconditionvaluemap">EncounterConditionValueMap</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-itemflag">ItemFlag</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-itemflagmap">ItemFlagMap</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-machine">Machine</a></li>
<li class="toctree-l3"><a class="reference internal" href="main-tables.html#dex-table-moveflag">MoveFlag</a></li>
@ -209,7 +212,7 @@
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
@ -238,11 +241,11 @@
<li class="right" >
<a href="usage.html" title="Using pokedex"
>previous</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>

View file

@ -3,13 +3,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search &mdash; pokedex v0.1 documentation</title>
<title>Search &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -23,7 +26,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="index.html" />
<link rel="top" title="pokedex 0.1 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
@ -40,7 +43,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -91,11 +94,11 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -3,13 +3,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Using pokedex &mdash; pokedex v0.1 documentation</title>
<title>Using pokedex &mdash; pokedex 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
@ -22,7 +25,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pokedex v0.1 documentation" href="index.html" />
<link rel="top" title="pokedex 0.1 documentation" href="index.html" />
<link rel="next" title="The database schema" href="schema.html" />
<link rel="prev" title="Installing the pokedex library" href="installing.html" />
</head>
@ -42,7 +45,7 @@
<li class="right" >
<a href="installing.html" title="Installing the pokedex library"
accesskey="P">previous</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
@ -54,7 +57,7 @@
<div class="section" id="using-pokedex">
<h1>Using pokedex<a class="headerlink" href="#using-pokedex" title="Permalink to this headline"></a></h1>
<p>The pokédex is, first and foremost, a Python library. To get the most of it,
you&#8217;ll need to learn <a href="#id1"><span class="problematic" id="id2">`Python`_</span></a> and <a href="#id3"><span class="problematic" id="id4">`SQLAlchemy`_</span></a>.</p>
you&#8217;ll need to learn <a class="reference external" href="http://www.python.org">Python</a> and <a class="reference external" href="http://www.sqlalchemy.org">SQLAlchemy</a>.</p>
<p>Here is a small example of using pokedex:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">pokedex.db</span> <span class="kn">import</span> <span class="n">connect</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">util</span>
<span class="n">session</span> <span class="o">=</span> <span class="n">connect</span><span class="p">()</span>
@ -70,14 +73,167 @@ you&#8217;ll need to learn <a href="#id1"><span class="problematic" id="id2">`Py
<h2>Connecting<a class="headerlink" href="#connecting" title="Permalink to this headline"></a></h2>
<p>To get information out of the Pokédex, you will need to create a
<tt class="xref py py-class docutils literal"><span class="pre">Session</span></tt>. To do that, use
<tt class="xref py py-func docutils literal"><span class="pre">pokedex.db.connect()</span></tt>. For simple uses, you don&#8217;t need to give it any
<a class="reference internal" href="#pokedex.db.connect" title="pokedex.db.connect"><tt class="xref py py-func docutils literal"><span class="pre">pokedex.db.connect()</span></tt></a>. For simple uses, you don&#8217;t need to give it any
arguments: it the database that <tt class="docutils literal"><span class="pre">pokedex</span> <span class="pre">load</span></tt> fills up by default. If you
need to select another database, give its URI as the first argument.</p>
<p>The object <tt class="xref py py-func docutils literal"><span class="pre">connect()</span></tt> gives you is actually a
<a class="reference external" href="http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.session.Session" title="(in SQLAlchemy v0.7)"><tt class="docutils literal"><span class="pre">sqlalchemy.orm.session.Session</span></tt></a>, giving you the
<p>The object <a class="reference internal" href="#pokedex.db.connect" title="pokedex.db.connect"><tt class="xref py py-func docutils literal"><span class="pre">connect()</span></tt></a> gives you is actually a
<tt class="xref py py-class docutils literal"><span class="pre">SQLAlchemy</span> <span class="pre">session</span></tt>, giving you the
full power of SQLAlchemy for working with the data. We&#8217;ll cover some basics
here, but if you intend to do some serious work, do read SQLAlchemy&#8217;s docs.</p>
<p>XXX: write the rest of this</p>
</div>
<div class="section" id="pokedex-tables">
<h2>Pokédex tables<a class="headerlink" href="#pokedex-tables" title="Permalink to this headline"></a></h2>
<p>Data in the pokédex is organized in tables, defined in
<a class="reference internal" href="main-tables.html#module-pokedex.db.tables" title="pokedex.db.tables"><tt class="xref py py-mod docutils literal"><span class="pre">pokedex.db.tables</span></tt></a>.
There is quite a few or them. To get you started, here are a few common ones:</p>
<ul class="simple">
<li><a class="reference internal" href="main-tables.html#pokedex.db.tables.PokemonSpecies" title="pokedex.db.tables.PokemonSpecies"><tt class="xref py py-class docutils literal"><span class="pre">PokemonSpecies</span></tt></a></li>
<li><a class="reference internal" href="main-tables.html#pokedex.db.tables.Move" title="pokedex.db.tables.Move"><tt class="xref py py-class docutils literal"><span class="pre">Move</span></tt></a></li>
<li><a class="reference internal" href="main-tables.html#pokedex.db.tables.Item" title="pokedex.db.tables.Item"><tt class="xref py py-class docutils literal"><span class="pre">Item</span></tt></a></li>
<li><a class="reference internal" href="main-tables.html#pokedex.db.tables.Type" title="pokedex.db.tables.Type"><tt class="xref py py-class docutils literal"><span class="pre">Type</span></tt></a></li>
</ul>
</div>
<div class="section" id="getting-things">
<h2>Getting things<a class="headerlink" href="#getting-things" title="Permalink to this headline"></a></h2>
<p>If you know what you want from the pokédex, you can use the
<a class="reference internal" href="#pokedex.db.util.get" title="pokedex.db.util.get"><tt class="xref py py-func docutils literal"><span class="pre">pokedex.db.util.get()</span></tt></a> function. It looks up a thing in a table, based on
its identifier, name, or ID, and returns it.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">print_pokemon</span><span class="p">(</span><span class="n">pokemon</span><span class="p">):</span>
<span class="k">print</span> <span class="s">u&#39;{0.name}, the {0.genus} Pokemon&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">pokemon</span><span class="p">)</span>
<span class="n">print_pokemon</span><span class="p">(</span><span class="n">util</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="p">,</span> <span class="n">identifier</span><span class="o">=</span><span class="s">&#39;eevee&#39;</span><span class="p">))</span>
<span class="n">print_pokemon</span><span class="p">(</span><span class="n">util</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">u&#39;Ho-Oh&#39;</span><span class="p">))</span>
<span class="n">print_pokemon</span><span class="p">(</span><span class="n">util</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="mi">50</span><span class="p">))</span>
<span class="k">def</span> <span class="nf">print_item</span><span class="p">(</span><span class="n">item</span><span class="p">):</span>
<span class="k">print</span> <span class="s">u&#39;{0.name}: ${0.cost}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
<span class="n">print_item</span><span class="p">(</span><span class="n">util</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">tables</span><span class="o">.</span><span class="n">Item</span><span class="p">,</span> <span class="n">identifier</span><span class="o">=</span><span class="s">&#39;great-ball&#39;</span><span class="p">))</span>
<span class="n">print_item</span><span class="p">(</span><span class="n">util</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">tables</span><span class="o">.</span><span class="n">Item</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;Potion&#39;</span><span class="p">))</span>
<span class="n">print_item</span><span class="p">(</span><span class="n">util</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">tables</span><span class="o">.</span><span class="n">Item</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="mi">30</span><span class="p">))</span>
</pre></div>
</div>
<div class="highlight-none"><div class="highlight"><pre>Eevee, the Evolution Pokemon
Ho-Oh, the Rainbow Pokemon
Diglett, the Mole Pokemon
Great Ball: $600
Potion: $300
Fresh Water: $200
</pre></div>
</div>
</div>
<div class="section" id="querying">
<h2>Querying<a class="headerlink" href="#querying" title="Permalink to this headline"></a></h2>
<p>So, how do you get data from the session? You use the session&#8217;s
<tt class="xref py py-meth docutils literal"><span class="pre">query()</span></tt> method, and give it a pokédex
Table as an argument. This will give you a <tt class="xref py py-class docutils literal"><span class="pre">SQLAlchemy</span> <span class="pre">query</span></tt>.</p>
<div class="section" id="ordering">
<h3>Ordering<a class="headerlink" href="#ordering" title="Permalink to this headline"></a></h3>
<p>As always with SQL, you should not rely on query results being in some
particular order unless you have ordered the query first. This means that
you&#8217;ll want to sort just about every query you will make.</p>
<p>For example, you can get a list of all pokémon species, sorted by their
<tt class="xref py py-attr docutils literal"><span class="pre">id</span></tt>, like so:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">pokemon</span> <span class="ow">in</span> <span class="n">session</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="p">)</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="o">.</span><span class="n">id</span><span class="p">):</span>
<span class="k">print</span> <span class="n">pokemon</span><span class="o">.</span><span class="n">name</span>
</pre></div>
</div>
<div class="highlight-none"><div class="highlight"><pre>Bulbasaur
Ivysaur
Venusaur
Charmander
Charmeleon
...
Keldeo
Meloetta
Genesect
</pre></div>
</div>
<p>Or to order by <tt class="xref py py-attr docutils literal"><span class="pre">name</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">pokemon</span> <span class="ow">in</span> <span class="n">session</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="p">)</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">PokemonSpecies</span><span class="o">.</span><span class="n">name</span><span class="p">):</span>
<span class="k">print</span> <span class="n">pokemon</span><span class="o">.</span><span class="n">name</span>
</pre></div>
</div>
<div class="highlight-none"><div class="highlight"><pre>Abomasnow
...
Zweilous
</pre></div>
</div>
</div>
<div class="section" id="filtering">
<h3>Filtering<a class="headerlink" href="#filtering" title="Permalink to this headline"></a></h3>
<p>Another major operation on queries is filtering, using the query&#8217;s
<tt class="xref py py-meth docutils literal"><span class="pre">filter()</span></tt> or
<tt class="xref py py-meth docutils literal"><span class="pre">filter_by()</span></tt> methods:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">move</span> <span class="ow">in</span> <span class="n">session</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="o">.</span><span class="n">power</span> <span class="o">&gt;</span> <span class="mi">200</span><span class="p">):</span>
<span class="k">print</span> <span class="n">move</span><span class="o">.</span><span class="n">name</span>
</pre></div>
</div>
<div class="highlight-none"><div class="highlight"><pre>Explosion
</pre></div>
</div>
</div>
<div class="section" id="joining">
<h3>Joining<a class="headerlink" href="#joining" title="Permalink to this headline"></a></h3>
<p>The final operation we&#8217;ll cover here is joining other tables to the query,
using the query&#8217;s <tt class="xref py py-meth docutils literal"><span class="pre">join()</span></tt>.
You will usually want to join on a relationship, such as in the following
example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">query</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="p">)</span>
<span class="n">query</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="o">.</span><span class="n">type</span><span class="p">)</span>
<span class="n">query</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">identifier</span> <span class="o">==</span> <span class="s">&#39;grass&#39;</span><span class="p">)</span>
<span class="n">query</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="o">.</span><span class="n">power</span> <span class="o">&gt;=</span> <span class="mi">100</span><span class="p">)</span>
<span class="n">query</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="o">.</span><span class="n">power</span><span class="p">)</span>
<span class="n">query</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Move</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="k">print</span> <span class="s">&#39;The most powerful Grass-type moves:&#39;</span>
<span class="k">for</span> <span class="n">move</span> <span class="ow">in</span> <span class="n">query</span><span class="p">:</span>
<span class="k">print</span> <span class="s">u&#39;{0.name} ({0.power})&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">move</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-none"><div class="highlight"><pre>The most powerful Grass-type moves:
Petal Dance (120)
Power Whip (120)
Seed Flare (120)
SolarBeam (120)
Wood Hammer (120)
Leaf Storm (140)
Frenzy Plant (150)
</pre></div>
</div>
<p>That concludes our brief tutorial.
If you need to do more, consult the <a class="reference external" href="http://www.sqlalchemy.org/docs/orm/tutorial.html">SQLAlchemy documentation</a>.</p>
</div>
</div>
<div class="section" id="api-documentation">
<h2>API documentation<a class="headerlink" href="#api-documentation" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pokedex.db.connect">
<tt class="descclassname">pokedex.db.</tt><tt class="descname">connect</tt><big>(</big><em>uri=None</em>, <em>session_args={}</em>, <em>engine_args={}</em>, <em>engine_prefix=''</em><big>)</big><a class="headerlink" href="#pokedex.db.connect" title="Permalink to this definition"></a></dt>
<dd><p>Connects to the requested URI. Returns a session object.</p>
<p>With the URI omitted, attempts to connect to a default SQLite database
contained within the package directory.</p>
<p>Calling this function also binds the metadata object to the created engine.</p>
<p>See <tt class="xref py py-class docutils literal"><span class="pre">sqlalchemy.orm.session.Session</span></tt> for more documentation on the
returned object.</p>
</dd></dl>
<dl class="function">
<dt id="pokedex.db.util.get">
<tt class="descclassname">pokedex.db.util.</tt><tt class="descname">get</tt><big>(</big><em>session</em>, <em>table</em>, <em>identifier=None</em>, <em>name=None</em>, <em>id=None</em>, <em>language=None</em><big>)</big><a class="headerlink" href="#pokedex.db.util.get" title="Permalink to this definition"></a></dt>
<dd><p>Get one object from the database.</p>
<p>session: The session to use (from pokedex.db.connect())
table: The table to select from (such as pokedex.db.tables.Move)</p>
<p>identifier: Identifier of the object
name: The name of the object
id: The ID number of the object</p>
<p>language: A Language to use for name and form_name</p>
<p>All conditions must match, so it&#8217;s not a good idea to specify more than one
of identifier/name/id at once.</p>
<p>If zero or more than one objects matching the criteria are found, the
appropriate SQLAlchemy exception is raised.</p>
</dd></dl>
</div>
</div>
@ -91,6 +247,15 @@ here, but if you intend to do some serious work, do read SQLAlchemy&#8217;s docs
<ul>
<li><a class="reference internal" href="#">Using pokedex</a><ul>
<li><a class="reference internal" href="#connecting">Connecting</a></li>
<li><a class="reference internal" href="#pokedex-tables">Pokédex tables</a></li>
<li><a class="reference internal" href="#getting-things">Getting things</a></li>
<li><a class="reference internal" href="#querying">Querying</a><ul>
<li><a class="reference internal" href="#ordering">Ordering</a></li>
<li><a class="reference internal" href="#filtering">Filtering</a></li>
<li><a class="reference internal" href="#joining">Joining</a></li>
</ul>
</li>
<li><a class="reference internal" href="#api-documentation">API documentation</a></li>
</ul>
</li>
</ul>
@ -109,7 +274,7 @@ here, but if you intend to do some serious work, do read SQLAlchemy&#8217;s docs
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
@ -138,11 +303,11 @@ here, but if you intend to do some serious work, do read SQLAlchemy&#8217;s docs
<li class="right" >
<a href="installing.html" title="Installing the pokedex library"
>previous</a> |</li>
<li><a href="index.html">pokedex v0.1 documentation</a> &raquo;</li>
<li><a href="index.html">pokedex 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>