Skip to content

Commit

Permalink
🌿 make fernignored classes pydantic v1 and v2 compatible (#7)
Browse files Browse the repository at this point in the history
* make fernignored classes pydantic v1 and v2 compatible

* add test_client to fernignore
  • Loading branch information
dsinghvi authored Jan 22, 2024
1 parent 2da486d commit da0ad5a
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ src/vocode/types/end_conversation_action_params.py
src/vocode/types/transfer_call_action_params.py
src/vocode/types/add_to_conference_action_params.py
src/vocode/types/set_hold_action_params.py

tests/test_client.py
7 changes: 5 additions & 2 deletions src/vocode/types/add_to_conference_action_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime
from .add_to_conference_action_params_action_trigger import AddToConferenceActionParamsActionTrigger
from .add_to_conference_config import AddToConferenceConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AddToConferenceActionParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_add_to_conference"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/add_to_conference_action_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import datetime as dt
import typing

import pydantic

from ..core.datetime_utils import serialize_datetime
from .add_to_conference_action_update_params_action_trigger import AddToConferenceActionUpdateParamsActionTrigger
from .add_to_conference_action_update_params_config import AddToConferenceActionUpdateParamsConfig
import typing_extensions

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AddToConferenceActionUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_add_to_conference"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/azure_voice_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AzureVoiceParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_azure"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/azure_voice_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
from .azure_voice_update_params_pitch import AzureVoiceUpdateParamsPitch
from .azure_voice_update_params_rate import AzureVoiceUpdateParamsRate
from .azure_voice_update_params_voice_name import AzureVoiceUpdateParamsVoiceName

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class AzureVoiceUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_azure"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/dtmf_action_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
from .empty_action_config import EmptyActionConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class DtmfActionParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_dtmf"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/dtmf_action_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime
from .dtmf_action_update_params_config import DtmfActionUpdateParamsConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class DtmfActionUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_dtmf"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/eleven_labs_voice_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class ElevenLabsVoiceParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_eleven_labs"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/eleven_labs_voice_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
Expand All @@ -13,6 +11,11 @@
from .eleven_labs_voice_update_params_stability import ElevenLabsVoiceUpdateParamsStability
from .eleven_labs_voice_update_params_voice_id import ElevenLabsVoiceUpdateParamsVoiceId

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class ElevenLabsVoiceUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_eleven_labs"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/end_conversation_action_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
from .empty_action_config import EmptyActionConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class EndConversationActionParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_end_conversation"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/end_conversation_action_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime
from .end_conversation_action_update_params_config import EndConversationActionUpdateParamsConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class EndConversationActionUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_end_conversation"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/play_ht_voice_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class PlayHtVoiceParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_play_ht"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/play_ht_voice_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
from .play_ht_voice_update_params_api_key import PlayHtVoiceUpdateParamsApiKey
from .play_ht_voice_update_params_api_user_id import PlayHtVoiceUpdateParamsApiUserId
from .play_ht_voice_update_params_voice_id import PlayHtVoiceUpdateParamsVoiceId

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class PlayHtVoiceUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_play_ht"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/rime_voice_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class RimeVoiceParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_rime"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/rime_voice_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
from .rime_voice_update_params_speaker import RimeVoiceUpdateParamsSpeaker

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class RimeVoiceUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["voice_rime"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/set_hold_action_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime
from .empty_action_config import EmptyActionConfig
from .set_hold_action_params_action_trigger import SetHoldActionParamsActionTrigger

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class SetHoldActionParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_set_hold"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/set_hold_action_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime
from .set_hold_action_update_params_action_trigger import SetHoldActionUpdateParamsActionTrigger
from .set_hold_action_update_params_config import SetHoldActionUpdateParamsConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class SetHoldActionUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_set_hold"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/transfer_call_action_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import datetime as dt
import typing

import pydantic

import typing_extensions

from ..core.datetime_utils import serialize_datetime
from .transfer_call_config import TransferCallConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class TransferCallActionParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_transfer_call"]
Expand Down
7 changes: 5 additions & 2 deletions src/vocode/types/transfer_call_action_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import typing
import typing_extensions

import pydantic

from ..core.datetime_utils import serialize_datetime
from .transfer_call_action_update_params_config import TransferCallActionUpdateParamsConfig

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class TransferCallActionUpdateParams(pydantic.BaseModel):
type: typing_extensions.Literal["action_transfer_call"]
Expand Down
10 changes: 5 additions & 5 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from vocode.client import Vocode

# Get started with writing tests with pytest at https://docs.pytest.org
@pytest.mark.skip(reason="Unimplemented")
def test_client() -> None:
assert True == True

# Test client instantiation
def test_client_instantiation() -> None:
Vocode(token="....")

0 comments on commit da0ad5a

Please sign in to comment.