You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the cass.get_version() method, I noticed that the date parameter in the function has a type hint of datetime.date. Based on that, I wrote the following code:
asyncdef_get_patch_version(self, target_date: Optional[Union[str, datetime.date]] =None) ->str:
"""Date format: %y%m%d"""iftarget_dateisNone:
target_date=datetime.date.today()
elifisinstance(target_date, str):
try:
target_date=datetime.datetime.strptime(target_date, "%y%m%d").date()
exceptValueError:
raiseValueError("Date format should be YYMMDD, e.g., '240508' for 2024-05-08.")
returnawaitasyncio.to_thread(cass.get_version, date=target_date, region=self.region)
When I use the above function and pass a datetime.date type as the date parameter to cass.get_version(), I encounter a type error in Patch.from_date() if I specify a date other than today.
.venv/lib/python3.12/site-packages/cassiopeia/cassiopeia.py:242: in get_version
patch = Patch.from_date(date, region=region)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'cassiopeia.core.patch.Patch'>, date = datetime.date(2024, 11, 2), region = <Region.korea: 'KR'>
@classmethod
def from_date(cls, date: arrow.Arrow, region: Union[Region, str]) -> "Patch":
if not cls.__patches:
cls.__load__()
if not isinstance(region, Region):
region = Region(region)
for patch in cls.__patches[region]:
patch_end = patch.end or arrow.now().shift(seconds=1)
> if patch.start <= date < patch_end:
E TypeError: '<=' not supported between instances of 'Arrow' and 'datetime.date'
.venv/lib/python3.12/site-packages/cassiopeia/core/patch.py:70: TypeError
================================================================================ short test summary info =================================================================================
FAILED tests/test_riot_handler.py::test_get_op_champions - TypeError: '<=' not supported between instances of 'Arrow' and 'datetime.date'
Based on my assessment, this error seems to be a bug. However, if I am missing something, I would appreciate it if you could let me know what it might be.
Let me know if you need any additional information.
Thank you.
The text was updated successfully, but these errors were encountered:
sdkim96
changed the title
cass.get_version() signature mismatches with Patch.from_date()
TypeError in cass.get_version() due to datetime.date and Arrow type mismatch in Patch.from_date()
Nov 2, 2024
Hello,
When I use the
cass.get_version()
method, I noticed that the date parameter in the function has a type hint of datetime.date. Based on that, I wrote the following code:When I use the above function and pass a datetime.date type as the date parameter to
cass.get_version()
, I encounter a type error inPatch.from_date()
if I specify a date other than today.Based on my assessment, this error seems to be a bug. However, if I am missing something, I would appreciate it if you could let me know what it might be.
Let me know if you need any additional information.
Thank you.
The text was updated successfully, but these errors were encountered: