tradedangerous 10.17.0__py3-none-any.whl → 11.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tradedangerous might be problematic. Click here for more details.

Files changed (74) hide show
  1. tradedangerous/__init__.py +4 -4
  2. tradedangerous/cache.py +183 -148
  3. tradedangerous/cli.py +2 -7
  4. tradedangerous/commands/TEMPLATE.py +1 -2
  5. tradedangerous/commands/__init__.py +2 -4
  6. tradedangerous/commands/buildcache_cmd.py +6 -11
  7. tradedangerous/commands/buy_cmd.py +11 -12
  8. tradedangerous/commands/commandenv.py +16 -15
  9. tradedangerous/commands/exceptions.py +6 -4
  10. tradedangerous/commands/export_cmd.py +2 -4
  11. tradedangerous/commands/import_cmd.py +3 -5
  12. tradedangerous/commands/local_cmd.py +16 -25
  13. tradedangerous/commands/market_cmd.py +9 -8
  14. tradedangerous/commands/nav_cmd.py +17 -25
  15. tradedangerous/commands/olddata_cmd.py +9 -15
  16. tradedangerous/commands/parsing.py +9 -6
  17. tradedangerous/commands/rares_cmd.py +9 -10
  18. tradedangerous/commands/run_cmd.py +25 -26
  19. tradedangerous/commands/sell_cmd.py +9 -9
  20. tradedangerous/commands/shipvendor_cmd.py +4 -7
  21. tradedangerous/commands/station_cmd.py +8 -14
  22. tradedangerous/commands/trade_cmd.py +5 -10
  23. tradedangerous/commands/update_cmd.py +10 -7
  24. tradedangerous/commands/update_gui.py +1 -3
  25. tradedangerous/corrections.py +1 -3
  26. tradedangerous/csvexport.py +8 -8
  27. tradedangerous/edscupdate.py +4 -6
  28. tradedangerous/edsmupdate.py +4 -4
  29. tradedangerous/formatting.py +53 -40
  30. tradedangerous/fs.py +6 -6
  31. tradedangerous/gui.py +53 -62
  32. tradedangerous/jsonprices.py +8 -16
  33. tradedangerous/mapping.py +4 -3
  34. tradedangerous/mfd/__init__.py +2 -4
  35. tradedangerous/mfd/saitek/__init__.py +0 -1
  36. tradedangerous/mfd/saitek/directoutput.py +8 -11
  37. tradedangerous/mfd/saitek/x52pro.py +5 -7
  38. tradedangerous/misc/checkpricebounds.py +2 -3
  39. tradedangerous/misc/clipboard.py +2 -3
  40. tradedangerous/misc/coord64.py +2 -1
  41. tradedangerous/misc/derp-sentinel.py +1 -1
  42. tradedangerous/misc/diff-system-csvs.py +3 -0
  43. tradedangerous/misc/eddb.py +1 -3
  44. tradedangerous/misc/eddn.py +2 -2
  45. tradedangerous/misc/edsc.py +7 -14
  46. tradedangerous/misc/edsm.py +1 -8
  47. tradedangerous/misc/importeddbstats.py +2 -1
  48. tradedangerous/misc/prices-json-exp.py +7 -5
  49. tradedangerous/misc/progress.py +2 -2
  50. tradedangerous/plugins/__init__.py +2 -2
  51. tradedangerous/plugins/edapi_plug.py +13 -19
  52. tradedangerous/plugins/edcd_plug.py +4 -5
  53. tradedangerous/plugins/eddblink_plug.py +11 -15
  54. tradedangerous/plugins/edmc_batch_plug.py +3 -5
  55. tradedangerous/plugins/journal_plug.py +2 -1
  56. tradedangerous/plugins/netlog_plug.py +5 -5
  57. tradedangerous/plugins/spansh_plug.py +394 -170
  58. tradedangerous/prices.py +19 -20
  59. tradedangerous/submit-distances.py +3 -8
  60. tradedangerous/templates/TradeDangerous.sql +305 -306
  61. tradedangerous/trade.py +12 -5
  62. tradedangerous/tradecalc.py +30 -34
  63. tradedangerous/tradedb.py +140 -206
  64. tradedangerous/tradeenv.py +143 -69
  65. tradedangerous/tradegui.py +4 -2
  66. tradedangerous/transfers.py +23 -20
  67. tradedangerous/version.py +1 -1
  68. {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.0.dist-info}/METADATA +2 -2
  69. tradedangerous-11.0.0.dist-info/RECORD +79 -0
  70. tradedangerous-10.17.0.dist-info/RECORD +0 -79
  71. {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.0.dist-info}/LICENSE +0 -0
  72. {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.0.dist-info}/WHEEL +0 -0
  73. {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.0.dist-info}/entry_points.txt +0 -0
  74. {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.0.dist-info}/top_level.txt +0 -0
