traffic icon indicating copy to clipboard operation
traffic copied to clipboard

Documentation out of date for `aircraft`

Open simonrp84 opened this issue 3 years ago • 2 comments

Hello, The documentation for the aircraft class seems to be out of date. For example, here it states that I can get information about a given aircraft using: aircraft["F-GFKY"] Which looks like it'll return a DataFrame object. However, trying this with the latest traffic from github instead it returns traffic.data.basic.aircraft.Aircraft. It is not clear from the documentation, or from my looking at the code, how to transform this into information about the aircraft itself. In the past, for example, I could do aircraft[my_icao].typecode to get the typecode, but this no longer works. Could you please update the documentation to show how the user can retrieve aircraft information using the recent updates to the code?

simonrp84 avatar Jun 12 '22 09:06 simonrp84

Thank you Simon for pointing this out.

In the past, aircraft[identifier] would return an Aircraft if the query result was unique and a pseudo-dataframe otherwise, which was questionable (understand, driving mypy nuts, a sign that the interface should be rethought)

Before I do the documentation update, few examples below:

Capture d’écran 2022-06-12 à 22 45 01

I must say I would prefer aircraft[identifier] to return Optional[Aircraft] but then there's no clear way (apart from a warning) to notify the user that there's a duplicate in the database (which could be there for good reasons too).

Anyway, get_unique() shouldn't change API in the future.

xoolive avatar Jun 12 '22 20:06 xoolive

Thanks for the tip! Much appreciated.

simonrp84 avatar Jun 13 '22 06:06 simonrp84