Skip to content

Commit

Permalink
Make use of PadSizeArgument for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed May 3, 2015
1 parent 707e79f commit 19499ec
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 40 deletions.
19 changes: 5 additions & 14 deletions commands/buy_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@
default=None,
type=int,
),
ParseArgument(
'--pad-size', '-p',
help='Limit the padsize to this ship size (S,M,L or ? for unkown).',
metavar='PADSIZES',
dest='padSize',
),
PadSizeArgument(),
MutuallyExclusiveGroup(
ParseArgument(
'--one-stop', '-1',
Expand Down Expand Up @@ -177,11 +172,7 @@ def sql_query(cmdenv, tdb, queries, mode):
bindValues.append(cmdenv.gt)

whereClause = ' AND '.join(constraints)
stmt = """
SELECT DISTINCT {columns}
FROM {tables}
WHERE {where}
""".format(
stmt = """SELECT DISTINCT {columns} FROM {tables} WHERE {where}""".format(
columns=','.join(columns),
tables=tables,
where=whereClause
Expand Down Expand Up @@ -218,9 +209,9 @@ def run(results, cmdenv, tdb):
results.summary.avg = first.cost
else:
avgPrice = tdb.query("""
SELECT CAST(AVG(si.supply_price) AS INT)
FROM StationItem AS si
WHERE si.item_id = ? AND si.supply_price > 0
SELECT CAST(AVG(si.supply_price) AS INT)
FROM StationItem AS si
WHERE si.item_id = ? AND si.supply_price > 0
""", [first.ID]).fetchone()[0]
results.summary.avg = avgPrice

Expand Down
6 changes: 1 addition & 5 deletions commands/local_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
type=float,
default=None,
),
ParseArgument('--pad-size', '-p',
help='Limit the padsize to this ship size (S,M,L or ? for unkown).',
metavar='PADSIZES',
dest='padSize',
),
PadSizeArgument(),
ParseArgument('--stations',
help='Limit to systems which have stations.',
action='store_true',
Expand Down
7 changes: 1 addition & 6 deletions commands/nav_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@
type=int,
dest='stationInterval',
),
ParseArgument(
'--pad-size', '-p',
help='Limit the padsize to this ship size (S,M,L or ? for unkown).',
metavar='PADSIZES',
dest='padSize',
),
PadSizeArgument(),
]

######################################################################
Expand Down
6 changes: 1 addition & 5 deletions commands/rares_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@
default=None,
type=int,
),
ParseArgument('--pad-size', '-p',
help='Limit the padsize to this ship size (S,M,L or ? for unkown).',
metavar='PADSIZES',
dest='padSize',
),
PadSizeArgument(),
ParseArgument('--price-sort', '-P',
help='(When using --near) Sort by price not distance.',
action='store_true',
Expand Down
6 changes: 1 addition & 5 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,12 @@
type=float,
dest='maxAge',
),
ParseArgument('--pad-size', '-p',
help='Limit the padsize to this ship size (S,M,L or ? for unknown).',
metavar='PADSIZES',
dest='padSize',
),
ParseArgument('--black-market', '-bm',
help='Require stations with a black market.',
action='store_true',
dest='blackMarket',
),
PadSizeArgument(),
ParseArgument('--ls-penalty', '--lsp',
help="Penalty per 1kls stations are from their stars.",
default=0.6,
Expand Down
6 changes: 1 addition & 5 deletions commands/sell_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
metavar='N.NN',
type=float,
),
ParseArgument('--pad-size', '-p',
help='Limit the padsize to this ship size (S,M,L or ? for unkown).',
metavar='PADSIZES',
dest='padSize',
),
PadSizeArgument(),
ParseArgument('--limit',
help='Maximum number of results to list.',
default=None,
Expand Down

0 comments on commit 19499ec

Please sign in to comment.