tradedangerous/cli.py CHANGED
@@ -31,11 +31,6 @@
31
31
  # cool, please see the TradeDB and TradeCalc modules. TD is designed
32
32
  # to empower other programmers to do cool stuff.
33
33
 
34
- from __future__ import absolute_import
35
- from __future__ import with_statement
36
- from __future__ import print_function
37
- from __future__ import division
38
- from __future__ import unicode_literals
39
34
  import os
40
35
  import traceback
41
36
 
@@ -58,7 +53,7 @@ def main(argv = None):
58
53
  "\tBug Tracker: https://github.com/eyeonus/Trade-Dangerous/issues\n"
59
54
  "\tDocumentation: https://github.com/eyeonus/Trade-Dangerous/wiki\n"
60
55
  "\tEDForum Thread: https://forums.frontier.co.uk/showthread.php/441509\n"
61
- )
56
+ )
62
57
  from . import tradeexcept
63
58
 
64
59
  try:
@@ -78,7 +73,7 @@ def main(argv = None):
78
73
  if 'EXCEPTIONS' in os.environ:
79
74
  raise e
80
75
  sys.exit(1)
81
- except (UnicodeEncodeError, UnicodeDecodeError) as e:
76
+ except (UnicodeEncodeError, UnicodeDecodeError):
82
77
  print("-----------------------------------------------------------")
83
78
  print("ERROR: Unexpected unicode error in the wild!")
84
79
  print()
@@ -1,4 +1,3 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
1
  from commands.commandenv import ResultRow
3
2
  from commands.parsing import *
4
3
  from formatting import RowFormat, ColumnFormat
@@ -59,4 +58,4 @@ def render(results, cmdenv, tdb):
59
58
  This is where you should generate any output from your command.
60
59
  """
61
60
 
62
- ### TODO: Implement
61
+ ### TODO: Implement
@@ -1,9 +1,7 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
1
  from .commandenv import CommandEnv
3
2
  from textwrap import TextWrapper
4
3
 
5
4
  import argparse # For parsing command line args.
6
- import importlib
7
5
  import os
8
6
  import pathlib
9
7
  import sys
@@ -63,7 +61,7 @@ def addArguments(group, options, required, topGroup = None):
63
61
  parsing.registerParserHelpers(exGrp)
64
62
  addArguments(exGrp, option.arguments, required, topGroup = group)
65
63
  else:
66
- assert not required in option.kwargs
64
+ assert required not in option.kwargs
67
65
  if option.args[0][0] == '-':
68
66
  group.add_argument(*(option.args), required = required, **(option.kwargs))
69
67
  else:
@@ -84,7 +82,7 @@ def _findFromFile(cmd, prefix = '.tdrc'):
84
82
  return None
85
83
 
86
84
 
87
- class CommandIndex(object):
85
+ class CommandIndex:
88
86
 
89
87
  def usage(self, argv):
90
88
  """
@@ -1,8 +1,6 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
- import sys
3
-
1
+ from __future__ import annotations
4
2
  from .exceptions import CommandLineError
5
- from .parsing import *
3
+ from .parsing import ParseArgument
6
4
  from ..cache import buildCache
7
5
  from ..tradedb import TradeDB
8
6
 
@@ -54,19 +52,16 @@ switches = [
54
52
  # Perform query and populate result set
55
53
 
56
54
 
57
- def run(results, cmdenv, tdb):
55
+ def run(results, cmdenv, tdb: TradeDB):
58
56
  # Check that the file doesn't already exist.
59
57
  if not cmdenv.force:
60
58
  if tdb.dbPath.exists():
61
59
  raise CommandLineError(
62
- "SQLite3 database '{}' already exists.\n"
63
- "Either remove the file first or use the '-f' option."
64
- .format(tdb.dbFilename))
60
+ "SQLite3 database '{tdb.dbFilename}' already exists.\n"
61
+ "Either remove the file first or use the '-f' option.")
65
62
 
66
63
  if not tdb.sqlPath.exists():
67
- raise CommandLineError(
68
- "SQL File does not exist: {}"
69
- .format(tdb.sqlFilename))
64
+ raise CommandLineError("SQL File does not exist: {tdb.sqlFilename}")
70
65
 
71
66
  buildCache(tdb, cmdenv)
72
67
 
@@ -1,12 +1,14 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
1
+ from __future__ import annotations
2
2
  from collections import defaultdict
3
3
  from .commandenv import ResultRow
4
- from .exceptions import *
5
- from .parsing import *
6
- from ..formatting import RowFormat, ColumnFormat, max_len
7
- from ..tradedb import TradeDB, AmbiguityError, System, Station
4
+ from .exceptions import CommandLineError, NoDataError
5
+ from ..formatting import RowFormat, max_len
6
+ from ..tradedb import Station, System, TradeDB
7
+ from .parsing import (
8
+ AvoidPlacesArgument, BlackMarketSwitch, FleetCarrierArgument, MutuallyExclusiveGroup,
9
+ NoPlanetSwitch, OdysseyArgument, PadSizeArgument, ParseArgument, PlanetaryArgument,
10
+ )
8
11
 
9
- import math
10
12
 
11
13
  ITEM_MODE = "Item"
12
14
  SHIP_MODE = "Ship"
@@ -114,7 +116,7 @@ def get_lookup_list(cmdenv, tdb):
114
116
  name for names in cmdenv.name for name in names.split(',')
115
117
  ]
116
118
  # We only support searching for one type of purchase a time: ship or item.
117
- # Our first match is open ended, but once we have matched one type of
119
+ # Our first match is open-ended, but once we have matched one type of
118
120
  # thing, the remaining arguments are all sourced from the same pool.
119
121
  # Thus: [food, cobra, metals] is illegal but [metals, hydrogen] is legal.
120
122
  mode = None
@@ -401,8 +403,5 @@ def render(results, cmdenv, tdb):
401
403
  print(stnRowFmt.format(row))
402
404
 
403
405
  if singleMode and cmdenv.detail:
404
- print("{:{lnl}} {:>10n}".format(
405
- "-- Ship Cost" if mode is SHIP_MODE else "-- Average",
406
- results.summary.avg,
407
- lnl = maxStnLen,
408
- ))
406
+ msg = "-- Ship Cost" if mode is SHIP_MODE else "-- Average",
407
+ print(f"{msg:{maxStnLen}} {results.summary.avg:>10n}")
@@ -1,7 +1,8 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
-
3
- from .exceptions import CommandLineError, PadSizeError, PlanetaryError, FleetCarrierError
4
- from ..tradedb import AmbiguityError, System, Station
1
+ from .exceptions import (
2
+ CommandLineError, FleetCarrierError, OdysseyError,
3
+ PadSizeError, PlanetaryError,
4
+ )
5
+ from ..tradedb import AmbiguityError, Station
5
6
  from ..tradeenv import TradeEnv
6
7
 
7
8
  import os
@@ -9,7 +10,7 @@ import pathlib
9
10
  import sys
10
11
 
11
12
 
12
- class CommandResults(object):
13
+ class CommandResults:
13
14
  """
14
15
  Encapsulates the results returned by running a command.
15
16
  """
@@ -24,7 +25,7 @@ class CommandResults(object):
24
25
  cmdenv._cmd.render(self, cmdenv, tdb)
25
26
 
26
27
 
27
- class ResultRow(object):
28
+ class ResultRow:
28
29
 
29
30
  def __init__(self, **kwargs):
30
31
  for k, v in kwargs.items():
@@ -46,7 +47,7 @@ class CommandEnv(TradeEnv):
46
47
  if self.detail and self.quiet:
47
48
  raise CommandLineError("'--detail' (-v) and '--quiet' (-q) are mutually exclusive.")
48
49
 
