diff --git a/MANIFEST.in b/MANIFEST.in index c2cd5ac..a159d6a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include rust/Cargo.toml include rust/.cargo/config recursive-include rust/src * -recursive-include ed_lrr_gui * +recursive-include ed_lrr_gui * \ No newline at end of file diff --git a/README.md b/README.md index bfd9d1e..dfeabf9 100644 --- a/README.md +++ b/README.md @@ -2,29 +2,36 @@ ## Features -- Three different routing algorithms: +- Five different routing algorithms: - **Breadth-first search:**, always finds the shortest route but is quite slow + - **Bidirectional BFS:**: should give similar route quality to BFS but take less time (not yet implemented) - **A-Star:** has an adjustable tradeoff between speed and quality - **Greedy search:** always picks the next reachable star that's closest to the destination, very fast but very poor quality routes + - **Economic:** computes route with lowest possible fuel consumption (WIP) - Nice GUI! (made with PyQt5) - Two themes! (Dark and Light) -- Uses data from (EDSM)[https://edsm.net/] for star data +- Uses data from [EDSM](https://edsm.net/) for star data - Only routes through scoopable systems, no more running out of fuel! (assuming you have a fuel scoop) -- Precomputing of BFS routing graphs for near-instant routing from your home system to any destination! +- Take fuel consumption into account and add refueling stops along the route (Not yet implemented) +- Precomputing of BFS routing graphs for: + - near-instant routing from your home system to any destination! + - near-instant routing any source back to your-home system (WIP)! + - near-instant routing between any pair of systems (Not yet implemented, see TODO) - Routing code written in Rust, so it's quite speedy! -- Export routes as HTML, JSON, CSV and SVG (WIP!) -- Automagically copy next jump destination into system clipboard (works by monitoring the player journal file) +- Export routes as HTML, JSON, CSV and SVG (WIP) +- Automagically copy next jump destination into system clipboard (works by monitoring the player journal file) (Not yet implemented) +- (optional) Web interface with job queue for route computations and multi-user support # Installation ## Prerequisites - Python: - - conda (miniconda/anaconda) - - tox (`conda install tox`) - - Inno Setup Compiler - - Download from [here](http://www.jrsoftware.org/isdl.php) - - or install via [scoop](https://scoop.sh/) `scoop install inno-setup`) + - conda ([Miniconda](https://docs.conda.io/en/latest/miniconda.html)/[Anaconda](https://www.anaconda.com/distribution/)) + - [nox](https://nox.thea.codes/en/stable/index.html) +- Inno Setup Compiler + - Download from [here](http://www.jrsoftware.org/isdl.php) + - or install via [scoop](https://scoop.sh/) `scoop install inno-setup`) - Visual Studio 2019 - nightly rust compiler (`x86_64-pc-windows-msvc`) @@ -32,9 +39,8 @@ (Assuming `conda` is in your `PATH`) -1. Start a Visual Studio 2019 x64 command prompt -2. Run `tox` -3. Grab the installer from `installer/Output/` +1. Run `nox -k build` +2. Grab the installer from `installer/Output/` ## Manual installation @@ -44,23 +50,86 @@ 2. Run the following commands: ``` -conda install pycrypto nuitka -pip install PyQt5 setuptools_rust -python build_gui.py -pip install . +conda install pycrypto ujson +pip install setuptools_rust +pip install .[all] ``` then you can run `ed_lrr -h` from your command prompt to get help +# Notes on FSD Fuel consumption and jump range + +FSD Fuel consumption ([E:D Wiki](https://elite-dangerous.fandom.com/wiki/Frame_Shift_Drive#Hyperspace_Fuel_Equation)): $$Fuel = 0.001 \cdot l \cdot \left(\frac{dist \cdot \left(m_{fuel} + +m_{ship}\right)}{boost \cdot m_{opt}}\right)^{p}$$ + +Solving for $dist$ gives the jump range (in Ly) for a given amount of fuel (in tons) as: $$dist = \frac{boost \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}$$ + +Assuming $f_{max}$ tons of available fuel gives us the maximum jump range for a single jump as: $$dist_{max} = \frac{boost \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot f_{max}}{l}\right)^{\frac{1}{p}}}{f_{max} + m_{ship}}$$ + +Since the guardian FSD booster increases the maximum jump range by $B_g$ Ly we can calculate a correction factor for the fuel consumption as: $$0.001 \cdot l \cdot \left(\frac{boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{B_{g} \cdot \left(m_{fuel} + m_{ship}\right) + boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}\right)^{p}$$ + +Incorporating $e_{fuel}$ into the distance equation yields $$dist = \frac{boost \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot e_{fuel} \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}$$ + +Expanding $e_{fuel}$ yields $$dist = \frac{boost \cdot m_{opt} \cdot \left(1.0 \cdot \left(\frac{boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{B_{g} \cdot \left(m_{fuel} + m_{ship}\right) + boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}\right)^{p} \cdot \min\left(f_{max}, m_{fuel}\right)\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}$$ + +Finally, Expanding $dist_{max}$ yields the full equation as $$dist = \frac{boost \cdot m_{opt} \cdot \left(\frac{1000000.0 \cdot \left(\frac{boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{B_{g} \cdot \left(m_{fuel} + m_{ship}\right) + boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}\right)^{- p} \cdot \min\left(f_{max}, m_{fuel}\right)}{l^{2}}\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}$$ + +Where: +- $Fuel$ is the fuel needed to jump (in tons) +- $l$ is the linear constant of your FSD (depends on the rating) +- $p$ is the power constant of your FSD (depends on the class) +- $m_{ship}$ is the mass of your ship (including cargo) +- $m_{fuel}$ is the amount of fuel in tons currently stored in your tanks +- $m_{opt}$ is the optimized mass of your FSD (in tons) +- $f_{max}$ is the maximum amount of fuel your FSD can use per jump +- $boost$ is the "boost factor" of your FSD (1.0 when jumping normally, 1.5 when supercharged by a white dwarf, 4.0 for a neutron star, etc) +- $dist$ is the distance you can jump with a given fuel amount +- $dist_{max}$ is the maximum distance you can jump (when $m_{fuel}=f_{max}$) +- $B_{g}$ is the amount of Ly added by your Guardian FSD Booster +- $e_{fuel}$ is the efficiency increase added by the Guardian FSD Booster + +# Fuel multiplier (CMDR jonburnage) + +$$F_f = f_{max} \cdot \left(\frac{B_{g} \cdot m_{ship}}{m_{opt}} + l \cdot \left(\frac{f_{max}}{l}\right)^{\frac{1}{p}}\right)^{- p}$$ + +# Fuel multiplier (Spansh) + +$$F_f = 0.001 \cdot l \cdot \left(\frac{boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{\left(B_{g} + \frac{boost^{2} \cdot m_ +{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}\right) \cdot \left(m_{fuel} + m_{ship}\right)}\right)^{p}$$ + +$$ F_f = 0.001 \cdot l \cdot \left(\frac{boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{B_{g} \cdot \left(m_{fuel} + m_{ship}\right) + boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}\right)^{p}$$ + +$$dist = \frac{boost \cdot m_{opt} \cdot \left(1.0 \cdot \left(\frac{boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{B_{g} \cdot \left(m_{fuel} + m_{ship}\right) + boost^{2} \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}\right)^{p} \cdot \min\left(f_{max}, m_{fuel}\right)\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}$$ + +# Misc Stuff + +--- + +$$dist = \frac{- B_{g} \cdot m_{fuel} - B_{g} \cdot m_{ship} + boost \cdot m_{opt} \cdot \left(\frac{1000.0 \cdot e_{fuel} \cdot \min\left(f_{max}, m_{fuel}\right)}{l}\right)^{\frac{1}{p}}}{m_{fuel} + m_{ship}}$$ + +$$e_{fuel} = \frac{l \cdot \left(\frac{10.0^{- \frac{3.0}{p}} \cdot \left(B_{g} + dist\right) \cdot \left(m_{fuel} + m_{ship}\right)}{boost \cdot m_{opt}}\right)^{p}}{\min\left(f_{max}, m_{fuel}\right)}$$ + + + +--- + # TODO ## Routing +- Implement Neutron Mode + - Filter for neutron stars, plot route, then plot "fine" router between waypoints + - What Jump-Range to use for neutron route? `max_range*4`? +- Implement Bidir BFS +- Optimized All-Pairs BFS for graph precomputation +- Take fuel consumption into account (WIP) + - Guardian Booster support (Done?) + - Economic routing - Custom weights and filtering for routing ## GUI -- Implement estimate time to completion display for route computation and preprocessing +- Implement estimate time to completion display for route computation and preprocessing (Done?) - Export route as: - JSON - HTML (WIP) @@ -74,6 +143,8 @@ then you can run `ed_lrr -h` from your command prompt to get help ## Preprocessing - Build index over `systemsWithCoordinates.json` instead of loading it into RAM (reuse modified `LineCache` from `router.rs`) +- Finish `galaxy.jsonl` preprocessor +- Implement Python interface to preprocessor ## Misc diff --git a/celery/celery_worker.py b/celery/celery_worker.py index 92db4a6..d6e6d63 100644 --- a/celery/celery_worker.py +++ b/celery/celery_worker.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import time from celery_test import route import sys diff --git a/docs/src/img_out.py b/docs/src/img_out.py index 6a76fbd..03ef3b2 100644 --- a/docs/src/img_out.py +++ b/docs/src/img_out.py @@ -50,13 +50,30 @@ PL.scatter( rasterized=True, ) PL.scatter( - p[:, 0], p[:, 1], marker="s", s=0.2, edgecolor="None", c=colors, rasterized=True + p[:, 0], + p[:, 1], + marker="s", + s=0.2, + edgecolor="None", + c=colors, + rasterized=True ) PL.plot(f1[0], f1[1], "r.", label="Source") PL.plot(f2[0], f2[1], "g.", label="Destination") -max_v = max(p_orig[:, 0].max(), p_orig[:, 1].max(), f1[0], f1[1], f2[0], f2[1]) + 2 -min_v = min(p_orig[:, 0].min(), p_orig[:, 1].min(), f1[0], f1[1], f2[0], f2[1]) - 2 +max_v = max( + p_orig[:, 0].max(), + p_orig[:, 1].max(), + f1[0], f1[1], + f2[0], f2[1] +) + 2 + +min_v = min( + p_orig[:, 0].min(), + p_orig[:, 1].min(), + f1[0], f1[1], + f2[0], f2[1] +) - 2 PL.xlim(min_v, max_v) diff --git a/ed_lrr_gui/html_export.py b/ed_lrr_gui/html_export.py index 3193d9c..e0fbec3 100644 --- a/ed_lrr_gui/html_export.py +++ b/ed_lrr_gui/html_export.py @@ -27,960 +27,6 @@ colors = { "Neutron": "#99A0FF", } -route = [ - { - "star_type": "F (White) Star", - "system": "Ix", - "body": "Ix", - "distance": 0, - "pos": [-65.21875, 7.75, -111.03125], - }, - { - "star_type": "Neutron Star", - "system": "18 Camelopardalis", - "body": "18 Camelopardalis C", - "distance": 90212, - "pos": [-57.9375, 31.96875, -122.5625], - }, - { - "star_type": "K (Yellow-Orange giant) Star", - "system": "HIP 4024", - "body": "HIP 4024", - "distance": 0, - "pos": [-22.09375, -122.65625, -15.96875], - }, - { - "star_type": "M (Red dwarf) Star", - "system": "Ceti Sector XU-P b5-2", - "body": "Ceti Sector XU-P b5-2", - "distance": 0, - "pos": [-17.78125, -156.375, 16.0], - }, - { - "star_type": "Neutron Star", - "system": "Beta Sculptoris", - "body": "Beta Sculptoris B", - "distance": 1669, - "pos": [4.875, -164.53125, 56.5625], - }, - { - "star_type": "Neutron Star", - "system": "Rukbat", - "body": "Rukbat B", - "distance": 270382, - "pos": [5.75, -73.0625, 166.375], - }, - { - "star_type": "Neutron Star", - "system": "53 Sagittarii", - "body": "53 Sagittarii C", - "distance": 39573, - "pos": [-86.75, -116.625, 287.3125], - }, - { - "star_type": "Neutron Star", - "system": "3 Capricorni", - "body": "3 Capricorni C", - "distance": 9867, - "pos": [-210.53125, -186.59375, 342.40625], - }, - { - "star_type": "Neutron Star", - "system": "68 Aquilae", - "body": "68 Aquilae B", - "distance": 593, - "pos": [-368.78125, -240.84375, 411.65625], - }, - { - "star_type": "Neutron Star", - "system": "HIP 99600", - "body": "HIP 99600 C", - "distance": 15368, - "pos": [-532.34375, -211.875, 494.375], - }, - { - "star_type": "Neutron Star", - "system": "Col 359 Sector CG-O d6-7", - "body": "Col 359 Sector CG-O d6-7", - "distance": 0, - "pos": [-534.875, -182.375, 667.28125], - }, - { - "star_type": "Neutron Star", - "system": "Col 359 Sector IC-M d7-13", - "body": "Col 359 Sector IC-M d7-13 A", - "distance": 0, - "pos": [-659.6875, -274.84375, 774.15625], - }, - { - "star_type": "F (White) Star", - "system": "Swoiwns UK-M d8-16", - "body": "Swoiwns UK-M d8-16", - "distance": 0, - "pos": [-656.75, -276.25, 963.90625], - }, - { - "star_type": "Neutron Star", - "system": "Swoiwns SP-M d8-57", - "body": "Swoiwns SP-M d8-57 A", - "distance": 0, - "pos": [-665.28125, -238.15625, 991.21875], - }, - { - "star_type": "M (Red dwarf) Star", - "system": "Swoiwns WC-K b41-2", - "body": "Swoiwns WC-K b41-2", - "distance": 0, - "pos": [-814.75, -266.4375, 1104.25], - }, - { - "star_type": "Neutron Star", - "system": "HD 184180", - "body": "HD 184180 B", - "distance": 27, - "pos": [-847.53125, -250.84375, 1108.9375], - }, - { - "star_type": "Neutron Star", - "system": "HD 187168", - "body": "HD 187168 B", - "distance": 1901, - "pos": [-883.84375, -357.0625, 1118.0], - }, - { - "star_type": "A (Blue-White) Star", - "system": "Swoiwns GT-G d11-7", - "body": "Swoiwns GT-G d11-7 A", - "distance": 0, - "pos": [-970.25, -496.8125, 1179.34375], - }, - { - "star_type": "F (White) Star", - "system": "Swoiwns IO-G d11-13", - "body": "Swoiwns IO-G d11-13", - "distance": 0, - "pos": [-987.3125, -538.09375, 1181.4375], - }, - { - "star_type": "M (Red dwarf) Star", - "system": "Swoiwns QC-N c22-3", - "body": "Swoiwns QC-N c22-3 A", - "distance": 0, - "pos": [-1007.375, -576.59375, 1177.5], - }, - { - "star_type": "Neutron Star", - "system": "Swoiwns KJ-G d11-14", - "body": "Swoiwns KJ-G d11-14", - "distance": 0, - "pos": [-989.90625, -595.34375, 1199.25], - }, - { - "star_type": "Neutron Star", - "system": "Swoiwns KE-G d11-6", - "body": "Swoiwns KE-G d11-6 A", - "distance": 0, - "pos": [-1112.3125, -719.0, 1231.59375], - }, - { - "star_type": "Neutron Star", - "system": "Swoiwns SA-E d12-6", - "body": "Swoiwns SA-E d12-6 A", - "distance": 0, - "pos": [-1140.4375, -880.90625, 1285.375], - }, - { - "star_type": "Neutron Star", - "system": "Swoiwns VQ-D d12-1", - "body": "Swoiwns VQ-D d12-1 A", - "distance": 0, - "pos": [-1239.5, -1007.59375, 1331.21875], - }, - { - "star_type": "Neutron Star", - "system": "Prooe Drye RD-A d14-3", - "body": "Prooe Drye RD-A d14-3", - "distance": 0, - "pos": [-1401.78125, -1061.375, 1415.75], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp HP-A d6", - "body": "Aucopp HP-A d6", - "distance": 0, - "pos": [-1554.03125, -1057.09375, 1525.875], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp IL-Y e0", - "body": "Aucopp IL-Y e0 B", - "distance": 236942, - "pos": [-1635.21875, -1118.84375, 1661.21875], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp RH-V d2-7", - "body": "Aucopp RH-V d2-7", - "distance": 0, - "pos": [-1741.25, -1040.6875, 1778.28125], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp ZO-R d4-5", - "body": "Aucopp ZO-R d4-5 A", - "distance": 0, - "pos": [-1840.09375, -1076.59375, 1911.125], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp OX-U e2-0", - "body": "Aucopp OX-U e2-0", - "distance": 0, - "pos": [-1849.09375, -1103.5625, 2097.09375], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp MS-K d8-0", - "body": "Aucopp MS-K d8-0 A", - "distance": 0, - "pos": [-1979.75, -1052.34375, 2226.71875], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp VZ-G d10-3", - "body": "Aucopp VZ-G d10-3 A", - "distance": 0, - "pos": [-2057.65625, -1127.40625, 2381.375], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp CM-D d12-0", - "body": "Aucopp CM-D d12-0 A", - "distance": 0, - "pos": [-2136.03125, -1135.1875, 2547.53125], - }, - { - "star_type": "Neutron Star", - "system": "Aucopp JY-Z d13-6", - "body": "Aucopp JY-Z d13-6", - "distance": 0, - "pos": [-2222.65625, -1104.75, 2714.71875], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae CV-Y d8", - "body": "Drojeae CV-Y d8", - "distance": 0, - "pos": [-2290.5, -1060.5, 2881.40625], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae LC-V d2-0", - "body": "Drojeae LC-V d2-0 A", - "distance": 0, - "pos": [-2377.71875, -1131.625, 3024.8125], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae SO-R d4-1", - "body": "Drojeae SO-R d4-1", - "distance": 0, - "pos": [-2424.40625, -1067.625, 3199.59375], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae XF-O d6-1", - "body": "Drojeae XF-O d6-1", - "distance": 0, - "pos": [-2542.5625, -1061.3125, 3343.25], - }, - { - "star_type": "Neutron Star", - "system": "Drojo VN-K d8-5", - "body": "Drojo VN-K d8-5", - "distance": 0, - "pos": [-2628.125, -1074.40625, 3511.4375], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae PZ-G d10-3", - "body": "Drojeae PZ-G d10-3 A", - "distance": 0, - "pos": [-2535.71875, -1121.9375, 3664.3125], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae UQ-D d12-4", - "body": "Drojeae UQ-D d12-4 A", - "distance": 0, - "pos": [-2574.0, -1062.40625, 3836.1875], - }, - { - "star_type": "Neutron Star", - "system": "Drojeae EY-Z d13-3", - "body": "Drojeae EY-Z d13-3 A", - "distance": 0, - "pos": [-2570.65625, -1081.65625, 4024.4375], - }, - { - "star_type": "Neutron Star", - "system": "Blae Drye YU-Y d5", - "body": "Blae Drye YU-Y d5", - "distance": 0, - "pos": [-2614.1875, -1046.90625, 4185.125], - }, - { - "star_type": "Neutron Star", - "system": "Thailoi VH-V d2-6", - "body": "Thailoi VH-V d2-6", - "distance": 0, - "pos": [-2664.0625, -1044.5625, 4366.71875], - }, - { - "star_type": "Neutron Star", - "system": "Thailoi DP-R d4-8", - "body": "Thailoi DP-R d4-8", - "distance": 0, - "pos": [-2796.4375, -1080.375, 4491.90625], - }, - { - "star_type": "Neutron Star", - "system": "Thailoi MB-O d6-5", - "body": "Thailoi MB-O d6-5 A", - "distance": 0, - "pos": [-2758.75, -1096.5625, 4672.21875], - }, - { - "star_type": "Neutron Star", - "system": "Thailoi XT-I d9-1", - "body": "Thailoi XT-I d9-1 A", - "distance": 0, - "pos": [-2788.84375, -1115.1875, 4858.53125], - }, - { - "star_type": "Neutron Star", - "system": "Thailoi GG-F d11-3", - "body": "Thailoi GG-F d11-3", - "distance": 0, - "pos": [-2731.46875, -1093.25, 5034.46875], - }, - { - "star_type": "Neutron Star", - "system": "Thailoi MX-B d13-14", - "body": "Thailoi MX-B d13-14", - "distance": 0, - "pos": [-2761.1875, -1059.65625, 5217.21875], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau IP-A d5", - "body": "Pyraleau IP-A d5", - "distance": 0, - "pos": [-2757.46875, -1030.96875, 5406.625], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau WC-V d2-8", - "body": "Pyraleau WC-V d2-8 A", - "distance": 0, - "pos": [-2783.15625, -1084.0, 5588.78125], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau DP-R d4-3", - "body": "Pyraleau DP-R d4-3", - "distance": 0, - "pos": [-2836.5, -1111.5, 5757.3125], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau KB-O d6-10", - "body": "Pyraleau KB-O d6-10", - "distance": 0, - "pos": [-2897.9375, -1096.4375, 5928.53125], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau SN-K d8-0", - "body": "Pyraleau SN-K d8-0", - "distance": 0, - "pos": [-2925.28125, -1123.90625, 6106.71875], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau ZZ-G d10-7", - "body": "Pyraleau ZZ-G d10-7", - "distance": 0, - "pos": [-2950.84375, -1113.15625, 6289.15625], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau GM-D d12-8", - "body": "Pyraleau GM-D d12-8 A", - "distance": 0, - "pos": [-3073.53125, -1138.15625, 6431.0625], - }, - { - "star_type": "Neutron Star", - "system": "Pyraleau PT-Z d13-8", - "body": "Pyraleau PT-Z d13-8", - "distance": 0, - "pos": [-3143.46875, -1154.5, 6599.71875], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae KL-Y d1", - "body": "Nyeajaae KL-Y d1", - "distance": 0, - "pos": [-3228.375, -1173.59375, 6757.78125], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae UI-T d3-1", - "body": "Nyeajaae UI-T d3-1 A", - "distance": 0, - "pos": [-3250.09375, -1137.59375, 6936.71875], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae WO-R d4-0", - "body": "Nyeajaae WO-R d4-0", - "distance": 0, - "pos": [-3354.8125, -1108.34375, 7094.65625], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae IH-M d7-5", - "body": "Nyeajaae IH-M d7-5 A", - "distance": 0, - "pos": [-3417.0, -1139.09375, 7260.09375], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae PT-I d9-3", - "body": "Nyeajaae PT-I d9-3", - "distance": 0, - "pos": [-3485.6875, -1144.21875, 7430.28125], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae VF-F d11-2", - "body": "Nyeajaae VF-F d11-2 A", - "distance": 0, - "pos": [-3600.21875, -1137.9375, 7582.625], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae YL-D d12-12", - "body": "Nyeajaae YL-D d12-12 A", - "distance": 0, - "pos": [-3735.65625, -1133.53125, 7716.8125], - }, - { - "star_type": "Neutron Star", - "system": "Nyeajaae EY-Z d13-0", - "body": "Nyeajaae EY-Z d13-0", - "distance": 0, - "pos": [-3858.5625, -1090.625, 7851.875], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge PQ-Y d8", - "body": "Flyiedge PQ-Y d8 A", - "distance": 0, - "pos": [-3909.71875, -1078.46875, 8035.65625], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge XC-V d2-16", - "body": "Flyiedge XC-V d2-16 A", - "distance": 0, - "pos": [-3984.84375, -1092.5, 8204.46875], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge EP-R d4-3", - "body": "Flyiedge EP-R d4-3", - "distance": 0, - "pos": [-4055.96875, -1086.71875, 8366.0625], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge PH-M d7-17", - "body": "Flyiedge PH-M d7-17 A", - "distance": 0, - "pos": [-4091.84375, -1074.125, 8547.46875], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge SN-K d8-20", - "body": "Flyiedge SN-K d8-20", - "distance": 0, - "pos": [-4213.84375, -1107.21875, 8686.3125], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge DG-F d11-22", - "body": "Flyiedge DG-F d11-22", - "distance": 0, - "pos": [-4267.0625, -1139.0625, 8859.75], - }, - { - "star_type": "Neutron Star", - "system": "Flyiedge KS-B d13-53", - "body": "Flyiedge KS-B d13-53 A", - "distance": 0, - "pos": [-4305.25, -1101.15625, 9041.0], - }, - { - "star_type": "Neutron Star", - "system": "Skaude GK-A d17", - "body": "Skaude GK-A d17 A", - "distance": 0, - "pos": [-4329.59375, -1097.03125, 9222.90625], - }, - { - "star_type": "Neutron Star", - "system": "Skaude LB-X d1-27", - "body": "Skaude LB-X d1-27", - "distance": 0, - "pos": [-4429.28125, -1046.4375, 9374.21875], - }, - { - "star_type": "Neutron Star", - "system": "Skaude KR-W e1-5", - "body": "Skaude KR-W e1-5", - "distance": 0, - "pos": [-4494.875, -1064.8125, 9548.1875], - }, - { - "star_type": "Neutron Star", - "system": "Skaude AA-Q d5-60", - "body": "Skaude AA-Q d5-60 A", - "distance": 0, - "pos": [-4528.8125, -1059.53125, 9734.78125], - }, - { - "star_type": "Neutron Star", - "system": "Skaude LS-K d8-0", - "body": "Skaude LS-K d8-0 A", - "distance": 0, - "pos": [-4611.90625, -1064.71875, 9902.3125], - }, - { - "star_type": "Neutron Star", - "system": "Skaude SE-H d10-0", - "body": "Skaude SE-H d10-0 A", - "distance": 0, - "pos": [-4697.96875, -1051.0625, 10069.53125], - }, - { - "star_type": "Neutron Star", - "system": "Skaude YQ-D d12-11", - "body": "Skaude YQ-D d12-11", - "distance": 0, - "pos": [-4788.53125, -1064.34375, 10235.8125], - }, - { - "star_type": "Neutron Star", - "system": "Skaude FD-A d14-51", - "body": "Skaude FD-A d14-51 A", - "distance": 0, - "pos": [-4896.46875, -1063.03125, 10394.53125], - }, - { - "star_type": "Neutron Star", - "system": "Preia Phoe AV-Y d54", - "body": "Preia Phoe AV-Y d54", - "distance": 0, - "pos": [-4988.53125, -1028.5, 10557.59375], - }, - { - "star_type": "Neutron Star", - "system": "Preia Phoe CL-Y e7", - "body": "Preia Phoe CL-Y e7 A", - "distance": 0, - "pos": [-5111.71875, -1079.0, 10695.0], - }, - { - "star_type": "Neutron Star", - "system": "Prua Phoe ZN-T d3-51", - "body": "Prua Phoe ZN-T d3-51 A", - "distance": 0, - "pos": [-5260.4375, -1044.625, 10804.71875], - }, - { - "star_type": "Neutron Star", - "system": "Prua Phoe RX-U e2-10", - "body": "Prua Phoe RX-U e2-10", - "distance": 0, - "pos": [-5333.375, -1048.625, 10974.53125], - }, - { - "star_type": "Neutron Star", - "system": "Prua Phoe NM-M d7-96", - "body": "Prua Phoe NM-M d7-96", - "distance": 0, - "pos": [-5364.96875, -1005.46875, 11158.21875], - }, - { - "star_type": "Neutron Star", - "system": "Prua Phoe UY-I d9-118", - "body": "Prua Phoe UY-I d9-118", - "distance": 0, - "pos": [-5457.6875, -1013.25, 11325.3125], - }, - { - "star_type": "Neutron Star", - "system": "Prua Phoe BL-F d11-40", - "body": "Prua Phoe BL-F d11-40 A", - "distance": 0, - "pos": [-5546.8125, -1021.5625, 11494.65625], - }, - { - "star_type": "Neutron Star", - "system": "Prua Phoe MD-A d14-112", - "body": "Prua Phoe MD-A d14-112 A", - "distance": 0, - "pos": [-5610.78125, -1003.90625, 11671.0], - }, - { - "star_type": "Neutron Star", - "system": "Clooku HV-Y d70", - "body": "Clooku HV-Y d70", - "distance": 0, - "pos": [-5685.59375, -990.4375, 11841.84375], - }, - { - "star_type": "Neutron Star", - "system": "Clooku PH-V d2-70", - "body": "Clooku PH-V d2-70", - "distance": 0, - "pos": [-5742.4375, -986.3125, 12017.6875], - }, - { - "star_type": "Neutron Star", - "system": "Clooku VT-R d4-64", - "body": "Clooku VT-R d4-64", - "distance": 0, - "pos": [-5844.5, -1003.53125, 12178.5625], - }, - { - "star_type": "Neutron Star", - "system": "Clooku CG-O d6-62", - "body": "Clooku CG-O d6-62", - "distance": 0, - "pos": [-5947.96875, -990.6875, 12336.15625], - }, - { - "star_type": "Neutron Star", - "system": "Clooku JS-K d8-209", - "body": "Clooku JS-K d8-209 A", - "distance": 0, - "pos": [-6040.5625, -1003.03125, 12503.03125], - }, - { - "star_type": "Neutron Star", - "system": "Clooku QE-H d10-213", - "body": "Clooku QE-H d10-213", - "distance": 0, - "pos": [-6136.1875, -1019.96875, 12668.0], - }, - { - "star_type": "Neutron Star", - "system": "Clooku XQ-D d12-40", - "body": "Clooku XQ-D d12-40", - "distance": 0, - "pos": [-6220.71875, -1014.1875, 12838.8125], - }, - { - "star_type": "Neutron Star", - "system": "Clooku ED-A d14-159", - "body": "Clooku ED-A d14-159", - "distance": 0, - "pos": [-6292.6875, -1042.96875, 13010.40625], - }, - { - "star_type": "Neutron Star", - "system": "Nuekuae CL-Y e121", - "body": "Nuekuae CL-Y e121", - "distance": 0, - "pos": [-6378.90625, -1062.1875, 13176.46875], - }, - { - "star_type": "Neutron Star", - "system": "Nuekuae MI-T d3-319", - "body": "Nuekuae MI-T d3-319", - "distance": 0, - "pos": [-6447.75, -1075.625, 13347.625], - }, - { - "star_type": "Neutron Star", - "system": "Stuelou HA-Q d5-181", - "body": "Stuelou HA-Q d5-181", - "distance": 0, - "pos": [-6533.59375, -1062.875, 13513.9375], - }, - { - "star_type": "Neutron Star", - "system": "Stuelou OM-M d7-64", - "body": "Stuelou OM-M d7-64", - "distance": 0, - "pos": [-6622.1875, -1051.3125, 13678.375], - }, - { - "star_type": "Neutron Star", - "system": "Stuelou UY-I d9-13", - "body": "Stuelou UY-I d9-13 A", - "distance": 0, - "pos": [-6724.65625, -1050.875, 13839.84375], - }, - { - "star_type": "Neutron Star", - "system": "Stuelou DG-F d11-114", - "body": "Stuelou DG-F d11-114 A", - "distance": 0, - "pos": [-6808.03125, -1092.25, 14004.40625], - }, - { - "star_type": "Neutron Star", - "system": "Stuelou IX-B d13-188", - "body": "Stuelou IX-B d13-188", - "distance": 0, - "pos": [-6875.40625, -1043.1875, 14176.4375], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec DP-A d53", - "body": "Blua Eaec DP-A d53 A", - "distance": 0, - "pos": [-6961.6875, -1032.90625, 14342.40625], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec LB-X d1-92", - "body": "Blua Eaec LB-X d1-92 A", - "distance": 0, - "pos": [-7011.84375, -1031.78125, 14525.3125], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec SN-T d3-478", - "body": "Blua Eaec SN-T d3-478", - "distance": 0, - "pos": [-7100.375, -1016.5625, 14689.59375], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec NX-U e2-714", - "body": "Blua Eaec NX-U e2-714 A", - "distance": 0, - "pos": [-7158.40625, -1024.6875, 14872.375], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec KS-K d8-157", - "body": "Blua Eaec KS-K d8-157 A", - "distance": 0, - "pos": [-7251.0625, -1051.09375, 15035.46875], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec RE-H d10-125", - "body": "Blua Eaec RE-H d10-125", - "distance": 0, - "pos": [-7327.90625, -1008.21875, 15204.4375], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec YQ-D d12-203", - "body": "Blua Eaec YQ-D d12-203", - "distance": 0, - "pos": [-7417.40625, -1001.15625, 15373.3125], - }, - { - "star_type": "Neutron Star", - "system": "Blua Eaec BW-N e6-503", - "body": "Blua Eaec BW-N e6-503", - "distance": 0, - "pos": [-7493.4375, -1021.5, 15545.5], - }, - { - "star_type": "Neutron Star", - "system": "Boelts AV-Y d430", - "body": "Boelts AV-Y d430 A", - "distance": 0, - "pos": [-7572.5, -1026.59375, 15719.5], - }, - { - "star_type": "Neutron Star", - "system": "Boelts CL-Y e45", - "body": "Boelts CL-Y e45", - "distance": 0, - "pos": [-7660.03125, -1005.0, 15888.65625], - }, - { - "star_type": "Neutron Star", - "system": "Boeph RX-U e2-1248", - "body": "Boeph RX-U e2-1248", - "distance": 0, - "pos": [-7750.6875, -997.90625, 16057.0], - }, - { - "star_type": "Neutron Star", - "system": "Boeph VD-T e3-102", - "body": "Boeph VD-T e3-102 A", - "distance": 0, - "pos": [-7797.46875, -1012.0, 16242.21875], - }, - { - "star_type": "Neutron Star", - "system": "Boeph WY-I d9-1143", - "body": "Boeph WY-I d9-1143 A", - "distance": 0, - "pos": [-7877.125, -1004.78125, 16415.46875], - }, - { - "star_type": "Neutron Star", - "system": "Boeph DL-F d11-417", - "body": "Boeph DL-F d11-417 A", - "distance": 0, - "pos": [-7960.5, -1006.8125, 16588.21875], - }, - { - "star_type": "Neutron Star", - "system": "Boeph KX-B d13-683", - "body": "Boeph KX-B d13-683 A", - "distance": 0, - "pos": [-8040.15625, -1036.3125, 16758.71875], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae FP-A d1295", - "body": "Eoch Flyuae FP-A d1295 A", - "distance": 0, - "pos": [-8115.34375, -1056.625, 16933.96875], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae LB-X d1-742", - "body": "Eoch Flyuae LB-X d1-742", - "distance": 0, - "pos": [-8236.34375, -1028.09375, 17079.65625], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae SN-T d3-36", - "body": "Eoch Flyuae SN-T d3-36 A", - "distance": 0, - "pos": [-8330.71875, -1019.21875, 17246.40625], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae FG-Y f36", - "body": "Eoch Flyuae FG-Y f36 C", - "distance": 349, - "pos": [-8422.96875, -1020.75, 17414.34375], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae KS-K d8-435", - "body": "Eoch Flyuae KS-K d8-435", - "distance": 0, - "pos": [-8483.0, -1027.125, 17592.71875], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae UJ-R e4-63", - "body": "Eoch Flyuae UJ-R e4-63", - "distance": 0, - "pos": [-8577.1875, -1042.1875, 17756.625], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae YQ-D d12-33", - "body": "Eoch Flyuae YQ-D d12-33 A", - "distance": 0, - "pos": [-8634.96875, -1042.5625, 17939.46875], - }, - { - "star_type": "Neutron Star", - "system": "Eoch Flyuae GD-A d14-337", - "body": "Eoch Flyuae GD-A d14-337", - "distance": 0, - "pos": [-8697.9375, -1036.625, 18120.125], - }, - { - "star_type": "Neutron Star", - "system": "Dryio Flyuae AV-Y d1681", - "body": "Dryio Flyuae AV-Y d1681 A", - "distance": 0, - "pos": [-8792.0, -1020.15625, 18286.46875], - }, - { - "star_type": "Neutron Star", - "system": "Dryio Flyuae HH-V d2-2139", - "body": "Dryio Flyuae HH-V d2-2139 A", - "distance": 0, - "pos": [-8900.59375, -1012.96875, 18444.03125], - }, - { - "star_type": "Neutron Star", - "system": "Dryio Flyuae GR-W e1-1731", - "body": "Dryio Flyuae GR-W e1-1731", - "distance": 0, - "pos": [-8995.875, -1031.875, 18609.625], - }, - { - "star_type": "Neutron Star", - "system": "Dryooe Flyou PM-M d7-558", - "body": "Dryooe Flyou PM-M d7-558", - "distance": 0, - "pos": [-9071.84375, -997.625, 18782.28125], - }, - { - "star_type": "Neutron Star", - "system": "Dryooe Flyou WY-I d9-403", - "body": "Dryooe Flyou WY-I d9-403 A", - "distance": 0, - "pos": [-9136.875, -996.84375, 18961.5625], - }, - { - "star_type": "Neutron Star", - "system": "Dryooe Flyou DL-F d11-719", - "body": "Dryooe Flyou DL-F d11-719", - "distance": 0, - "pos": [-9221.8125, -1015.71875, 19131.40625], - }, - { - "star_type": "Neutron Star", - "system": "Dryooe Flyou KX-B d13-614", - "body": "Dryooe Flyou KX-B d13-614 A", - "distance": 0, - "pos": [-9307.0625, -1013.84375, 19300.375], - }, - { - "star_type": "Neutron Star", - "system": "Eol Prou FP-A d1088", - "body": "Eol Prou FP-A d1088", - "distance": 0, - "pos": [-9394.15625, -1010.34375, 19471.1875], - }, - { - "star_type": "Neutron Star", - "system": "Eol Prou MB-X d1-871", - "body": "Eol Prou MB-X d1-871 A", - "distance": 0, - "pos": [-9458.4375, -992.8125, 19650.71875], - }, - { - "star_type": "F (White) Star", - "system": "Colonia", - "body": "Colonia", - "distance": 0, - "pos": [-9530.5, -910.28125, 19808.125], - }, -] entries = [] prev = route[0] num = 1 diff --git a/ed_lrr_gui/web/app.py b/ed_lrr_gui/web/app.py index 3427d6b..b900dac 100644 --- a/ed_lrr_gui/web/app.py +++ b/ed_lrr_gui/web/app.py @@ -437,6 +437,13 @@ class Job(db.Model): db.session.add(self) db.session.commit() +class Ship(db.Model): + user_name = db.Column( + db.String, db.ForeignKey("user.name"), nullable=True, index=True, primary_key=True + ) + user = relationship("User", backref="ships") + ship = db.Column(db.JSONType, nullable=False, index=True, primary_key = True) + db.create_all() for role in ["admin", "user", "worker_host"]: @@ -661,9 +668,11 @@ def change_password(): return render_template("form.html", form=form, title="Register") -@app.route("/workers/") + +@app.route("/workers/", defaults={"worker_id": None}) +@app.route("/workers/") @login_required -def worker(): +def worker(worker_id): return render_template("workers.html") diff --git a/icon/make.py b/icon/make.py index 2fccd8f..e9a42dd 100644 --- a/icon/make.py +++ b/icon/make.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import svgwrite import random -import time -from math import factorial, sin, cos, pi -from itertools import permutations +from math import sin, cos, pi import tsp as m_tsp @@ -45,6 +43,10 @@ def make_points(n, size, min_dist=0): return points +def ring_step(v): + return 10 + v * 10 + + def generate(seed, name=None, small=False): sd = 1 if small: @@ -55,7 +57,6 @@ def generate(seed, name=None, small=False): num_points = 5 min_dist = 10 + 10 + 20 * (max_rings + 1) base_r = 10 - ring_step = lambda v: 10 + v * 10 size = 1000 if name is None: name = seed @@ -73,7 +74,12 @@ def generate(seed, name=None, small=False): x2 /= sd y1 /= sd y2 /= sd - line = dwg.add(dwg.line((x1, y1), (x2, y2), stroke_width=w, stroke=color)) + dwg.add(dwg.line( + (x1, y1), + (x2, y2), + stroke_width=w, + stroke=color + )) for (px, py) in pos: base_r = 3 @@ -110,7 +116,12 @@ def generate(seed, name=None, small=False): ring_col = color if random.random() > 0.75: ring_col = "#ea0" - circ = dwg.add(dwg.circle((px, py), r=r, stroke_width=w, stroke=ring_col)) + circ = dwg.add(dwg.circle( + (px, py), + r=r, + stroke_width=w, + stroke=ring_col + )) circ.fill(color, opacity=0) d = random.random() * pi * 2 dx = cos(d) diff --git a/noxfile.py b/noxfile.py index c6e3543..7797fd6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -21,7 +21,7 @@ path += to_append path = os.pathsep.join(path) os.environ["PATH"] = path -versions = ["3.{}".format(s) for s in [5, 6, 7, 8]] +versions = ["3.{}".format(s) for s in [6, 7, 8]] versions += ["3"] @@ -35,7 +35,7 @@ def devenv(session): location = os.path.abspath(session._runner.venv.location_name) session.env["PATH"] = os.pathsep.join([location, path, location]) session.conda_install("pycrypto", "ujson") - session.install("--no-cache-dir", "-e", ".[all]") + session.install("--no-cache-dir", "-e",".[all]") logger.warning(f'Devenv set up, now run "conda activate {location}"') diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 28922b0..cd1d3fa 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1,20 +1,43 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "addr2line" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gimli 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "adler32" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "aho-corasick" -version = "0.7.8" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "as-slice" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -25,30 +48,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.44" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "addr2line 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "object 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "backtrace-sys" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "better-panic" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -58,7 +74,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -68,13 +84,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -87,13 +103,13 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -106,16 +122,21 @@ name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cc" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "chrono" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clicolors-control" version = "1.0.1" @@ -123,7 +144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -143,9 +164,9 @@ dependencies = [ "clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -173,11 +194,11 @@ name = "csv" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -190,21 +211,21 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.13" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "derivative" -version = "2.0.2" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -212,17 +233,17 @@ name = "dict_derive" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "digest" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -232,19 +253,21 @@ dependencies = [ "better-panic 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "derivative 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derivative 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "dict_derive 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "permutohedron 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pyo3 0.9.0-alpha.1 (git+https://github.com/PyO3/pyo3)", - "rstar 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pyo3 0.10.1 (git+https://github.com/PyO3/pyo3)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rstar 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -255,7 +278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "fnv" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -263,7 +286,24 @@ name = "generic-array" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "generic-array" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "generic-array" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -271,63 +311,87 @@ name = "ghost" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gimli" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hash32" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heapless" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "as-slice 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hash32 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hermit-abi" -version = "0.1.8" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "humantime" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "indoc" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "indoc-impl 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "indoc-impl 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "indoc-impl" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", "unindent 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "inventory" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ctor 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "ghost 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "inventory-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "inventory-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "inventory-impl" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -347,12 +411,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.67" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -368,9 +432,26 @@ name = "memchr" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "miniz_oxide" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-traits" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -378,13 +459,18 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "object" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "opaque-debug" version = "0.2.3" @@ -392,44 +478,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parking_lot" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste" -version = "0.1.7" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "paste-impl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" -version = "0.1.7" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -444,17 +527,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro-hack" -version = "0.5.11" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -462,51 +540,45 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.9.0-alpha.1" -source = "git+https://github.com/PyO3/pyo3#74b22eb651aac14cd64524219943b77cf7e700ac" +version = "0.10.1" +source = "git+https://github.com/PyO3/pyo3#93608bf031442fe41e8c259b392c2d2d78dc7d6e" dependencies = [ - "indoc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "inventory 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "pyo3cls 0.9.0-alpha.1 (git+https://github.com/PyO3/pyo3)", - "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "indoc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "inventory 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "pyo3cls 0.10.1 (git+https://github.com/PyO3/pyo3)", "unindent 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pyo3-derive-backend" -version = "0.9.0-alpha.1" -source = "git+https://github.com/PyO3/pyo3#74b22eb651aac14cd64524219943b77cf7e700ac" +version = "0.10.1" +source = "git+https://github.com/PyO3/pyo3#93608bf031442fe41e8c259b392c2d2d78dc7d6e" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pyo3cls" -version = "0.9.0-alpha.1" -source = "git+https://github.com/PyO3/pyo3#74b22eb651aac14cd64524219943b77cf7e700ac" +version = "0.10.1" +source = "git+https://github.com/PyO3/pyo3#93608bf031442fe41e8c259b392c2d2d78dc7d6e" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pyo3-derive-backend 0.9.0-alpha.1 (git+https://github.com/PyO3/pyo3)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "pyo3-derive-backend 0.10.1 (git+https://github.com/PyO3/pyo3)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -516,18 +588,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "1.3.4" +version = "1.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -535,16 +607,18 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.14" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rstar" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "heapless 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "pdqselect 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -554,7 +628,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ryu" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -564,47 +638,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.105" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.105" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.48" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" -version = "0.8.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" -version = "1.2.0" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "stable_deref_trait" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -614,20 +693,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.15" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termios" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -638,9 +717,18 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typenum" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -655,7 +743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -678,21 +766,23 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "743ad5a418686aad3b87fd14c43badd828cf26e214a00f92a384291cf22e1811" +"checksum addr2line 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" +"checksum adler32 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" +"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +"checksum as-slice 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37dfb65bc03b2bc85ee827004f14a6817e04160e3b1a28931986a666a9290e70" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" -"checksum backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536" -"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" +"checksum backtrace 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" "checksum better-panic 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d12a680cc74d8c4a44ee08be4a00dedf671b089c2440b2e3fdaa776cd468476" "checksum bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +"checksum block-buffer 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dbcf92448676f82bb7a334c58bbce8b0d43580fb5362a9d608b18879d12a3d31" "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -"checksum bstr 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "502ae1441a0a5adb8fbd38a5955a6416b9493e92b465de5e4a9bde6a539c2c48" +"checksum bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum console 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45e0f3986890b3acbc782009e2629dfe2baa430ac091519ce3be26164a2ae6c0" @@ -700,63 +790,73 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" "checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum ctor 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" -"checksum derivative 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1b94d2eb97732ec84b4e25eaf37db890e317b80e921f168c82cb5282473f8151" +"checksum ctor 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "39858aa5bac06462d4dd4b9164848eb81ffc4aa5c479746393598fd193afa227" +"checksum derivative 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" "checksum dict_derive 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d7ee5676aa48357bd5e8bcf095167e6678837232a7b85bce424f46cd93a2c60" -"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +"checksum digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" "checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd" +"checksum generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac746a5f3bbfdadd6106868134545e684693d54d9d44f6e9588a7d54af0bf980" "checksum ghost 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a36606a68532b5640dc86bb1f33c64b45c4682aad4c50f3937b317ea387f3d6" -"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" -"checksum humantime 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9b6c53306532d3c8e8087b44e6580e10db51a023cf9b433cea2ac38066b92da" -"checksum indoc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9553c1e16c114b8b77ebeb329e5f2876eed62a8d51178c8bc6bff0d65f98f8" -"checksum indoc-impl 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b714fc08d0961716390977cdff1536234415ac37b509e34e5a983def8340fb75" -"checksum inventory 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2bf98296081bd2cb540acc09ef9c97f22b7e487841520350293605db1b2c7a27" -"checksum inventory-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0a8e30575afe28eea36a9a39136b70b2fb6b0dd0a212a5bd1f30a498395c0274" +"checksum gimli 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +"checksum hash32 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4041af86e63ac4298ce40e5cca669066e75b6f1aa3390fe2561ffa5e1d9f4cc" +"checksum heapless 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "73a8a2391a3bc70b31f60e7a90daa5755a360559c0b6b9c5cfc0fee482362dc0" +"checksum hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +"checksum humantime 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" +"checksum indoc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "79255cf29f5711995ddf9ec261b4057b1deb34e66c90656c201e41376872c544" +"checksum indoc-impl 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "54554010aa3d17754e484005ea0022f1c93839aabc627c2c55f3d7b47206134c" +"checksum inventory 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "82d3f4b90287725c97b17478c60dda0c6324e7c84ee1ed72fb9179d0fdf13956" +"checksum inventory-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9092a4fefc9d503e9287ef137f03180a6e7d1b04c419563171ee14947c5e80ec" "checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" -"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" +"checksum libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +"checksum lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" -"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" +"checksum miniz_oxide 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum object 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" -"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" -"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" -"checksum paste 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "63e1afe738d71b1ebab5f1207c055054015427dbfc7bbe9ee1266894156ec046" -"checksum paste-impl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc4a7f6f743211c5aab239640a65091535d97d43d92a52bca435a640892bb" +"checksum parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +"checksum parking_lot_core 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +"checksum paste 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "026c63fe245362be0322bfec5a9656d458d13f9cfb1785d1b38458b9968e8080" +"checksum paste-impl 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9281a268ec213237dcd2aa3c3d0f46681b04ced37c1616fd36567a9e6954b0" "checksum pdqselect 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ec91767ecc0a0bbe558ce8c9da33c068066c57ecc8bb8477ef8c1ad3ef77c27" "checksum permutohedron 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b687ff7b5da449d39e418ad391e5e08da53ec334903ddbb921db208908fc372c" -"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum pyo3 0.9.0-alpha.1 (git+https://github.com/PyO3/pyo3)" = "" -"checksum pyo3-derive-backend 0.9.0-alpha.1 (git+https://github.com/PyO3/pyo3)" = "" -"checksum pyo3cls 0.9.0-alpha.1 (git+https://github.com/PyO3/pyo3)" = "" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" +"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +"checksum pyo3 0.10.1 (git+https://github.com/PyO3/pyo3)" = "" +"checksum pyo3-derive-backend 0.10.1 (git+https://github.com/PyO3/pyo3)" = "" +"checksum pyo3cls 0.10.1 (git+https://github.com/PyO3/pyo3)" = "" +"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" -"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" -"checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" -"checksum rstar 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0650eaaa56cbd1726fd671150fce8ac6ed9d9a25d1624430d7ee9d196052f6b6" +"checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +"checksum rstar 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b305196ce78c78c37c47890cfde452a14f8a5e7d5516314e69b062b5ed132c2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)" = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" -"checksum serde_derive 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)" = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" -"checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" -"checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" -"checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +"checksum serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243" +"checksum serde_derive 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57" +"checksum serde_json 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)" = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" +"checksum sha3 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b859cf80317bb4ab6b29422f3d77de357ef60a0e0b3dedf28469d2b11d098968" +"checksum smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -"checksum syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a0294dc449adc58bb6592fff1a23d3e5e6e235afc6a0ffca2657d19e7bbffe5" -"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" +"checksum syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" +"checksum termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +"checksum time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unindent 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "63f18aa3b0e35fed5a0048f029558b1518095ffe2a0a31fb87c93dece93a4993" -"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +"checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 33b5eef..603eea3 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,39 +1,42 @@ -[package] -name = "ed_lrr" -version = "0.2.0" -authors = ["Daniel Seiller "] -edition = "2018" -repository = "https://gitlab.com/Earthnuker/ed_lrr.git" -license = "WTFPL" - -[lib] -crate-type = ["cdylib"] -name = "_ed_lrr" - - -[[bin]] -name = "galaxy_test" -path = "src/galaxy.rs" - -[profile.release] -codegen-units = 1 -lto = true - -[dependencies] -pyo3 = { git = "https://github.com/PyO3/pyo3", features = ["extension-module"] } -csv = "1.1.3" -serde = { version = "1.0.105", features = ["derive"] } -humantime = "2.0.0" -permutohedron = "0.2.4" -serde_json = "1.0.48" -fnv = "1.0.6" -bincode = "1.2.1" -sha3 = "0.8.2" -byteorder = "1.3.4" -strsim = "0.10.0" -rstar = "0.7.1" -crossbeam-channel = "0.4.2" -better-panic = "0.2.0" -derivative = "2.0.2" -dict_derive = "0.2.0" -num_cpus = "1.12.0" +[package] +name = "ed_lrr" +version = "0.2.0" +authors = [ "Daniel Seiller ",] +edition = "2018" +repository = "https://gitlab.com/Earthnuker/ed_lrr.git" +license = "MIT" + +[lib] +crate-type = [ "cdylib",] +name = "_ed_lrr" + +[dependencies] +csv = "1.1.3" +humantime = "2.0.1" +permutohedron = "0.2.4" +serde_json = "1.0.55" +fnv = "1.0.7" +bincode = "1.2.1" +sha3 = "0.9.0" +byteorder = "1.3.4" +strsim = "0.10.0" +rstar = "0.8.0" +crossbeam-channel = "0.4.2" +better-panic = "0.2.0" +derivative = "2.1.1" +dict_derive = "0.2.0" +num_cpus = "1.13.0" +regex = "1.3.9" +chrono = "0.4.11" + +[dependencies.pyo3] +git = "https://github.com/PyO3/pyo3" +features = [ "extension-module",] + +[dependencies.serde] +version = "1.0.112" +features = [ "derive",] + +[profile.release] +codegen-units = 1 +lto = true diff --git a/rust/src/common.rs b/rust/src/common.rs index 78009f0..ad626e6 100644 --- a/rust/src/common.rs +++ b/rust/src/common.rs @@ -1,15 +1,86 @@ use crate::route::Router; use dict_derive::IntoPyObject; +use pyo3::conversion::ToPyObject; +use pyo3::prelude::*; +use pyo3::types::{PyDict, PyTuple}; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::collections::HashMap; -use std::num::ParseIntError; use std::path::PathBuf; -use std::str::FromStr; + +pub fn get_fsd_booster_info(class: usize) -> Result { + // Data from https://elite-dangerous.fandom.com/wiki/Guardian_Frame_Shift_Drive_Booster + let ret = match class { + 0 => 0.0, + 1 => 4.0, + 2 => 6.0, + 3 => 7.75, + 4 => 9.25, + 5 => 10.5, + _ => return Err(format!("Invalid Guardian booster class: {}", class)), + }; + return Ok(ret); +} + +pub fn get_fsd_info(rating: usize, class: usize) -> Result, String> { + let mut ret = HashMap::new(); + // Data from https://elite-dangerous.fandom.com/wiki/Frame_Shift_Drive#Specifications + let (opt_mass, max_fuel) = match (class, rating) { + (2, 1) => (48.0, 0.6), + (2, 2) => (54.0, 0.6), + (2, 3) => (60.0, 0.6), + (2, 4) => (75.0, 0.8), + (2, 5) => (90.0, 0.9), + + (3, 1) => (80.0, 1.2), + (3, 2) => (90.0, 1.2), + (3, 3) => (100.0, 1.2), + (3, 4) => (125.0, 1.5), + (3, 5) => (150.0, 1.8), + + (4, 1) => (280.0, 2.0), + (4, 2) => (315.0, 2.0), + (4, 3) => (350.0, 2.0), + (4, 4) => (438.0, 2.5), + (4, 5) => (525.0, 3.0), + + (5, 1) => (560.0, 3.3), + (5, 2) => (630.0, 3.3), + (5, 3) => (700.0, 3.3), + (5, 4) => (875.0, 4.1), + (5, 5) => (1050.0, 5.0), + + (6, 1) => (960.0, 5.3), + (6, 2) => (1080.0, 5.3), + (6, 3) => (1200.0, 5.3), + (6, 4) => (1500.0, 6.6), + (6, 5) => (1800.0, 8.0), + + (7, 1) => (1440.0, 8.5), + (7, 2) => (1620.0, 8.5), + (7, 3) => (1800.0, 8.5), + (7, 4) => (2250.0, 10.6), + (7, 5) => (2700.0, 12.8), + (r, c) => return Err(format!("Invalid FSD Type: Rating: {}, Class: {}", r, c)), + }; + ret.insert("FSDOptimalMass".to_owned(), opt_mass); + ret.insert("MaxFuel".to_owned(), max_fuel); + return Ok(ret); +} + +pub fn get_mult(star_type: &str) -> f32 { + if star_type.contains("White Dwarf") { + return 1.5; + } + if star_type.contains("Neutron") { + return 4.0; + } + 1.0 +} pub enum SysEntry { ID(u32), - Name(String) + Name(String), } impl SysEntry { @@ -37,7 +108,7 @@ pub fn find_matches( let mut reader = match csv::ReaderBuilder::new().from_path(path) { Ok(rdr) => rdr, Err(e) => { - return Err(format!("Error opening {}: {}", path.to_str().unwrap(), e).to_string()); + return Err(format!("Error opening {}: {}", path.to_str().unwrap(), e)); } }; let systems = reader.deserialize::(); @@ -83,7 +154,7 @@ pub struct SystemSerde { pub system: String, pub body: String, pub mult: f32, - pub distance: u32, + pub distance: f32, pub x: f32, pub y: f32, pub z: f32, @@ -118,10 +189,25 @@ pub struct System { pub system: String, pub body: String, pub mult: f32, - pub distance: u32, + pub distance: f32, pub pos: [f32; 3], } +impl ToPyObject for System { + fn to_object(&self, py: Python) -> PyObject { + let pos = PyTuple::new(py, self.pos.iter()); + let elem = PyDict::new(py); + elem.set_item("star_type", self.star_type.clone()).unwrap(); + elem.set_item("system", self.system.clone()).unwrap(); + elem.set_item("body", self.body.clone()).unwrap(); + elem.set_item("distance", self.distance).unwrap(); + elem.set_item("mult", self.mult).unwrap(); + elem.set_item("id", self.id).unwrap(); + elem.set_item("pos", pos).unwrap(); + elem.to_object(py) + } +} + impl System { pub fn to_node(&self) -> TreeNode { TreeNode { diff --git a/rust/src/galaxy.rs b/rust/src/galaxy.rs index 5a91d46..434c57d 100644 --- a/rust/src/galaxy.rs +++ b/rust/src/galaxy.rs @@ -1,8 +1,31 @@ -use serde::Deserialize; -use serde_json; -use std::io::{BufRead, BufReader}; +use serde::{Deserialize, Serialize}; +use std::fs::File; +use std::io::{BufRead, BufReader, BufWriter}; use std::str; +#[derive(Debug, Clone, Serialize)] +pub struct SystemSerde { + pub id: u32, + pub star_type: String, + pub system: String, + pub body: String, + pub mult: f32, + pub distance: f32, + pub x: f32, + pub y: f32, + pub z: f32, +} + +fn get_mult(star_type: &str) -> f32 { + if star_type.contains("White Dwarf") { + return 1.5; + } + if star_type.contains("Neutron") { + return 4.0; + } + 1.0 +} + #[derive(Debug, Deserialize)] struct Coords { x: f32, @@ -28,28 +51,23 @@ struct System { bodies: Vec, } - -/* -pub id: u32, -pub star_type: String, -pub system: String, -pub body: String, -pub mult: f32, -pub distance: u32, -pub x: f32, -pub y: f32, -pub z: f32, -*/ - - -fn main() -> std::io::Result<()> { - better_panic::install(); +pub fn process_galaxy_dump(path: &str) -> std::io::Result<()> { + let fh = File::create("stars.csv")?; + let mut wtr = csv::Writer::from_writer(BufWriter::new(fh)); let mut buffer = String::new(); - let mut bz2_reader = std::process::Command::new("bzip2") - .args(&["-d", "-c", r#"E:\EDSM\galaxy.json.bz2"#]) + let mut bz2_reader = std::process::Command::new("7z") + .args(&["x", "-so", path]) .stdout(std::process::Stdio::piped()) .spawn() - .expect("Failed to spawn execute bzip2!"); + .unwrap_or_else(|err| { + eprintln!("Failed to run 7z: {}", err); + eprintln!("Falling back to bzip2"); + std::process::Command::new("bzip2") + .args(&["-d", "-c", path]) + .stdout(std::process::Stdio::piped()) + .spawn() + .expect("Failed to execute bzip2!") + }); let mut reader = BufReader::new( bz2_reader .stdout @@ -66,13 +84,25 @@ fn main() -> std::io::Result<()> { .trim_end_matches(|c| c == ',') .trim() .to_string(); + if !buffer.contains("Star") { + continue; + }; if let Ok(sys) = serde_json::from_str::(&buffer) { for b in &sys.bodies { if b.body_type == "Star" { + let s = SystemSerde { + id: count, + star_type: b.sub_type.clone(), + distance: b.distance, + mult: get_mult(&b.sub_type), + body: b.name.clone(), + system: sys.name.clone(), + x: sys.coords.x, + y: sys.coords.y, + z: sys.coords.z, + }; + wtr.serialize(s)?; count += 1; - if (count % 100_000) == 0 { - println!("{}: {:?}", count, b); - } } } } diff --git a/rust/src/lib.rs b/rust/src/lib.rs index cfc6679..e05dc6f 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,54 +1,28 @@ // #![deny(warnings)] -mod common; -mod preprocess; -mod route; +#![allow(dead_code, clippy::needless_return, clippy::too_many_arguments)] +pub mod common; +pub mod edsm; +pub mod galaxy; +pub mod journal; +pub mod route; +pub mod ship; -#[macro_use] extern crate derivative; -use crate::common::SystemSerde; use crate::common::{find_matches, SysEntry}; use crate::route::{Router, SearchState}; +use crate::ship::Ship; use pyo3::exceptions::*; use pyo3::prelude::*; use pyo3::types::{PyDict, PyList, PyTuple}; use pyo3::PyObjectProtocol; use std::path::PathBuf; -/* - -pub id: u32, -pub star_type: String, -pub system: String, -pub body: String, -pub mult: f32, -pub distance: u32, -pub x: f32, -pub y: f32, -pub z: f32, -*/ - -impl SystemSerde { - fn fill_dict(&self, dict: &PyDict) -> PyResult<()> { - dict.clear(); - dict.set_item("id", self.id)?; - dict.set_item("star_type", self.star_type.clone())?; - dict.set_item("system", self.system.clone())?; - dict.set_item("body", self.body.clone())?; - dict.set_item("mult", self.mult)?; - dict.set_item("distance", self.distance)?; - dict.set_item("x", self.x)?; - dict.set_item("y", self.y)?; - dict.set_item("z", self.z)?; - return Ok(()); - } -} - #[pyclass(dict)] -#[derive(Derivative)] -#[derivative(Debug)] -#[text_signature = "(callback, workers, /)"] +#[derive(Debug)] +#[text_signature = "(callback, /)"] struct PyRouter { router: Router, + primary_only: bool, stars_path: String, } @@ -57,31 +31,37 @@ impl PyRouter { #[new] #[args(callback = "None")] fn new(callback: Option, py: Python<'static>) -> PyResult { - let cb_func = move |state: &SearchState| { - return match callback.as_ref() { - Some(cb) => cb.call(py, (state.clone(),), None), - None => Ok(py.None()), - }; - }; - - let router = match Router::new(Box::new(cb_func)) { - Ok(router) => router, - Err(err_msg) => { - return Err(PyErr::new::(err_msg)); - } - }; - let ret = PyRouter { - router, + Ok(PyRouter { + router: Router::new(Box::new( + move |state: &SearchState| { + match callback.as_ref() { + Some(cb) => cb.call(py, (state.clone(),), None), + None => Ok(py.None()), + } + } + )), + primary_only: false, stars_path: String::from(""), - }; - Ok(ret) + }) } - #[args(filter_func = "None")] - #[text_signature = "(path, /)"] - fn load(&mut self, path: String, py: Python<'static>) -> PyResult { + #[text_signature = "(ship, /)"] + fn set_ship(&mut self, py: Python, ship: &PyShip) -> PyResult { + self.router.set_ship(ship.ship.clone()); + Ok(py.None()) + } + + #[args(primary_only = "false")] + #[text_signature = "(path, primary_only, /)"] + fn load( + &mut self, + path: String, + primary_only: bool, + py: Python, + ) -> PyResult { self.stars_path = path; - return Ok(py.None()); + self.primary_only = primary_only; + Ok(py.None()) } #[args(greedyness = "0.5", num_workers = "0", beam_width = "0")] @@ -89,13 +69,15 @@ impl PyRouter { fn route( &mut self, hops: &PyList, - range: f32, + range: Option, greedyness: f32, beam_width: usize, num_workers: usize, py: Python, ) -> PyResult { - let route_res = self.router.load(&PathBuf::from(self.stars_path.clone())); + let route_res = self + .router + .load(&PathBuf::from(self.stars_path.clone()), self.primary_only); if let Err(err_msg) = route_res { return Err(PyErr::new::(err_msg)); }; @@ -116,10 +98,12 @@ impl PyRouter { }; match self .router - .computer_route(&ids, range, greedyness, beam_width, num_workers) + .compute_route(&ids, range, greedyness, beam_width, num_workers) { - // TODO: return list of dicts (or objects) - Ok(route) => Ok(route.len().to_object(py)), + Ok(route) => { + let py_route: Vec<_> = route.iter().map(|hop| hop.to_object(py)).collect(); + Ok(py_route.to_object(py)) + } Err(err_msg) => Err(PyErr::new::(err_msg)), } } @@ -136,7 +120,8 @@ impl PyRouter { } } println!("Resolving systems..."); - let ids: Vec = match resolve(&sys_entries, &PathBuf::from(self.stars_path.clone())) { + let stars_path = PathBuf::from(self.stars_path.clone()); + let ids: Vec = match resolve(&sys_entries, &stars_path) { Ok(ids) => ids, Err(err_msg) => { return Err(PyErr::new::(err_msg)); @@ -148,12 +133,12 @@ impl PyRouter { #[staticmethod] fn preprocess_edsm() -> PyResult<()> { - unimplemented!() + todo!("Implement EDSM Preprocessor") } #[staticmethod] fn preprocess_galaxy() -> PyResult<()> { - unimplemented!() + todo!("Implement galaxy.json Preprocessor") } } @@ -168,7 +153,7 @@ impl PyObjectProtocol for PyRouter { } } -fn resolve(entries: &Vec, path: &PathBuf) -> Result, String> { +fn resolve(entries: &[SysEntry], path: &PathBuf) -> Result, String> { let mut names: Vec = Vec::new(); let mut ids: Vec = Vec::new(); let mut ret: Vec = Vec::new(); @@ -209,7 +194,99 @@ fn resolve(entries: &Vec, path: &PathBuf) -> Result, String> SysEntry::ID(id) => ret.push(*id), } } - return Ok(ret); + Ok(ret) +} + +#[pyclass(dict)] +#[derive(Debug)] +struct PyShip { + ship: Ship, +} + +#[pyproto] +impl PyObjectProtocol for PyShip { + fn __str__(&self) -> PyResult { + Ok(format!("{:?}", &self.ship)) + } + + fn __repr__(&self) -> PyResult { + Ok(format!("{:?}", &self.ship)) + } +} + +#[pymethods] +impl PyShip { + #[staticmethod] + fn from_loadout(py: Python, loadout: &str) -> PyResult { + match Ship::new_from_json(loadout) { + Ok(ship) => Ok((PyShip { ship }).into_py(py)), + Err(err_msg) => Err(PyErr::new::(err_msg)), + } + } + #[staticmethod] + fn from_journal(py: Python) -> PyResult { + let mut ship = match Ship::new_from_journal() { + Ok(ship) => ship, + Err(err_msg) => { + return Err(PyErr::new::(err_msg)); + } + }; + let ships: Vec<(PyObject, PyObject)> = ship + .drain() + .map(|(k, v)| { + let k_py = k.to_object(py); + let v_py = (PyShip { ship: v }).into_py(py); + (k_py, v_py) + }) + .collect(); + Ok(PyDict::from_sequence(py, ships.to_object(py))?.to_object(py)) + } + + fn to_dict(&self, py: Python) -> PyResult { + self.ship.to_object(py) + } + + #[text_signature = "(dist, /)"] + fn fuel_cost(&self, _py: Python, dist: f32) -> PyResult { + Ok(self.ship.fuel_cost(dist)) + } + + #[text_signature = "(/)"] + fn range(&self, _py: Python) -> PyResult { + Ok(self.ship.range()) + } + + #[text_signature = "(/)"] + fn max_range(&self, _py: Python) -> PyResult { + Ok(self.ship.max_range()) + } + + #[text_signature = "(dist, /)"] + fn make_jump(&mut self, dist: f32, _py: Python) -> PyResult> { + Ok(self.ship.make_jump(dist)) + } + + #[text_signature = "(dist, /)"] + fn can_jump(&self, dist: f32, _py: Python) -> PyResult { + Ok(self.ship.can_jump(dist)) + } + + #[args(fuel_amount = "None")] + #[text_signature = "(fuel_amount, /)"] + fn refuel(&mut self, fuel_amount: Option, _py: Python) -> PyResult<()> { + if let Some(fuel) = fuel_amount { + self.ship.fuel_mass = (self.ship.fuel_mass + fuel).min(self.ship.fuel_capacity) + } else { + self.ship.fuel_mass = self.ship.fuel_capacity; + } + Ok(()) + } + + #[text_signature = "(factor, /)"] + fn boost(&mut self, factor: f32, _py: Python) -> PyResult<()> { + self.ship.boost(factor); + Ok(()) + } } #[pymodule] @@ -217,7 +294,32 @@ pub fn _ed_lrr(_py: Python, m: &PyModule) -> PyResult<()> { better_panic::install(); m.add_class::()?; + m.add_class::()?; + /* + #[pyfn(m, "get_ships_from_journal")] + fn get_ships_from_journal(py: Python) -> PyResult { + let ship = match Ship::new_from_journal() { + Ok(ship) => ship, + Err(err_msg) => { + return Err(PyErr::new::(err_msg)); + } + }; + let ships: Vec<(_,_)> = ship.iter().map(|(k,v)| (k.to_object(py),v.to_object(py))).collect(); + Ok(PyDict::from_sequence(py, ships.to_object(py))?.to_object(py)) + } + + #[pyfn(m, "get_ships_from_loadout")] + fn get_ship_from_loadout(py: Python, loadout: &str) -> PyResult { + let ship = match Ship::new_from_json(loadout) { + Ok(ship) => ship, + Err(err_msg) => { + return Err(PyErr::new::(err_msg)); + } + }; + Ok(ship.to_object(py)) + } + */ Ok(()) } diff --git a/rust/src/preprocess.rs b/rust/src/preprocess.rs deleted file mode 100644 index bb96d0c..0000000 --- a/rust/src/preprocess.rs +++ /dev/null @@ -1,205 +0,0 @@ -use crate::common::SystemSerde; -use fnv::FnvHashMap; -use pyo3::prelude::*; -use serde::Deserialize; -use serde_json::Result; -use std::fs::File; -use std::io::Seek; -use std::io::{BufRead, BufReader, BufWriter, SeekFrom}; -use std::path::PathBuf; -use std::str; -use std::time::Instant; - -#[derive(Debug, Deserialize)] -#[allow(non_snake_case)] -struct Body { - name: String, - subType: String, - #[serde(rename = "type")] - body_type: String, - systemId: i32, - systemId64: i64, - #[serde(rename = "distanceToArrival")] - distance: u32, -} - -#[derive(Debug, Deserialize)] -struct Coords { - x: f32, - y: f32, - z: f32, -} - -#[derive(Debug, Deserialize)] -struct System { - id: i32, - id64: i64, - name: String, - coords: Coords, -} - -#[derive(Debug)] -pub struct PreprocessState { - pub file: String, - pub message: String, - pub total: u64, - pub done: u64, - pub count: usize, -} - -fn get_mult(star_type: &str) -> f32 { - if star_type.contains("White Dwarf") { - return 1.5; - } - if star_type.contains("Neutron") { - return 4.0; - } - 1.0 -} - -fn process( - path: &PathBuf, - func: &mut dyn for<'r> FnMut(&'r str) -> (), - callback: &dyn Fn(&PreprocessState) -> PyResult, -) -> std::io::Result<()> { - let mut buffer = String::new(); - let fh = File::open(path)?; - let total_size = fh.metadata()?.len(); - let mut t_last = Instant::now(); - let mut reader = BufReader::new(fh); - let mut state = PreprocessState { - file: path.to_str().unwrap().to_owned(), - total: total_size, - done: 0, - count: 0, - message: format!("Processing {} ...", path.to_str().unwrap()), - }; - println!("Loading {} ...", path.to_str().unwrap()); - while let Ok(n) = reader.read_line(&mut buffer) { - if n == 0 { - break; - } - buffer = buffer.trim_end().trim_end_matches(|c| c == ',').to_string(); - if !buffer.is_empty() { - func(&buffer); - } - let pos = reader.seek(SeekFrom::Current(0)).unwrap(); - state.done = pos; - state.count += 1; - if t_last.elapsed().as_millis() > 100 { - callback(&state)?; - t_last = Instant::now(); - } - buffer.clear(); - } - Ok(()) -} - -fn process_systems( - path: &PathBuf, - callback: &dyn Fn(&PreprocessState) -> PyResult, -) -> FnvHashMap { - let mut ret = FnvHashMap::default(); - process( - path, - &mut |line| { - let sys_res: Result = serde_json::from_str(&line); - if let Ok(sys) = sys_res { - ret.insert(sys.id, sys); - } else { - eprintln!("\nError parsing: {}\n\t{:?}\n", line, sys_res.unwrap_err()); - } - }, - callback, - ) - .unwrap(); - ret -} - -pub fn build_index(path: &PathBuf) -> std::io::Result<()> { - let mut wtr = BufWriter::new(File::create(path.with_extension("idx"))?); - let mut idx: Vec = Vec::new(); - let mut records = (csv::Reader::from_path(path)?).into_deserialize::(); - loop { - idx.push(records.reader().position().byte()); - if records.next().is_none() { - break; - } - } - bincode::serialize_into(&mut wtr, &idx).unwrap(); - Ok(()) -} - -fn process_bodies( - path: &PathBuf, - out_path: &PathBuf, - systems: &mut FnvHashMap, - callback: &dyn Fn(&PreprocessState) -> PyResult, -) -> std::io::Result<()> { - println!( - "Processing {} into {} ...", - path.to_str().unwrap(), - out_path.to_str().unwrap(), - ); - let mut n: u32 = 0; - let mut wtr = csv::Writer::from_path(out_path)?; - process( - path, - &mut |line| { - if !line.contains("Star") { - return; - } - let body_res: Result = serde_json::from_str(&line); - if let Ok(body) = body_res { - if !body.body_type.contains("Star") { - return; - } - if let Some(sys) = systems.get(&body.systemId) { - let sub_type = body.subType; - let mult = get_mult(&sub_type); - let sys_name = sys.name.clone(); - let rec = SystemSerde { - id: n, - star_type: sub_type, - system: sys_name, - body: body.name, - mult, - distance: body.distance, - x: sys.coords.x, - y: sys.coords.y, - z: sys.coords.z, - }; - wtr.serialize(rec).unwrap(); - n += 1; - }; - } else { - eprintln!("\nError parsing: {}\n\t{:?}\n", line, body_res.unwrap_err()); - } - }, - callback, - ) - .unwrap(); - println!("Total Systems: {}", n); - systems.clear(); - Ok(()) -} - -pub fn preprocess_files( - bodies: &PathBuf, - systems: &PathBuf, - out_path: &PathBuf, - callback: &dyn Fn(&PreprocessState) -> PyResult, -) -> std::io::Result<()> { - if !out_path.exists() { - let mut systems = process_systems(systems, &callback); - process_bodies(bodies, out_path, &mut systems, &callback)?; - } else { - println!( - "File '{}' exists, not overwriting it", - out_path.to_str().unwrap() - ); - } - println!("Building index..."); - println!("Index result: {:?}", build_index(&out_path)); - Ok(()) -} diff --git a/rust/src/route.rs b/rust/src/route.rs index 7369a9f..eecdc38 100644 --- a/rust/src/route.rs +++ b/rust/src/route.rs @@ -1,9 +1,10 @@ use crate::common::{System, SystemSerde, TreeNode}; +use crate::edsm::build_index; +use crate::ship::Ship; use core::cmp::Ordering; use crossbeam_channel::{bounded, unbounded, Receiver, SendError, Sender, TryIter}; use derivative::Derivative; use dict_derive::IntoPyObject; -use crate::preprocess::build_index; use fnv::{FnvHashMap, FnvHashSet}; use humantime::format_duration; use permutohedron::LexicalPermutation; @@ -23,8 +24,6 @@ use std::time::Instant; const STATUS_INVERVAL: u128 = 5000; //ms struct Weight { - // TODO: implement - star_type: FnvHashMap, dist_from_start: f32, dist_to_goal: f32, dist_to_point: Vec<(f32, [f32; 3])>, @@ -32,9 +31,15 @@ struct Weight { impl Weight { fn calc(&self, node: &TreeNode, dst: &TreeNode, src: &TreeNode) -> f32 { - let d_start = dist(&node.pos, &src.pos); - let d_goal = dist(&node.pos, &dst.pos); - return 0.0; + let d_total = dist(&src.pos, &dst.pos); + let d_start = (dist(&node.pos, &src.pos) / d_total) * self.dist_from_start; + let d_goal = (dist(&node.pos, &dst.pos) / d_total) * self.dist_to_goal; + let points: f32 = self + .dist_to_point + .iter() + .map(|&(f, p)| dist(&p, &node.pos) * f) + .sum(); + return d_start + d_goal + points; } } @@ -80,14 +85,13 @@ pub enum Mode { Shortest, // TODO: A-Star with distance as weight } - #[derive(Debug)] #[allow(non_camel_case_types)] pub enum PrecomputeMode { Full, Route_From, Route_To, - None + None, } impl Mode { @@ -179,7 +183,7 @@ fn hash_file(path: &PathBuf) -> Vec { let mut hash_reader = BufReader::new(File::open(path).unwrap()); let mut hasher = Sha3_256::new(); std::io::copy(&mut hash_reader, &mut hasher).unwrap(); - hasher.result().iter().copied().collect() + hasher.finalize().iter().copied().collect() } pub struct LineCache { @@ -193,9 +197,11 @@ impl LineCache { let idx_path = path.with_extension("idx"); if !idx_path.exists() { eprintln!("No index found for {:?}, building...", path); - build_index(path).map_err(|e| { - eprintln!("Error creating index for {:?}: {}", path, e); - }).ok()?; + build_index(path) + .map_err(|e| { + eprintln!("Error creating index for {:?}: {}", path, e); + }) + .ok()?; } let cache = bincode::deserialize_from(&mut BufReader::new( File::open(idx_path) @@ -227,9 +233,7 @@ impl LineCache { let mut pos = csv::Position::new(); pos.set_byte(self.cache[id as usize]); self.reader.seek(pos).ok()?; - let sys = self.read_sys().map(SystemSerde::build); - // println!("{} {:?}",id,&sys); - sys + self.read_sys().map(SystemSerde::build) } } @@ -308,7 +312,7 @@ impl WorkerSet { fn resize(self, tree: Arc>, num: usize) -> Result { self.close()?; - return Ok(WorkerSet::new(tree.clone(), num)); + return Ok(WorkerSet::new(tree, num)); } // fn replace(self, tree: Arc>) -> Result { @@ -325,7 +329,7 @@ impl WorkerSet { { let t_start = Instant::now(); loop { - if (rx.len() == 0) && (tx.len() == 0) { + if rx.is_empty() && tx.is_empty() { break; } rx.try_iter().for_each(|_| {}); @@ -343,7 +347,10 @@ impl WorkerSet { handle.join().unwrap(); } drop(rx); - println!("cleared in {}", format_duration(t_start.elapsed())); + println!( + "workerset cleared in {}", + format_duration(t_start.elapsed()) + ); } return Ok(()); } @@ -411,9 +418,14 @@ pub struct Router { scoopable: FnvHashSet, #[derivative(Debug = "ignore")] pub route_tree: Option>, + + pub ship: Option, #[derivative(Debug = "ignore")] pub cache: Option>>, + pub path: PathBuf, + pub primary_only: bool, + #[derivative(Debug = "ignore")] workers: WorkerSet, #[derivative(Debug = "ignore")] @@ -421,21 +433,22 @@ pub struct Router { } impl Router { - pub fn new(callback: Box PyResult>) -> Result { - let ret = Self { + pub fn new(callback: Box PyResult>) -> Self { + Self { tree: Arc::new(LargeNodeRTree::default()), scoopable: FnvHashSet::default(), route_tree: None, cache: None, + ship: None, callback, + primary_only: false, workers: WorkerSet::Empty, path: PathBuf::from(""), - }; - Ok(ret) + } } - pub fn load(&mut self, path: &PathBuf) -> Result<(), String> { - if self.path == path.to_path_buf() { + pub fn load(&mut self, path: &PathBuf, primary_only: bool) -> Result<(), String> { + if self.path == path.to_path_buf() && self.primary_only == primary_only { return Ok(()); } self.tree = Arc::new(LargeNodeRTree::default()); // clear R*-Tree @@ -452,7 +465,7 @@ impl Router { .deserialize::() .filter_map(|res| { let sys = res.expect("Failed to read"); - if sys.distance != 0 { + if primary_only && sys.distance != 0.0 { return None; } if sys.mult > 1.0f32 { @@ -482,7 +495,11 @@ impl Router { Ok(()) } - pub fn start_workers(&mut self, num: usize) -> Result<(), String> { + pub fn set_ship(&mut self, ship: Ship) { + self.ship = Some(ship); + } + + fn start_workers(&mut self, num: usize) -> Result<(), String> { let mut w = WorkerSet::Empty; std::mem::swap(&mut self.workers, &mut w); self.workers = w.resize(self.tree.clone(), num)?; @@ -522,6 +539,8 @@ impl Router { cache, path, callback, + ship: None, + primary_only: primary, workers: WorkerSet::Empty, }, )) @@ -536,7 +555,7 @@ impl Router { } fn neighbours_r(&self, node: &TreeNode, range: f32) -> impl Iterator { - let pos = node.pos.clone(); + let pos = node.pos; self.points_in_sphere(&node.pos, range * 4.0) .filter(move |s| { return s.dist2(&pos) < (range * s.mult) * (range * s.mult); @@ -548,7 +567,12 @@ impl Router { return scoopable; } - pub fn best_multiroute( + fn make_jump(&mut self, d: f32) -> Option { + let ship = self.ship.as_mut().expect("Tried to jump without a ship!"); + return ship.make_jump(d); + } + + fn best_multiroute( &mut self, waypoints: &[System], range: f32, @@ -597,7 +621,7 @@ impl Router { ) } - pub fn multiroute( + fn multiroute( &mut self, waypoints: &[System], range: f32, @@ -648,7 +672,7 @@ impl Router { Ok(route) } - pub fn route_astar( + fn route_astar( &self, src: &System, dst: &System, @@ -659,8 +683,11 @@ impl Router { if factor == 0.0 { return self.route_bfs(src, dst, range, beam_width); } - if factor == 1.0 { - return self.route_greedy(src, dst, range, beam_width); + if (factor - 1.0).abs() < 1e-3 { + if beam_width != 0 { + eprintln!("Usign greedy algorithm, ignorimg beam width!") + } + return self.route_greedy(src, dst, range); } let src_name = src.system.clone(); let dst_name = dst.system.clone(); @@ -686,7 +713,7 @@ impl Router { let total = self.tree.size() as f32; let mut t_last = Instant::now(); let mut prev = FnvHashMap::default(); - let mut seen = FnvHashSet::default(); + let mut seen: FnvHashMap = FnvHashMap::default(); let mut found = false; let mut queue: Vec<(usize, usize, TreeNode)> = Vec::new(); queue.push(( @@ -694,13 +721,13 @@ impl Router { (start_sys.distp(goal_sys) / range) as usize, // h start_sys.to_node(), )); - seen.insert(start_sys.id); + seen.insert(start_sys.id, 0.0); while !found { while let Some((depth, _, node)) = queue.pop() { if t_last.elapsed().as_millis() > STATUS_INVERVAL { let sys = node .get(&self) - .expect(&format!("System-ID {} not found!", node.id)); + .unwrap_or_else(|| panic!("System-ID {} not found!", node.id)); t_last = Instant::now(); state.depth = depth; state.queue_size = queue.len(); @@ -713,7 +740,7 @@ impl Router { match (self.callback)(&state) { Ok(_) => (), Err(e) => { - return Err(format!("{:?}", e).to_string()); + return Err(format!("{:?}", e)); } }; } @@ -722,19 +749,24 @@ impl Router { found = true; break; } - queue.extend( - self.neighbours(&node, range) - .filter(|nb| (self.valid(nb.id) || (nb.id == goal_sys.id))) - .filter(|nb| seen.insert(nb.id)) - .map(|nb| { - prev.insert(nb.id, node); - let d_g = nb.distp(goal_sys); - if d_g < d_rem { - d_rem = d_g; - } - (depth + 1, (d_g / (range * 4.0)) as usize, *nb) - }), - ); + + let new_nodes: Vec<_> = self + .neighbours(&node, range) + .filter(|nb| (self.valid(nb.id) || (nb.id == goal_sys.id))) + .filter(|nb| !seen.contains_key(&nb.id)) + .map(|nb| { + prev.insert(nb.id, node); + let d_g = nb.distp(goal_sys); + if d_g < d_rem { + d_rem = d_g; + } + (depth + 1, (d_g / (range * 4.0)) as usize, *nb) + }) + .collect(); + for node in new_nodes { + seen.insert(node.2.id, 0.0); + queue.push(node); + } queue.sort_by(|b, a| { let (a_0, a_1) = (a.0 as f32, a.1 as f32); let (b_0, b_1) = (b.0 as f32, b.1 as f32); @@ -769,13 +801,7 @@ impl Router { Ok(v) } - pub fn route_greedy( - &self, - src: &System, - dst: &System, - range: f32, - beam_width: usize, - ) -> Result, String> { + fn route_greedy(&self, src: &System, dst: &System, range: f32) -> Result, String> { let src_name = src.system.clone(); let dst_name = dst.system.clone(); let start_sys = src; @@ -799,17 +825,17 @@ impl Router { let total = self.tree.size() as f32; let mut t_last = Instant::now(); let mut prev = FnvHashMap::default(); - let mut seen = FnvHashSet::default(); + let mut seen: FnvHashMap = FnvHashMap::default(); let mut found = false; let mut queue: Vec<(f32, usize, TreeNode)> = Vec::new(); queue.push((start_sys.distp(goal_sys), 0, start_sys.to_node())); - seen.insert(start_sys.id); + seen.insert(start_sys.id, 0.0); while !found { while let Some((_, depth, node)) = queue.pop() { if t_last.elapsed().as_millis() > STATUS_INVERVAL { let sys = node .get(&self) - .expect(&format!("System-ID {} does not exist!", &node.id)); + .unwrap_or_else(|| panic!("System-ID {} does not exist!", &node.id)); t_last = Instant::now(); state.depth = depth; state.queue_size = queue.len(); @@ -822,7 +848,7 @@ impl Router { match (self.callback)(&state) { Ok(_) => (), Err(e) => { - return Err(format!("{:?}", e).to_string()); + return Err(format!("{:?}", e)); } }; } @@ -831,19 +857,23 @@ impl Router { found = true; break; } - queue.extend( - self.neighbours(&node, range) - .filter(|nb| (self.valid(nb.id) || (nb.id == goal_sys.id))) - .filter(|nb| seen.insert(nb.id)) - .map(|nb| { - prev.insert(nb.id, node); - let d_g = nb.distp(goal_sys); - if d_g < d_rem { - d_rem = d_g; - } - (d_g, depth + 1, nb.clone()) - }), - ); + let new_nodes: Vec<_> = self + .neighbours(&node, range) + .filter(|nb| (self.valid(nb.id) || (nb.id == goal_sys.id))) + .filter(|nb| !seen.contains_key(&nb.id)) + .map(|nb| { + prev.insert(nb.id, node); + let d_g = nb.distp(goal_sys); + if d_g < d_rem { + d_rem = d_g; + } + (d_g, depth + 1, *nb) + }) + .collect(); + for node in new_nodes { + seen.insert(node.2.id, 0.0); + queue.push(node); + } queue.sort_by(|a, b| fcmp(b.0, a.0).then(b.1.cmp(&a.1))); } if queue.is_empty() { @@ -868,17 +898,17 @@ impl Router { Ok(v) } - pub fn precompute_all(&mut self, range:f32) -> Result<(),String> { + fn precompute_all(&mut self, range: f32) -> Result<(), String> { // TODO: implement all-pairs shortest path based on optimized BFS unimplemented!(); } - pub fn precompute_to(&mut self, dst: &System, range: f32) -> Result<(), String> { + fn precompute_to(&mut self, dst: &System, range: f32) -> Result<(), String> { // TODO: -> precompute to unimplemented!(); } - pub fn precompute(&mut self, src: &System, range: f32) -> Result<(), String> { + fn precompute(&mut self, src: &System, range: f32) -> Result<(), String> { // TODO: -> precompute from let total = self.tree.size() as f32; let t_start = Instant::now(); @@ -906,7 +936,7 @@ impl Router { .filter(|&nb| seen.insert(nb.id)) .map(|nb| { prev.insert(nb.id, sys.id); - (d + 1, nb.clone()) + (d + 1, *nb) }), ); } @@ -936,20 +966,16 @@ impl Router { ); match bincode::serialize_into(&mut out_fh, &data) { Ok(_) => Ok(()), - Err(e) => Err(format!("Error: {}", e).to_string()), + Err(e) => Err(format!("Error: {}", e)), } } fn get_sys(&self, id: u32) -> Result, String> { let path = &self.path; if let Some(c) = &self.cache { - let mut c = c.lock().unwrap(); - match c.get(id) { - Some(sys) => { - return Ok(Some(sys)); - } - None => {} - } + if let Some(sys) = c.lock().unwrap().get(id) { + return Ok(Some(sys)); + }; } let mut reader = match csv::ReaderBuilder::new().from_path(path) { Ok(reader) => reader, @@ -998,10 +1024,9 @@ impl Router { .deserialize::() .map(|res| res.unwrap()) .filter(|sys| ids.contains(&sys.id)) - .map(|sys| { + .for_each(|sys| { ret.insert(sys.id, sys.build()); - }) - .count(); + }); for id in ids { if !ret.contains_key(&id) { return Err(format!("ID {} not found", id)); @@ -1010,13 +1035,13 @@ impl Router { Ok(ret) } - pub fn route_to(&self, dst: &System) -> Result, String> { + fn route_to(&self, dst: &System) -> Result, String> { if self.route_tree.is_none() { return Err("Can't computer route without a precomputed route-tree".to_owned()); } let prev = self.route_tree.as_ref().unwrap(); if !prev.contains_key(&dst.id) { - return Err(format!("System-ID {} not found", dst.id).to_string()); + return Err(format!("System-ID {} not found", dst.id)); }; let mut v_ids: Vec = Vec::new(); let mut v: Vec = Vec::new(); @@ -1044,7 +1069,7 @@ impl Router { Ok(v) } - pub fn route_bfs( + fn route_bfs( &self, start_sys: &System, goal_sys: &System, @@ -1058,7 +1083,7 @@ impl Router { let t_start = Instant::now(); let mut t_last = Instant::now(); let mut prev = FnvHashMap::default(); - let mut seen = FnvHashSet::default(); + let mut seen: FnvHashMap = FnvHashMap::default(); let src_name = start_sys.system.clone(); let dst_name = goal_sys.system.clone(); let workers = &self.workers; @@ -1089,7 +1114,7 @@ impl Router { system: start_sys.system.clone(), body: start_sys.body.clone(), }; - seen.insert(wu.node.id); + seen.insert(wu.node.id, 0.0); workers.send(wu).unwrap(); loop { if found { @@ -1098,7 +1123,7 @@ impl Router { let num_seen = seen.len(); let mut nbs: Vec<_> = workers .iter()? - .filter(|wu| !found && seen.insert(wu.node.id)) + .filter(|wu| !found && !seen.contains_key(&wu.node.id)) .filter(|wu| wu.parent_id.is_some()) .inspect(|wu| { if t_last.elapsed().as_millis() > STATUS_INVERVAL { @@ -1114,8 +1139,8 @@ impl Router { state.prc_seen = ((num_seen * 100) as f32) / total; { let s = wu.node.get(&self).unwrap(); - state.system = s.system.clone(); - state.body = s.body.clone(); + state.system = s.system; + state.body = s.body; } match (self.callback)(&state) { Ok(_) => (), @@ -1143,6 +1168,7 @@ impl Router { if let Some(parent_id) = wu.parent_id { prev.insert(wu.node.id, parent_id); } + seen.insert(wu.node.id, 0.0); if wu.node.id == goal_sys.id { found = true; println!("FOUND!"); @@ -1177,7 +1203,7 @@ impl Router { Ok(v) } - pub fn route_bfs_serial( + fn route_bfs_serial( &self, start_sys: &System, goal_sys: &System, @@ -1209,14 +1235,14 @@ impl Router { }; let total = self.tree.size() as f32; let mut prev = FnvHashMap::default(); - let mut seen = FnvHashSet::default(); + let mut seen: FnvHashMap = FnvHashMap::default(); let mut depth = 0; let mut found = false; let mut t_last = Instant::now(); let mut queue: VecDeque = VecDeque::new(); let mut queue_next: VecDeque = VecDeque::new(); queue.push_front(start_sys.to_node()); - seen.insert(start_sys.id); + seen.insert(start_sys.id, 0.0); while !found { while let Some(node) = queue.pop_front() { if node.id == goal_sys.id { @@ -1239,7 +1265,7 @@ impl Router { match (self.callback)(&state) { Ok(_) => (), Err(e) => { - return Err(format!("{:?}", e).to_string()); + return Err(format!("{:?}", e)); } }; t_last = Instant::now(); @@ -1247,14 +1273,14 @@ impl Router { let valid_nbs = self .neighbours(&node, range) .filter(|nb| (self.valid(nb.id) || (nb.id == goal_sys.id))) - .filter(|nb| seen.insert(nb.id)) + .filter(|nb| seen.insert(nb.id, 0.0).is_none()) .map(|nb| { prev.insert(nb.id, node); let dist = nb.distp(goal_sys); if dist < d_rem { d_rem = dist; }; - nb.clone() + *nb }); queue_next.extend(valid_nbs); } @@ -1309,14 +1335,18 @@ impl Router { } impl Router { - pub fn computer_route( + pub fn compute_route( &mut self, sys_ids: &[u32], - range: f32, + range: Option, factor: f32, beam_width: usize, num_workers: usize, ) -> Result, String> { + if range.is_none() && self.ship.is_none() { + return Err("Need either a jump range or a ship to compute a route with!".to_owned()); + } + let range = range.ok_or("Dynamic range calculation is not yet implemented, sorry!")?; let id_map = self.get_systems_by_ids(sys_ids)?; let hops: Vec = sys_ids .iter() diff --git a/setup.cfg b/setup.cfg index 596fb22..25fcc08 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,11 @@ [flake8] -exclude = .nox,.git,__pycache__,build,dist,.history +exclude = .nox,.git,__pycache__,build,dist,.history,.eggs verbose = 1 [tool:pytest] qt_api = pyqt5 console_output_style = progress -addopts = --benchmark-skip --flake8 +addopts = --benchmark-skip testpaths = tests python_files = test_*.py -python_functions = test_* \ No newline at end of file +python_functions = test_* diff --git a/setup.py b/setup.py index 29e0c2a..84671f7 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ extras_require = { 'pytest-mock', 'pytest-flask-sqlalchemy', 'pytest-steps', + 'pytest-xdist', 'flake8-bugbear', 'flake8-comprehensions', 'cohesion', @@ -69,7 +70,6 @@ setup( '_ed_lrr', path='rust/Cargo.toml', binding=Binding.PyO3, - rustc_flags=['--emit=asm'], strip=Strip.No, debug=False, native=True, diff --git a/tests/conftest.py b/tests/conftest.py index 8e003d2..1d43e53 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,8 +16,7 @@ def get_mult(star_type): def gen_pos(p_distrib): p = [] for v in p_distrib: - v = random.triangular(-v, v) - p.append(v) + p.append(random.triangular(-v, v)) return p @@ -107,10 +106,7 @@ def stars_path(): csv_writer.writeheader() csv_writer.writerows(rows) tmpfile.close() - while True: - sys_ids = random.choices(range(num_stars), k=10) - if len(set(sys_ids)) == len(sys_ids): - break + sys_ids = random.sample(range(num_stars), k=10) rand_sys = list(map("System {}".format, sys_ids)) yield str(filename.resolve()), rand_sys if filename.exists(): diff --git a/tests/test_ed_lrr.py b/tests/test_ed_lrr.py index 70e1962..b10c74a 100644 --- a/tests/test_ed_lrr.py +++ b/tests/test_ed_lrr.py @@ -3,14 +3,16 @@ import random import pytest import os from flaky import flaky +from pytest import approx +from glob import glob -if not hasattr(random, "choices"): - - def choices(population, *, k=1): - return [random.choice(population) for _ in range(k)] - - random.choices = choices +def dist(a, b, m=2): + assert len(a) == len(b) + s = 0 + for c1, c2 in zip(a, b): + s += (c1 - c2) ** 2 + return s ** (1 / m) @pytest.fixture(scope="module") @@ -27,7 +29,43 @@ def py_router(stars_path): yield router, resolved_systems -class Test_ED_LRR(object): # noqa: H601 +def idf(name): + return lambda val: "{}:{}".format(name, val) + + +# class Test_PyShip(object): +# folder = os.path.dirname(__file__) +# ships = glob(os.path.join(folder,"data","ships","*.json")) +# ship_data=[] +# ship_ids=[] +# for ship in ships: +# with open(ship,"r",encoding="utf-8") as fh: +# ship_data.append(fh.read()) +# ship_ids.append(os.path.splitext(os.path.basename(ship))[0]) + +# @pytest.mark.parametrize("ship_data", ship_data, ids=ship_ids) +# def test_ship_from_json(self, ship_data): +# import json +# from _ed_lrr import PyShip + +# loadout = json.loads(ship_data) +# ship = PyShip.from_loadout(ship_data) +# ship_dict = ship.to_dict() +# booster = ship_dict.get("fsd", {}).get("guardian_booster") +# assert booster is not None +# rel = None +# if booster != approx(0.0): +# rel = 0.01 +# assert ship.max_range() == approx(loadout["MaxJumpRange"], rel) + + +class Test_PyRouter(object): # noqa: H601 + + beam_widths = [256, 512, 1024, 0] + greedyness = [0, 0.5, 1] + n_workers = [0, 1, 2, os.cpu_count()] + ranges = [30, 50] + @pytest.mark.dependency() @flaky(max_runs=10, min_passes=5) def test_load_and_resolve(self, stars_path): @@ -42,37 +80,34 @@ class Test_ED_LRR(object): # noqa: H601 assert name in resolved_systems, err @pytest.mark.dependency(depends=["Test_ED_LRR::test_load_and_resolve"]) - @flaky(max_runs=10, min_passes=5) - def test_zero_range_fails(self, py_router): - r, resolved_systems = py_router - waypoints = random.choices(list(resolved_systems.values()), k=2) - err = pytest.raises(RuntimeError, r.route, waypoints, 0) - err.match(r"No route from .* to .* found!") - - beam_widths = [256, 512, 1024, 0] - greedyness = [0, 0.5, 1] - n_workers = [0, os.cpu_count()] - ranges = [30, 50] - - @pytest.mark.dependency(depends=["Test_ED_LRR::test_load_and_resolve"]) - @flaky(max_runs=10, min_passes=2) - @pytest.mark.parametrize("workers", n_workers, - ids=lambda v: "workers:{}".format(v)) - @pytest.mark.parametrize("jump_range", ranges, - ids=lambda v: "range:{}".format(v)) @pytest.mark.parametrize( "greedyness", greedyness, ids=lambda v: "greedyness:{}".format(v) ) - @pytest.mark.parametrize( - "beam_width", beam_widths, ids=lambda v: "beam_width:{}".format(v) - ) - def test_route(self, py_router, jump_range, - workers, greedyness, beam_width): + @flaky(max_runs=10, min_passes=5) + def test_zero_range_fails(self, py_router, greedyness): + r, resolved_systems = py_router + waypoints = random.sample(list(resolved_systems.values()), k=2) + err = pytest.raises(RuntimeError, r.route, waypoints, 0, greedyness) + err.match(r"No route from .* to .* found!") + + @pytest.mark.dependency(depends=["Test_ED_LRR::test_load_and_resolve"]) + @flaky(max_runs=10, min_passes=2) + @pytest.mark.parametrize("workers", n_workers, ids=idf("workers")) + @pytest.mark.parametrize("jump_range", ranges, ids=idf("range")) + @pytest.mark.parametrize("greedyness", greedyness, ids=idf("greedyness")) + @pytest.mark.parametrize("beam_width", beam_widths, ids=idf("beam_width")) + def test_route(self, py_router, jump_range, workers, greedyness, beam_width): r, resolved_systems = py_router waypoints = random.choices(list(resolved_systems.values()), k=2) args = waypoints, jump_range, greedyness, beam_width, workers err = "Failed to route for waypoints: {}".format(waypoints) - route_len = r.route(*args) - assert route_len != 0, err + route = r.route(*args) + assert len(route) != 0, err del r - # TODO: verify hop distance and inclusion of waypoints + hops = [h["id"] for h in route] + for wp in waypoints: + assert wp in hops, "System id {} not found in route".format(wp) + for a, b in zip(route, route[1:]): + d = dist(a["pos"], b["pos"]) + msg = "jump from {} to {} seems impossible".format(a["system"], b["system"]) + assert d <= jump_range * a["mult"], msg