HullSeals / HalpyBOT

The Hull Seals IRC Utility bot, built with Pydle
GNU General Public License v3.0
7 stars 3 forks source link

[Halpy-136] Add EDDB Diversion Station Loader - [merged] #273

Closed Rixxan closed 1 year ago

Rixxan commented 2 years ago

Merges feature/halpy-136 -> feature/halpy-120c

Adds a system to generate a list of all stations in the galaxy with repair functionality, and uses the new !diversion command to display the 5 closest stations in the galaxy to a client using EDSM lookup coordinates.

EDDB does not have a public API, so this tool is needed to filter down and get the closest stations, very similar to the current DSSA and Landmark systems.

Closes #136

Rixxan commented 2 years ago

added 2 commits

Compare with previous version

Rixxan commented 2 years ago

I feel like there has to be a way to simplify this or put it in a loop but I just... can't remember or figure it out.

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/files/input/.gitignore line 4

reasonably sure git ignores .gitignore files not in the VCS root.

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 21

String concatenation. replace with fstrings

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 36

Consider using pathlib instead.

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 56

Once the file has been read from, you can release the resource. (exit the with stanza here.)

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 67

            if not temp_system_dict["needs_permit"]:
Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 81

for i, key in enumerate(tqdm(...

Consider using a dict comprehension here instead.

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 113

Whats the issue here? cattrs can handle dicts...

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:47

Commented on CLI/EDDBFormatter/main.py line 118

like above, enumerate or dict comprehension

Rixxan commented 2 years ago

The problem isn't with cattrs, so much as how we used cattrs later in the bot it expects a list file not a dict file. Not a problem with the code, just what we are expecting and so what we need to create.

Rixxan commented 2 years ago

changed this line in version 3 of the diff

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 27, 2022, 24:56

Commented on CLI/EDDBFormatter/main.py line 113

Then why does the comment make it sound like you're working around a issue with cattrs? :rofl:

Rixxan commented 2 years ago

Bad comment is bad. #willfix

Rixxan commented 2 years ago

changed this line in version 4 of the diff

Rixxan commented 2 years ago

changed this line in version 4 of the diff

Rixxan commented 2 years ago

changed this line in version 4 of the diff

Rixxan commented 2 years ago

changed this line in version 4 of the diff

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

changed this line in version 5 of the diff

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

changed this line in version 6 of the diff

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

I could manage it with the second one but if I take out the first one the program begins throwing a fit. More investigation required.

Rixxan commented 2 years ago

changed this line in version 7 of the diff

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

os.path does everything we need right now, but if we start working further with the filesystem in the future might be worth looking into.

At present, it just doesn't seem really worthwhile for 3 files that use os.path.

Rixxan commented 2 years ago

On further review, as the counter does not INCREASE on every loop (only loops that result in qualifying stations) I don't think we can use enumerate here. Thus must remain as is unless I'm missing something.

Rixxan commented 2 years ago

resolved all threads

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 28, 2022, 24:33

Commented on CLI/EDDBFormatter/main.py line 101

            and temp_station_dict["has_repair"]
            and not temp_station_dict["is_planet"]
Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 28, 2022, 24:35

Commented on halpybot/commands/edsm.py line 274

(x) doubt

Rixxan commented 2 years ago

In GitLab by @theunkn0wn1 on May 28, 2022, 24:40

Commented on halpybot/commands/edsm.py line 286

shouldn't this be system = args[0].strip()? this would catch the --new arg (unless your command system strips flags out of the message?)

Rixxan commented 2 years ago

changed this line in version 12 of the diff

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

added 1 commit

Compare with previous version

Rixxan commented 2 years ago

Fixed

Rixxan commented 2 years ago

resolved all threads

Rixxan commented 2 years ago

In GitLab by @rik079 on May 29, 2022, 14:39

approved this merge request

Rixxan commented 2 years ago

In GitLab by @rik079 on May 29, 2022, 14:41

mentioned in commit 1d7c194e5c3932bf35b64784c1a2821308eafa68