mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-17 04:12:43 +00:00
fix(compat): compat with pydantic<2.8.0 when using additional fields
This commit is contained in:
parent
74f0fa2404
commit
662246b39c
1 changed files with 60 additions and 10 deletions
|
|
@ -77,12 +77,17 @@ class AgentBuild(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class AgentGeneralPermission(BaseModel):
|
||||
|
|
@ -113,12 +118,17 @@ class AgentGeneral(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class AgentPlanPermission(BaseModel):
|
||||
|
|
@ -149,12 +159,17 @@ class AgentPlan(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class AgentAgentItemPermission(BaseModel):
|
||||
|
|
@ -185,12 +200,17 @@ class AgentAgentItem(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class Agent(BaseModel):
|
||||
|
|
@ -200,12 +220,17 @@ class Agent(BaseModel):
|
|||
|
||||
plan: Optional[AgentPlan] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, AgentAgentItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, AgentAgentItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> AgentAgentItem: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, AgentAgentItem]
|
||||
|
||||
|
||||
class Command(BaseModel):
|
||||
|
|
@ -299,12 +324,17 @@ class ModeBuild(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class ModePlanPermission(BaseModel):
|
||||
|
|
@ -335,12 +365,17 @@ class ModePlan(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class ModeModeItemPermission(BaseModel):
|
||||
|
|
@ -371,12 +406,17 @@ class ModeModeItem(BaseModel):
|
|||
|
||||
top_p: Optional[float] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class Mode(BaseModel):
|
||||
|
|
@ -384,12 +424,17 @@ class Mode(BaseModel):
|
|||
|
||||
plan: Optional[ModePlan] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, ModeModeItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, ModeModeItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> ModeModeItem: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, ModeModeItem]
|
||||
|
||||
|
||||
class Permission(BaseModel):
|
||||
|
|
@ -449,12 +494,17 @@ class ProviderOptions(BaseModel):
|
|||
Default is 300000 (5 minutes). Set to false to disable timeout.
|
||||
"""
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
||||
# value to this field, so for compatibility we avoid doing it at runtime.
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
else:
|
||||
__pydantic_extra__: Dict[str, object]
|
||||
|
||||
|
||||
class Provider(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue