8000 X cash refac by 9qeklajc · Pull Request #60 · Routstr/proxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

X cash refac #60

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

Merged
merged 17 commits into from
Jul 5, 2025
Merged

X cash refac #60

merged 17 commits into from
Jul 5, 2025

Conversation

9qeklajc
Copy link
Contributor

No description provided.

Copy link
Contributor
@shroominic shroominic left a comment

Choose a reason for hiding this comment

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

whats the difference between CostData | MaxCostData?
because form the class its the same
class MaxCostData(CostData):
pass

so why this match?
case MaxCostData() as cost:
return cost.dict()
case CostData() as cost:

because its a different class it matches different?

CURRENCY = cast(CurrencyUnit, os.environ.get("CURRENCY", "sat"))
not 100% sure but i think cast is not type validation but just overriding the type for type checking so mybe better Pydantic validation?

or cast just to get rid of the typing error

@9qeklajc
Copy link
Contributor Author
9qeklajc commented Jul 1, 2025

whats the difference between CostData | MaxCostData? because form the class its the same class MaxCostData(CostData): pass

so why this match? case MaxCostData() as cost: return cost.dict() case CostData() as cost:

because its a different class it matches different?

it is basically a type check to move value check consern to different level, so the function where the classes are used, will not have to care about checking values to decide when and what to return ...

@9qeklajc
Copy link
Contributor Author
9qeklajc commented Jul 1, 2025

CURRENCY = cast(CurrencyUnit, os.environ.get("CURRENCY", "sat")) not 100% sure but i think cast is not type validation but just overriding the type for type checking so mybe better Pydantic validation?

or cast just to get rid of the typing error

not realy validating in that case, I'm not sure if we need to validate (we could) .. just making sure that the user, that uses the redeem function knows what to expect

Copy link
Contributor
@shroominic shroominic left a comment

Choose a reason for hiding this comment

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

LGTM!

@shroominic shroominic merged commit 63c1188 into main Jul 5, 2025
4 checks passed
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
0