The match-case statement was introduced to Python in v3.10.
When I run the code in Python 3.9.13, It gives me this - File "C:\Users\omkar\Desktop\textbook_quality\app\llm\llm.py", line 74 match model: ^ SyntaxError: invalid syntax
I encountered another syntax error - created: datetime | None = Field( TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
The reason for this is - datetime | None syntax is only supported in 3.10 or later.
A solution for this could be - from typing import Optional name: Optional[datetime] = None
The match-case statement was introduced to Python in v3.10.
When I run the code in Python 3.9.13, It gives me this -
File "C:\Users\omkar\Desktop\textbook_quality\app\llm\llm.py", line 74
match model:
^
SyntaxError: invalid syntax
I encountered another syntax error -
created: datetime | None = Field(
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
The reason for this is -datetime | None
syntax is only supported in 3.10 or later.A solution for this could be -
from typing import Optional
name: Optional[datetime] = None