49
- self._cmd = cmdModule or __main__
50
+ self._cmd = cmdModule or getattr("__main__")
50
51
  self.wantsTradeDB = getattr(cmdModule, 'wantsTradeDB', True)
51
52
  self.usesTradeData = getattr(cmdModule, 'usesTradeData', False)
52
53
 
@@ -187,7 +188,7 @@ class CommandEnv(TradeEnv):
187
188
 
188
189
  # But if it matched more than once, whine about ambiguity
189
190
  if item and place:
190
- raise AmbiguityError('Avoidance', avoid, [ item, place.str() ])
191
+ raise AmbiguityError('Avoidance', avoid, [ item, place.text() ])
191
192
 
192
193
  self.DEBUG0("Avoiding items {}, places {}",
193
194
  [ item.name() for item in avoidItems ],
@@ -213,7 +214,7 @@ class CommandEnv(TradeEnv):
213
214
  return
214
215
  self.padSize = padSize = padSize.upper()
215
216
  for value in padSize:
216
- if not value in 'SML?':
217
+ if value not in 'SML?':
217
218
  raise PadSizeError(padSize)
218
219
  self.padSize = padSize
219
220
 
@@ -227,7 +228,7 @@ class CommandEnv(TradeEnv):
227
228
  return
228
229
  self.planetary = planetary = planetary.upper()
229
230
  for value in planetary:
230
- if not value in 'YN?':
231
+ if value not in 'YN?':
231
232
  raise PlanetaryError(planetary)
232
233
  self.planetary = planetary
233
234
 
@@ -237,8 +238,8 @@ class CommandEnv(TradeEnv):
237
238
  return
238
239
  fleet = ''.join(sorted(list(set(fleet)))).upper()
239
240
  for value in fleet:
240
- if not value in 'YN?':
241
- raise FleetError(fleet)
241
+ if value not in 'YN?':
242
+ raise FleetCarrierError(fleet)
242
243
  if fleet == '?NY':
243
244
  self.fleet = None
244
245
  return
@@ -250,12 +251,12 @@ class CommandEnv(TradeEnv):
250
251
  return
251
252
  odyssey = ''.join(sorted(list(set(odyssey)))).upper()
252
253
  for value in odyssey:
253
- if not value in 'YN?':
254
- raise odysseyError(odyssey)
254
+ if value not in 'YN?':
255
+ raise OdysseyError(odyssey)
255
256
  if odyssey == '?NY':
256
257
  self.odyssey = None
257
258
  return
258
- self.odyssey = odyssey = odyssey.upper()
259
+ self.odyssey = odyssey.upper()
259
260
 
260
261
  def colorize(self, color, rawText):
261
262
  """
@@ -1,6 +1,5 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
1
  from ..tradeexcept import TradeException
3
- import sys
2
+
4
3
 
5
4
  ######################################################################
6
5
  # Exceptions
@@ -8,6 +7,7 @@ import sys
8
7
  class UsageError(TradeException):
9
8
  def __init__(self, title, usage):
10
9
  self.title, self.usage = title, usage
10
+
11
11
  def __str__(self):
12
12
  return self.title + "\n\n" + self.usage
13
13
 
@@ -20,6 +20,7 @@ class CommandLineError(TradeException):
20
20
  """
21
21
  def __init__(self, errorStr, usage=None):
22
22
  self.errorStr, self.usage = errorStr, usage
23
+
23
24
  def __str__(self):
24
25
  if self.usage:
25
26
  return "ERROR: {}\n\n{}".format(self.errorStr, self.usage)
@@ -35,8 +36,9 @@ class NoDataError(TradeException):
35
36
  """
36
37
  def __init__(self, errorStr):
37
38
  self.errorStr = errorStr
39
+
38
40
  def __str__(self):
39
- return "Error: {}\n".format(self.errorStr) + ("""
41
+ return f"""Error: {self.errorStr}
40
42
  Possible causes:
41
43
  - No profitable runs or routes meet your criteria,
42
44
  - Missing Systems or Stations along the route (see "local -vv"),
@@ -47,7 +49,7 @@ project such as EDDBlink (https://github.com/eyeonus/EDDBlink).
47
49
 
48
50
  For more help, see the TradeDangerous Wiki:
49
51
  https://github.com/eyeonus/Trade-Dangerous/wiki
50
- """).format(sys.argv[0])
52
+ """
51
53
 
52
54
 
53
55
  class PadSizeError(CommandLineError):
@@ -1,7 +1,5 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
-
3
1
  from ..csvexport import exportTableToFile
4
- from .parsing import *
2
+ from .parsing import ParseArgument, MutuallyExclusiveGroup
5
3
  from .exceptions import CommandLineError
6
4
  from pathlib import Path
7
5
 
@@ -122,4 +120,4 @@ def run(results, cmdenv, tdb):
122
120
  filePath.unlink()
123
121
  cmdenv.DEBUG0("Delete empty file {file}'".format(file=filePath))
124
122
 
125
- return None
123
+ return None
@@ -1,13 +1,11 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
-
3
- from .exceptions import *
4
- from .parsing import *
1
+ from .exceptions import CommandLineError
2
+ from .parsing import ParseArgument, MutuallyExclusiveGroup
5
3
  from itertools import chain
6
4
  from pathlib import Path
7
5
 
8
6
  from .. import cache, plugins, transfers
9
- import math
10
7
  import re
8
+ import sys
11
9
 
12
10
  try:
13
11
  import tkinter
@@ -1,12 +1,14 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
1
  from .commandenv import ResultRow
3
- from .parsing import *
2
+ from .parsing import (
3
+ ParseArgument, PadSizeArgument, MutuallyExclusiveGroup, NoPlanetSwitch,
4
+ PlanetaryArgument, FleetCarrierArgument, OdysseyArgument, BlackMarketSwitch,
5
+ ShipyardSwitch, OutfittingSwitch, RearmSwitch, RefuelSwitch, RepairSwitch,
6
+ )
4
7
  from ..formatting import RowFormat, ColumnFormat, max_len
5
8
  from itertools import chain
6
9
  from ..tradedb import TradeDB
7
10
  from ..tradeexcept import TradeException
8
11
 
9
- import math
10
12
 
11
13
  ######################################################################
12
14
  # Parser config
@@ -186,48 +188,37 @@ def render(results, cmdenv, tdb):
186
188
  key=lambda row: row.age)
187
189
  ).append(
188
190
  ColumnFormat("Mkt", '>', '3',
189
- key=lambda row: \
190
- TradeDB.marketStates[row.station.market])
191
+ key=lambda row: TradeDB.marketStates[row.station.market])
191
192
  ).append(
192
193
  ColumnFormat("BMk", '>', '3',
193
- key=lambda row: \
194
- TradeDB.marketStates[row.station.blackMarket])
194
+ key=lambda row: TradeDB.marketStates[row.station.blackMarket])
195
195
  ).append(
196
196
  ColumnFormat("Shp", '>', '3',
197
- key=lambda row: \
198
- TradeDB.marketStates[row.station.shipyard])
197
+ key=lambda row: TradeDB.marketStates[row.station.shipyard])
199
198
  ).append(
200
199
  ColumnFormat("Out", '>', '3',
201
- key=lambda row: \
202
- TradeDB.marketStates[row.station.outfitting])
200
+ key=lambda row: TradeDB.marketStates[row.station.outfitting])
203
201
  ).append(
204
202
  ColumnFormat("Arm", '>', '3',
205
- key=lambda row: \
206
- TradeDB.marketStates[row.station.rearm])
203
+ key=lambda row: TradeDB.marketStates[row.station.rearm])
207
204
  ).append(
208
205
  ColumnFormat("Ref", '>', '3',
209
- key=lambda row: \
210
- TradeDB.marketStates[row.station.refuel])
206
+ key=lambda row: TradeDB.marketStates[row.station.refuel])
211
207
  ).append(
212
208
  ColumnFormat("Rep", '>', '3',
213
- key=lambda row: \
214
- TradeDB.marketStates[row.station.repair])
209
+ key=lambda row: TradeDB.marketStates[row.station.repair])
215
210
  ).append(
216
211
  ColumnFormat("Pad", '>', '3',
217
- key=lambda row: \
218
- TradeDB.padSizes[row.station.maxPadSize])
212
+ key=lambda row: TradeDB.padSizes[row.station.maxPadSize])
219
213
  ).append(
220
214
  ColumnFormat("Plt", '>', '3',
221
- key=lambda row: \
222
- TradeDB.planetStates[row.station.planetary])
215
+ key=lambda row: TradeDB.planetStates[row.station.planetary])
223
216
  ).append(
224
217
  ColumnFormat("Flc", '>', '3',
225
- key=lambda row: \
226
- TradeDB.fleetStates[row.station.fleet])
218
+ key=lambda row: TradeDB.fleetStates[row.station.fleet])
227
219
  ).append(
228
220
  ColumnFormat("Ody", '>', '3',
229
- key=lambda row: \
230
- TradeDB.odysseyStates[row.station.odyssey])
221
+ key=lambda row: TradeDB.odysseyStates[row.station.odyssey])
231
222
  )
232
223
  if cmdenv.detail > 1:
233
224
  stnRowFmt.append(
@@ -1,9 +1,10 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
1
  from .commandenv import ResultRow
3
- from .exceptions import *
4
- from .parsing import *
5
- from ..formatting import RowFormat, ColumnFormat
6
- from ..tradedb import TradeDB
2
+ from .exceptions import CommandLineError
3
+ from .parsing import (
4
+ ParseArgument, MutuallyExclusiveGroup,
5
+ )
6
+ from ..formatting import RowFormat
7
+
7
8
 
8
9
  ######################################################################
9
10
  # Parser config
@@ -129,8 +130,8 @@ def render(results, cmdenv, tdb):
129
130
  if showCategories:
130
131
  rowFmt.prefix = ' '
131
132
 
132
- sellPred = lambda row: row.sellCr != 0 and row.supply != '-'
133
- buyPred = lambda row: row.buyCr != 0 and row.demand != '-'
133
+ sellPred = lambda row: row.sellCr != 0 and row.supply != '-' # noqa: E731
134
+ buyPred = lambda row: row.buyCr != 0 and row.demand != '-' # noqa: E731
134
135
 
135
136
  rowFmt.addColumn('Item', '<', longestLen,
136
137
  key=lambda row: row.item.name())
@@ -170,4 +171,4 @@ def render(results, cmdenv, tdb):
170
171
  if showCategories and row.item.category is not lastCat:
171
172
  print("+{}".format(row.item.category.name()))
172
173
  lastCat = row.item.category
173
- print(rowFmt.format(row))
174
+ print(rowFmt.format(row))
@@ -1,9 +1,12 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
- from .parsing import *
3
- import math
1
+ from .parsing import (
2
+ AvoidPlacesArgument, FleetCarrierArgument, MutuallyExclusiveGroup,
3
+ NoPlanetSwitch, OdysseyArgument, PadSizeArgument, ParseArgument,
4
+ PlanetaryArgument,
5
+ )
4
6
  from ..tradedb import System, Station, TradeDB
5
7
  from ..tradeexcept import TradeException
6
8
 
9
+
7
10
  ######################################################################
8
11
  # Parser config
9
12
 
@@ -197,48 +200,37 @@ def render(results, cmdenv, tdb):
197
200
  key=lambda row: row.age)
198
201
  ).append(
199
202
  ColumnFormat('Mkt', '>', '3',
200
- key=lambda row: \
201
- TradeDB.marketStates[row.station.market])
203
+ key=lambda row: TradeDB.marketStates[row.station.market])
202
204
  ).append(
203
205
  ColumnFormat("BMk", '>', '3',
204
- key=lambda row: \
205
- TradeDB.marketStates[row.station.blackMarket])
206
+ key=lambda row: TradeDB.marketStates[row.station.blackMarket])
206
207
  ).append(
207
208
  ColumnFormat("Shp", '>', '3',
208
- key=lambda row: \
209
- TradeDB.marketStates[row.station.shipyard])
209
+ key=lambda row: TradeDB.marketStates[row.station.shipyard])
210
210
  ).append(
211
211
  ColumnFormat("Out", '>', '3',
212
- key=lambda row: \
213
- TradeDB.marketStates[row.station.outfitting])
212
+ key=lambda row: TradeDB.marketStates[row.station.outfitting])
214
213
  ).append(
215
214
  ColumnFormat("Arm", '>', '3',
216
- key=lambda row: \
217
- TradeDB.marketStates[row.station.rearm])
215
+ key=lambda row: TradeDB.marketStates[row.station.rearm])
218
216
  ).append(
219
217
  ColumnFormat("Ref", '>', '3',
220
- key=lambda row: \
221
- TradeDB.marketStates[row.station.refuel])
218
+ key=lambda row: TradeDB.marketStates[row.station.refuel])
222
219
  ).append(
223
220
  ColumnFormat("Rep", '>', '3',
224
- key=lambda row: \
225
- TradeDB.marketStates[row.station.repair])
221
+ key=lambda row: TradeDB.marketStates[row.station.repair])
226
222
  ).append(
227
223
  ColumnFormat("Pad", '>', '3',
228
- key=lambda row: \
229
- TradeDB.padSizes[row.station.maxPadSize])
224
+ key=lambda row: TradeDB.padSizes[row.station.maxPadSize])
230
225
  ).append(
231
226
  ColumnFormat("Plt", '>', '3',
232
- key=lambda row: \
233
- TradeDB.planetStates[row.station.planetary])
227
+ key=lambda row: TradeDB.planetStates[row.station.planetary])
234
228
  ).append(
235
229
  ColumnFormat("Flc", '>', '3',
236
- key=lambda row: \
237
- TradeDB.fleetStates[row.station.fleet])
230
+ key=lambda row: TradeDB.fleetStates[row.station.fleet])
238
231
  ).append(
239
232
  ColumnFormat("Ody", '>', '3',
240
- key=lambda row: \
241
- TradeDB.odysseyStates[row.station.odyssey])
233
+ key=lambda row: TradeDB.odysseyStates[row.station.odyssey])
242
234
  )
243
235
  if cmdenv.detail > 1:
244
236
  stnRowFmt.append(
@@ -1,11 +1,10 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
- from .parsing import *
1
+ from .parsing import (
2
+ FleetCarrierArgument, MutuallyExclusiveGroup, NoPlanetSwitch,
3
+ OdysseyArgument, ParseArgument, PadSizeArgument, PlanetaryArgument,
4
+ )
3
5
  from ..tradedb import TradeDB
4
6
  from ..tradeexcept import TradeException
5
7
 
6
- import itertools
7
- import math
8
- import sys
9
8
 
10
9
  ######################################################################
11
10
  # Parser config
@@ -66,7 +65,6 @@ def run(results, cmdenv, tdb):
66
65
 
67
66
  cmdenv = results.cmdenv
68
67
  tdb = cmdenv.tdb
69
- srcSystem = cmdenv.nearSystem
70
68
 
71
69
  results.summary = ResultRow()
72
70
  results.limit = cmdenv.limit
@@ -240,20 +238,16 @@ def render(results, cmdenv, tdb):
240
238
  key=lambda row: row.station.distFromStar())
241
239
  ).append(
242
240
  ColumnFormat("Pad", '>', '3',
243
- key=lambda row: \
244
- TradeDB.padSizes[row.station.maxPadSize])
241
+ key=lambda row: TradeDB.padSizes[row.station.maxPadSize])
245
242
  ).append(
246
243
  ColumnFormat("Plt", '>', '3',
247
- key=lambda row: \
248
- TradeDB.planetStates[row.station.planetary])
244
+ key=lambda row: TradeDB.planetStates[row.station.planetary])
249
245
  ).append(
250
246
  ColumnFormat("Flc", '>', '3',
251
- key=lambda row: \
252
- TradeDB.fleetStates[row.station.fleet])
247
+ key=lambda row: TradeDB.fleetStates[row.station.fleet])
253
248
  ).append(
254
249
  ColumnFormat("Ody", '>', '3',
255
- key=lambda row: \
256
- TradeDB.odysseyStates[row.station.odyssey])
250
+ key=lambda row: TradeDB.odysseyStates[row.station.odyssey])
257
251
  )
258
252
 
259
253
  if not cmdenv.quiet:
@@ -261,4 +255,4 @@ def render(results, cmdenv, tdb):
261
255
  print(heading, underline, sep='\n')
262
256
 
263
257
  for row in results.rows:
264
- print(rowFmt.format(row))
258
+ print(rowFmt.format(row))
@@ -1,10 +1,11 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
- from .exceptions import PadSizeError, PlanetaryError, FleetCarrierError
1
+ from .exceptions import (
2
+ FleetCarrierError, OdysseyError, PadSizeError, PlanetaryError,
3
+ )
3
4
 
4
5
  ######################################################################
5
6
  # Parsing Helpers
6
7
 
7
- class ParseArgument(object):
8
+ class ParseArgument:
8
9
  """
