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

[ProfileData] fix dataclasses "mutable default for field is not allow… #427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

srdjan0
Copy link

@srdjan0 srdjan0 commented May 24, 2024

…ed" error

Copy link
Member

@GuillaumeDSM GuillaumeDSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you fox the fix 👍
For now OctoBot ensures compatibility with python 3.10 in which this syntax is not an issue. However when updating to newer versions, this fix will be necessary !

@@ -111,9 +111,9 @@ class OptionsData(octobot_commons.dataclasses.FlexibleDataclass):
class ProfileData(octobot_commons.dataclasses.MinimizableDataclass):
profile_details: ProfileDetailsData
crypto_currencies: list[CryptoCurrencyData]
trading: TradingData
trading: TradingData = dataclasses.field(default_factory=TradingData)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trading: TradingData = dataclasses.field(default_factory=TradingData)
trading: TradingData

exchanges: list[ExchangeData] = dataclasses.field(default_factory=list)
trader: TraderData = TraderData()
trader: TraderData = dataclasses.field(default_factory=TraderData)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@srdjan0
Copy link
Author

srdjan0 commented May 24, 2024

Sure, I've just started trying it out, and I'm on 3.11. In case I trip again, do you want me to push a PR or refrain until you go 3.11?

@GuillaumeDSM
Copy link
Member

GuillaumeDSM commented May 24, 2024

Sure, I've just started trying it out, and I'm on 3.11. In case I trip again, do you want me to push a PR or refrain until you go 3.11?

If you find other things to fix/improve on 3.11, it's always good to have them fixed already, plz make a PR !

@srdjan0 srdjan0 force-pushed the fix-dataclasses-mutable-default branch from 59a1bfe to 256812e Compare September 1, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants