tradedangerous 11.0.4__py3-none-any.whl → 11.0.6__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.

@@ -33,19 +33,12 @@
33
33
  # DEVELOPERS: If you are a programmer who wants TD to do something
34
34
  # cool, please see the TradeDB and TradeCalc modules. TD is designed
35
35
  # to empower other programmers to do cool stuff.
36
- from __future__ import annotations
37
-
38
36
  from tradedangerous import cli
39
37
 
40
- import sys
41
-
42
-
43
- def main(argv: list[tuple] = None) -> None:
44
- """ Entry point for the TradeDangerous command-line app. """
45
- if argv is None:
46
- argv = sys.argv
47
- cli.main(argv)
48
-
38
+ def main(argv = None):
39
+ import sys
40
+ cli.main(sys.argv)
49
41
 
50
42
  if __name__ == "__main__":
51
- cli.main(sys.argv)
43
+ import sys
44
+ cli.main(sys.argv)
@@ -57,11 +57,11 @@ def run(results, cmdenv, tdb: TradeDB):
57
57
  if not cmdenv.force:
58
58
  if tdb.dbPath.exists():
59
59
  raise CommandLineError(
60
- "SQLite3 database '{tdb.dbFilename}' already exists.\n"
60
+ f"SQLite3 database '{tdb.dbFilename}' already exists.\n"
61
61
  "Either remove the file first or use the '-f' option.")
62
62
 
63
63
  if not tdb.sqlPath.exists():
64
- raise CommandLineError("SQL File does not exist: {tdb.sqlFilename}")
64
+ raise CommandLineError(f"SQL File does not exist: {tdb.sqlFilename}")
65
65
 
66
66
  buildCache(tdb, cmdenv)
67
67
 
@@ -1,8 +1,12 @@
1
- #!/usr/bin/env python3.6
1
+ from tradedangerous import tradedb
2
+ from tradedangerous.tradeexcept import TradeException
2
3
 
3
- import tradedb
4
- from tradeexcept import TradeException
5
4
  import json
5
+ import sys
6
+
7
+
8
+ sys.stderr.write("*** WARNING: jsonprices.py is deprecated; if you rely on it, please post a github issue\n")
9
+
6
10
 
7
11
  class UnknownSystemError(TradeException):
8
12
  def __str__(self):
@@ -12,6 +16,7 @@ class UnknownStationError(TradeException):
12
16
  def __str__(self):
13
17
  return "Unknown Station: " + ' '.join(self.args)
14
18
 
19
+
15
20
  def lookup_system(tdb, tdenv, name, x, y, z):
16
21
  try:
17
22
  system = tdb.systemByName[name.upper()]
@@ -112,6 +117,13 @@ def load_prices_json(
112
117
  blackMarket = '?'
113
118
  except KeyError:
114
119
  blackMarket = '?'
120
+
121
+ try:
122
+ maxPadSize = stnData['mps'].upper()
123
+ if maxPadSize not in ['S', 'M', 'L']:
124
+ maxPadSize = '?'
125
+ except KeyError:
126
+ maxPadSize = '?'
115
127
 
116
128
  system = lookup_system(
117
129
  tdb, tdenv,
@@ -139,6 +151,7 @@ def load_prices_json(
139
151
  stnName,
140
152
  lsFromStar,
141
153
  blackMarket,
154
+ maxPadSize,
142
155
  )
143
156
  if not station:
144
157
  if tdenv.ignoreUnknown:
@@ -129,7 +129,6 @@ class ImportPlugin(plugins.ImportPluginBase):
129
129
  "(Useful for updating Vendor tables if they were skipped during a '-O clean' run.)",
130
130
  'purge': "Remove any empty systems that previously had fleet carriers.",
131
131
  'solo': "Don't download crowd-sourced market data. (Implies '-O skipvend', supercedes '-O all', '-O clean', '-O listings'.)",
132
- "prices": "Backup listings to the TradeDangerous.prices cache file",
133
132
  }
134
133
 
135
134
  def __init__(self, tdb, tdenv):
@@ -499,7 +498,7 @@ class ImportPlugin(plugins.ImportPluginBase):
499
498
  if self.downloadFile(self.liveListingsPath) or self.getOption("force"):
500
499
  self.importListings(self.liveListingsPath)
501
500
 
502
- if self.getOption("prices"):
501
+ if self.getOption("listings"):
503
502
  self.tdenv.NOTE("Regenerating .prices file.")
504
503
  cache.regeneratePricesFile(self.tdb, self.tdenv)
505
504
 
@@ -294,19 +294,14 @@ class ImportPlugin(plugins.ImportPluginBase):
294
294
 
295
295
  for station, commodities in stations:
296
296
  fq_station_name = f'@{upper_sys}/{station.name}'
297
- if age_cutoff and (now - station.modified) > age_cutoff:
298
- if self.tdenv.detail:
299
- self.print(f' | {fq_station_name:50s} | Skipping station due to age: {now - station.modified}, ts: {station.modified}')
300
- progress.bump(sys_task)
301
- continue
302
297
 
303
298
  station_info = self.known_stations.get(station.id)
304
- if not station_info:
299
+ if not station_info or station.modified > station_info[2]:
305
300
  self.ensure_station(station)
306
301
  elif station_info[1] != station.system_id:
307
302
  self.print(f' | {station.name:50s} | Megaship station moved, updating system')
308
303
  self.execute("UPDATE Station SET system_id = ? WHERE station_id = ?", station.system_id, station.id, commitable=True)
309
- self.known_stations[station.id] = (station.name, station.system_id)
304
+ self.known_stations[station.id] = (station.name, station.system_id, station.modified)
310
305
 
311
306
  items = []
312
307
  db_times = dict(self.execute("SELECT item_id, modified FROM StationItem WHERE station_id = ?", station.id))
@@ -315,12 +310,19 @@ class ImportPlugin(plugins.ImportPluginBase):
315
310
  if commodity.id not in self.known_commodities:
316
311
  commodity = self.ensure_commodity(commodity)
317
312
 
313
+ # We're concerned with the market age, not the station age,
314
+ # as they each have their own 'modified' times.
315
+ if age_cutoff and (now - commodity.modified) > age_cutoff:
316
+ if self.tdenv.detail:
317
+ self.print(f' | {fq_station_name:50s} | Skipping station due to age: {now - station.modified}, ts: {station.modified}')
318
+ break
319
+
318
320
  db_modified = db_times.get(commodity.id)
319
321
  modified = parse_ts(db_modified) if db_modified else None
320
322
  if modified and commodity.modified <= modified:
321
323
  # All commodities in a station will have the same modified time,
322
324
  # so no need to check the rest if the fist is older.
323
- if self.tdenv.detail:
325
+ if self.tdenv.detail > 2:
324
326
  self.print(f' | {fq_station_name:50s} | Skipping older commodity data')
325
327
  break
326
328
  items.append((station.id, commodity.id, commodity.modified,
@@ -337,8 +339,8 @@ class ImportPlugin(plugins.ImportPluginBase):
337
339
  ?, ?, ?, ?
338
340
  )""", items, commitable=True)
339
341
  commodity_count += len(items)
340
- # Good time to save data and try to keep the transaction small
341
- self.commit()
342
+ # Good time to save data and try to keep the transaction small
343
+ self.commit()
342
344
 
343
345
  if commodity_count:
344
346
  station_count += 1
@@ -360,12 +362,6 @@ class ImportPlugin(plugins.ImportPluginBase):
360
362
  progress.update(f"{sys_desc}{DIM} ({total_station_count}:station:, {avg_stations:.1f}per:glowing_star:){CLOSE}")
361
363
 
362
364
  self.commit()
363
-
364
- # Need to make sure cached tables are updated, if changes were made
365
- # if self.update_cache:
366
- # for table in [ "Item", "Station", "System" ]:
367
- # _, path = csvexport.exportTableToFile( self.tdb, self.tdenv, table )
368
-
369
365
  self.tdb.close()
370
366
 
371
367
  # Need to make sure cached tables are updated
@@ -378,6 +374,11 @@ class ImportPlugin(plugins.ImportPluginBase):
378
374
  f'{total_station_count} st {total_commodity_count} co'
379
375
  )
380
376
 
377
+ with Timing() as timing:
378
+ self.print('Exporting to cache...')
379
+ cache.regeneratePricesFile(self.tdb, self.tdenv)
380
+ self.print(f'Cache export completed in {timedelta(seconds=int(timing.elapsed))!s}')
381
+
381
382
  return False
382
383
 
383
384
  def data_stream(self):
@@ -445,7 +446,7 @@ class ImportPlugin(plugins.ImportPluginBase):
445
446
  def load_known_stations(self) -> dict[int, tuple[str, int]]:
446
447
  """ Returns a dictionary of {station_id -> (station_name, system_id)} for all current stations in the database. """
447
448
  try:
448
- return {cols[0]: (cols[1], cols[2]) for cols in self.cursor.execute('SELECT station_id, name, system_id FROM Station')}
449
+ return {cols[0]: (cols[1], cols[2], parse_ts(cols[3])) for cols in self.cursor.execute('SELECT station_id, name, system_id, modified FROM Station')}
449
450
  except Exception as e: # pylint: disable=broad-except
450
451
  self.print("[purple]:thinking_face:Assuming no station data yet")
451
452
  self.tdenv.DEBUG0(f"load_known_stations query raised {e}")
@@ -477,7 +478,7 @@ class ImportPlugin(plugins.ImportPluginBase):
477
478
  """ Adds a record for a station, and registers the station in the known_stations dict. """
478
479
  self.execute(
479
480
  '''
480
- INSERT INTO Station (
481
+ INSERT OR REPLACE INTO Station (
481
482
  system_id, station_id, name,
482
483
  ls_from_star, max_pad_size,
483
484
  market, blackmarket, shipyard, outfitting,
@@ -513,9 +514,10 @@ class ImportPlugin(plugins.ImportPluginBase):
513
514
  station.type,
514
515
  commitable=True,
515
516
  )
517
+ note = "Updated" if self.known_stations.get(station.id) else "Added"
516
518
  if self.tdenv.detail > 1:
517
- self.print(f' | {station.name:50s} | Added missing station')
518
- self.known_stations[station.id] = (station.name, station.system_id)
519
+ self.print(f' | {station.name:50s} | {note} station')
520
+ self.known_stations[station.id] = (station.name, station.system_id, station.modified)
519
521
 
520
522
  def ensure_commodity(self, commodity: Commodity):
521
523
  """ Adds a record for a commodity and registers the commodity in the known_commodities dict. """
@@ -21,8 +21,8 @@ import sys
21
21
  import tradedb
22
22
  import tradeenv
23
23
 
24
- from misc.edsc import StarSubmission, StarSubmissionResult, SubmissionError
25
- from misc.clipboard import SystemNameClip
24
+ from tradedangerous.misc.edsc import StarSubmission, StarSubmissionResult, SubmissionError
25
+ from tradedangerous.misc.clipboard import SystemNameClip
26
26
 
27
27
 
28
28
  standardStars = [
@@ -33,6 +33,10 @@ standardStars = [
33
33
  "ASELLUS AUSTRALIS",
34
34
  ]
35
35
 
36
+
37
+ sys.stderr.write("*** WARNING: submit-distances.py is deprecated; if you rely on it, please post a github issue\n")
38
+
39
+
36
40
  ############################################################################
37
41
 
38
42
 
tradedangerous/version.py CHANGED
@@ -12,5 +12,5 @@
12
12
  """just keeper of current version"""
13
13
 
14
14
  # TODO: remember to update tests when version changes
15
- __version__ = '11.0.4'
15
+ __version__ = '11.0.6'
16
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tradedangerous
3
- Version: 11.0.4
3
+ Version: 11.0.6
4
4
  Summary: Trade-Dangerous is a set of powerful trading tools for Elite Dangerous, organized around one of the most powerful trade run optimizers available.
5
5
  Home-page: https://github.com/eyeonus/Trade-Dangerous
6
6
  Author: eyeonus
@@ -1,3 +1,5 @@
1
+ trade.py,sha256=vBEJZR3Bybesw9FMelcHOTRA7KqKeH-4_wqbJ4VMB_E,1779
2
+ tradegui.py,sha256=q2HdIdoyeLUpeF2X0hVIGn7sU6T4zOzq1HN0zGvZdyE,788
1
3
  tradedangerous/__init__.py,sha256=bwsbE_GyCNsuyGDKnfXAg0RD-ewsWHliySJ5QfCK7h8,1166
2
4
  tradedangerous/cache.py,sha256=mROADjtCtSWkvR6crdl7SycBH0AjuaceagUj-x9RZDM,36071
3
5
  tradedangerous/cli.py,sha256=dLekZ3MTbn9XcSGtE532qZF3iSnsb5G-ddQyErwTv9o,4559
@@ -8,23 +10,21 @@ tradedangerous/edsmupdate.py,sha256=jpDUxUkDKxlG_gS3qWy5fg9p3mBPC-akU2pHSlfTPkI,
8
10
  tradedangerous/formatting.py,sha256=-FdlH1yMKPkqhpCtKmbl0chbyZ1VjKZsZ8OLc8v-Knc,6927
9
11
  tradedangerous/fs.py,sha256=_5OJHIRy_M-WFHEZO4g2EIgqDxdrz4s8tcdDmgG7NME,2494
10
12
  tradedangerous/gui.py,sha256=DFsF5zATr-lyJShL6t5kPKvcLLJYkICurzBz0WBa-oQ,43676
11
- tradedangerous/jsonprices.py,sha256=GAaNbfEs1LX_F5f69MiEhHIEwoGZtubGC8EQ9MM4B9A,6878
13
+ tradedangerous/jsonprices.py,sha256=V9Xm3pocQfEHoC38VYWomzbwX0wu9R2zJ2gB99JzYPQ,7212
12
14
  tradedangerous/mapping.py,sha256=eGBQeYPD04Kq_ygZCDRafKMGz9EnxSgXUzQU-u78_2A,4049
13
15
  tradedangerous/prices.py,sha256=JqiDVrtvvPd5pqE3HdwOHOuFgdAbOR-pt0GLD3ZIXM8,7425
14
- tradedangerous/submit-distances.py,sha256=EMpqxXFauo3oaR9OAnHCHCsrqwABK1nZdmg92m62zrk,11560
16
+ tradedangerous/submit-distances.py,sha256=zxHtRpX10soJKLuRcun9uelfXGq2S9jvIWxD--P9zus,11709
15
17
  tradedangerous/tools.py,sha256=pp-4WtA12SVaaQHFJFOMTF7EDFRCU2mQeOhC4xoXmEk,1331
16
- tradedangerous/trade.py,sha256=nGiTFj9ZrqeN9Xad3z8e4MpA2fNqYAcYMrZnwpnuus4,1938
17
18
  tradedangerous/tradecalc.py,sha256=A7peEMiaCjlwFvReSq3E7_Ar0shUoFedQi83ZmOc7uY,42075
18
19
  tradedangerous/tradedb.py,sha256=3nGB55dYs4igP3U3J4Ye1-M6Kt9A4xPAMmnX7JEDW7w,72220
19
20
  tradedangerous/tradeenv.py,sha256=SDzRC6ERYZzzb_I6uexmFpFJJrnbzXa-1ogYt_GH26w,10576
20
21
  tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk,368
21
- tradedangerous/tradegui.py,sha256=q2HdIdoyeLUpeF2X0hVIGn7sU6T4zOzq1HN0zGvZdyE,788
22
22
  tradedangerous/transfers.py,sha256=88gIvXpjd8T6NLxBrBRzmH2IfUmDDtiMcDTrc7qF3OI,7830
23
23
  tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
24
- tradedangerous/version.py,sha256=VIRNV1KJN_g_ByHP19vQGbhe4W2DtWVHoyZrEjvMkaI,646
24
+ tradedangerous/version.py,sha256=BSZwwteRJKEewGrOC8xXBQh8tm89aQ-iSDuWzNALBS8,646
25
25
  tradedangerous/commands/TEMPLATE.py,sha256=MOE69xsZPHPIMBQ-LXicfsOlCZdy-2gPX_nlnwYYil8,2026
26
26
  tradedangerous/commands/__init__.py,sha256=3gz2cnXNZNkV1gtZh0dOnCRxBkQHbeIyysRe3bM2WEE,9516
27
- tradedangerous/commands/buildcache_cmd.py,sha256=_8vKu9e3tQy0HEPrnG8Ts0OoQ_kF6gZPQ9EOfTUd73w,2179
27
+ tradedangerous/commands/buildcache_cmd.py,sha256=jhNSqHX_xX43SiSUMFiKtWpB9v4oeZ0sqfNq6DCrjUs,2181
28
28
  tradedangerous/commands/buy_cmd.py,sha256=jfN1KwLVWAssx4MABgPD32BzP7FhhwIr2o62u6kpLc8,13597
29
29
  tradedangerous/commands/commandenv.py,sha256=lzPbxhrgx4PJL_x8pRdYu22rqtL4U6kNQ5ExXTPoAao,9462
30
30
  tradedangerous/commands/exceptions.py,sha256=xJib2n0YRSgrs8WhZX5IeVHM-XakS3YwfjlF8_cNx4E,3476
@@ -62,18 +62,18 @@ tradedangerous/misc/progress.py,sha256=NKvKP1OSCTpItc1CNxDuEH2A1oGJ6aWSyCdPSAjsG
62
62
  tradedangerous/plugins/__init__.py,sha256=TL-OIptlqNENKhoFqkFeBJn_vSw8L0pVaDJgjhaTj7A,7860
63
63
  tradedangerous/plugins/edapi_plug.py,sha256=5nqBYmjUceAt-KTfiBn7IEl443R1SsGLDmfVXgbcyms,42262
64
64
  tradedangerous/plugins/edcd_plug.py,sha256=JuDtuEM_mN9Sz2H09-qYizM-9N3cuNjgvQy7Y-wHwKw,14412
65
- tradedangerous/plugins/eddblink_plug.py,sha256=EWJrVn5twwPVT-vGicmWuL4NAwf69G_0mw9lnjzn1Xw,21606
65
+ tradedangerous/plugins/eddblink_plug.py,sha256=m1fSG9YQZZcJZhGzEk4y_OyAMK-psczZ-WxJ5JwxSbA,21525
66
66
  tradedangerous/plugins/edmc_batch_plug.py,sha256=rrP_lFFxWsba8DPEo0WF2EdCiMoRC7tCT8z62MIvtIo,4173
67
67
  tradedangerous/plugins/journal_plug.py,sha256=5HMyoxQ7z42qj7NiL8rDxSyTN9gKikoQjyWzJLD-SYQ,23746
68
68
  tradedangerous/plugins/netlog_plug.py,sha256=yUl47l9xt3kGj9oSiY_FZaDGdnQj63oa9MBtSeIy1Zo,13469
69
- tradedangerous/plugins/spansh_plug.py,sha256=FmOJcYq6-ENYdVNRN96kYdskeqZ4IqzjEsyCYm6hVXI,26762
69
+ tradedangerous/plugins/spansh_plug.py,sha256=FiIS9cN2_8VKDrAj8yvkdy1NIni2kEc0ECqhgrvML4E,27048
70
70
  tradedangerous/templates/Added.csv,sha256=8o54civQCcS9y7_DBo0GX196XWRbbREQqKDYTKibsgQ,649
71
71
  tradedangerous/templates/Category.csv,sha256=8xwUDcBZE25T6x6dZGlRUMTCqeDLt3a9LXU5h6hRHV8,250
72
72
  tradedangerous/templates/RareItem.csv,sha256=F1RhRnTD82PiwrVUO-ai2ErGH2PTqNnQaDw5mcgljXs,10483
73
73
  tradedangerous/templates/TradeDangerous.sql,sha256=VlQK7QGtEi2brGtWaIZDvKmbJ_vLocD4CJ8h_6kKptU,7808
74
- tradedangerous-11.0.4.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
- tradedangerous-11.0.4.dist-info/METADATA,sha256=wtvXMMQTXzopIxDvS5GcaFubPfU2pDHlM3T6csHiTlY,4435
76
- tradedangerous-11.0.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
77
- tradedangerous-11.0.4.dist-info/entry_points.txt,sha256=pSwa-q0ob443uiKux7xFKYQl8uen66iDTnjdrQhNLx8,92
78
- tradedangerous-11.0.4.dist-info/top_level.txt,sha256=bF29i-oEltmNICgElEKxNsg83oahJvxg3a7YrxZi9Rk,15
79
- tradedangerous-11.0.4.dist-info/RECORD,,
74
+ tradedangerous-11.0.6.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
+ tradedangerous-11.0.6.dist-info/METADATA,sha256=nuonbPrRraJnIMjz081PA16DnemsCYnYZHr9RnbRExE,4435
76
+ tradedangerous-11.0.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
77
+ tradedangerous-11.0.6.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
78
+ tradedangerous-11.0.6.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
79
+ tradedangerous-11.0.6.dist-info/RECORD,,
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ trade = trade:main
3
+ tradegui = tradegui:main
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- trade = tradedangerous.trade:main
3
- tradegui = tradedangerous.tradegui:main
File without changes