
    k7i                     X   S r SSKrSSKrSSKJr  SSKJrJr  SSKJr  SSK	J
r
Jr  \
(       a
  SSKJrJrJr  SS	KJrJr  SS
KJr  \" \5      r\\S/S4   r\\S/S4   r " S S\R2                  5      r\" SS9 " S S5      5       r\" \R8                  S9/rS\S\\   S\4S jr/ SQr g)z+Route mapping logic for OpenAPI operations.    N)Callable)	dataclassfield)Pattern)TYPE_CHECKINGLiteral   )OpenAPIResourceOpenAPIResourceTemplateOpenAPITool)
HttpMethod	HTTPRoute)
get_loggerMCPTypezMCPType | Nonez7OpenAPITool | OpenAPIResource | OpenAPIResourceTemplatec                   (    \ rS rSrSrSrSrSrSrSr	g)	r   !   a`  Type of FastMCP component to create from a route.

Enum values:
    TOOL: Convert the route to a callable Tool
    RESOURCE: Convert the route to a Resource (typically GET endpoints)
    RESOURCE_TEMPLATE: Convert the route to a ResourceTemplate (typically GET with path params)
    EXCLUDE: Exclude the route from being converted to any MCP component
TOOLRESOURCERESOURCE_TEMPLATEEXCLUDE N)
__name__
__module____qualname____firstlineno____doc__r   r   r   r   __static_attributes__r       e/home/james-whalen/.local/lib/python3.13/site-packages/fastmcp/experimental/server/openapi/routing.pyr   r   !   s     DH+Gr   T)kw_onlyc                       \ rS rSr% Sr\" SS9r\\   \	S   -  \
S'   \" SS9r\\   \-  \
S'   \" \SS	0S
9r\\   \
S'   \" SS0S9r\\
S'   \" \SS0S
9r\\   \
S'   Srg)RouteMap2   zAMapping configuration for HTTP routes to FastMCP component types.*)defaultmethodsz.*patterndescriptionz,A set of tags to match. All tags must match.)default_factorymetadatatagsz(The type of FastMCP component to create.)r*   mcp_typez:A set of tags to apply to the generated FastMCP component.mcp_tagsr   N)r   r   r   r   r   r   r&   listr   r   __annotations__r'   r   strsetr+   r,   r   r-   r   r   r   r   r"   r"   2   s    K/4S/AGT*,A"'"6GWS\C6!OPD#c(  !KLHg  W
Hc#h r   r"   r,   routemappingsreturnc           	         U GHA  nUR                   S:X  d  U R                  UR                   ;   d  M0  [        UR                  [        5      (       a&  UR                  R                  U R                  5      nO+[        R
                  " UR                  U R                  5      nU(       d  M  UR                  (       a@  [        U R                  =(       d    / 5      nUR                  R                  U5      (       d  M  [        R                  SU R                   SU R                   SUR                  R                   35        Us  $    [        [         R"                  S9$ )a  
Determines the FastMCP component type based on the route and mappings.

Args:
    route: HTTPRoute object
    mappings: List of RouteMap objects in priority order

Returns:
    The RouteMap that matches the route, or a catchall "Tool" RouteMap if no match is found.
r$   zRoute  z mapped to r2   )r&   method
isinstancer'   r   searchpathrer+   r1   issubsetloggerdebugr,   namer"   r   r   )r3   r4   	route_mappattern_matchesroute_tags_sets        r   _determine_route_typerD   O   s     	#u||y7H7H'H)++W55"+"3"3":":5::"F"$))I,=,=uzz"J >>%()9r%:N$>>22>BB U\\N!EJJ<{9CUCUCZCZB[\ ! - 2 W\\**r   )DEFAULT_ROUTE_MAPPINGSComponentFnr   r"   
RouteMapFnrD   )!r   enumr<   collections.abcr   dataclassesr   r   r   typingr   r   
componentsr
   r   r   &fastmcp.experimental.utilities.openapir   r   fastmcp.utilities.loggingr   r   r>   rG   rF   Enumr   r"   r   rE   r.   rD   __all__r   r   r   <module>rQ      s    1  	 $ (  )  I 0	H	 y),.>>?
A 		
dii " 4  0 gll# 
(+(+8n(+ (+Xr   