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

tradedangerous/cache.py CHANGED
@@ -548,17 +548,18 @@ def processPrices(tdenv, priceFile, db, defaultZero):
548
548
 
549
549
  processedItems[itemID] = lineNo
550
550
 
551
+ space_cleanup = re.compile(r'\s{2,}').sub
551
552
  for line in priceFile:
552
553
  lineNo += 1
553
554
  text, _, comment = line.partition('#')
554
- text = text.strip()
555
+ text = space_cleanup(line, ' ').strip()
555
556
  if not text:
556
557
  continue
557
558
 
558
- # replace whitespace with single spaces
559
- if text.find(" "):
560
- # http://stackoverflow.com/questions/2077897
561
- text = ' '.join(text.split())
559
+ # # replace whitespace with single spaces
560
+ # if text.find(" "):
561
+ # # http://stackoverflow.com/questions/2077897
562
+ # text = ' '.join(text.split())
562
563
 
563
564
  ########################################
564
565
  # ## "@ STAR/Station" lines.
@@ -9,7 +9,7 @@ import requests
9
9
  import simdjson
10
10
  import sqlite3
11
11
 
12
- from .. import plugins, cache, fs, transfers
12
+ from .. import plugins, cache, fs, transfers, csvexport
13
13
 
14
14
  SOURCE_URL = 'https://downloads.spansh.co.uk/galaxy_stations.json'
15
15
 
@@ -63,7 +63,7 @@ class ImportPlugin(plugins.ImportPluginBase):
63
63
  super().__init__(*args, **kwargs)
64
64
  self.url = self.getOption('url')
65
65
  self.file = self.getOption('file')
66
- self.maxage = float(self.getOption('maxage'))
66
+ self.maxage = float(self.getOption('maxage')) if self.getOption('maxage') else None
67
67
  self.listener = self.getOption('listener')
68
68
  assert not (self.url and self.file), 'Provide either url or file, not both'
69
69
  if self.file and (self.file != '-'):
@@ -100,18 +100,19 @@ class ImportPlugin(plugins.ImportPluginBase):
100
100
  total_station_count = 0
101
101
  total_commodity_count = 0
102
102
  self.need_commit = False
103
+ self.update_cache = False
103
104
  seen_stations = set()
104
105
  for system, stations in self.data_stream():
105
106
  self.ensure_system(system)
106
107
  station_count = 0
107
108
  commodity_count = 0
108
109
  for station, commodities in stations:
109
- if (datetime.now() - station.modified) > timedelta(days=self.maxage):
110
+ fq_station_name = f'@{system.name.upper()}/{station.name}'
111
+ if self.maxage and (datetime.now() - station.modified) > timedelta(days=self.maxage):
110
112
  if self.tdenv.detail >= 1:
111
- self.print(f' | @{system.name.upper()}/{station.name.upper():50s} | Skipping station due to age: {datetime.now() - station.modified}, ts: {station.modified}')
113
+ self.print(f' | {fq_station_name:50s} | Skipping station due to age: {datetime.now() - station.modified}, ts: {station.modified}')
112
114
  continue
113
115
  if (system.name.upper(), station.name.upper()) in seen_stations:
114
- fq_station_name = f'@{system.name.upper()}/{station.name}'
115
116
  if self.tdenv.detail >= 1:
116
117
  self.print(f' | {fq_station_name:50s} | Skipping duplicate station record')
117
118
  continue
@@ -148,6 +149,13 @@ class ImportPlugin(plugins.ImportPluginBase):
148
149
  if self.need_commit:
149
150
  self.execute('COMMIT')
150
151
  self.need_commit = False
