Skip to content

commons.hub_state.py needs more #131

@littlebee

Description

@littlebee

There are several things I find lacking in the current implementation of basic_bot.commons.hub_state.

  1. For example, there is no example of how to fetch an individual key. Probably because the accepted way is to just reach into the state member variable and do a .get on that like, hub_state.state.get('some-key'). See below for more about this.
  2. There should be an overload of .get method on basic_bot.commons.HubState that accepts a singular key and does a .get on the state var to get and return a singular value
  3. Doc comment for the get method need to explicitly swear allegience to the Pythonic way of .get method and what is returned / happens when keys don't exist in the state. The current method is behaving as I might expect - keys not found are not added to the return value. Singular version should just return None if key not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions