-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Fix error in image platform of Habitica integration #135897
base: dev
Are you sure you want to change the base?
Conversation
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
def _appearance(self) -> UserStyles: | ||
"""Gather all attributes relevant for avatar appearance from user data.""" | ||
|
||
return UserStyles.from_dict(asdict(self.coordinator.data.user)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did not answer my question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then i misunderstood, sorry. UserStyles
is a subset of UserData
, and when doing this, the resulting object will only contain the fields that are relevant and I can then easily compare if there were changes in gear, pets/mounts, background and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume casting won't work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much fields are there? Because I don't really like that we practically make a copy of the object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like 40? It's a bit nested. The method that generates the avatar takes a UserStyles
object
UserStyles(items=ItemsUserStyles(gear=GearItemsUserStyles(equipped=EquippedGear(weapon='weapon_special_2', armor='armor_special_pageArmor', head='head_special_2', shield='shield_special_lootBag', back='back_base_0', headAccessory='headAccessory_base_0', eyewear='eyewear_base_0', body='body_base_0'), costume=EquippedGear(weapon='weapon_base_0', armor='armor_special_snowSovereignRobes', head='head_mystery_202501', shield='shield_mystery_202501', back='back_base_0', headAccessory='headAccessory_base_0', eyewear='eyewear_base_0', body='body_base_0')), currentMount='Gryphon-White', currentPet='Wolf-Spooky'), preferences=PreferencesUserStyles(hair=HairPreferences(color='brown', base=0, bangs=1, beard=0, mustache=0, flower=16), size='broad', skin='98461a', shirt='pink', chair='none', costume=True, sleep=False, background='surrounded_by_ghosts'), stats=StatsUserStyles(buffs=BuffsUserStyles(per=31, con=31, stealth=0, seafoam=False, shinySeed=False, snowball=False, spookySparkles=False), Class=<HabiticaClass.WARRIOR: 'warrior'>))
Proposed change
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: