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

attrs: use sugar syntax for factory #487

Merged
merged 1 commit into from
Dec 25, 2023
Merged

attrs: use sugar syntax for factory #487

merged 1 commit into from
Dec 25, 2023

Conversation

skshetry
Copy link
Member

There are three ways to set factory in attrs:

  1. What is being done in the PR.
@define
class Klass:
  attr: list = field(default=Factory(list))
  1. Using factory kwarg, which is a sugar for above.
@define
class Klass:
  attr: list = field(factory=list)
  1. Another sugar for above.
@define
class Klass:
  attr: list = Factory(list)
  1. is verbose, but I prefer 2).

@codecov-commenter
Copy link

codecov-commenter commented Dec 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a535b4b) 63.70% compared to head (eb93189) 63.74%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #487      +/-   ##
==========================================
+ Coverage   63.70%   63.74%   +0.03%     
==========================================
  Files          61       61              
  Lines        4177     4173       -4     
  Branches      714      713       -1     
==========================================
- Hits         2661     2660       -1     
+ Misses       1368     1367       -1     
+ Partials      148      146       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@efiop efiop merged commit 1e3c730 into main Dec 25, 2023
15 checks passed
@skshetry skshetry deleted the attrs-simplify branch December 25, 2023 08:04
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.

3 participants