152
+ self.update_cache = True
153
+
154
+ # Need to make sure cached tables are updated, if changes were made
155
+ if self.update_cache:
156
+ for table in [ "Item", "Station", "System" ]:
157
+ _, path = csvexport.exportTableToFile( self.tdb, self.tdenv, table )
158
+
151
159
  self.print(
152
160
  f'{timedelta(seconds=int(timing.elapsed))!s} Done '
153
161
  f'{total_station_count} st {total_commodity_count} co'
@@ -198,7 +206,7 @@ class ImportPlugin(plugins.ImportPluginBase):
198
206
  # if not attempts:
199
207
  # raise
200
208
  # attempts -= 1
201
- self.print(f'Retrying query: {ex!s}')
209
+ self.print(f'Retrying query \'{query}\': {ex!s}')
202
210
  time.sleep(1)
203
211
 
204
212
  def load_known_space(self):
@@ -296,13 +304,35 @@ class ImportPlugin(plugins.ImportPluginBase):
296
304
  return commodity
297
305
  self.execute(
298
306
  '''
299
- INSERT INTO Item (category_id, name, fdev_id)
300
- VALUES ((SELECT category_id FROM Category WHERE upper(name) = ?), ?, ?)
307
+ INSERT INTO Item (item_id, category_id, name, fdev_id)
308
+ VALUES (?, (SELECT category_id FROM Category WHERE upper(name) = ?), ?, ?)
301
309
  ''',
310
+ commodity.id,
302
311
  commodity.category.upper(),
303
312
  commodity.name,
304
313
  commodity.id,
305
314
  )
315
+
316
+ # Need to update ui_order
317
+ temp = self.execute("""SELECT
318
+ name, category_id, fdev_id
319
+ FROM Item
320
+ ORDER BY category_id, name
321
+ """)
322
+ cat_id = 0
323
+ ui_order = 1
324
+ self.tdenv.DEBUG0("Adding ui_order data to items.")
325
+ for line in temp:
326
+ if line[1] != cat_id:
327
+ ui_order = 1
328
+ cat_id = line[1]
329
+ else:
330
+ ui_order += 1
331
+ self.execute("""UPDATE Item
332
+ set ui_order = ?
333
+ WHERE fdev_id = ?""",
334
+ ui_order, line[2],)
335
+
306
336
  self.need_commit = True
307
337
  if self.tdenv.detail >= 2:
308
338
  self.print(f' | {commodity.name:50s} | Added missing commodity')
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__ = '10.15.0'
15
+ __version__ = '10.15.2'
16
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tradedangerous
3
- Version: 10.15.0
3
+ Version: 10.15.2
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,5 +1,5 @@
1
1
  tradedangerous/__init__.py,sha256=5ZeypoZaM8hlh6c-yTkD8x5hZYP8q3Q8a3bVeicHr90,1122
2
- tradedangerous/cache.py,sha256=R-QTud9KwrRKbe-sVHDHXYZQblkXKuKxK1nYegM90BA,33647
2
+ tradedangerous/cache.py,sha256=Zt1Mkf5h4tSFdxUV8mpe5v-LTOHLuSlVwuL4aq06fXQ,33721
3
3
  tradedangerous/cli.py,sha256=ycGkzMszwpP9OrngFIyhQbYoZ2wzRhJMTDCW1YhLrNI,4727
4
4
  tradedangerous/corrections.py,sha256=QMs-7MKLw2imFgIHthnwcpqWT1yJTb3CrABJw9LaKLA,1441
5
5
  tradedangerous/csvexport.py,sha256=OcOKe_VIgafw6rCvG3k5tM11KwwoYXMNY5DSSfCC0mU,8705
@@ -21,7 +21,7 @@ tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk
21
21
  tradedangerous/tradegui.py,sha256=JbGFnsWupgesk6hrcUgKSdD9NNDyo0U9gh6m3DccAwU,782
22
22
  tradedangerous/transfers.py,sha256=NmXXk2aF88YkAvYqc9Syt_aO6d2jJjC-OxoRFoOyQH4,9923
23
23
  tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
24
- tradedangerous/version.py,sha256=HvTZZF5gQzfcRfEd7T27CYhdQFzmH1fwqUuu3623Bh0,647
24
+ tradedangerous/version.py,sha256=8Ar6G_NOScaKIeRlxzF9L9L6TzUEwTmHyrzuUBkS3mU,647
25
25
  tradedangerous/commands/TEMPLATE.py,sha256=7oXL124aqxGHwnb0h9yRylUiwc6M5QrRrGVrubwI1gg,2124
26
26
  tradedangerous/commands/__init__.py,sha256=6B0WuqkFBOll5Hj67yKDAnhmyr5ZAnHc6nzUNEUh384,9640
27
27
  tradedangerous/commands/buildcache_cmd.py,sha256=oJvP06fA8svnHrfrpWkHKR16cba8GIhHdMOyZqds18Y,2332
@@ -66,14 +66,14 @@ tradedangerous/plugins/eddblink_plug.py,sha256=n8AzLh2pJdHdar1SnqSSjCwWPl4f-OKQ8
66
66
  tradedangerous/plugins/edmc_batch_plug.py,sha256=3Ptr-SZqaZFR8ViIIrp9Ak7rvfU3zl11AZYBhIceN7s,4224
67
67
  tradedangerous/plugins/journal_plug.py,sha256=K1oIeI7E3mb04fvYLXyoAh7fOTyM9NBelibTI88MIDQ,23696
68
68
  tradedangerous/plugins/netlog_plug.py,sha256=Gw_HSZWpN17D--OIYEM3Vo8y9SvDOv9UwAUfY24kz28,13460
69
- tradedangerous/plugins/spansh_plug.py,sha256=VBq0hl8p8x4HVIATpEFnCcj3gNPP5ilxdpZbitz71Mg,15914
69
+ tradedangerous/plugins/spansh_plug.py,sha256=6gTCln2vKnU2AIF5FsuAP0-ZP2a2tFMJnYkR_FElAVQ,17095
70
70
  tradedangerous/templates/Added.csv,sha256=8o54civQCcS9y7_DBo0GX196XWRbbREQqKDYTKibsgQ,649
71
71
  tradedangerous/templates/DefaultShipIndex.json,sha256=m5cI3vkKiqRk1VKO1Z_8LZrG9nczV0PUMDfBSt4-1RM,94739
72
72
  tradedangerous/templates/RareItem.csv,sha256=F1RhRnTD82PiwrVUO-ai2ErGH2PTqNnQaDw5mcgljXs,10483
73
73
  tradedangerous/templates/TradeDangerous.sql,sha256=6sjEogGHy-9zYpjPo0Y2a5tElowmHFyJNwrimOUBfHk,8079
74
- tradedangerous-10.15.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
- tradedangerous-10.15.0.dist-info/METADATA,sha256=8Y24VwY_h_KlhtqxWs1qRVcmM6HdawZdF6vCPEJhp-I,4421
76
- tradedangerous-10.15.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
77
- tradedangerous-10.15.0.dist-info/entry_points.txt,sha256=pSwa-q0ob443uiKux7xFKYQl8uen66iDTnjdrQhNLx8,92
78
- tradedangerous-10.15.0.dist-info/top_level.txt,sha256=bF29i-oEltmNICgElEKxNsg83oahJvxg3a7YrxZi9Rk,15
79
- tradedangerous-10.15.0.dist-info/RECORD,,
74
+ tradedangerous-10.15.2.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
+ tradedangerous-10.15.2.dist-info/METADATA,sha256=u2wFl6SsgCIi4JpYjoAbw-yNgEUNP77UgKCanjyck9E,4421
76
+ tradedangerous-10.15.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
77
+ tradedangerous-10.15.2.dist-info/entry_points.txt,sha256=pSwa-q0ob443uiKux7xFKYQl8uen66iDTnjdrQhNLx8,92
78
+ tradedangerous-10.15.2.dist-info/top_level.txt,sha256=bF29i-oEltmNICgElEKxNsg83oahJvxg3a7YrxZi9Rk,15
79
+ tradedangerous-10.15.2.dist-info/RECORD,,