tradedangerous 11.1.5__py3-none-any.whl → 11.2.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.

@@ -412,5 +412,5 @@ def render(results, cmdenv, tdb):
412
412
  print(stnRowFmt.format(row))
413
413
 
414
414
  if singleMode and cmdenv.detail:
415
- msg = "-- Ship Cost" if mode is SHIP_MODE else "-- Average",
415
+ msg = "-- Ship Cost" if mode is SHIP_MODE else "-- Average"
416
416
  print(f"{msg:{maxStnLen}} {results.summary.avg:>10n}")
@@ -1,3 +1,5 @@
1
+ # Deprecated
2
+ # Can already use buy command for ship searching
1
3
  from .commandenv import ResultRow
2
4
  from .exceptions import CommandLineError
3
5
  from .parsing import MutuallyExclusiveGroup, ParseArgument
@@ -1,3 +1,4 @@
1
+ # Deprecated
1
2
  from .commandenv import ResultRow
2
3
  from .exceptions import CommandLineError
3
4
  from .parsing import MutuallyExclusiveGroup, ParseArgument
@@ -6,7 +6,7 @@ from ..formatting import RowFormat, max_len
6
6
  ######################################################################
7
7
  # Parser config
8
8
 
9
- help='Find places to buy a given item within range of a given station.'
9
+ help='Find potential trades between two given stations.'
10
10
  name='trade'
11
11
  epilog=None
12
12
  wantsTradeDB=True
@@ -1,3 +1,4 @@
1
+ # Deprecated
1
2
  from .parsing import MutuallyExclusiveGroup, ParseArgument
2
3
  from ..tradeexcept import TradeException
3
4
  from .exceptions import CommandLineError
@@ -1,3 +1,4 @@
1
+ # Deprecated
1
2
  import tkinter as tk
2
3
  import tkinter.messagebox as mbox
3
4
  import sqlite3
@@ -1,3 +1,4 @@
1
+ # Deprecated
1
2
  #!/usr/bin/env python3.6
2
3
 
3
4
  """
@@ -1,3 +1,4 @@
1
+ # Deprecated
1
2
  #!/usr/bin/env python3.6
2
3
 
3
4
  """
@@ -1,3 +1,4 @@
1
+ # Deprecated
1
2
  from tradedangerous import tradedb
2
3
  from tradedangerous.tradeexcept import TradeException
3
4
 
tradedangerous/mapping.py CHANGED
@@ -1,7 +1,8 @@
1
1
  #
2
2
  # Mapping class for FDEV-IDs to TD names
3
3
  #
4
-
4
+ # Deprecated
5
+ # FDEVMappingItems and FDEVMappingShips used by edapi plugin
5
6
  class FDEVMappingBase:
6
7
  """
7
8
  Base class to map FDEV-IDs to TD names, do not use directly.
@@ -100,7 +101,7 @@ class FDEVMappingItems(FDEVMappingBase):
100
101
  Maps ID to TD and EDDN items
101
102
  """
102
103
  tableName = "Item"
103
- colNames = [ 'fdev_id', 'name' ]
104
+ colNames = [ 'item_id', 'name' ]
104
105
 
105
106
  def mapUnknown(self):
106
107
  # no ID known yet for:
@@ -113,7 +114,7 @@ class FDEVMappingShips(FDEVMappingBase):
113
114
  Maps ID to TD ships
114
115
  """
115
116
  tableName = "Ship"
116
- colNames = [ 'fdev_id', 'name' ]
117
+ colNames = [ 'ship_id', 'name' ]
117
118
 
118
119
  class FDEVMappingShipyard(FDEVMappingBase):
119
120
  """
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env python3.6
2
+ # Deprecated
3
+ # Website no longer exists
2
4
 
