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

wrong examples in documentation #204

Closed
pat1 opened this issue Dec 20, 2019 · 2 comments
Closed

wrong examples in documentation #204

pat1 opened this issue Dec 20, 2019 · 2 comments
Assignees

Comments

@pat1
Copy link
Contributor

pat1 commented Dec 20, 2019

https://arpa-simc.github.io/dballe/python/dballe_messages.html

class dballe.Message

    print("{m.report},{m.coords},{m.ident},{m.datetime},{m.type}".format(m=msg))
AttributeError: 'tuple' object has no attribute 'report'

suggested example:

importer = dballe.Importer("BUFR")
with dballe.File("temp.bufr") as f:
    for binmsg in f:
        msgs = importer.from_binary(binmsg)
        for msg in msgs:
            print("#{b.index}: {m.report},{m.coords},{m.ident},{m.datetime},{m.type}".format(b=binmsg, m=msg))

class dballe.Importer
same problem as above

https://arpa-simc.github.io/dballe/python/dballe_db.html
the example:

  • do not use transaction
  • B11101 do not exist
  • db.insert_data do not have the last two parameters setted to True so running the example on some DB do not work
  • lat e long are used as float; as native type is decimal I think that a better examble should use decimal

https://arpa-simc.github.io/dballe/python/dballe_messages.html

get_named(name: str) → Union[dballe.Var, None]
    Get a Var given its shortcut name; returns None if not found

set_named(name: str, value: Union[dballe.Var, int, str, double])
    Set a Var given its shortcut name

which 'shortcut name' I can use ?

     msg.set_named("report", dballe.var("B01194", "sound"))
KeyError: "Shortcut name 'report' not found"
@spanezz
Copy link
Contributor

spanezz commented Jan 8, 2020

I have just documented the shortcuts (see #206)

@spanezz spanezz closed this as completed in 7d3b4d9 Jan 9, 2020
@spanezz
Copy link
Contributor

spanezz commented Jan 9, 2020

I have implemented a way to execute and test all code snippets in the documentation. It should be quite unlikely that documentation bits do not compile or work, or use deprecated functions now.

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

2 participants