mimesis/schema.py
def perform(
        self,
        name: Optional[str] = None,
        key: Optional[Callable[[Any], Any]] = None,
        **kwargs: Any
    ) -> Any:
        """Performs the value of the field by its name.

        It takes any string which represents the name of any method of
        any supported data provider and the ``**kwargs`` of this method.

        .. note:: Some data providers have methods with the same names
            and in such cases, you can explicitly define that the method
            belongs to data-provider ``name='provider.name'`` otherwise
            it will return the data from the first provider which
            has a method ``name``.

        You can apply a *key function* to the result returned by
        the method, bt passing a parameter **key** with a callable
        object which returns the final result.

        :param name: Name of the method.
        :param key: A key function (or any other callable object)
            which will be applied to result.
        :param kwargs: Kwargs of method.
        :return: Value which represented by method.
        :raises ValueError: if provider not
            supported or if field not defined.
        """
        if name is None:
            raise FieldError()

        def tail_parser(tails: str, obj: Any) -> Any:
            """Return method from end of tail.

            :param tails: Tail string
            :param obj: Search tail from this object
            :return last tailed method
            """
            provider_name, method_name = tails.split(".", 1)

            if "." in method_name:
                raise FieldError(name)

            attr = getattr(obj, provider_name)
            if attr is not None:
                try:
                    return getattr(attr, method_name)
                except AttributeError:
                    raise FieldError(name)

        try:
            if name not in self._table:
                if "." not in name:
                    # Fix https://github.com/lk-geimfari/mimesis/issues/619
                    if name == self._gen.choice.Meta.name:
                        self._table[name] = self._gen.choice
                    else:
                        for provider in dir(self._gen):
                            provider = getattr(self._gen, provider)
                            if name in dir(provider):
                                self._table[name] = getattr(provider, name)
                else:
                    self._table[name] = tail_parser(name, self._gen)

            result = self._table[name](**kwargs)
            if key and callable(key):
                return key(result)
            return result
        except KeyError:
            raise FieldError(name)
Performs the value of the field by its name.

        It takes any string which represents the name of any method of
        any supported data provider and the ``**kwargs`` of this method.

        .. note:: Some data providers have methods with the same names
            and in such cases, you can explicitly define that the method
            belongs to data-provider ``name='provider.name'`` otherwise
            it will return the data from the first provider which
            has a method ``name``.

        You can apply a *key function* to the result returned by
        the method, bt passing a parameter **key** with a callable
        object which returns the final result.

        :param name: Name of the method.
        :param key: A key function (or any other callable object)
            which will be applied to result.
        :param kwargs: Kwargs of method.
        :return: Value which represented by method.
        :raises ValueError: if provider not
            supported or if field not defined.
        
Performs the value of the field by its name.
It takes any string which represents the name of any method of
any supported data provider and the ``**kwargs`` of this method.




Performs the value of the field by its name . It takes any string which represents the name of any method of any supported data provider and the ` ` ** kwargs ` ` of this method .
def perform(
        self,
        name: Optional[str] = None,
        key: Optional[Callable[[Any], Any]] = None,
        **kwargs: Any
    ) -> Any:
        if name is None:
            raise FieldError()
        def tail_parser(tails: str, obj: Any) -> Any:
            provider_name, method_name = tails.split(".", 1)
            if "." in method_name:
                raise FieldError(name)
            attr = getattr(obj, provider_name)
            if attr is not None:
                try:
                    return getattr(attr, method_name)
                except AttributeError:
                    raise FieldError(name)
        try:
            if name not in self._table:
                if "." not in name:
                    if name == self._gen.choice.Meta.name:
                        self._table[name] = self._gen.choice
                    else:
                        for provider in dir(self._gen):
                            provider = getattr(self._gen, provider)
                            if name in dir(provider):
                                self._table[name] = getattr(provider, name)
                else:
                    self._table[name] = tail_parser(name, self._gen)
            result = self._table[name](**kwargs)
            if key and callable(key):
                return key(result)
            return result
        except KeyError:
            raise FieldError(name)
def perform ( self , name : Optional [ str ] = None , key : Optional [ Callable [ [ Any ] , Any ] ] = None , ** kwargs : Any ) -> Any : if name is None : raise FieldError ( ) def tail_parser ( tails : str , obj : Any ) -> Any : """Return method from end of tail.

            :param tails: Tail string
            :param obj: Search tail from this object
            :return last tailed method
            """ provider_name , method_name = tails . split ( "." , 1 ) if "." in method_name : raise FieldError ( name ) attr = getattr ( obj , provider_name ) if attr is not None : try : return getattr ( attr , method_name ) except AttributeError : raise FieldError ( name ) try : if name not in self . _table : if "." not in name : if name == self . _gen . choice . Meta . name : self . _table [ name ] = self . _gen . choice else : for provider in dir ( self . _gen ) : provider = getattr ( self . _gen , provider ) if name in dir ( provider ) : self . _table [ name ] = getattr ( provider , name ) else : self . _table [ name ] = tail_parser ( name , self . _gen ) result = self . _table [ name ] ( ** kwargs ) if key and callable ( key ) : return key ( result ) return result except KeyError : raise FieldError ( name )
Performs the value of the field by its name.
Performs the value of the field by its name .
"""Performs the value of the field by its name.

        It takes any string which represents the name of any method of
        any supported data provider and the ``**kwargs`` of this method.

        .. note:: Some data providers have methods with the same names
            and in such cases, you can explicitly define that the method
            belongs to data-provider ``name='provider.name'`` otherwise
            it will return the data from the first provider which
            has a method ``name``.

        You can apply a *key function* to the result returned by
        the method, bt passing a parameter **key** with a callable
        object which returns the final result.

        :param name: Name of the method.
        :param key: A key function (or any other callable object)
            which will be applied to result.
        :param kwargs: Kwargs of method.
        :return: Value which represented by method.
        :raises ValueError: if provider not
            supported or if field not defined.
        """ """Return method from end of tail.

            :param tails: Tail string
            :param obj: Search tail from this object
            :return last tailed method
            """ # Fix https://github.com/lk-geimfari/mimesis/issues/619
Value which represented by method.
Value which represented by method .
if provider not
supported or if field not defined.
if provider not supported or if field not defined .
ValueError
self
name
Optional[str]
Name of the method.
Name of the method .
key
Optional[Callable[[Any], Any]]
A key function (or any other callable object)
which will be applied to result.
A key function ( or any other callable object ) which will be applied to result .
kwargs
Any
Kwargs of method.
Kwargs of method .