3
5
  """
4
6
  Small tool to submit new star data to EDStarCoordinator.
@@ -2,6 +2,7 @@
2
2
  # into a single object, the TradeEnv. See TradeEnv docstring for more.
3
3
  from __future__ import annotations
4
4
 
5
+ from pathlib import Path
5
6
  import os
6
7
  import sys
7
8
  import traceback
@@ -270,3 +271,36 @@ class TradeEnv(Utf8SafeConsoleIOMixin):
270
271
  return noteFn
271
272
 
272
273
  return None
274
+
275
+ def remove_file(self, *args) -> bool:
276
+ """ Unlinks a file, as long as it exists, and logs the action at level 1. """
277
+ path = Path(*args)
278
+ if not path.exists():
279
+ return False
280
+ path.unlink()
281
+ self.DEBUG1(":cross_mark: deleted {}", path)
282
+ return True
283
+
284
+ def rename_file(self, *, old: os.PathLike, new: os.PathLike) -> bool:
285
+ """
286
+ If 'new' exists, deletes it, and then attempts to rename old -> new. If new is not specified,
287
+ then '.old' is appended to the end of the old filename while retaining the original suffix.
288
+
289
+ :param old: The current path/name of the file.
290
+ :param new: The path/name to rename the file to and remove before attempting.
291
+ :returns: True if the file existed and was renamed.
292
+ """
293
+ # Promote new to a guaranteed Path and remove it if it's present.
294
+ new = Path(new)
295
+ self.remove_file(new)
296
+
297
+ # Promote new to a guaranteed Path and confirm it exists.
298
+ old = Path(old)
299
+ if not old.exists():
300
+ return False
301
+
302
+ # Perform the rename and log it at level 1.
303
+ old.rename(new)
304
+ self.DEBUG1(":recycle: moved {} to {}", old, new)
305
+
306
+ return True
@@ -6,7 +6,6 @@ from .tradeexcept import TradeException
6
6
  from .misc import progress as pbar
7
7
  from . import fs
8
8
 
9
- import csv
10
9
  import json
11
10
  import time
12
11
  import typing
@@ -50,6 +49,7 @@ def download(
50
49
  timeout: int = 90,
51
50
  *,
52
51
  length: Optional[Union[int, str]] = None,
52
+ session: Optional[requests.Session] = None,
53
53
  ):
54
54
  """
55
55
  Fetch data from a URL and save the output
