Skip to main content
Glama

API Docs MCP Server

converters.cpython-310.pyc3.75 kB
o �I�g�@sZdZddlZddlmZddlmZmZmZmZgd�Z dd�Z edfd d �Z d d �Z dS) z Commonly useful converters. �N�)�_AnnotationExtractor)�NOTHING� Converter�Factory�pipe)�default_if_none�optionalr�to_boolcs�t�t�r �fdd�}n�fdd�}t��}|��}|r$tj||jd<|��}|r2tj||jd<t�t�r>t|ddd�S|S) a_ A converter that allows an attribute to be optional. An optional attribute is one which can be set to `None`. Type annotations will be inferred from the wrapped converter's, if it has any. Args: converter (typing.Callable): the converter that is used for non-`None` values. .. versionadded:: 17.1.0 cs|durdS�|||�S�N�)�val�inst�field�� converterr �]C:\Users\apqls\Documents\Github\tkbase\api-docs-mcp\venv\Lib\site-packages\attr/converters.py�optional_converter&s z$optional.<locals>.optional_convertercs|durdS�|�Sr r �r rr rr-sr �returnT)� takes_selfZ takes_fieldN)� isinstancerrZget_first_param_type�typing�Optional�__annotations__Zget_return_type)rrZxtr�t�rtr rrr s   r cs��tur|durd}t|���tur|durd}t|��|dur$t|��t�t�r:�jr2d}t|���fdd�}|S�fdd�}|S)a� A converter that allows to replace `None` values by *default* or the result of *factory*. Args: default: Value to be used if `None` is passed. Passing an instance of `attrs.Factory` is supported, however the ``takes_self`` option is *not*. factory (typing.Callable): A callable that takes no parameters whose result is used if `None` is passed. Raises: TypeError: If **neither** *default* or *factory* is passed. TypeError: If **both** *default* and *factory* are passed. ValueError: If an instance of `attrs.Factory` is passed with ``takes_self=True``. .. versionadded:: 18.2.0 Nz(Must pass either `default` or `factory`.z5Must pass either `default` or `factory` but not both.z1`takes_self` is not supported by default_if_none.cs|dur|S���Sr )�factoryr��defaultr r�default_if_none_converterlsz2default_if_none.<locals>.default_if_none_convertercs|dur|S�Sr r rrr rr ts)r� TypeErrorrrr� ValueError)rr�msgr r rrrBs    �rcCs<t|t�r |��}|dvrdS|dvrdSd|��}t|��)a� Convert "boolean" strings (for example, from environment variables) to real booleans. Values mapping to `True`: - ``True`` - ``"true"`` / ``"t"`` - ``"yes"`` / ``"y"`` - ``"on"`` - ``"1"`` - ``1`` Values mapping to `False`: - ``False`` - ``"false"`` / ``"f"`` - ``"no"`` / ``"n"`` - ``"off"`` - ``"0"`` - ``0`` Raises: ValueError: For any other value. .. versionadded:: 21.3.0 )T�truer�yes�y�on�1rT)F�false�f�no�n�off�0rFzCannot convert value to bool: N)r�str�lowerr")r r#r r rr }s  r ) �__doc__rZ_compatr�_makerrrr�__all__r rr r r r r�<module>s - ;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShotaNagafuchi/api-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server