tradedangerous 11.1.2__py3-none-any.whl → 11.1.4__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.
- trade.py +4 -4
- tradedangerous/formatting.py +4 -4
- tradedangerous/plugins/eddblink_plug.py +30 -31
- tradedangerous/tradedb.py +2 -1
- tradedangerous/transfers.py +33 -17
- tradedangerous/version.py +1 -1
- {tradedangerous-11.1.2.dist-info → tradedangerous-11.1.4.dist-info}/METADATA +1 -1
- {tradedangerous-11.1.2.dist-info → tradedangerous-11.1.4.dist-info}/RECORD +12 -12
- {tradedangerous-11.1.2.dist-info → tradedangerous-11.1.4.dist-info}/LICENSE +0 -0
- {tradedangerous-11.1.2.dist-info → tradedangerous-11.1.4.dist-info}/WHEEL +0 -0
- {tradedangerous-11.1.2.dist-info → tradedangerous-11.1.4.dist-info}/entry_points.txt +0 -0
- {tradedangerous-11.1.2.dist-info → tradedangerous-11.1.4.dist-info}/top_level.txt +0 -0
trade.py
CHANGED
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
# to empower other programmers to do cool stuff.
|
|
36
36
|
from tradedangerous import cli
|
|
37
37
|
|
|
38
|
+
import sys
|
|
39
|
+
|
|
38
40
|
def main(argv = None):
|
|
39
|
-
|
|
40
|
-
cli.main(sys.argv)
|
|
41
|
+
cli.main(sys.argv)
|
|
41
42
|
|
|
42
43
|
if __name__ == "__main__":
|
|
43
|
-
|
|
44
|
-
cli.main(sys.argv)
|
|
44
|
+
cli.main(sys.argv)
|
tradedangerous/formatting.py
CHANGED
|
@@ -199,7 +199,7 @@ if __name__ == '__main__':
|
|
|
199
199
|
print("Simple usage:")
|
|
200
200
|
present()
|
|
201
201
|
|
|
202
|
-
#print()
|
|
203
|
-
#print("Adding age ColumnFormat:")
|
|
204
|
-
#rowFmt.append(after='Name', col=ColumnFormat("Age", '>', 3, pre='|', post='|', key=lambda row: row['age']))
|
|
205
|
-
#present()
|
|
202
|
+
# print()
|
|
203
|
+
# print("Adding age ColumnFormat:")
|
|
204
|
+
# rowFmt.append(after='Name', col=ColumnFormat("Age", '>', 3, pre='|', post='|', key=lambda row: row['age']))
|
|
205
|
+
# present()
|
|
@@ -3,23 +3,22 @@ Import plugin that uses data files from
|
|
|
3
3
|
https://elite.tromador.com/ to update the Database.
|
|
4
4
|
"""
|
|
5
5
|
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from .. import plugins, cache, transfers
|
|
9
|
+
from ..misc import progress as pbar
|
|
10
|
+
from ..plugins import PluginException
|
|
11
|
+
|
|
6
12
|
import certifi
|
|
7
13
|
import csv
|
|
8
14
|
import datetime
|
|
9
|
-
import json
|
|
10
15
|
import os
|
|
16
|
+
import requests
|
|
11
17
|
import sqlite3
|
|
12
18
|
import ssl
|
|
13
|
-
import time
|
|
14
19
|
import typing
|
|
15
20
|
import locale
|
|
16
|
-
|
|
17
|
-
from urllib import request
|
|
18
|
-
from pathlib import Path
|
|
19
|
-
|
|
20
|
-
from .. import plugins, cache, transfers
|
|
21
|
-
from ..misc import progress as pbar
|
|
22
|
-
from ..plugins import PluginException
|
|
21
|
+
import platform
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
if typing.TYPE_CHECKING:
|
|
@@ -28,7 +27,6 @@ if typing.TYPE_CHECKING:
|
|
|
28
27
|
|
|
29
28
|
# Find the first English UTF-8 locale for use in parsing timestamps.
|
|
30
29
|
LOCALE = None
|
|
31
|
-
import platform
|
|
32
30
|
if platform.system() == 'Windows':
|
|
33
31
|
for lang in locale.windows_locale.values():
|
|
34
32
|
if "en" in lang:
|
|
@@ -52,14 +50,6 @@ BASE_URL = os.environ.get('TD_SERVER') or "https://elite.tromador.com/files/"
|
|
|
52
50
|
CONTEXT=ssl.create_default_context(cafile=certifi.where())
|
|
53
51
|
|
|
54
52
|
|
|
55
|
-
def _request_url(url, headers=None):
|
|
56
|
-
data = None
|
|
57
|
-
if headers:
|
|
58
|
-
data = bytes(json.dumps(headers), encoding="utf-8")
|
|
59
|
-
|
|
60
|
-
return request.urlopen(request.Request(url, data=data), context=CONTEXT, timeout=90)
|
|
61
|
-
|
|
62
|
-
|
|
63
53
|
class DecodingError(PluginException):
|
|
64
54
|
pass
|
|
65
55
|
|
|
@@ -180,9 +170,6 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
180
170
|
"""
|
|
181
171
|
Fetch the latest dumpfile from the website if newer than local copy.
|
|
182
172
|
"""
|
|
183
|
-
def openURL(url):
|
|
184
|
-
return _request_url(url, headers = {'User-Agent': 'Trade-Dangerous'})
|
|
185
|
-
|
|
186
173
|
if path not in (self.liveListingsPath, self.listingsPath):
|
|
187
174
|
localPath = Path(self.tdb.dataPath, path)
|
|
188
175
|
else:
|
|
@@ -191,26 +178,38 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
191
178
|
url = BASE_URL + str(path)
|
|
192
179
|
|
|
193
180
|
self.tdenv.NOTE("Checking for update to '{}'.", path)
|
|
181
|
+
# Use an HTTP Request header to obtain the Last-Modified and Content-Length headers.
|
|
182
|
+
# Also, tell the server to give us the un-compressed length of the file by saying
|
|
183
|
+
# that >this< request only wants text.
|
|
184
|
+
headers = {"User-Agent": "Trade-Dangerous", "Accept-Encoding": "identity"}
|
|
194
185
|
try:
|
|
195
|
-
response =
|
|
186
|
+
response = requests.head(url, headers=headers, timeout=70)
|
|
196
187
|
except Exception as e: # pylint: disable=broad-exception-caught
|
|
197
|
-
self.tdenv.WARN("Problem with download:\n URL: {}\n Error: {}",
|
|
188
|
+
self.tdenv.WARN("Problem with download:\n URL: {}\n Error: {}", url, str(e))
|
|
198
189
|
return False
|
|
199
190
|
|
|
200
|
-
url_time = response.getheader("Last-Modified")
|
|
201
191
|
locale.setlocale(locale.LC_ALL, LOCALE)
|
|
202
|
-
|
|
192
|
+
last_modified = response.headers.get("last-modified")
|
|
193
|
+
dump_mod_time = datetime.datetime.strptime(last_modified, "%a, %d %b %Y %H:%M:%S %Z").timestamp()
|
|
203
194
|
locale.setlocale(locale.LC_ALL, '')
|
|
204
195
|
|
|
205
196
|
if Path.exists(localPath):
|
|
206
|
-
|
|
207
|
-
if
|
|
197
|
+
local_mod_time = localPath.stat().st_mtime
|
|
198
|
+
if local_mod_time >= dump_mod_time:
|
|
208
199
|
self.tdenv.DEBUG0("'{}': Dump is not more recent than Local.", path)
|
|
209
200
|
return False
|
|
210
201
|
|
|
202
|
+
# The server doesn't know the gzip'd length, and we won't see the gzip'd data,
|
|
203
|
+
# so we want the actual text-only length. Capture it here so we can tell the
|
|
204
|
+
# transfer mechanism how big the file is going to be.
|
|
205
|
+
length = response.headers.get("content-length")
|
|
206
|
+
|
|
211
207
|
self.tdenv.NOTE("Downloading file '{}'.", path)
|
|
212
|
-
transfers.download(self.tdenv, url, localPath)
|
|
213
|
-
|
|
208
|
+
transfers.download(self.tdenv, url, localPath, chunkSize=16384, length=length)
|
|
209
|
+
|
|
210
|
+
# Change the timestamps on the file so they match the website
|
|
211
|
+
os.utime(localPath, (dump_mod_time, dump_mod_time))
|
|
212
|
+
|
|
214
213
|
return True
|
|
215
214
|
|
|
216
215
|
def purgeSystems(self):
|
|
@@ -355,6 +354,8 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
355
354
|
def run(self):
|
|
356
355
|
self.tdenv.DEBUG2(f'Using "{LOCALE}" locale for parsing modified timestamps. Please include this information in any error reports.')
|
|
357
356
|
|
|
357
|
+
self.tdenv.ignoreUnknown = True
|
|
358
|
+
|
|
358
359
|
# Create the /eddb folder for downloading the source files if it doesn't exist.
|
|
359
360
|
try:
|
|
360
361
|
Path(str(self.dataPath)).mkdir()
|
|
@@ -511,8 +512,6 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
511
512
|
self.tdb.close()
|
|
512
513
|
self.tdb.reloadCache()
|
|
513
514
|
|
|
514
|
-
self.tdenv.ignoreUnknown = True
|
|
515
|
-
|
|
516
515
|
if self.getOption("purge"):
|
|
517
516
|
self.purgeSystems()
|
|
518
517
|
|
tradedangerous/tradedb.py
CHANGED
|
@@ -1150,8 +1150,9 @@ class TradeDB:
|
|
|
1150
1150
|
self.tradingStationCount = 0
|
|
1151
1151
|
# Fleet Carriers are station type 24.
|
|
1152
1152
|
# Odyssey settlements are station type 25.
|
|
1153
|
+
# Assume type 0 (Unknown) are also Fleet Carriers.
|
|
1153
1154
|
# Storing as a list allows easy expansion if needed.
|
|
1154
|
-
types = {'fleet-carrier':[24,],'odyssey':[25,],}
|
|
1155
|
+
types = {'fleet-carrier':[24, 0,],'odyssey':[25,],}
|
|
1155
1156
|
with closing(self.query(stmt)) as cur:
|
|
1156
1157
|
for (
|
|
1157
1158
|
ID, systemID, name,
|
tradedangerous/transfers.py
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import json
|
|
3
|
-
import time
|
|
1
|
+
from __future__ import annotations
|
|
4
2
|
|
|
5
3
|
from collections import deque
|
|
6
4
|
from pathlib import Path
|
|
@@ -8,9 +6,20 @@ from .tradeexcept import TradeException
|
|
|
8
6
|
from .misc import progress as pbar
|
|
9
7
|
from . import fs
|
|
10
8
|
|
|
9
|
+
import csv
|
|
10
|
+
import json
|
|
11
|
+
import time
|
|
12
|
+
import typing
|
|
13
|
+
|
|
11
14
|
import requests
|
|
12
15
|
|
|
13
16
|
|
|
17
|
+
if typing.TYPE_CHECKING:
|
|
18
|
+
import os # for PathLike
|
|
19
|
+
from .tradeenv import TradeEnv
|
|
20
|
+
from typing import Optional, Union
|
|
21
|
+
|
|
22
|
+
|
|
14
23
|
######################################################################
|
|
15
24
|
# Helpers
|
|
16
25
|
|
|
@@ -31,12 +40,16 @@ def makeUnit(value):
|
|
|
31
40
|
return None
|
|
32
41
|
|
|
33
42
|
def download(
|
|
34
|
-
tdenv,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
tdenv: TradeEnv,
|
|
44
|
+
url: str,
|
|
45
|
+
localFile: os.PathLike,
|
|
46
|
+
headers: Optional[dict] = None,
|
|
47
|
+
backup: bool = False,
|
|
48
|
+
shebang: Optional[str] = None,
|
|
49
|
+
chunkSize: int = 4096,
|
|
50
|
+
timeout: int = 90,
|
|
51
|
+
*,
|
|
52
|
+
length: Optional[Union[int, str]] = None,
|
|
40
53
|
):
|
|
41
54
|
"""
|
|
42
55
|
Fetch data from a URL and save the output
|
|
@@ -57,21 +70,24 @@ def download(
|
|
|
57
70
|
shebang:
|
|
58
71
|
function to call on the first line
|
|
59
72
|
"""
|
|
60
|
-
|
|
61
73
|
tdenv.NOTE("Requesting {}".format(url))
|
|
74
|
+
|
|
75
|
+
if isinstance(length, str):
|
|
76
|
+
length = int(length)
|
|
77
|
+
|
|
62
78
|
req = requests.get(url, headers=headers or None, stream=True, timeout=timeout)
|
|
63
79
|
req.raise_for_status()
|
|
64
80
|
|
|
65
81
|
encoding = req.headers.get('content-encoding', 'uncompress')
|
|
66
|
-
|
|
82
|
+
content_length = req.headers.get('content-length', length)
|
|
67
83
|
transfer = req.headers.get('transfer-encoding', None)
|
|
68
|
-
if transfer != 'chunked':
|
|
84
|
+
if not length and transfer != 'chunked':
|
|
69
85
|
# chunked transfer-encoding doesn't need a content-length
|
|
70
|
-
if
|
|
86
|
+
if content_length is None:
|
|
71
87
|
print(req.headers)
|
|
72
88
|
raise Exception("Remote server replied with invalid content-length.")
|
|
73
|
-
|
|
74
|
-
if
|
|
89
|
+
content_length = int(content_length)
|
|
90
|
+
if content_length <= 0:
|
|
75
91
|
raise TradeException(
|
|
76
92
|
"Remote server gave an empty response. Please try again later."
|
|
77
93
|
)
|
|
@@ -81,8 +97,8 @@ def download(
|
|
|
81
97
|
# the uncompressed data, which should be larger, which will cause our
|
|
82
98
|
# download indicators to sit at 100% for a really long time if the file is
|
|
83
99
|
# heavily compressed and large (e.g spansh 1.5gb compressed vs 9GB uncompressed)
|
|
84
|
-
if encoding == "gzip" and
|
|
85
|
-
length
|
|
100
|
+
if length is None and encoding == "gzip" and content_length:
|
|
101
|
+
length = content_length * 3
|
|
86
102
|
|
|
87
103
|
if tdenv.detail > 1:
|
|
88
104
|
if length:
|
tradedangerous/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tradedangerous
|
|
3
|
-
Version: 11.1.
|
|
3
|
+
Version: 11.1.4
|
|
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,4 +1,4 @@
|
|
|
1
|
-
trade.py,sha256=
|
|
1
|
+
trade.py,sha256=Skqy0bC47g1KujuYrVwa3T8AfJ9NoLLOZcVjjxJ2daQ,1769
|
|
2
2
|
tradegui.py,sha256=q2HdIdoyeLUpeF2X0hVIGn7sU6T4zOzq1HN0zGvZdyE,788
|
|
3
3
|
tradedangerous/__init__.py,sha256=bwsbE_GyCNsuyGDKnfXAg0RD-ewsWHliySJ5QfCK7h8,1166
|
|
4
4
|
tradedangerous/cache.py,sha256=N7z1e2fov003wIh_aHkw1pdByKDPt3FkDZiH_EEPdMc,36080
|
|
@@ -7,7 +7,7 @@ tradedangerous/corrections.py,sha256=_WLgo1IBWoskrrPFeshRwCOeJ2BeJb_x4tDQ0JdAo-s
|
|
|
7
7
|
tradedangerous/csvexport.py,sha256=_19bGVnCGJPzvx_8DzLGOs4rqx8Asn7eCVdXKdKu92E,8653
|
|
8
8
|
tradedangerous/edscupdate.py,sha256=G8N-j61MZbCgY07WIVK23CCw6eMPE3WkraXHeARt9QE,17297
|
|
9
9
|
tradedangerous/edsmupdate.py,sha256=jpDUxUkDKxlG_gS3qWy5fg9p3mBPC-akU2pHSlfTPkI,14915
|
|
10
|
-
tradedangerous/formatting.py,sha256
|
|
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
13
|
tradedangerous/jsonprices.py,sha256=V9Xm3pocQfEHoC38VYWomzbwX0wu9R2zJ2gB99JzYPQ,7212
|
|
@@ -16,12 +16,12 @@ tradedangerous/prices.py,sha256=JqiDVrtvvPd5pqE3HdwOHOuFgdAbOR-pt0GLD3ZIXM8,7425
|
|
|
16
16
|
tradedangerous/submit-distances.py,sha256=zxHtRpX10soJKLuRcun9uelfXGq2S9jvIWxD--P9zus,11709
|
|
17
17
|
tradedangerous/tools.py,sha256=pp-4WtA12SVaaQHFJFOMTF7EDFRCU2mQeOhC4xoXmEk,1331
|
|
18
18
|
tradedangerous/tradecalc.py,sha256=A7peEMiaCjlwFvReSq3E7_Ar0shUoFedQi83ZmOc7uY,42075
|
|
19
|
-
tradedangerous/tradedb.py,sha256=
|
|
19
|
+
tradedangerous/tradedb.py,sha256=mitKkS4MczivDK_K7A-IC94hkObUmGWFhwIrh_ts9qw,72282
|
|
20
20
|
tradedangerous/tradeenv.py,sha256=SDzRC6ERYZzzb_I6uexmFpFJJrnbzXa-1ogYt_GH26w,10576
|
|
21
21
|
tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk,368
|
|
22
|
-
tradedangerous/transfers.py,sha256=
|
|
22
|
+
tradedangerous/transfers.py,sha256=KwskYBB5_TYDXx5fkN1ABYsPuPnICKdkEx0WUfC7BnA,8378
|
|
23
23
|
tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
|
|
24
|
-
tradedangerous/version.py,sha256=
|
|
24
|
+
tradedangerous/version.py,sha256=5eX-o8e6DHQLNfwJLHkmRQAAtV7y1dzLdlazgmPIdH8,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
|
|
@@ -62,7 +62,7 @@ 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=
|
|
65
|
+
tradedangerous/plugins/eddblink_plug.py,sha256=P-Z4szyP8dsKPvnm7O7KbdT-65oOvvLKqyuudMSWfUg,22887
|
|
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
|
|
@@ -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.
|
|
75
|
-
tradedangerous-11.1.
|
|
76
|
-
tradedangerous-11.1.
|
|
77
|
-
tradedangerous-11.1.
|
|
78
|
-
tradedangerous-11.1.
|
|
79
|
-
tradedangerous-11.1.
|
|
74
|
+
tradedangerous-11.1.4.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
75
|
+
tradedangerous-11.1.4.dist-info/METADATA,sha256=8GX1JREqpfffxkJmZ6JtlzbBhbhQqyLHHfEAYpWsNhE,4435
|
|
76
|
+
tradedangerous-11.1.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
77
|
+
tradedangerous-11.1.4.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
|
|
78
|
+
tradedangerous-11.1.4.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
|
|
79
|
+
tradedangerous-11.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|