@@ -75,7 +75,8 @@ def download(
75
75
  if isinstance(length, str):
76
76
  length = int(length)
77
77
 
78
- req = requests.get(url, headers=headers or None, stream=True, timeout=timeout)
78
+ # If the caller provided an existing session stream, use that the fetch the request.
79
+ req = (session or requests).get(url, headers=headers or None, stream=True, timeout=timeout)
79
80
  req.raise_for_status()
80
81
 
81
82
  encoding = req.headers.get('content-encoding', 'uncompress')
@@ -85,7 +86,7 @@ def download(
85
86
  # chunked transfer-encoding doesn't need a content-length
86
87
  if content_length is None:
87
88
  print(req.headers)
88
- raise Exception("Remote server replied with invalid content-length.")
89
+ raise TradeException("Remote server replied with invalid content-length.")
89
90
  content_length = int(content_length)
90
91
  if content_length <= 0:
91
92
  raise TradeException(
@@ -210,52 +211,3 @@ def get_json_data(url, *, timeout: int = 90):
210
211
  progBar.clear()
211
212
 
212
213
  return json.loads(jsData.decode())
213
-
214
- class CSVStream:
215
- """
216
- Provides an iterator that fetches CSV data from a given URL
217
- and presents it as an iterable of (columns, values).
218
-
219
- Example:
220
- stream = transfers.CSVStream("http://blah.com/foo.csv")
221
- for cols, vals in stream:
222
- print("{} = {}".format(cols[0], vals[0]))
223
- """
224
-
225
- def __init__(self, url, tdenv=None, *, timeout: int = 90):
226
- self.url = url
227
- self.tdenv = tdenv
228
- if not url.startswith("file:///"):
229
- self.req = requests.get(self.url, stream=True, timeout=timeout)
230
- self.lines = self.req.iter_lines()
231
- else:
232
- self.lines = open(url[8:], "rUb")
233
- self.columns = self.next_line().split(',')
234
-
235
- def next_line(self):
236
- """ Fetch the next line as a text string """
237
- while True:
238
- line = next(self.lines)
239
- try:
240
- return line.decode(encoding="utf-8")
241
- except UnicodeDecodeError as e:
242
- if not self.tdenv:
243
- raise e
244
- self.tdenv.WARN(
245
- "{}: line:{}: {}\n{}",
246
- self.url, self.csvin.line_num, line, e
247
- )
248
-
249
- def __iter__(self):
250
- """
251
- Iterate across data received as csv values.
252
- Yields [column headings], [column values]
253
- """
254
- self.csvin = csvin = csv.reader(
255
- iter(self.next_line, 'END'),
256
- delimiter=',', quotechar="'", doublequote=True
257
- )
258
- columns = self.columns
259
- for values in csvin:
260
- if values and len(values) == len(columns):
261
- yield columns, values
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.1.5'
15
+ __version__ = '11.2.0'
16
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tradedangerous
3
- Version: 11.1.5
3
+ Version: 11.2.0
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
@@ -5,27 +5,27 @@ tradedangerous/cache.py,sha256=N7z1e2fov003wIh_aHkw1pdByKDPt3FkDZiH_EEPdMc,36080
5
5
  tradedangerous/cli.py,sha256=dLekZ3MTbn9XcSGtE532qZF3iSnsb5G-ddQyErwTv9o,4559
6
6
  tradedangerous/corrections.py,sha256=_WLgo1IBWoskrrPFeshRwCOeJ2BeJb_x4tDQ0JdAo-s,1340
7
7
  tradedangerous/csvexport.py,sha256=_19bGVnCGJPzvx_8DzLGOs4rqx8Asn7eCVdXKdKu92E,8653
8
- tradedangerous/edscupdate.py,sha256=G8N-j61MZbCgY07WIVK23CCw6eMPE3WkraXHeARt9QE,17297
9
- tradedangerous/edsmupdate.py,sha256=jpDUxUkDKxlG_gS3qWy5fg9p3mBPC-akU2pHSlfTPkI,14915
8
+ tradedangerous/edscupdate.py,sha256=uZpapPnGLSEGXFR0u0_DydpXD6TF2oq-FOeXsLgrcwE,17310
9
+ tradedangerous/edsmupdate.py,sha256=n3fkY2A5EBAcAiIn7j2nt4w7icWf56ikI8yd6CiyWsk,14928
10
10
  tradedangerous/formatting.py,sha256=K3XL_mZJ4cAiTTTmJmTXK7ePYzzsSxg7EoBVFh7gj60,6931
11
11
  tradedangerous/fs.py,sha256=_5OJHIRy_M-WFHEZO4g2EIgqDxdrz4s8tcdDmgG7NME,2494
12
12
  tradedangerous/gui.py,sha256=DFsF5zATr-lyJShL6t5kPKvcLLJYkICurzBz0WBa-oQ,43676
13
- tradedangerous/jsonprices.py,sha256=V9Xm3pocQfEHoC38VYWomzbwX0wu9R2zJ2gB99JzYPQ,7212
14
- tradedangerous/mapping.py,sha256=eGBQeYPD04Kq_ygZCDRafKMGz9EnxSgXUzQU-u78_2A,4049
13
+ tradedangerous/jsonprices.py,sha256=GJ07fbZSNX5U_6lczWTSk6mWwme_weJbXgE8zcZBnpY,7225
14
+ tradedangerous/mapping.py,sha256=Bf2G8LzP1Bat5k3hFs9XyeI1z3tfUpfeh4nuLP2QJuQ,4122
15
15
  tradedangerous/prices.py,sha256=JqiDVrtvvPd5pqE3HdwOHOuFgdAbOR-pt0GLD3ZIXM8,7425
16
- tradedangerous/submit-distances.py,sha256=zxHtRpX10soJKLuRcun9uelfXGq2S9jvIWxD--P9zus,11709
16
+ tradedangerous/submit-distances.py,sha256=xL7fwdbVrb05-zWNH-9nyYBDtV4bfUfP7OBx3NMBc34,11749
17
17
  tradedangerous/tools.py,sha256=pp-4WtA12SVaaQHFJFOMTF7EDFRCU2mQeOhC4xoXmEk,1331
18
18
  tradedangerous/tradecalc.py,sha256=A7peEMiaCjlwFvReSq3E7_Ar0shUoFedQi83ZmOc7uY,42075
19
19
  tradedangerous/tradedb.py,sha256=mitKkS4MczivDK_K7A-IC94hkObUmGWFhwIrh_ts9qw,72282
20
- tradedangerous/tradeenv.py,sha256=SDzRC6ERYZzzb_I6uexmFpFJJrnbzXa-1ogYt_GH26w,10576
20
+ tradedangerous/tradeenv.py,sha256=o956HN7-7uzIcNi9vI4zh-L1z5jwBioVARyhhiAlsRQ,11885
21
21
  tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk,368
22
- tradedangerous/transfers.py,sha256=KwskYBB5_TYDXx5fkN1ABYsPuPnICKdkEx0WUfC7BnA,8378
22
+ tradedangerous/transfers.py,sha256=NdPNzrpa5YuZeo2wBK6X8sy1VyFUaAXb0EtASyVXsuQ,6885
23
23
  tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
24
- tradedangerous/version.py,sha256=RW4r1F63KW3hk-PZN1UtKuplBR5kfZV1j0tMS5F4kaw,646
24
+ tradedangerous/version.py,sha256=CIRQudWzY9CP4niZ5hY2VqrxXsnZnG_3vA77k9Otwo8,646
25
25
  tradedangerous/commands/TEMPLATE.py,sha256=MOE69xsZPHPIMBQ-LXicfsOlCZdy-2gPX_nlnwYYil8,2026
26
26
  tradedangerous/commands/__init__.py,sha256=3gz2cnXNZNkV1gtZh0dOnCRxBkQHbeIyysRe3bM2WEE,9516
27
27
  tradedangerous/commands/buildcache_cmd.py,sha256=jhNSqHX_xX43SiSUMFiKtWpB9v4oeZ0sqfNq6DCrjUs,2181
28
- tradedangerous/commands/buy_cmd.py,sha256=VbHSUI9eocaQAdzaLRnHr-Nsnu15Q2WlhC3VzMK_3KQ,13924
28
+ tradedangerous/commands/buy_cmd.py,sha256=GZa4wx5NKsZLKx1vtO1a47hSL8la5fatOY3dCazQSSo,13923
29
29
  tradedangerous/commands/commandenv.py,sha256=lzPbxhrgx4PJL_x8pRdYu22rqtL4U6kNQ5ExXTPoAao,9462
30
30
  tradedangerous/commands/exceptions.py,sha256=xJib2n0YRSgrs8WhZX5IeVHM-XakS3YwfjlF8_cNx4E,3476
31
31
  tradedangerous/commands/export_cmd.py,sha256=VfxwrNU_TzrSw71KrmtmXKYCBkpDGr5KRLGPXOBewnI,4405
@@ -38,11 +38,11 @@ tradedangerous/commands/parsing.py,sha256=RUnCnML59IOXYI6jEljE5lrE_WKcDmFFqKF1JV
38
38
  tradedangerous/commands/rares_cmd.py,sha256=L_QoW2zIZTU9Jpavt_K2fZyu8T153nUSuVqIiz4uksQ,9207
39
39
  tradedangerous/commands/run_cmd.py,sha256=HtvxKfD2ef_fUCDdUzBv9yRwd2gBOqIq4hzUAOLgcyU,47650
40
40
  tradedangerous/commands/sell_cmd.py,sha256=RI8T1DWaBuQkYSy2Pjoo0Kxy5n9UgRTqtlSBE0Vg1SI,7943
41
- tradedangerous/commands/shipvendor_cmd.py,sha256=PQXMmPin3HsAAdeBesnyDVuqAh-GATWwp2C2gnHdS9I,6918
42
- tradedangerous/commands/station_cmd.py,sha256=pN0IuisOp_ngWE8lrUKMkLpfOO7p3DxidgTGiKOrWCE,16219
43
- tradedangerous/commands/trade_cmd.py,sha256=3oTAsnV4ka18I7aQkgwtdQNIzS1Vt3LdisXMbrHw1WY,3031
44
- tradedangerous/commands/update_cmd.py,sha256=2A3i8J1XGe5TOfpvKyTXon2cVzhUosiaWuekEpbAh4U,14551
45
- tradedangerous/commands/update_gui.py,sha256=IhHXSQvLdol-i4LibOGgdvVUG9V2oS2g7Zqc60qf0YI,23318
41
+ tradedangerous/commands/shipvendor_cmd.py,sha256=IA85tHmZK-dBAUM5Q2ds5cBSvRzDyhILnXxjNbq9Lsg,6980
42
+ tradedangerous/commands/station_cmd.py,sha256=gnWOT-Z8DfOeA4GNjUwj57eNxuNGh5mPZ-D0E_BeoTw,16232
43
+ tradedangerous/commands/trade_cmd.py,sha256=o4Xdel5asGY8i6qES95fLHdyfyjKdC5CTOQrZIeu0i4,3016
44
+ tradedangerous/commands/update_cmd.py,sha256=2UWR6aDbAbvtKFtfmehVwFUBQfJM5KThR71HoC6wVnM,14564
45
+ tradedangerous/commands/update_gui.py,sha256=WwZvvad7pF0LasZztjO6v5OTWzCZlcey2DFj8h91dWg,23331
46
46
  tradedangerous/mfd/__init__.py,sha256=g8pT9Ev_le_yOeAF7sr9fUuEi8VW3u9n_qq-xLga1xw,2958
47
47
  tradedangerous/mfd/saitek/__init__.py,sha256=CGgkAik87Kb5uc43G0bBFueD47bb_BydDM8qb7YQLyA,62
48
48
  tradedangerous/mfd/saitek/directoutput.py,sha256=ReBzax7ttoffzH8DLXx0AS2RFLLQWOQUw1ESQUjOMGk,24840
@@ -71,9 +71,9 @@ tradedangerous/templates/Added.csv,sha256=8o54civQCcS9y7_DBo0GX196XWRbbREQqKDYTK
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.1.5.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
- tradedangerous-11.1.5.dist-info/METADATA,sha256=vL1cKyh5Qp1R9sHAv_mlmJgU-vqjEQQumPuyibG-Wew,4435
76
- tradedangerous-11.1.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
77
- tradedangerous-11.1.5.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
78
- tradedangerous-11.1.5.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
79
- tradedangerous-11.1.5.dist-info/RECORD,,
74
+ tradedangerous-11.2.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
75
+ tradedangerous-11.2.0.dist-info/METADATA,sha256=uSI0GspaqOSLmD6k3Kn3wPvlc7hsNOEPl2sRHq7LKCM,4435
76
+ tradedangerous-11.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
77
+ tradedangerous-11.2.0.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
78
+ tradedangerous-11.2.0.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
79
+ tradedangerous-11.2.0.dist-info/RECORD,,