Module supertokens_python.ingredients.smsdelivery

Expand source code
# Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
#
# This software is licensed under the Apache License, Version 2.0 (the
# "License") as published by the Apache Software Foundation.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from typing import Generic, TypeVar

from supertokens_python.ingredients.smsdelivery.types import (
    SMSDeliveryConfigWithService,
    SMSDeliveryInterface,
)

_T = TypeVar("_T")


class SMSDeliveryIngredient(Generic[_T]):
    ingredient_interface_impl: SMSDeliveryInterface[_T]

    def __init__(self, config: SMSDeliveryConfigWithService[_T]) -> None:
        self.ingredient_interface_impl = (
            config.service
            if config.override is None
            else config.override(config.service)
        )

Sub-modules

supertokens_python.ingredients.smsdelivery.services
supertokens_python.ingredients.smsdelivery.types

Classes

class SMSDeliveryIngredient (config: SMSDeliveryConfigWithService[~_T])

Abstract base class for generic types.

On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class's name::

class Mapping[KT, VT]:
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

On older versions of Python, however, generic classes have to explicitly inherit from Generic.

After a class has been declared to be generic, it can then be used as follows::

def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
Expand source code
class SMSDeliveryIngredient(Generic[_T]):
    ingredient_interface_impl: SMSDeliveryInterface[_T]

    def __init__(self, config: SMSDeliveryConfigWithService[_T]) -> None:
        self.ingredient_interface_impl = (
            config.service
            if config.override is None
            else config.override(config.service)
        )

Ancestors

  • typing.Generic

Class variables

var ingredient_interface_implSMSDeliveryInterface[~_T]