Enums
Let's talk about App
and AppContext
enum's a little.
Thankfully to an aenum package, these enum's extending selves when member is missing. Therefore, as mentioned before, hardcoded members are just predefined.
You can create App
and AppContext
for non-predefined app+context
As instance:
from aiosteampy import App, AppContext
BANANA_APP = App(2923300)
BANANA = AppContext((BANANA_APP, 2)) # with context 2
And then use it within your app. Moreover, from now AppContext
and App
enums have a new member.
Caveat¶
If you print/log BANANA_APP
you receive something like
Not so beautiful, yes. Name is auto-generated, due to inability to know name of the app, if we, for example,
get a trade offer
with non-predefined app items.
Next version
Solution comes in next minor version (0.6.4)
As a workaround you can extend enum manually:
from aenum import extend_enum
from aiosteampy import App, AppContext
BANANA_APP = extend_enum(App, "BANANA", 2923300)
BANANA_DEFAULT_CONTEXT = extend_enum(
AppContext,
"BANANA_DEFAULT_CONTEXT",
(BANANA_APP, 2),
) # with context 2
Then repr
of a AppContext
new member will be: