Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small improvement for occasional Python user #185

Closed
espinielli opened this issue Feb 19, 2022 · 1 comment
Closed

small improvement for occasional Python user #185

espinielli opened this issue Feb 19, 2022 · 1 comment

Comments

@espinielli
Copy link
Collaborator

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
Copy link
Collaborator Author

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()
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant