small improvement for occasional Python user
espinielli opened this issue · 1 comments
espinielli commented
Being a dumb/occasional user of Python, I would like to suggest self contained examples like for example enhancing
the from_file()
in traffic/core/mixins.py
from
Example usage: >>> t = Traffic.from_file("data/sample_opensky.pkl")
to
Example usage: >>> from traffic.core import Traffic >>> t = Traffic.from_file("data/sample_opensky.pkl")
Similarly for other parts of the library implementing a from_file()
method, like SO6
(from traffic.data
) or Decoder
(from traffic.data.decode
)...
Suggesting this because I resolve to searching/browsing the source code every time... ;-)
espinielli commented
I also think that query()
with f-string is not prominently documented enough.
Things like (think about looping over multiple airports):
from traffic.data import opensky
from traffic.data import airports
apt = airports["LTFM"]
ltfm = opensky.history(
date,
airport=apt.icao)
ltfm40_arr = (
ltfm
.distance(apt)
.query(f"destination == '{apt.icao}' & distance <= 40")
.eval()
)