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

feat(python)!: Remove class variables from some DataTypes #16524

Merged
merged 5 commits into from
Jun 4, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented May 27, 2024

Some DataType classes had class variables. The Datetime class, for example, had time_unit and time_zone as class variables. This was unintended: these should have been instance variables. This has now been corrected.

Example

Before:

>>> dtype = pl.Datetime
>>> dtype.time_unit is None
True

After:

>>> dtype.time_unit is None
Traceback (most recent call last):
...
AttributeError: type object 'Datetime' has no attribute 'time_unit'

Use instead:

>>> getattr(dtype, "time_unit", None) is None
True

@github-actions github-actions bot added breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars labels May 27, 2024
@stinodego stinodego added this to the 1.0.0 milestone May 29, 2024
@stinodego stinodego self-assigned this May 30, 2024
@stinodego stinodego marked this pull request as ready for review May 30, 2024 21:33
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.50%. Comparing base (d7b4f72) to head (35fbace).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16524      +/-   ##
==========================================
- Coverage   81.51%   81.50%   -0.02%     
==========================================
  Files        1414     1414              
  Lines      185906   185899       -7     
  Branches     3027     3024       -3     
==========================================
- Hits       151535   151509      -26     
- Misses      33840    33861      +21     
+ Partials      531      529       -2     

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

@stinodego stinodego merged commit 4ef4aa4 into main Jun 4, 2024
14 checks passed
@stinodego stinodego deleted the datatype-classvar-none branch June 4, 2024 06:29
@c-peters c-peters added the accepted Ready for implementation label Jun 9, 2024
@stinodego stinodego changed the title feat(python)!: Remove default class variable values on DataTypes feat(python)!: Remove class variables from some DataTypes Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants