tradedangerous 11.2.0__py3-none-any.whl → 11.3.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.
- tradedangerous/cache.py +35 -18
- tradedangerous/commands/parsing.py +0 -4
- tradedangerous/edscupdate.py +1 -1
- tradedangerous/edsmupdate.py +1 -1
- tradedangerous/formatting.py +1 -2
- tradedangerous/fs.py +38 -2
- tradedangerous/misc/progress.py +164 -56
- tradedangerous/plugins/eddblink_plug.py +58 -75
- tradedangerous/templates/TradeDangerous.sql +37 -4
- tradedangerous/tradecalc.py +156 -159
- tradedangerous/transfers.py +26 -60
- tradedangerous/version.py +1 -1
- {tradedangerous-11.2.0.dist-info → tradedangerous-11.3.0.dist-info}/METADATA +1 -1
- {tradedangerous-11.2.0.dist-info → tradedangerous-11.3.0.dist-info}/RECORD +18 -18
- {tradedangerous-11.2.0.dist-info → tradedangerous-11.3.0.dist-info}/LICENSE +0 -0
- {tradedangerous-11.2.0.dist-info → tradedangerous-11.3.0.dist-info}/WHEEL +0 -0
- {tradedangerous-11.2.0.dist-info → tradedangerous-11.3.0.dist-info}/entry_points.txt +0 -0
- {tradedangerous-11.2.0.dist-info → tradedangerous-11.3.0.dist-info}/top_level.txt +0 -0
tradedangerous/tradecalc.py
CHANGED
|
@@ -930,176 +930,173 @@ class TradeCalc:
|
|
|
930
930
|
odyssey = odyssey,
|
|
931
931
|
)
|
|
932
932
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
tdenv.DEBUG1("Route = {}", route.text(lambda x, y: y))
|
|
940
|
-
|
|
941
|
-
srcStation = route.lastStation
|
|
942
|
-
startCr = credits + int(route.gainCr * safetyMargin)
|
|
943
|
-
|
|
944
|
-
srcSelling = getSelling(srcStation.ID, None)
|
|
945
|
-
srcSelling = tuple(
|
|
946
|
-
values for values in srcSelling
|
|
947
|
-
if values[1] <= startCr
|
|
948
|
-
)
|
|
949
|
-
if not srcSelling:
|
|
950
|
-
tdenv.DEBUG1("Nothing sold/affordable - next.")
|
|
951
|
-
continue
|
|
952
|
-
|
|
953
|
-
if goalSystem:
|
|
954
|
-
origSystem = route.firstSystem
|
|
955
|
-
srcSystem = srcStation.system
|
|
956
|
-
srcDistTo = srcSystem.distanceTo
|
|
957
|
-
goalDistTo = goalSystem.distanceTo
|
|
958
|
-
origDistTo = origSystem.distanceTo
|
|
959
|
-
srcGoalDist = srcDistTo(goalSystem)
|
|
960
|
-
srcOrigDist = srcDistTo(origSystem)
|
|
961
|
-
origGoalDist = origDistTo(goalSystem)
|
|
962
|
-
|
|
963
|
-
if unique:
|
|
964
|
-
uniquePath = route.route
|
|
965
|
-
elif loopInt:
|
|
966
|
-
pos_from_end = 0 - loopInt
|
|
967
|
-
uniquePath = route.route[pos_from_end:-1]
|
|
968
|
-
|
|
969
|
-
stations = (d for d in station_iterator(srcStation)
|
|
970
|
-
if (d.station != srcStation) and
|
|
971
|
-
(d.station.blackMarket == 'Y' if reqBlackMarket else True) and
|
|
972
|
-
(d.station not in uniquePath if uniquePath else True) and
|
|
973
|
-
(d.station in restrictStations if restrictStations else True) and
|
|
974
|
-
(d.station.dataAge and d.station.dataAge <= maxAge if maxAge else True) and
|
|
975
|
-
(((d.system is not srcSystem) if bool(tdenv.unique) else (d.system is goalSystem or d.distLy < srcGoalDist)) if goalSystem else True)
|
|
976
|
-
)
|
|
977
|
-
|
|
978
|
-
if tdenv.debug >= 1:
|
|
933
|
+
with pbar.Progress(max_value=len(routes), width=25, show=tdenv.progress) as prog:
|
|
934
|
+
connections = 0
|
|
935
|
+
getSelling = self.stationsSelling.get
|
|
936
|
+
for route_no, route in enumerate(routes):
|
|
937
|
+
prog.increment(progress=route_no)
|
|
938
|
+
tdenv.DEBUG1("Route = {}", route.text(lambda x, y: y))
|
|
979
939
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
"destSys {}, destStn {}, jumps {}, distLy {}",
|
|
983
|
-
dest.system.dbname,
|
|
984
|
-
dest.station.dbname,
|
|
985
|
-
"->".join(jump.text() for jump in dest.via),
|
|
986
|
-
dest.distLy
|
|
987
|
-
)
|
|
988
|
-
return True
|
|
989
|
-
|
|
990
|
-
stations = (d for d in stations if annotate(d))
|
|
991
|
-
|
|
992
|
-
for dest in stations:
|
|
993
|
-
dstStation = dest.station
|
|
940
|
+
srcStation = route.lastStation
|
|
941
|
+
startCr = credits + int(route.gainCr * safetyMargin)
|
|
994
942
|
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
943
|
+
srcSelling = getSelling(srcStation.ID, None)
|
|
944
|
+
srcSelling = tuple(
|
|
945
|
+
values for values in srcSelling
|
|
946
|
+
if values[1] <= startCr
|
|
947
|
+
)
|
|
948
|
+
if not srcSelling:
|
|
949
|
+
tdenv.DEBUG1("Nothing sold/affordable - next.")
|
|
998
950
|
continue
|
|
999
|
-
trade = fitFunction(items, startCr, capacity, maxUnits)
|
|
1000
951
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
if
|
|
1019
|
-
|
|
952
|
+
if goalSystem:
|
|
953
|
+
origSystem = route.firstSystem
|
|
954
|
+
srcSystem = srcStation.system
|
|
955
|
+
srcDistTo = srcSystem.distanceTo
|
|
956
|
+
goalDistTo = goalSystem.distanceTo
|
|
957
|
+
origDistTo = origSystem.distanceTo
|
|
958
|
+
srcGoalDist = srcDistTo(goalSystem)
|
|
959
|
+
srcOrigDist = srcDistTo(origSystem)
|
|
960
|
+
origGoalDist = origDistTo(goalSystem)
|
|
961
|
+
|
|
962
|
+
if unique:
|
|
963
|
+
uniquePath = route.route
|
|
964
|
+
elif loopInt:
|
|
965
|
+
pos_from_end = 0 - loopInt
|
|
966
|
+
uniquePath = route.route[pos_from_end:-1]
|
|
967
|
+
|
|
968
|
+
stations = (d for d in station_iterator(srcStation)
|
|
969
|
+
if (d.station != srcStation) and
|
|
970
|
+
(d.station.blackMarket == 'Y' if reqBlackMarket else True) and
|
|
971
|
+
(d.station not in uniquePath if uniquePath else True) and
|
|
972
|
+
(d.station in restrictStations if restrictStations else True) and
|
|
973
|
+
(d.station.dataAge and d.station.dataAge <= maxAge if maxAge else True) and
|
|
974
|
+
(((d.system is not srcSystem) if bool(tdenv.unique) else (d.system is goalSystem or d.distLy < srcGoalDist)) if goalSystem else True)
|
|
975
|
+
)
|
|
976
|
+
|
|
977
|
+
if tdenv.debug >= 1:
|
|
1020
978
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
979
|
+
def annotate(dest):
|
|
980
|
+
tdenv.DEBUG1(
|
|
981
|
+
"destSys {}, destStn {}, jumps {}, distLy {}",
|
|
982
|
+
dest.system.dbname,
|
|
983
|
+
dest.station.dbname,
|
|
984
|
+
"->".join(jump.text() for jump in dest.via),
|
|
985
|
+
dest.distLy
|
|
986
|
+
)
|
|
987
|
+
return True
|
|
1026
988
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
# multiplier *= (1 - penalty)
|
|
989
|
+
stations = (d for d in stations if annotate(d))
|
|
990
|
+
|
|
991
|
+
for dest in stations:
|
|
992
|
+
dstStation = dest.station
|
|
1032
993
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
#
|
|
1039
|
-
# The sigmoid: (-1-(50(x-4))/(1+abs(50(x-4))))/4
|
|
1040
|
-
# ranges between 0 and -0.5 with a drop around x=4,
|
|
1041
|
-
# making it great for penalizing distances > 4Kls.
|
|
1042
|
-
#
|
|
1043
|
-
# The curve: (-1+1/(x+1)^((x+1)/4))/2
|
|
1044
|
-
# ranges between 0 and -0.5 in a smooth arc,
|
|
1045
|
-
# which will be used for making distances
|
|
1046
|
-
# closer to 4Kls get a slightly higher penalty
|
|
1047
|
-
# then distances closer to 1Kls.
|
|
1048
|
-
#
|
|
1049
|
-
# Adding the three together creates a doubly-kinked curve
|
|
1050
|
-
# that ranges from ~0.5 to -1.0, with drops around x=1 and x=4,
|
|
1051
|
-
# which closely matches ksfone's intention without going into
|
|
1052
|
-
# negative numbers and causing problems when we add it to
|
|
1053
|
-
# the multiplier variable. ( 1 + -1 = 0 )
|
|
1054
|
-
#
|
|
1055
|
-
# You can see a graph of the formula here:
|
|
1056
|
-
# https://goo.gl/sn1PqQ
|
|
1057
|
-
# NOTE: The black curve is at a penalty of 0%,
|
|
1058
|
-
# the red curve at a penalty of 100%, with intermediates at
|
|
1059
|
-
# 25%, 50%, and 75%.
|
|
1060
|
-
# The other colored lines show the penalty curves individually
|
|
1061
|
-
# and the teal composite of all three.
|
|
994
|
+
connections += 1
|
|
995
|
+
items = self.getTrades(srcStation, dstStation, srcSelling)
|
|
996
|
+
if not items:
|
|
997
|
+
continue
|
|
998
|
+
trade = fitFunction(items, startCr, capacity, maxUnits)
|
|
1062
999
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1000
|
+
multiplier = 1.0
|
|
1001
|
+
# Calculate total K-lightseconds supercruise time.
|
|
1002
|
+
# This will amortize for the start/end stations
|
|
1003
|
+
dstSys = dest.system
|
|
1004
|
+
if goalSystem and dstSys is not goalSystem:
|
|
1005
|
+
dstGoalDist = goalDistTo(dstSys)
|
|
1006
|
+
# Biggest reward for shortening distance to goal
|
|
1007
|
+
score = 5000 * origGoalDist / dstGoalDist
|
|
1008
|
+
# bias towards bigger reductions
|
|
1009
|
+
score += 50 * srcGoalDist / dstGoalDist
|
|
1010
|
+
# discourage moving back towards origin
|
|
1011
|
+
if dstSys is not origSystem:
|
|
1012
|
+
score += 10 * (origDistTo(dstSys) - srcOrigDist)
|
|
1013
|
+
# Gain per unit pays a small part
|
|
1014
|
+
score += (trade.gainCr / trade.units) / 25
|
|
1015
|
+
else:
|
|
1016
|
+
score = trade.gainCr
|
|
1017
|
+
if lsPenalty:
|
|
1018
|
+
# [kfsone] Only want 1dp
|
|
1019
|
+
|
|
1020
|
+
cruiseKls = int(dstStation.lsFromStar / 100) / 10
|
|
1021
|
+
# Produce a curve that favors distances under 1kls
|
|
1022
|
+
# positively, starts to penalize distances over 1k,
|
|
1023
|
+
# and after 4kls starts to penalize aggressively
|
|
1024
|
+
# http://goo.gl/Otj2XP
|
|
1025
|
+
|
|
1026
|
+
# [eyeonus] As aadler pointed out, this goes into negative
|
|
1027
|
+
# numbers, which causes problems.
|
|
1028
|
+
# penalty = ((cruiseKls ** 2) - cruiseKls) / 3
|
|
1029
|
+
# penalty *= lsPenalty
|
|
1030
|
+
# multiplier *= (1 - penalty)
|
|
1031
|
+
|
|
1032
|
+
# [eyeonus]:
|
|
1033
|
+
# (Keep in mind all this ignores values of x<0.)
|
|
1034
|
+
# The sigmoid: (1-(25(x-1))/(1+abs(25(x-1))))/4
|
|
1035
|
+
# ranges between 0.5 and 0 with a drop around x=1,
|
|
1036
|
+
# which makes it great for giving a boost to distances < 1Kls.
|
|
1037
|
+
#
|
|
1038
|
+
# The sigmoid: (-1-(50(x-4))/(1+abs(50(x-4))))/4
|
|
1039
|
+
# ranges between 0 and -0.5 with a drop around x=4,
|
|
1040
|
+
# making it great for penalizing distances > 4Kls.
|
|
1041
|
+
#
|
|
1042
|
+
# The curve: (-1+1/(x+1)^((x+1)/4))/2
|
|
1043
|
+
# ranges between 0 and -0.5 in a smooth arc,
|
|
1044
|
+
# which will be used for making distances
|
|
1045
|
+
# closer to 4Kls get a slightly higher penalty
|
|
1046
|
+
# then distances closer to 1Kls.
|
|
1047
|
+
#
|
|
1048
|
+
# Adding the three together creates a doubly-kinked curve
|
|
1049
|
+
# that ranges from ~0.5 to -1.0, with drops around x=1 and x=4,
|
|
1050
|
+
# which closely matches ksfone's intention without going into
|
|
1051
|
+
# negative numbers and causing problems when we add it to
|
|
1052
|
+
# the multiplier variable. ( 1 + -1 = 0 )
|
|
1053
|
+
#
|
|
1054
|
+
# You can see a graph of the formula here:
|
|
1055
|
+
# https://goo.gl/sn1PqQ
|
|
1056
|
+
# NOTE: The black curve is at a penalty of 0%,
|
|
1057
|
+
# the red curve at a penalty of 100%, with intermediates at
|
|
1058
|
+
# 25%, 50%, and 75%.
|
|
1059
|
+
# The other colored lines show the penalty curves individually
|
|
1060
|
+
# and the teal composite of all three.
|
|
1061
|
+
|
|
1062
|
+
def sigmoid(x):
|
|
1063
|
+
return x / (1 + abs(x))
|
|
1064
|
+
|
|
1065
|
+
boost = (1 - sigmoid(25 * (cruiseKls - 1))) / 4
|
|
1066
|
+
drop = (-1 - sigmoid(50 * (cruiseKls - 4))) / 4
|
|
1067
|
+
try:
|
|
1068
|
+
penalty = (-1 + 1 / (cruiseKls + 1) ** ((cruiseKls + 1) / 4)) / 2
|
|
1069
|
+
except OverflowError:
|
|
1070
|
+
penalty = -0.5
|
|
1071
|
+
|
|
1072
|
+
multiplier += (penalty + boost + drop) * lsPenalty
|
|
1065
1073
|
|
|
1066
|
-
|
|
1067
|
-
drop = (-1 - sigmoid(50 * (cruiseKls - 4))) / 4
|
|
1068
|
-
try:
|
|
1069
|
-
penalty = (-1 + 1 / (cruiseKls + 1) ** ((cruiseKls + 1) / 4)) / 2
|
|
1070
|
-
except OverflowError:
|
|
1071
|
-
penalty = -0.5
|
|
1074
|
+
score *= multiplier
|
|
1072
1075
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
# Check if it is a better option than we just produced
|
|
1088
|
-
bestTradeScore = bestRoute.score + bestScore
|
|
1089
|
-
newTradeScore = route.score + score
|
|
1090
|
-
if bestTradeScore > newTradeScore:
|
|
1091
|
-
continue
|
|
1092
|
-
if bestTradeScore == newTradeScore:
|
|
1093
|
-
bestLy = btd[4]
|
|
1094
|
-
if bestLy <= dest.distLy:
|
|
1076
|
+
dstID = dstStation.ID
|
|
1077
|
+
try:
|
|
1078
|
+
# See if there is already a candidate for this destination
|
|
1079
|
+
btd = bestToDest[dstID]
|
|
1080
|
+
except KeyError:
|
|
1081
|
+
# No existing candidate, we win by default
|
|
1082
|
+
pass
|
|
1083
|
+
else:
|
|
1084
|
+
bestRoute = btd[1]
|
|
1085
|
+
bestScore = btd[5]
|
|
1086
|
+
# Check if it is a better option than we just produced
|
|
1087
|
+
bestTradeScore = bestRoute.score + bestScore
|
|
1088
|
+
newTradeScore = route.score + score
|
|
1089
|
+
if bestTradeScore > newTradeScore:
|
|
1095
1090
|
continue
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1091
|
+
if bestTradeScore == newTradeScore:
|
|
1092
|
+
bestLy = btd[4]
|
|
1093
|
+
if bestLy <= dest.distLy:
|
|
1094
|
+
continue
|
|
1095
|
+
|
|
1096
|
+
bestToDest[dstID] = (
|
|
1097
|
+
dstStation, route, trade, dest.via, dest.distLy, score
|
|
1098
|
+
)
|
|
1099
|
+
|
|
1103
1100
|
if connections == 0:
|
|
1104
1101
|
raise NoHopsError(
|
|
1105
1102
|
"No destinations could be reached within the constraints."
|
tradedangerous/transfers.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from collections import deque
|
|
4
3
|
from pathlib import Path
|
|
4
|
+
from urllib.parse import urlparse, unquote
|
|
5
|
+
|
|
5
6
|
from .tradeexcept import TradeException
|
|
6
7
|
from .misc import progress as pbar
|
|
7
8
|
from . import fs
|
|
@@ -16,7 +17,7 @@ import requests
|
|
|
16
17
|
if typing.TYPE_CHECKING:
|
|
17
18
|
import os # for PathLike
|
|
18
19
|
from .tradeenv import TradeEnv
|
|
19
|
-
from typing import Optional, Union
|
|
20
|
+
from typing import Callable, Optional, Union # noqa
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
######################################################################
|
|
@@ -38,15 +39,21 @@ def makeUnit(value):
|
|
|
38
39
|
unitSize /= 1024
|
|
39
40
|
return None
|
|
40
41
|
|
|
42
|
+
|
|
43
|
+
def get_filename_from_url(url: str) -> str:
|
|
44
|
+
""" extracts just the filename from a url. """
|
|
45
|
+
return Path(unquote(urlparse(url).path)).name
|
|
46
|
+
|
|
47
|
+
|
|
41
48
|
def download(
|
|
42
49
|
tdenv: TradeEnv,
|
|
43
50
|
url: str,
|
|
44
51
|
localFile: os.PathLike,
|
|
45
52
|
headers: Optional[dict] = None,
|
|
46
53
|
backup: bool = False,
|
|
47
|
-
shebang: Optional[
|
|
54
|
+
shebang: Optional[Callable] = None,
|
|
48
55
|
chunkSize: int = 4096,
|
|
49
|
-
timeout: int =
|
|
56
|
+
timeout: int = 30,
|
|
50
57
|
*,
|
|
51
58
|
length: Optional[Union[int, str]] = None,
|
|
52
59
|
session: Optional[requests.Session] = None,
|
|
@@ -55,20 +62,11 @@ def download(
|
|
|
55
62
|
Fetch data from a URL and save the output
|
|
56
63
|
to a local file. Returns the response headers.
|
|
57
64
|
|
|
58
|
-
tdenv:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
localFile:
|
|
65
|
-
Name of the local file to open.
|
|
66
|
-
|
|
67
|
-
headers:
|
|
68
|
-
dict() of additional HTTP headers to send
|
|
69
|
-
|
|
70
|
-
shebang:
|
|
71
|
-
function to call on the first line
|
|
65
|
+
:param tdenv: TradeEnv we're working under
|
|
66
|
+
:param url: URL we're fetching (http, https or ftp)
|
|
67
|
+
:param localFile: Name of the local file to open.
|
|
68
|
+
:param headers: dict() of additional HTTP headers to send
|
|
69
|
+
:param shebang: function to call on the first line
|
|
72
70
|
"""
|
|
73
71
|
tdenv.NOTE("Requesting {}".format(url))
|
|
74
72
|
|
|
@@ -108,24 +106,14 @@ def download(
|
|
|
108
106
|
tdenv.NOTE("Downloading {} {}ed data", transfer, encoding)
|
|
109
107
|
tdenv.DEBUG0(str(req.headers).replace("{", "{{").replace("}", "}}"))
|
|
110
108
|
|
|
111
|
-
# Figure out how much data we have
|
|
112
|
-
if length and not tdenv.quiet:
|
|
113
|
-
progBar = pbar.Progress(length, 20)
|
|
114
|
-
else:
|
|
115
|
-
progBar = None
|
|
116
|
-
|
|
117
109
|
actPath = Path(localFile)
|
|
118
110
|
fs.ensurefolder(tdenv.tmpDir)
|
|
119
111
|
tmpPath = Path(tdenv.tmpDir, "{}.dl".format(actPath.name))
|
|
120
112
|
|
|
121
|
-
histogram = deque()
|
|
122
|
-
|
|
123
113
|
fetched = 0
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
]
|
|
128
|
-
with tmpPath.open("wb") as fh:
|
|
114
|
+
started = time.time()
|
|
115
|
+
filename = get_filename_from_url(url)
|
|
116
|
+
with pbar.Progress(max_value=length, width=25, prefix=filename, style=pbar.CountingBar, show=not tdenv.quiet) as prog, tmpPath.open("wb") as fh:
|
|
129
117
|
for data in req.iter_content(chunk_size=chunkSize):
|
|
130
118
|
fh.write(data)
|
|
131
119
|
fetched += len(data)
|
|
@@ -134,29 +122,11 @@ def download(
|
|
|
134
122
|
tdenv.DEBUG0("Checking shebang of {}", bangLine)
|
|
135
123
|
shebang(bangLine)
|
|
136
124
|
shebang = None
|
|
137
|
-
if
|
|
138
|
-
|
|
139
|
-
deltaT = max(now - lastTime, 0.001)
|
|
140
|
-
lastTime = now
|
|
141
|
-
if len(histogram) >= 15:
|
|
142
|
-
histogram.popleft()
|
|
143
|
-
histogram.append(len(data) / deltaT)
|
|
144
|
-
progBar.increment(
|
|
145
|
-
len(data),
|
|
146
|
-
postfix=lambda value, goal: \
|
|
147
|
-
" {:>7s} [{:>7s}/s] {:>3.0f}% {:1s}".format(
|
|
148
|
-
makeUnit(value),
|
|
149
|
-
makeUnit(sum(histogram) / len(histogram)),
|
|
150
|
-
(fetched * 100. / length),
|
|
151
|
-
spinners[spinner]
|
|
152
|
-
)
|
|
153
|
-
)
|
|
154
|
-
if deltaT > 0.200:
|
|
155
|
-
spinner = (spinner + 1) % len(spinners)
|
|
125
|
+
if prog:
|
|
126
|
+
prog.increment(len(data))
|
|
156
127
|
tdenv.DEBUG0("End of data")
|
|
128
|
+
|
|
157
129
|
if not tdenv.quiet:
|
|
158
|
-
if progBar:
|
|
159
|
-
progBar.clear()
|
|
160
130
|
elapsed = (time.time() - started) or 1
|
|
161
131
|
tdenv.NOTE(
|
|
162
132
|
"Downloaded {} of {}ed data {}/s",
|
|
@@ -197,17 +167,13 @@ def get_json_data(url, *, timeout: int = 90):
|
|
|
197
167
|
jsData = req.content
|
|
198
168
|
else:
|
|
199
169
|
totalLength = int(totalLength)
|
|
200
|
-
|
|
170
|
+
filename = get_filename_from_url(url)
|
|
171
|
+
progBar = pbar.Progress(totalLength, 25, prefix=filename)
|
|
172
|
+
|
|
201
173
|
jsData = bytes()
|
|
202
174
|
for data in req.iter_content():
|
|
203
175
|
jsData += data
|
|
204
|
-
progBar.increment(
|
|
205
|
-
len(data),
|
|
206
|
-
postfix=lambda value, goal: \
|
|
207
|
-
" {}/{}".format(
|
|
208
|
-
makeUnit(value),
|
|
209
|
-
makeUnit(goal),
|
|
210
|
-
))
|
|
176
|
+
progBar.increment(len(data))
|
|
211
177
|
progBar.clear()
|
|
212
178
|
|
|
213
179
|
return json.loads(jsData.decode())
|
tradedangerous/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tradedangerous
|
|
3
|
-
Version: 11.
|
|
3
|
+
Version: 11.3.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
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
trade.py,sha256=Skqy0bC47g1KujuYrVwa3T8AfJ9NoLLOZcVjjxJ2daQ,1769
|
|
2
2
|
tradegui.py,sha256=q2HdIdoyeLUpeF2X0hVIGn7sU6T4zOzq1HN0zGvZdyE,788
|
|
3
3
|
tradedangerous/__init__.py,sha256=bwsbE_GyCNsuyGDKnfXAg0RD-ewsWHliySJ5QfCK7h8,1166
|
|
4
|
-
tradedangerous/cache.py,sha256=
|
|
4
|
+
tradedangerous/cache.py,sha256=0Pyvh5XYrNzC7Pj7KzDIioI-Xhydx7JGUXZGcrO1org,37225
|
|
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=
|
|
9
|
-
tradedangerous/edsmupdate.py,sha256=
|
|
10
|
-
tradedangerous/formatting.py,sha256=
|
|
11
|
-
tradedangerous/fs.py,sha256=
|
|
8
|
+
tradedangerous/edscupdate.py,sha256=To7hL2FuR4A7A4gJfvow_jGl6mlD7aP-Drv1rEkwy-I,17310
|
|
9
|
+
tradedangerous/edsmupdate.py,sha256=9IANIASA8ZKnZsLPBRAh7IArDRsa0jriL2UwjqKJ1fI,14928
|
|
10
|
+
tradedangerous/formatting.py,sha256=R8GX2Zya1xazLOOBIWlLqUEjIESZJO41UlvhZDbyY4Q,6908
|
|
11
|
+
tradedangerous/fs.py,sha256=41yUdriBSv-rinGEmxjBTKyKH4-RA2bIO4sKCMIwvUA,3861
|
|
12
12
|
tradedangerous/gui.py,sha256=DFsF5zATr-lyJShL6t5kPKvcLLJYkICurzBz0WBa-oQ,43676
|
|
13
13
|
tradedangerous/jsonprices.py,sha256=GJ07fbZSNX5U_6lczWTSk6mWwme_weJbXgE8zcZBnpY,7225
|
|
14
14
|
tradedangerous/mapping.py,sha256=Bf2G8LzP1Bat5k3hFs9XyeI1z3tfUpfeh4nuLP2QJuQ,4122
|
|
15
15
|
tradedangerous/prices.py,sha256=JqiDVrtvvPd5pqE3HdwOHOuFgdAbOR-pt0GLD3ZIXM8,7425
|
|
16
16
|
tradedangerous/submit-distances.py,sha256=xL7fwdbVrb05-zWNH-9nyYBDtV4bfUfP7OBx3NMBc34,11749
|
|
17
17
|
tradedangerous/tools.py,sha256=pp-4WtA12SVaaQHFJFOMTF7EDFRCU2mQeOhC4xoXmEk,1331
|
|
18
|
-
tradedangerous/tradecalc.py,sha256=
|
|
18
|
+
tradedangerous/tradecalc.py,sha256=GlJZ9UwkoQUoayqUGVwlefhQvs-1SxYB5Y6Vkr31nSg,42753
|
|
19
19
|
tradedangerous/tradedb.py,sha256=mitKkS4MczivDK_K7A-IC94hkObUmGWFhwIrh_ts9qw,72282
|
|
20
20
|
tradedangerous/tradeenv.py,sha256=o956HN7-7uzIcNi9vI4zh-L1z5jwBioVARyhhiAlsRQ,11885
|
|
21
21
|
tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk,368
|
|
22
|
-
tradedangerous/transfers.py,sha256=
|
|
22
|
+
tradedangerous/transfers.py,sha256=s0fRWDZCsL-VYm5E4ceTMKcUelcvzcOUelsfg6TjYI8,6000
|
|
23
23
|
tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
|
|
24
|
-
tradedangerous/version.py,sha256=
|
|
24
|
+
tradedangerous/version.py,sha256=Lf6tzJrBdghRB7hsnuyfhzDziiCbZ8EhcNAAsCHjmVs,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
|
|
@@ -34,7 +34,7 @@ tradedangerous/commands/local_cmd.py,sha256=tf7YMGX-vaVGNO2lvQF9EvQEN3Wj7DE9-NTS
|
|
|
34
34
|
tradedangerous/commands/market_cmd.py,sha256=Ig16zDuksywiiF3Exps6UuM-ZhqgbXqkW6Lu2s9xQf0,5411
|
|
35
35
|
tradedangerous/commands/nav_cmd.py,sha256=v245L1MxiUliITUgvWeeB4cL4UdkNO8n0CiP6ztrV54,8460
|
|
36
36
|
tradedangerous/commands/olddata_cmd.py,sha256=6rpPRRs4kLhV9c0sogmctVAjta7v0L0Deu999spXY2s,7888
|
|
37
|
-
tradedangerous/commands/parsing.py,sha256=
|
|
37
|
+
tradedangerous/commands/parsing.py,sha256=_AoC41kXFWlHMHADZY8QqVmeyRNT6_VapoFhj7sSflY,6595
|
|
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
|
|
@@ -58,11 +58,11 @@ tradedangerous/misc/edsc.py,sha256=SN_da9qZ7H8ozibyhoFVB8nAvwBDPF3Z_PMlt70J2Ro,1
|
|
|
58
58
|
tradedangerous/misc/edsm.py,sha256=equDwO1SY3QTsoJIb3LjiHes4C8Dejaap_TMpYlCm8o,2910
|
|
59
59
|
tradedangerous/misc/importeddbstats.py,sha256=iLAcrFzdwiMm_MnUuaHcT_xGgZF8pfEEd1qljhhWJTU,1787
|
|
60
60
|
tradedangerous/misc/prices-json-exp.py,sha256=Fpm62ugP35ZBqnRs6ekYfS3GoDFYmvLD3b3SFJfaMOI,4944
|
|
61
|
-
tradedangerous/misc/progress.py,sha256=
|
|
61
|
+
tradedangerous/misc/progress.py,sha256=pWBHPA8Xc5uzjufAwCn7mkTrz7UbwSpY46o2BgEi7HU,7058
|
|
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=V58hRCfjeZ7t3aAIgdzbS5VdO5l39A-9_QKbY7KNJ48,21209
|
|
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
|
|
@@ -70,10 +70,10 @@ tradedangerous/plugins/spansh_plug.py,sha256=FiIS9cN2_8VKDrAj8yvkdy1NIni2kEc0ECq
|
|
|
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
|
-
tradedangerous/templates/TradeDangerous.sql,sha256=
|
|
74
|
-
tradedangerous-11.
|
|
75
|
-
tradedangerous-11.
|
|
76
|
-
tradedangerous-11.
|
|
77
|
-
tradedangerous-11.
|
|
78
|
-
tradedangerous-11.
|
|
79
|
-
tradedangerous-11.
|
|
73
|
+
tradedangerous/templates/TradeDangerous.sql,sha256=S9TH1bp0dfJLv90T6lTQ-TD8w8YGEZRMyUn8J1W4G3k,9330
|
|
74
|
+
tradedangerous-11.3.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
75
|
+
tradedangerous-11.3.0.dist-info/METADATA,sha256=ctub0LqxjEV1nSRKjKmOwkDrXNnEmGtfae8X8vx87Jk,4435
|
|
76
|
+
tradedangerous-11.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
77
|
+
tradedangerous-11.3.0.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
|
|
78
|
+
tradedangerous-11.3.0.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
|
|
79
|
+
tradedangerous-11.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|