Skip to content

Commit

Permalink
⚡️ Remove unnecessary frozen from dataclasses.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Krupinski committed Jan 25, 2024
1 parent 2c33e30 commit cecf0fc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lapidary/runtime/model/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .request import RequestBuilder


@dc.dataclass(frozen=True)
@dc.dataclass
class OperationModel:
method: str
path: str
Expand Down
8 changes: 4 additions & 4 deletions src/lapidary/runtime/model/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ParamStyle(Enum):
deepObject = 'deepObject'


@dc.dataclass(frozen=True)
class Param( RequestPartHandler,abc.ABC,):
@dc.dataclass
class Param(RequestPartHandler, abc.ABC):
alias: ty.Optional[str] = dc.field(default=None)

style: ParamStyle = dc.field(default=ParamStyle.simple)
Expand Down Expand Up @@ -118,7 +118,7 @@ def apply(self, builder: 'RequestBuilder', name: str, typ: type, value: ty.Any)
builder.auth = value


@dc.dataclass(frozen=True)
@dc.dataclass
class RequestPart:
request_part: RequestPartHandler
name: str
Expand All @@ -129,7 +129,7 @@ def apply(self, builder: 'RequestBuilder', value: ty.Any) -> None:
self.request_part.apply(builder, self.name, self.type, value)


@dc.dataclass(frozen=True)
@dc.dataclass
class RequestBody(RequestPartHandler):
content: ty.Mapping[str, ty.Type]

Expand Down
2 changes: 1 addition & 1 deletion src/lapidary/runtime/model/response_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
ResponseMap = ty.Mapping[ResponseCode, MimeMap]


@dc.dataclass(frozen=True)
@dc.dataclass
class Responses:
responses: ResponseMap
8 changes: 4 additions & 4 deletions src/lapidary/runtime/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@
from .model.request import RequestBuilder


@dc.dataclass(frozen=True)
@dc.dataclass
class Cookie(Param):
style: ParamStyle = ParamStyle.form

def _apply(self, builder: 'RequestBuilder', name: str, value: ty.Any) -> None:
builder.cookies[name] = value


@dc.dataclass(frozen=True)
@dc.dataclass
class Header(Param):
style: ParamStyle = ParamStyle.simple

def _apply(self, builder: 'RequestBuilder', name: str, value: ParamValue) -> None:
builder.headers[name] = str(value)


@dc.dataclass(frozen=True)
@dc.dataclass
class Path(Param):
style: ParamStyle = ParamStyle.simple

def _apply(self, builder: 'RequestBuilder', name: str, value: ty.Any) -> None:
builder.path_params[name] = value


@dc.dataclass(frozen=True)
@dc.dataclass
class Query(Param):
style: ParamStyle = dc.field(default=ParamStyle.form)

Expand Down

0 comments on commit cecf0fc

Please sign in to comment.