We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
When I run the script below, I get the subsequent terminal output.
The print of c0 shows that the dates field is not a tuple.
c0
dates
tuple
Notably, the validator does not seem to be catching that dates is not a tuple.
Is there anything obviously wrong I'm doing here?
import pandas as pd import attr from attr import ( field, frozen, ) from attr.validators import ( instance_of, deep_iterable, ) @frozen class Calendar0: dates: field(validator=deep_iterable(instance_of(pd.Timestamp), instance_of(tuple)), converter=tuple) print(f'attr version: {attr.__version__}') dti = pd.date_range('2023-01-01', freq='D', periods=10) c0 = Calendar0(dti) print(c0)
attr version: 22.2.0 Calendar0(dates=DatetimeIndex(['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05', '2023-01-06', '2023-01-07', '2023-01-08', '2023-01-09', '2023-01-10'], dtype='datetime64[ns]', freq='D'))
The text was updated successfully, but these errors were encountered:
derp, I was using :, not =
:
=
Sorry, something went wrong.
No branches or pull requests
When I run the script below, I get the subsequent terminal output.
The print of
c0
shows that thedates
field is not atuple
.Notably, the validator does not seem to be catching that
dates
is not atuple
.Is there anything obviously wrong I'm doing here?
The text was updated successfully, but these errors were encountered: