Skip to content

Commit

Permalink
fix: mypy violations
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Nov 22, 2024
1 parent 96f74d2 commit 5a87bd9
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 88 deletions.
4 changes: 1 addition & 3 deletions catalystwan/models/configuration/feature_profile/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ class WANIPv4StaticRoute(BaseModel):
gateway: Global[Literal["nextHop", "null0", "dhcp"]] = Field(
default=Global(value="nextHop"), serialization_alias="gateway", validation_alias="gateway"
)
next_hops: Optional[List[NextHop]] = Field(
default_factory=list, serialization_alias="nextHop", validation_alias="nextHop"
)
next_hops: Optional[List[NextHop]] = Field(default=None, serialization_alias="nextHop", validation_alias="nextHop")
distance: Optional[Global[int]] = Field(default=None, serialization_alias="distance", validation_alias="distance")

def set_to_next_hop(
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ class SslDecryptionParcel(_ParcelBase):
)
unknown_status: Optional[Global[Action]] = Field(default=None, validation_alias=AliasPath("data", "unknownStatus"))
unsupported_protocol_versions: Global[UnspportedModeAction] = Field(
default=Global[Action](value="drop"), validation_alias=AliasPath("data", "unsupportedProtocolVersions")
default=Global[UnspportedModeAction](value="drop"),
validation_alias=AliasPath("data", "unsupportedProtocolVersions"),
)
unsupported_cipher_suites: Global[UnspportedModeAction] = Field(
default=Global[Action](value="drop"), validation_alias=AliasPath("data", "unsupportedCipherSuites")
default=Global[UnspportedModeAction](value="drop"),
validation_alias=AliasPath("data", "unsupportedCipherSuites"),
)
failure_mode: Global[FailureMode] = Field(
default=Global[FailureMode](value="close"), validation_alias=AliasPath("data", "failureMode")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class SslDecryptionProfileParcel(_ParcelBase):
default=Global[List[Categories]](value=[]), validation_alias=AliasPath("data", "neverDecryptCategories")
)
skip_decrypt_categories: Global[List[Categories]] = Field(
default=None, validation_alias=AliasPath("data", "skipDecryptCategories")
default=Global[List[Categories]](value=[]), validation_alias=AliasPath("data", "skipDecryptCategories")
)
reputation: Global[bool] = Field(
default=Global[bool](value=False), validation_alias=AliasPath("data", "reputation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@ class LoggingParcel(_ParcelBase):
populate_by_name=True,
)
disk: Disk = Field(default_factory=Disk, validation_alias=AliasPath("data", "disk"))
tls_profile: Optional[List[TlsProfile]] = Field(
default_factory=list, validation_alias=AliasPath("data", "tlsProfile")
)
server: Optional[List[Server]] = Field(default_factory=list, validation_alias=AliasPath("data", "server"))
ipv6_server: Optional[List[Server]] = Field(default_factory=list, validation_alias=AliasPath("data", "ipv6Server"))
tls_profile: Optional[List[TlsProfile]] = Field(default=None, validation_alias=AliasPath("data", "tlsProfile"))
server: Optional[List[Server]] = Field(default=None, validation_alias=AliasPath("data", "server"))
ipv6_server: Optional[List[Server]] = Field(default=None, validation_alias=AliasPath("data", "ipv6Server"))

def set_disk(self, enable: bool, disk_file_size: int = 10, disk_file_rotate: int = 10):
self.disk.disk_enable = as_global(enable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Actions(BaseModel):

class Sequence(BaseModel):
model_config = ConfigDict(populate_by_name=True)
actions: Optional[List[Actions]] = Field(default_factory=list)
actions: Optional[List[Actions]] = Field(default=None)
base_action: Optional[Global[AcceptRejectActionType]] = Field(
default=None, validation_alias="baseAction", serialization_alias="baseAction"
)
Expand Down
2 changes: 1 addition & 1 deletion catalystwan/models/policy/definition/url_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class UrlFilteringDefinition(BaseModel):
logging: List[str] = Field(default_factory=list)
enable_alerts: bool = Field(validation_alias="enableAlerts", serialization_alias="enableAlerts")
alerts: Set[UrlFilteringAlerts] = Field(
default_factory=list, validation_alias="alerts", serialization_alias="alerts"
default_factory=set, validation_alias="alerts", serialization_alias="alerts"
)
target_vpns: List[VpnId] = Field(
default_factory=list, validation_alias="targetVpns", serialization_alias="targetVpns"
Expand Down
4 changes: 2 additions & 2 deletions catalystwan/models/policy/list/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

class IdentityListEntry(BaseModel):
model_config = ConfigDict(populate_by_name=True)
user: str = Field(default=None)
user_group: str = Field(default=None, validation_alias="userGroup", serialization_alias="userGroup")
user: str
user_group: str = Field(validation_alias="userGroup", serialization_alias="userGroup")


class IdentityList(PolicyListBase):
Expand Down

0 comments on commit 5a87bd9

Please sign in to comment.