mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix typing.Optional normalization.
This commit is contained in:
parent
af2573dbee
commit
43c565d39b
4 changed files with 326 additions and 318 deletions
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import typing
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from generator.normalizers import normalize_type, get_returning
|
||||
from generator.normalizers import normalize_type, get_returning, normalize_optional
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
@ -21,10 +21,11 @@ class Annotation:
|
|||
|
||||
@property
|
||||
def python_type(self) -> str:
|
||||
return normalize_type(self.type, self.required)
|
||||
result = normalize_type(self.type)
|
||||
return normalize_optional(result, self.required)
|
||||
|
||||
@property
|
||||
def python_argument(self):
|
||||
def python_field(self):
|
||||
result = f"{self.python_name}: {self.python_type}"
|
||||
|
||||
value = "" if self.required else "None"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue