Skip to content

Commit c764836

Browse files
committed
Improves support for new evepaste parsers
1 parent cc99223 commit c764836

3 files changed

Lines changed: 9 additions & 32 deletions

File tree

‎evepraisal/helpers.py‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,7 @@ def decorated_function(*args, **kwargs):
1414

1515

1616
def iter_types(kind, result):
17-
if kind in ['assets',
18-
'contract',
19-
'dscan',
20-
'fitting',
21-
'listing',
22-
'cargo_scan',
23-
'loot_history',
24-
'pi',
25-
'survey_scanner',
26-
'view_contents',
27-
'heuristic']:
28-
for item in result:
29-
item['quantity'] = item.get('quantity', 1)
30-
yield item
31-
elif kind == 'bill_of_materials':
17+
if kind == 'bill_of_materials':
3218
for item in result:
3319
yield {'name': item['name'],
3420
'quantity': item.get('you', item.get('quantity'))}
@@ -57,4 +43,6 @@ def iter_types(kind, result):
5743
item['quantity'] = item.get('quantity', 1)
5844
yield item
5945
else:
60-
raise ValueError('Invalid kind %s', kind)
46+
for item in result:
47+
item['quantity'] = item.get('quantity', 1)
48+
yield item

‎evepraisal/parser.py‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,10 @@ def parse(raw_paste):
1414
representative_kind = 'unknown'
1515
largest_kind_num = 0
1616

17-
parser_list = [('loot_history', parsers.parse_loot_history),
18-
('survey_scanner', parsers.parse_survey_scanner),
19-
('pi', parsers.parse_pi),
20-
('dscan', dscan_parser),
21-
('killmail', parsers.parse_killmail),
22-
('chat', parsers.parse_chat),
23-
('eft', parsers.parse_eft),
24-
('fitting', parsers.parse_fitting),
25-
('contract', parsers.parse_contract),
26-
('assets', parsers.parse_assets),
27-
('view_contents', parsers.parse_view_contents),
28-
('wallet', parsers.parse_wallet),
29-
('cargo_scan', parsers.parse_cargo_scan),
30-
('listing', listing_parser),
31-
('heuristic', tryhard_parser)]
17+
parser_list = list(evepaste.PARSER_TABLE) + [
18+
('listing', listing_parser),
19+
('heuristic', tryhard_parser),
20+
]
3221

3322
iterations = 0
3423
while iterations < 10:

‎requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Flask-Cache
66
Flask-Babel
77
flask_openid
88
flask-sqlalchemy
9-
evepaste
9+
evepaste>=0.9
1010
git+git://github.com/ntt/reverence.git

0 commit comments

Comments
 (0)