-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgrade & fix models & tests * address deprecated pydantic warnings * remove print statments, uncomment test * fix optional -> None fields
- Loading branch information
1 parent
c09833c
commit 0a8d217
Showing
15 changed files
with
260 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
pytest==7.4.2 | ||
responses==0.22.0 | ||
coverage | ||
pydantic>=1.10,==1.* | ||
pydantic==2.5.2 | ||
|
||
bump2version | ||
build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
from pydantic import BaseModel, confloat, conint | ||
from typing import Optional, List | ||
from typing import List | ||
|
||
|
||
class InputTypes: | ||
class Dtmf(BaseModel): | ||
timeOut: Optional[conint(ge=0, le=10)] | ||
maxDigits: Optional[conint(ge=1, le=20)] | ||
submitOnHash: Optional[bool] | ||
timeOut: conint(ge=0, le=10) = None | ||
maxDigits: conint(ge=1, le=20) = None | ||
submitOnHash: bool = None | ||
|
||
class Speech(BaseModel): | ||
uuid: Optional[str] | ||
endOnSilence: Optional[confloat(ge=0.4, le=10.0)] | ||
language: Optional[str] | ||
context: Optional[List[str]] | ||
startTimeout: Optional[conint(ge=1, le=60)] | ||
maxDuration: Optional[conint(ge=1, le=60)] | ||
saveAudio: Optional[bool] | ||
uuid: str = None | ||
endOnSilence: confloat(ge=0.4, le=10.0) = None | ||
language: str = None | ||
context: List[str] = None | ||
startTimeout: conint(ge=1, le=60) = None | ||
maxDuration: conint(ge=1, le=60) = None | ||
saveAudio: bool = None | ||
|
||
@classmethod | ||
def create_dtmf_model(cls, dict) -> Dtmf: | ||
return cls.Dtmf.parse_obj(dict) | ||
return cls.Dtmf.model_validate(dict) | ||
|
||
@classmethod | ||
def create_speech_model(cls, dict) -> Speech: | ||
return cls.Speech.parse_obj(dict) | ||
return cls.Speech.model_validate(dict) |
Oops, something went wrong.