9
10
  Provides argument forwarding so that 'makeSubParser' can take function-like arguments.
10
11
  """
@@ -12,7 +13,7 @@ class ParseArgument(object):
12
13
  self.args, self.kwargs = args, kwargs
13
14
 
14
15
 
15
- class MutuallyExclusiveGroup(object):
16
+ class MutuallyExclusiveGroup:
16
17
  def __init__(self, *args):
17
18
  self.arguments = list(args)
18
19
 
@@ -24,9 +25,10 @@ class MutuallyExclusiveGroup(object):
24
25
  class CreditParser(int):
25
26
  """
26
27
  argparse helper for parsing numeric prefixes, i.e.
27
- 'k' for thousand, 'm' for million and 'b' for billion.
28
+ 'k' for thousands, 'm' for millions and 'b' for billions.
28
29
  """
29
30
  suffixes = {'k': 10**3, 'm': 10**6, 'b': 10**9}
31
+
30
32
  def __new__(cls, val, **kwargs):
31
33
  if isinstance(val, str):
32
34
  if val[-1] in CreditParser.suffixes:
@@ -82,7 +84,7 @@ class SwitchArgument(ParseArgument):
82
84
  else:
83
85
  self.args = (self.switches,)
84
86
  help = help or self.help
85
- self.kwargs = {'action':'store_true', 'dest':self.dest, 'help':help}
87
+ self.kwargs = {'action': 'store_true', 'dest': self.dest, 'help': help}
86
88
 
87
89
 
88
90
  class BlackMarketSwitch(SwitchArgument):
@@ -209,6 +211,7 @@ class OdysseyArgument(int):
209
211
  'choices': 'YN?',
210
212
  }
211
213
 
214
+
212
215
  __tdParserHelpers = {
213
216
  'credits': CreditParser,
214
217
  'padsize': PadSizeArgument.PadSizeParser,
@@ -1,11 +1,12 @@
1
- from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
2
1
  from .commandenv import ResultRow
3
- from .exceptions import *
4
- from .parsing import *
5
- from ..formatting import RowFormat, ColumnFormat, max_len
2
+ from .exceptions import CommandLineError
3
+ from .parsing import (
4
+ PadSizeArgument, ParseArgument, MutuallyExclusiveGroup, NoPlanetSwitch,
5
+ PlanetaryArgument, FleetCarrierArgument, OdysseyArgument,
6
+ )
7
+ from ..formatting import RowFormat, max_len
6
8
  from ..tradedb import TradeDB
7
9
 
8
- import math
9
10
 
10
11
  ######################################################################
11
12
  # Parser config
@@ -61,8 +62,7 @@ switches = [
61
62
  default=False,
62
63
  ),
63
64
  ParseArgument('--away',
64
- help='Require "--from" systems to be at least this far ' \
65
- 'from primary system',
65
+ help='Require "--from" systems to be at least this far from primary system',
66
66
  metavar='LY',
67
67
  default=0,
68
68
  type=float,
@@ -78,8 +78,7 @@ switches = [
78
78
  )
79
79
  ),
80
80
  ParseArgument('--from',
81
- help='Additional systems to range check candidates against, ' \
82
- 'requires --away.',
81
+ help='Additional systems to range check candidates against, requires --away.',
83
82
  metavar='SYSTEMNAME',
84
83
  action='append',
85
84
  dest='awayFrom',
@@ -165,7 +164,7 @@ def run(results, cmdenv, tdb):
165
164
 
166
165
  # Look through the rares list.
167
166
  for rare in tdb.rareItemByID.values():
168
- if not rare.illegal in wantIllegality:
167
+ if rare.illegal not in wantIllegality:
169
168
  continue
170
169
  if padSize: # do we care about pad size?
171
170
  if not rare.station.checkPadSize(padSize):