mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Merge branch 'master' of git.veekun.com:pokedex
This commit is contained in:
commit
de41731d1f
3 changed files with 696 additions and 671 deletions
|
@ -24,6 +24,29 @@ except ImportError:
|
||||||
sys.stderr.write("Please install PyYAML.\n")
|
sys.stderr.write("Please install PyYAML.\n")
|
||||||
sys.exit(13)
|
sys.exit(13)
|
||||||
|
|
||||||
|
# Try to use ordered dicts, so the YAML keys are in database table order
|
||||||
|
odict = dict # fall back to regular dict
|
||||||
|
try:
|
||||||
|
from collections import OrderedDict as odict
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
# This is a library for 2.4-2.6
|
||||||
|
from ordereddict import OrderedDict as odict
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Tell PyYAML how to dump our ordered dict.
|
||||||
|
# The items() is to avoid the sorting the library does automatically.
|
||||||
|
# Needs to be added to SafeDumper manually, because we use safe_dump below, and
|
||||||
|
# every Representer class has its own independent goddamn dict of these things
|
||||||
|
from yaml.dumper import SafeDumper
|
||||||
|
yaml.add_representer(
|
||||||
|
odict,
|
||||||
|
lambda dumper, data: dumper.represent_dict(data.items()),
|
||||||
|
Dumper=SafeDumper,
|
||||||
|
)
|
||||||
|
|
||||||
|
### Do actual work!
|
||||||
infilename, = sys.argv[1:]
|
infilename, = sys.argv[1:]
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
@ -33,7 +56,7 @@ with open(infilename) as infile:
|
||||||
|
|
||||||
# Read data...
|
# Read data...
|
||||||
for row in reader:
|
for row in reader:
|
||||||
datum = dict()
|
datum = odict()
|
||||||
for col, value in zip(column_names, row):
|
for col, value in zip(column_names, row):
|
||||||
datum[col] = value.decode('utf-8')
|
datum[col] = value.decode('utf-8')
|
||||||
|
|
||||||
|
@ -46,7 +69,7 @@ orig_choose_scalar_style = Emitter.choose_scalar_style
|
||||||
def new_choose_scalar_style(self):
|
def new_choose_scalar_style(self):
|
||||||
if self.analysis is None:
|
if self.analysis is None:
|
||||||
self.analysis = self.analyze_scalar(self.event.value)
|
self.analysis = self.analyze_scalar(self.event.value)
|
||||||
if self.analysis.multiline:
|
if self.analysis.multiline or len(self.analysis.scalar) > 80:
|
||||||
return '>'
|
return '>'
|
||||||
return orig_choose_scalar_style(self)
|
return orig_choose_scalar_style(self)
|
||||||
Emitter.choose_scalar_style = new_choose_scalar_style
|
Emitter.choose_scalar_style = new_choose_scalar_style
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -363,6 +363,8 @@ class Item(TableBase):
|
||||||
info=dict(description=u"Power of the move Fling when used with this item."))
|
info=dict(description=u"Power of the move Fling when used with this item."))
|
||||||
fling_effect_id = Column(Integer, ForeignKey('item_fling_effects.id'), nullable=True,
|
fling_effect_id = Column(Integer, ForeignKey('item_fling_effects.id'), nullable=True,
|
||||||
info=dict(description=u"ID of the fling-effect of the move Fling when used with this item. Note that these are different from move effects."))
|
info=dict(description=u"ID of the fling-effect of the move Fling when used with this item. Note that these are different from move effects."))
|
||||||
|
short_effect = Column(Unicode(256), nullable=False,
|
||||||
|
info=dict(description="A short summary of the effect", format='plaintext'))
|
||||||
effect = Column(markdown.MarkdownColumn(5120), nullable=False,
|
effect = Column(markdown.MarkdownColumn(5120), nullable=False,
|
||||||
info=dict(description=u"Detailed English description of the item's effect.", format='markdown'))
|
info=dict(description=u"Detailed English description of the item's effect.", format='markdown'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue