
    Lf*                       d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZ d dlmZ d dlmZ d dlZd dlmZ d dlmZ d d	lmZ d d
lmZ d dl m!Z!  G d de"      Z# G d de"      Z$ G d de"      Z%d Z&d Z'd&dZ(d&dZ) G d de"      Z* G d de"      Z+ G d de"      Z, G d de"      Z- G d de"      Z. G d  d!e"      Z/d"ee   fd#Z0 G d$ d%e"      Z1y)'    N)Path)pformat)UnionDictListOptionalIOAnyTuple)Sequence)
FormatCode)InvalidPayload)hlval)Schema)BaseType)Fieldc                   z   e Zd ZdZdZej                  Zej                  Zej                  Zej                  Z	ej                  Z
ej                  Zej                  Zej                  Zej                  Zej                  Zej                   Zej"                  Zej$                  Zej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                   ej"                  ej$                  gZej(                  Zej*                  Zej,                  Zej(                  ej*                  ej,                  gZi ej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                   dej"                  dej$                  dej(                  dej*                  d	ej,                  d
Zej                  eej                  eej                  eej                  eej                  eej                  eej                  eej                  eej                  eej                  eej                   eej"                  eej$                  eej(                  eej*                  eiZej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                   dej"                  diZ ej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                  dej                   dej"                  d iZ!i ej                  d!ej                  d"ej                  d#ej                  d$ej                  d%ej                  d&ej                  d'ej                  d(ej                  d)ej                  d*ej                   d+ej"                  d,ej$                  d-ej(                  d.ej*                  d/ej,                  d
Z"i d!ej                  d"ej                  d#ej                  d$ej                  d%ej                  d&ej                  d'ej                  d(ej                  d)ej                  d*ej                  d+ej                   d,ej"                  d-ej$                  d.ej(                  d/ej*                  d
ej,                  Z#	 	 dJd1d2d3d4d5ed6ed7ed8e$e   d9e$e   fd:Z%e&dKd<       Z'e&dLd=       Z(e&d;efd>       Z)e&d;efd?       Z*e&d;efd@       Z+e&d;e$e   fdA       Z,e&d;e$e   fdB       Z-	 	 dMdCedDe$e.   dEe$e   dFed;ef
dGZ/d;efdHZ0d;e.ee1f   fdIZ2y0)NFbsTypez
    Flatbuffers type.

    See: https://github.com/google/flatbuffers/blob/11a19887053534c43f73e74786b46a615ecbf28e/reflection/reflection.fbs#L33
    )_repository_schema	_basetype_element_index_objtype_elementtypeintboolbytesfloatstrr   objectr   	BoolFlags	Int8Flags
Uint8Flags
Int16FlagsUint16Flags
Int32FlagsUint32Flags
Int64FlagsUint64FlagsFloat32FlagsFloat64FlagsPrependBoolSlotPrependInt8SlotPrependUint8SlotPrependInt16SlotPrependUint16SlotPrependInt32SlotPrependUint32SlotPrependInt64SlotPrependUint64SlotPrependFloat32SlotPrependFloat64SlotUTypeBoolByteUByteShortUShortIntUIntLongULongFloatDoubleStringVectorObjN
repositoryFbsRepositoryschema	FbsSchemabasetypeelementindexobjtypeelementtypec                 f    || _         || _        || _        || _        || _        || _        || _        y N)r   r   r   r   r   r   r   )selfrG   rI   rK   rL   rM   rN   rO   s           O/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/autobahn/xbr/_schema.py__init__zFbsType.__init__   s7     &!'    returnc                     | j                   S rQ   r   rR   s    rS   rG   zFbsType.repository       rU   c                     | j                   S rQ   r   rY   s    rS   rI   zFbsType.schema       ||rU   c                     | j                   S )z:
        Flatbuffers base type.

        :return:
        )r   rY   s    rS   rK   zFbsType.basetype   s     ~~rU   c                     | j                   S )z>
        Only if basetype == Vector

        :return:
        )r   rY   s    rS   rL   zFbsType.element   s     }}rU   c                     | j                   S )z
        If basetype == Object, index into "objects".
        If base_type == Union, UnionType, or integral derived from an enum, index into "enums".
        If base_type == Vector && element == Union or UnionType.

        :return:
        )r   rY   s    rS   rM   zFbsType.index   s     {{rU   c                 0   | j                   t        j                  k(  rn| j                  b| j                  t        j
                  k(  r>| j                  j                  | j                     j                  | _        | j                  S J d       | j                  S )z]
        If basetype == Vector, fully qualified element type name.

        :return:
        FIXME)
r   r   rE   r   r   rF   r   
objs_by_idr   namerY   s    rS   rO   zFbsType.elementtype   sv     >>W^^+0A0A0I}}+$(LL$;$;DKK$H$M$M!     &g%u   rU   c                     | j                   t        j                  k(  r>| j                  2| j                  j
                  | j                     j                  | _        | j                  S )z\
        If basetype == Object, fully qualified object type name.

        :return:
        )r   r   rF   r   r   rc   r   rd   rY   s    rS   rN   zFbsType.objtype  sG     >>W[[(T]]-B LL33DKK@EEDM}}rU   languageattrsrequiredobjtype_as_stringc                    |dk(  r?d}| j                   t        j                  k(  r| j                  t        j                  k(  r|rd|v rd}nd}n| j
                  r/dj                  | j
                  j                  d      d         }nSdj                  t        j                  | j                           }n%| j                   t        j                  k(  rX| j
                  r| j
                  j                  d      d   }ndj                  t        j                  | j                           }n| j                   t        j                  t        j                  t        j                  gz   v rD| j                   t        j                  k(  r	|rd	|v rd
}nMt        j                  | j                      }n/t        dj                  | j                   | j                              |rA| j                   t        j                  k(  r$|rdj                  |      S dj                  |      S |rdj                  |      S dj                  |      S t!        dj                  || j                              )z

        :param language:
        :param attrs:
        :param required:
        :param objtype_as_string:
        :return:
        pythonNuuidz	uuid.UUIDr   zList[{}].	timestampznp.datetime64zAFIXME: implement mapping of FlatBuffers type "{}" to Python in {}'{}'Optional['{}']{}Optional[{}]z9cannot map FlatBuffers type to target language "{}" in {})rK   r   rE   rL   r;   rN   formatsplitFBS2PYrF   SCALAR_TYPESr8   r   rA   NotImplementedErrormapRuntimeError)rR   rf   rg   rh   ri   _mapped_types         rS   ry   zFbsType.map  s    xL}}.<<7==05'2'. ||'1'8'89K9KC9PQS9T'U (2'8'89U'V'++-<<#'<<#5#5c#:2#>L $.#4#4W^^DLL5Q#RL'"6"6'--9W"WW==GMM1eu@T#2L#*>>$--#@L *W^^_c_l_lnrnvnvwy y !T]]gkk%A !==66+22<@@;;|44)00>>ZaabjlpltltuvvrU   c                 f    dj                  t        j                  | j                                     S N
{}
rt   pprintr   marshalrY   s    rS   __str__zFbsType.__str__]       v~~dlln=>>rU   c                     | j                   j                  | j                  d       | j                   j                  | j                  d       | j                  | j
                  d}|S )N)rK   rL   rM   rN   )FBS2STRgetrK   rL   rM   rN   )rR   objs     rS   r   zFbsType.marshal`  sP     ((=||''d;ZZ||	
 
rU   )NNrV   rH   rV   rJ   )NTF)3__name__
__module____qualname____doc__	__slots__	_BaseTyper8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rw   rE   rF   r   STRUCTURED_TYPESrv   r   r   r   r    listdictFBS2PY_TYPE	FBS2FLAGSFBS2PREPENDr   STR2FBSr   rT   propertyrG   rI   rK   rL   rM   rO   rN   r   ry   r   r
   r    rU   rS   r   r   2   sA    jIOOE >>D>>DOOEOOEF
--C>>D>>DOOEOOEFFNNNNOOOO$$MMNNNNOOOO$$$$&L F
--COOE!((!!) 	 		
 	 	% 	u 	 	 	 	 	' 	% 	& 	x  	!F( 	#s%#$tK( 	-|.I 	))++-)+*,-.K 	 		
 	 	( 	u 	 	 	 	 	( 	( 	( 	u  	!G&	 		 		
 	 	)"" 	y}} 		 		 	 	 	)"" 	)"" 	)"" 	y}}  	!G2 +/.2 , $    	 
   #3-  'sm         #      s   !Xc] ! !  #   [_&+>wC >w >wRV >w#>w03>w@? ?c3h rU   r   c                       e Zd Zd Zd Zy)FbsAttributec                      y rQ   r   rY   s    rS   rT   zFbsAttribute.__init__l  s    rU   c                 "    dj                         S )N )rt   rY   s    rS   r   zFbsAttribute.__str__o  s    yy{rU   N)r   r   r   rT   r   r   rU   rS   r   r   k  s    rU   r   c                   ~   e Zd ZdZdddddededed	ed
edededede	ee
f   defdZed!d       Zed"d       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zede	ee
f   fd       Zedefd       ZdefdZde	eef   fdZy )#FbsFieldr   r   _name_type_id_offset_default_int_default_real_deprecated	_required_attrs_docsrG   rH   rI   rJ   rd   typeidoffsetdefault_intdefault_real
deprecatedrh   rg   docsc                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        || _        y rQ   r   )rR   rG   rI   rd   r   r   r   r   r   r   rh   rg   r   s                rS   rT   zFbsField.__init__w  s\     &

')%!
rU   rV   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsField.repository  rZ   rU   c                     | j                   S rQ   r\   rY   s    rS   rI   zFbsField.schema  r]   rU   c                     | j                   S rQ   r   rY   s    rS   rd   zFbsField.name      zzrU   c                     | j                   S rQ   )r   rY   s    rS   r   zFbsField.type  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsField.id      xxrU   c                     | j                   S rQ   )r   rY   s    rS   r   zFbsField.offset  r]   rU   c                     | j                   S rQ   )r   rY   s    rS   r   zFbsField.default_int         rU   c                     | j                   S rQ   )r   rY   s    rS   r   zFbsField.default_real      !!!rU   c                     | j                   S rQ   )r   rY   s    rS   r   zFbsField.deprecated  rZ   rU   c                     | j                   S rQ   )r   rY   s    rS   rh   zFbsField.required      ~~rU   c                     | j                   S rQ   r   rY   s    rS   rg   zFbsField.attrs      {{rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsField.docs  r   rU   c                 f    dj                  t        j                  | j                                     S r}   r   rY   s    rS   r   zFbsField.__str__  r   rU   c                 x   | j                   | j                  r| j                  j                         nd | j                  | j                  | j
                  | j                  | j                  | j                  i | j                  d
}| j                  r*| j                  j                         D ]  \  }}||d   |<    |S )N)
rd   r   r   r   r   r   r   rh   rg   r   rg   )r   r   r   r   r   r   r   r   r   r   r   itemsrR   r   kvs       rS   r   zFbsField.marshal  s    JJ,0JJDJJ&&(D((ll,, ..**JJ
 ;;))+ $1"#GQ$
rU   Nr   r   )r   r   r   r   r    r   r   r   r   r   r   rT   r   rG   rI   rd   r   r   r   r   r   r   rh   rg   r   r   r
   r   r   rU   rS   r   r   s  s   QI,$  	
   "  % "   S,./ 4       c   g   C      !S ! ! "e " "  D     $   tC-.   c  ? ?c3h rU   r   c                 
   i }t        | j                               D ]d  }| j                  |      }|j                         }|r|j	                  d      }|j                         }|r|j	                  d      }||vsJ |||<   f |S )Nutf8)rangeAttributesLength
AttributesKeydecodeValue)r   rg   jfbs_attrattr_key
attr_values         rS   
parse_attrr     s    E3'')* 	%>>!$<<>v.H^^%
#**62Ju$$$$h	% LrU   c                    g }t        | j                               D ]F  }| j                  |      }|s|j                  d      j	                         }|j                  |       H dj                  |      j	                         }|S )Nr    )r   DocumentationLengthDocumentationr   stripappendjoin)r   r   r   doc_lines       rS   
parse_docsr     sw    D3**,- "$$Q'v.446HKK!	" 88D>!DKrU   c                 B   i }i }t        |j                               D ]I  }|j                  |      }|j                         }|r|j	                  d      }t        |j                               }	|||	<   |j                         }
d }t        | ||
j                         |
j                         |
j                         |      }t        | ||||	|j                         |j                         |j                         |j!                         |j#                         t%        |      t'        |            }||vs/J dj)                  ||	t+        |j-                                            |||<   L g }t        t/        |            D ]  }|j1                  |||              ||fS )Nr   )rG   rI   rK   rL   rM   rN   )rG   rI   rd   r   r   r   r   r   r   rh   rg   r   z,field "{}" with id "{}" already in fields {})r   FieldsLengthFieldsNamer   r   IdTyper   r   ElementIndexr   OffsetDefaultIntegerDefaultReal
DeprecatedRequiredr   r   rt   sortedkeyslenr   )rG   rI   r   objs_lstfields_by_namefield_id_to_namer   	fbs_field
field_namefield_idfbs_field_typer   
field_typefieldfields_by_idis                   rS   parse_fieldsr     s    N
 3##%& 0+::a=	^^%
#**62Jy||~& &0"")  
$*&4&=&=&?%3%;%;%=#1#7#7#9%-/
 J &(($ ) 0 0 2%.%=%=%?&/&;&;&=$-$8$8$:"+"4"4"6))4(35 / 	F1_1f1fgqgogmn|  oB  oB  oD  hE2F 	F/ &+z"a0+f L3~&' AN+;A+>?@A <''rU   c                 l   i }i }t        |j                               D ]Z  }|j                  |      }|j                         }|r|j	                  d      }|}	|j                         }
|
j                         }|r|j	                  d      }|
j                         }|r|j	                  d      }|
j                         }|
j                         }|
j                         }t        |
      }t        |
      }t        | ||
|      \  }}t        | ||||||||||      }|j                         }|j                         }|r|j	                  d      }|j                         }|r|j	                  d      }|j                         }|j                         }|j                         }t        |      }t        |      }t        | |||      \  }}t        | ||||||||||      }t        |      } t        |      }!t        | |||	||| |!      }"||vs/J dj!                  ||	t#        |j%                                            |"||<   |	|vs/J dj!                  ||	t#        |j%                                            |||	<   ] g }#t#        |j'                               D ]  \  }$}%|#j)                  |%        |#}||fS )Nr   r   rG   rI   declaration_filerd   fieldsr   	is_struct	min_alignbytesizerg   r   )rG   rI   rd   r   requestresponser   rg   z*call "{}" with id "{}" already in calls {}z+call "{}" with id " {}" already in calls {})r   CallsLengthCallsr   r   RequestDeclarationFileIsStructMinalignBytesizer   r   r   	FbsObjectResponse
FbsRPCCallrt   r   r   r   r   )&rG   rI   svc_objr   callscalls_by_idr   fbs_call	call_namecall_idfbs_call_reqcall_req_namecall_req_declaration_filecall_req_is_structcall_req_min_aligncall_req_bytesizecall_req_docscall_req_attrscall_req_fieldscall_fields_by_idcall_reqfbs_call_respcall_resp_namecall_resp_declaration_filecall_resp_is_structcall_resp_min_aligncall_resp_bytesizecall_resp_docscall_resp_attrscall_resp_fieldscall_resp_fields_by_id	call_resp	call_docs
call_attrscallres_values&                                         rS   parse_callsr7  <  s   EK7&&() M)==#MMO	!((0I '')$))+)008M$0$@$@$B!$(A(H(H(P%)224)224(113"<0#L1-9*flem-n**
$*.G"/$3*;'9'9&7#1"/
1 !))+&++-+226:N%2%B%B%D"%)C)J)J6)R&+446+446*335#M2$]33?
FTalt3u00%+/I#1%5+A(;(;'9$3#1
3	 x(	)
Z!'($"*#,( *, % 	q'S'Z'Z[dfm[abgblblbn[o(q 	q%ik) 	v+X+_+_`ikr`fglgqgqgs`t,v 	v)(G[M)^ C;,,./ 5

5K+rU   c                      e Zd ZdZdddddededeeef   d	ee   d
ede	de	deee
f   defdZd%dedee   dedefdZdedefdZed&d       Zed'd       Zedefd       Zedefd       Zedeeef   fd       Zedee   fd       Zedefd       Zede	fd       Zede	fd       Zedeee
f   fd       Zedefd        Zdefd!Zdeeef   fd"Zed(d$       Zy#))r  )r   r   _declaration_filer   _fields_fields_by_id
_is_struct
_min_align	_bytesizer   r   
modulename	classnamemodule_relimportrG   rH   rI   rJ   r  rd   r  r   r  r  r  rg   r   c                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        y rQ   )r   r   r9  r   r:  r;  r<  r=  r>  r   r   )rR   rG   rI   r  rd   r  r   r  r  r  rg   r   s               rS   rT   zFbsObject.__init__  sT     &!1
)##!
rU   rf   rh   ri   rV   c                     |dk(  rh| j                   j                  d      d   }|r$|rdj                  |      S dj                  |      S |rdj                  |      S dj                  |      S t               )Nrk   rm   rn   rp   rq   rr   rs   r   ru   rt   rx   )rR   rf   rh   ri   klasss        rS   ry   zFbsObject.map  sw    xJJ$$S)"-E  !==//+22599;;u--)0077%''rU   c                     |dk(  rN| j                   j                  d      d   }| j                   j                  d      d   }dj                  ||      S t               )Nrk   rm   rn   zfrom {} import {}rD  )rR   rf   baserE  s       rS   
map_importzFbsObject.map_import  sX    x::##C(,DJJ$$S)"-E&--dE::%''rU   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsObject.repository  rZ   rU   c                     | j                   S rQ   r\   rY   s    rS   rI   zFbsObject.schema  r]   rU   c                     | j                   S rQ   r9  rY   s    rS   r  zFbsObject.declaration_file      %%%rU   c                     | j                   S rQ   r   rY   s    rS   rd   zFbsObject.name  r   rU   c                     | j                   S rQ   )r:  rY   s    rS   r  zFbsObject.fields  r]   rU   c                     | j                   S rQ   )r;  rY   s    rS   r   zFbsObject.fields_by_id  r   rU   c                     | j                   S rQ   )r<  rY   s    rS   r  zFbsObject.is_struct      rU   c                     | j                   S rQ   )r=  rY   s    rS   r  zFbsObject.min_align  rS  rU   c                     | j                   S rQ   )r>  rY   s    rS   r  zFbsObject.bytesize  r   rU   c                     | j                   S rQ   r   rY   s    rS   rg   zFbsObject.attrs  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsObject.docs  r   rU   c                 f    dj                  t        j                  | j                                     S r}   r   rY   s    rS   r   zFbsObject.__str__  r   rU   c           	         | j                   | j                  i | j                  | j                  | j                  i | j
                  d}| j                  r<| j                  j                         D ]  \  }}|r|j                         nd |d   |<   ! | j                  r*| j                  j                         D ]  \  }}||d   |<    |S )N)rd   r  r  r  r  r  rg   r   r  rg   )
r   r9  r<  r=  r>  r   r:  r   r   r   r   s       rS   r   zFbsObject.marshal  s    JJ $ 6 6JJ	
 <<**, >123199;Ha >;;))+ $1"#GQ$
rU   Nc                 b   |j                         }|r|j                  d      }|j                         }|r|j                  d      }t        |      }t	        |      }t        | |||      \  }}	t        | |||||	|j                         |j                         |j                         ||      }
|
S )Nr   r  r  )
r   r   r  r   r   r   r  r  r  r  )rG   rI   fbs_objr   obj_nameobj_declaration_fileobj_docs	obj_attrsr   r   r   s              rS   parsezFbsObject.parse  s    <<>v.H&668#7#>#>v#F g&w'	'3JZb'c$:%)=%-%1")"2"2"4")"2"2"4!(!1!1!3'%
' 
rU   )TFr   r   rQ   ) r   r   r   r   r    r   r   r   r   r   r   rT   r   ry   rI  r   rG   rI   r  rd   r  r   r  r  r  rg   r   r   r
   r   staticmethodr`  r   rU   rS   r  r    s0   @I,$ $' 	
 c8m,  $H~ !    S,./ 0(C (8D> (UY (fi (&(3 (3 (       &# & & c   S(]+   "d8n " " 4   3   #   tC-.   c  ? ?c3h &  rU   r  c                       e Zd Zdddddedededed	ed
eeef   fdZe	d        Z
e	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Zd Zd Zy)r  rG   rH   rI   rJ   rd   r   r	  r
  r   rg   c	                 t    || _         || _        || _        || _        || _        || _        || _        || _        y rQ   )r   r   r   r   _request	_responser   r   )	rR   rG   rI   rd   r   r	  r
  r   rg   s	            rS   rT   zFbsRPCCall.__init__+  s=     &
!
rU   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsRPCCall.repository=  rZ   rU   c                     | j                   S rQ   r\   rY   s    rS   rI   zFbsRPCCall.schemaA  r]   rU   c                     | j                   S rQ   r   rY   s    rS   rd   zFbsRPCCall.nameE  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsRPCCall.idI  r   rU   c                     | j                   S rQ   )rd  rY   s    rS   r	  zFbsRPCCall.requestM  s    }}rU   c                     | j                   S rQ   )re  rY   s    rS   r
  zFbsRPCCall.responseQ  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsRPCCall.docsU  r   rU   c                     | j                   S rQ   r   rY   s    rS   rg   zFbsRPCCall.attrsY  r   rU   c                 f    dj                  t        j                  | j                                     S r}   r   rY   s    rS   r   zFbsRPCCall.__str__]  r   rU   c                 B   | j                   | j                  r| j                  j                         nd | j                  r| j                  j                         nd i | j                  d}| j
                  r*| j
                  j                         D ]  \  }}||d   |<    |S )N)rd   r	  r
  rg   r   rg   )r   rd  r   re  r   r   r   r   s       rS   r   zFbsRPCCall.marshal`  s    JJ26--t}},,.T48NN..0JJ
 ;;))+ $1"#GQ$
rU   N)r   r   r   r    r   r  r   r   rT   r   rG   rI   rd   r   r	  r
  r   rg   r   r   r   rU   rS   r  r  *  s   ,$  	
 $ %  S,./$                  ?rU   r  c                       e Zd Zdddddededeeef   dee   d	eeef   d
efdZe	d        Z
e	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Ze	d        Zd Zd Zy)
FbsServicerG   rH   rI   rJ   r  rd   r  r  rg   r   c	                 t    || _         || _        || _        || _        || _        || _        || _        || _        y rQ   )r   r   r9  r   _calls_calls_by_idr   r   )	rR   rG   rI   r  rd   r  r  rg   r   s	            rS   rT   zFbsService.__init__o  s?     &!1
'
rU   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsService.repository  rZ   rU   c                     | j                   S rQ   r\   rY   s    rS   rI   zFbsService.schema  r]   rU   c                     | j                   S rQ   rM  rY   s    rS   r  zFbsService.declaration_file  rN  rU   c                     | j                   S rQ   r   rY   s    rS   rd   zFbsService.name  r   rU   c                     | j                   S rQ   )rs  rY   s    rS   r  zFbsService.calls  r   rU   c                     | j                   S rQ   )rt  rY   s    rS   r  zFbsService.calls_by_id  r   rU   c                     | j                   S rQ   r   rY   s    rS   rg   zFbsService.attrs  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsService.docs  r   rU   c                 f    dj                  t        j                  | j                                     S r}   r   rY   s    rS   r   zFbsService.__str__  r   rU   c                 F   | j                   | j                  i i | j                  d}| j                  r8| j                  j	                         D ]  \  }}|j                         |d   |<    | j                  r*| j                  j	                         D ]  \  }}||d   |<    |S )N)rd   r  r  rg   r   r  rg   )r   r9  r   rs  r   r   r   r   s       rS   r   zFbsService.marshal  s    JJ $ 6 6JJ
 ;;))+ .1"#))+GQ.;;))+ $1"#GQ$
rU   N)r   r   r   r    r   r  r   r   rT   r   rG   rI   r  rd   r  r  rg   r   r   r   r   rU   rS   rq  rq  n  s   ,$ $' 	
 S*_- #:. S,./ $       & &     ! !    ?rU   rq  c                       e Zd ZdddddedefdZed        Zed	        Zed
        Z	ed        Z
ed        Zed        Zed        Zd Zd Zy)FbsEnumValuerG   rH   rI   rJ   rd   r   c                 f    || _         || _        || _        || _        || _        i | _        || _        y)ze

        :param repository:
        :param name:
        :param value:
        :param docs:
        N)r   r   r   r   _valuer   r   )rR   rG   rI   rd   r   r6  r   s          rS   rT   zFbsEnumValue.__init__  s6     &

rU   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsEnumValue.repository  rZ   rU   c                     | j                   S rQ   r\   rY   s    rS   rI   zFbsEnumValue.schema  r]   rU   c                     | j                   S rQ   r   rY   s    rS   rd   zFbsEnumValue.name  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsEnumValue.id  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r6  zFbsEnumValue.value  r   rU   c                     | j                   S rQ   r   rY   s    rS   rg   zFbsEnumValue.attrs  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsEnumValue.docs  r   rU   c                 f    dj                  t        j                  | j                                     S r}   r   rY   s    rS   r   zFbsEnumValue.__str__  r   rU   c                     | j                   | j                  | j                  | j                  | j                  d}| j                  r*| j                  j                         D ]  \  }}||d   |<    |S )N)r   rd   rg   r   r6  rg   )r   r   r   r   r  r   r   s       rS   r   zFbsEnumValue.marshal  sg    ((JJ[[JJ[[
 ;;))+ $1"#GQ$
rU   N)r   r   r   r    r   rT   r   rG   rI   rd   r   r6  rg   r   r   r   r   rU   rS   r  r    s    ,$  	,                ?rU   r  c                      e Zd ZdZdddddededed	eeef   d
ee   de	dedeee
f   defdZed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zd Zd Zy)FbsEnumz
    FlatBuffers enum type.

    See https://github.com/google/flatbuffers/blob/11a19887053534c43f73e74786b46a615ecbf28e/reflection/reflection.fbs#L61
    rG   rH   rI   rJ   r  rd   r   valuesvalues_by_idis_unionunderlying_typerg   r   c                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        y rQ   )r   r   r9  r   r   _values_values_by_id	_is_union_underlying_typer   r   )rR   rG   rI   r  rd   r   r  r  r  r  rg   r   s               rS   rT   zFbsEnum.__init__   sW     &!1
)! !0
rU   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsEnum.repository  rZ   rU   c                     | j                   S rQ   r\   rY   s    rS   rI   zFbsEnum.schema  r]   rU   c                     | j                   S rQ   rM  rY   s    rS   r  zFbsEnum.declaration_file"  rN  rU   c                     | j                   S rQ   r   rY   s    rS   rd   zFbsEnum.name&  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   z
FbsEnum.id*  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsEnum.values.  r]   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsEnum.values_by_id2  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsEnum.is_union6  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsEnum.underlying_type:  s    $$$rU   c                     | j                   S rQ   r   rY   s    rS   rg   zFbsEnum.attrs>  r   rU   c                     | j                   S rQ   r   rY   s    rS   r   zFbsEnum.docsB  r   rU   c                 f    dj                  t        j                  | j                                     S r}   r   rY   s    rS   r   zFbsEnum.__str__F  r   rU   c                    | j                   | j                  i | j                  t        j                  j                  | j                  d       i | j                  d}| j                  r8| j                  j                         D ]  \  }}|j                         |d   |<    | j                  r*| j                  j                         D ]  \  }}||d   |<    |S )N)rd   r   r  r  r  rg   r   r  rg   )r   r   r  r   r   r   r  r   r  r   r   r   r   s       rS   r   zFbsEnum.marshalI  s    JJ((&2243H3H$OJJ
 <<**, /1#$99;Ha /;;))+ $1"#GQ$
rU   N)r   r   r   r   r    r   r   r  r   r   r   rT   r   rG   rI   r  rd   r   r  r  r  r  rg   r   r   r   r   rU   rS   r  r    su   ,$ $' 	
  c</0  $L1   #& S,./ 4       & &       " "   % %    ?rU   r  c            !       $   e Zd ZdZ	 	 	 	 	 	 d)dddedededed	ed
eeeef      dede	de
eeef      de
ee      de
eeef      de
ee      de
eeef      de
ee      fdZed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed         Zed!        Zed"        Zd# Zd$eeef   fd%Z e!	 d*ddd&e"ee#jH                  e%e&   f   d'e
e   d$d fd(       Z'y)+rJ   z
    NrG   rH   	file_namefile_sha256	file_size
file_identfile_ext	fbs_files
root_tablerootobjsrc   enumsenums_by_idservicesservices_by_idc                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        || _        || _        || _        || _        y)a  

        :param repository:
        :param file_name:
        :param file_sha256:
        :param file_size:
        :param file_ident:
        :param file_ext:
        :param fbs_files:
        :param root_table:
        :param root:
        :param objs:
        :param objs_by_id:
        :param enums:
        :param enums_by_id:
        :param services:
        :param services_by_id:
        N)r   
_file_name_file_sha256
_file_size_file_ident	_file_ext
_fbs_files_root_table_root_objs_objs_by_id_enums_enums_by_id	_services_services_by_id)rR   rG   r  r  r  r  r  r  r  r  r  rc   r  r  r  r  s                   rS   rT   zFbsSchema.__init__`  su    D &#'#%!#%

%'!-rU   c                     | j                   S rQ   rX   rY   s    rS   rG   zFbsSchema.repository  rZ   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.file_name  rS  rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.file_sha256  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.file_size  rS  rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.file_ident  rZ   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.file_ext  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.fbs_files  rS  rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.root_table  rZ   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.root  r   rU   c                     | j                   S rQ   r  rY   s    rS   r  zFbsSchema.objs  r   rU   c                     | j                   S rQ   )r  rY   s    rS   rc   zFbsSchema.objs_by_id  rZ   rU   c                     | j                   S rQ   r  rY   s    rS   r  zFbsSchema.enums  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.enums_by_id  r   rU   c                     | j                   S rQ   r  rY   s    rS   r  zFbsSchema.services  r   rU   c                     | j                   S rQ   )r  rY   s    rS   r  zFbsSchema.services_by_id  s    ###rU   c                 j    dj                  t        j                  | j                         d            S )Nr~      )widthr   rY   s    rS   r   zFbsSchema.__str__  s"    v~~dllnCHIIrU   rV   c                 N   | j                   | j                  | j                  r)t        j                  j                  | j                        nd| j                  | j                  | j                  t        | j                        t        | j                        t        | j                        d	| j                  r| j                  j                         ndi i i d}| j                  r8| j                  j                         D ]  \  }}|j                         |d   |<    | j                  r8| j                  j                         D ]  \  }}|j                         |d   |<    | j                  r8| j                  j                         D ]  \  }}|j                         |d   |<    |S )z

        :return:
        N)	identextrd   filessha256sizeobjectsr  r  )rI   r  r  r  r  r  r  r  )r  r  r  ospathbasenamer  r  r  r   r  r  r  r  r   r   r   s       rS   r   zFbsSchema.marshal  sW    ))~~=A__((9RV++tzz?T[[)/
 9=8H8H$**224d
" ;;))+ .1"#))+GQ.::

((* 01$%IIKIq!0>>,,. 11%&YY[J"1
rU   sfilefilenamec                 	   t        |      t        k(  rEt        j                  j	                  |      r&t        |d      5 }|j                         }ddd       n|j                         }t        j                         }|j                         t        j                  |d      }|j                         }||j                  d      }|j                         }||j                  d      }g }	t        |j!                               D ]  }
|j#                  |
      }|j%                         }|r|j                  d      }g }t        |j'                               D ]7  }|j)                  |      }|r|j                  d      }|j+                  |       9 |	j+                  ||d        |j-                         }|t.        j1                  | |      }t3        | |t5        |      |j7                         |||	||	      }i }g }t        |j9                               D ]Z  }
|j;                  |
      }|j=                         }|r|j                  d      }|j?                         }|r|j                  d      }|jA                         }i }g }t        |jC                               D ]~  }|jE                  |      }|j=                         }|r|j                  d      }|jG                         }tI        |      }tK        | |||||      }||vsJ |||<   |j+                  |        tM        | ||||
|||jO                         |tQ        |      tI        |            }||vsJ |||<   |j+                  |       ] ||_)        ||_*        i } g }!t        |jW                               D ]\  }
|jY                  |
      }"t.        j1                  | ||"|!	      }#|#jZ                  | vsJ |#| |#jZ                  <   |!j+                  |#       ^ | |_.        |!|_/        i }$g }%t        |ja                               D ]  }
|jc                  |
      }&|&j=                         }'|'r|'j                  d      }'|&j?                         }(|(r|(j                  d      }(tI        |&      })tQ        |&      }*te        | ||&|!	      \  }+},tg        | ||(|'|+|,|*|)
      }-|'|$vsJ |-|$|'<   |%j+                  |-        |$|_4        |%|_5        |S # 1 sw Y   xY w)ze

        :param repository:
        :param sfile:
        :param filename:
        :return:
        rbNr   r   )r  included_filenames)	rG   r  r  r  r  r  r  r  r  )rG   rI   rd   r   r6  r   )rG   rI   r  rd   r   r  r  r  r  rg   r   r  )rG   rI   r  rd   r  r  rg   r   )6r   r    r  r  isfileopenreadhashlibr  update_SchemaGetRootAsSchema	FileIdentr   FileExtr   FbsFilesLengthFbsFilesFilenameIncludedFilenamesLengthIncludedFilenamesr   	RootTabler  r`  rJ   r   	hexdigestEnumsLengthEnumsr   r  UnderlyingTypeValuesLengthValuesr   r   r  r  IsUnionr   r  r  ObjectsLengthObjectsrd   r  r  ServicesLengthServicesr7  rq  r  r  ).rG   r  r  fddatamr  r  r  r  r   schema_fileschema_file_filenameschema_file_included_filenamesr   included_filenamer  rI   r  r  fbs_enum	enum_nameenum_declaration_fileenum_underlying_typeenum_valuesenum_values_by_idfbs_enum_valueenum_value_nameenum_value_valueenum_value_docs
enum_valueenumr  rc   r[  r   r  r  r  svc_namesvc_declaration_filer   rg   r  r  services.                                                 rS   loadzFbsSchema.load  s!    ;#"''.."7eT" !bwwy! ! ::<DNN	
 &&tQ/^^%
!#**62J<<>v.H	t**,- 	A--*K#.#7#7#9 #';'B'B6'J$-/*;>>@A I$/$A$A!$D!$(9(@(@(H%.556GH	I
  4*H	& ^^%
!"Z@Jj%-%(Y'({{}&0$,%.&0 $& t'')* -	%Azz!}H I%,,V4	$,$<$<$>!$(=(D(DV(L%#+#:#:#< K "80023 5!)!3"0"5"5"7"&5&<&<V&DO#1#7#7#9 ",^"<)Z17/>-.0@/>@
 'k999/9O,!((45" j"(,A )"-(9$,$4$4$6+?!+H!5 *8 4
6D E)))#E)t$[-	%\ ) 
t))+, 	#All1oG//*fg
/SC884''' DNc"	# ' t**,- 	+AmmA&G||~H#??62#*#:#:#< #';'B'B6'J$g&Dw'E!,ZS]!^E; J(.2F&.',-8',&*,G 8+++!(HX!!'*3	+4 $!/o! !s   S,,S6)NNNNNNrQ   )(r   r   r   r   r    r   r   r   r  r  r   r  rq  rT   r   rG   r  r  r  r  r  r  r  r  r  rc   r  r  r  r  r   r!   r   ra  r   io	RawIOBaser	   r   r  r   rU   rS   rJ   rJ   \  s    9=9=7;8<=A>B0.,0.0. "0.  	0.
 !0. 0. !c3h00. '0. 0.  S)^ 450. &d9o60. !c7l!340. 'tG}50. $Dj$9:0. "*$z*:!;0.d       ! !                         ! !   $ $Jc6k* B  (,c c#r||RY67c}c0;c crU   rJ   r6  c                    | j                   j                  t        j                  v rZt        j                  | j                   j                     }t        |      |k7  r$t	        dj                  t        |      |            y J d       )Nz&invalid type {} for value, expected {}rb   )r   rK   r   r   r   rt   )r   r6  expected_types      rS   validate_scalarr    st     zzg111++EJJ,?,?@;-' !I!P!PQUV[Q\^k!lmm ( 	gurU   c            	       n   e Zd ZdZdefdZededd fd       Zededd fd       Ze	defd	       Z
e	deeef   fd
       Ze	deeef   fd       Ze	deeef   fd       Ze	deeef   fd       Ze	d        Zdedeeef   fdZddZd Zd Zdee   dee   fdZdedee   deeef   dee   fdZy)rH   z
    crossbar.interfaces.IInventory
      - add: FbsRepository[]
        - load: FbsSchema[]

    https://github.com/google/flatbuffers/blob/master/reflection/reflection.fbs
    
basemodulec                 |    t        j                         | _        || _        i | _        i | _        i | _        i | _        y rQ   )txaiomake_loggerlog_basemodule	_schematar  r  r  )rR   r  s     rS   rT   zFbsRepository.__init__  s6    $$&%/1+-
*,02rU   r  rV   c                     t               }|S rQ   rH   )r  catalogs     rS   from_archivezFbsRepository.from_archive      /rU   addressc                     t               }|S rQ   r$  )r(  r%  s     rS   from_addresszFbsRepository.from_address  r'  rU   c                     | j                   S rQ   )r!  rY   s    rS   r  zFbsRepository.basemodule  rZ   rU   c                     | j                   S rQ   )r"  rY   s    rS   schemaszFbsRepository.schemas  r   rU   c                     | j                   S rQ   r  rY   s    rS   r  zFbsRepository.objs  r   rU   c                     | j                   S rQ   r  rY   s    rS   r  zFbsRepository.enums  r   rU   c                     | j                   S rQ   r  rY   s    rS   r  zFbsRepository.services  r   rU   c                     t        | j                        t        | j                        z   t        | j                        z   S rQ   )r   r  r  r  rY   s    rS   total_countzFbsRepository.total_count  s,    4::T[[!11C4GGGrU   c                    d}g }t         j                  j                  |      rpt        |      j	                  d      D ]Q  }t         j                  j                  ||j                        }|| j                  vr|j                  |       M|dz  }S nt         j                  j                  |      r&|| j                  vr|j                  |       n|dz  }nd|v r|j                  d      D ]  }t         j                  j                  |      }t         j                  j                  |      r;|| j                  vr|j                  |       at        dj                  |             |t        dj                  |             nt        dj                  |            d}d}d}	|D ]*  }t        j!                  | |      }
|
j"                  j%                         D ]9  }|j                  | j&                  v r|dz  }!|| j&                  |j                  <   ; |
j(                  j%                         D ]9  }|j                  | j*                  v r|dz  }!|| j*                  |j                  <   ; |
j,                  j%                         D ]9  }|j                  | j.                  v r|	dz  }	!|| j.                  |j                  <   ; |
| j                  |<   - ||z   |	z   }||fS )aM  
        Load and add all schemata from Flatbuffers binary schema files (`*.bfbs`)
        found in the given directory. Alternatively, a path to a single schema file
        can be provided.

        :param filename: Filesystem path of a directory or single file from which to
            load and add Flatbuffers schemata.
        r   z*.bfbs   ,z3duplicate schema file skipped ("{}" already loaded)z"{}" in list is not a filez*cannot open schema file or directory: "{}")r  r  isdirr   rglobr   rd   r"  r   r  ru   
expanduserprintrt   rz   rJ   r  r  r  r  r  r  r  r  )rR   r  	file_dupsload_from_filenamesr  fnfilename_single	enum_dupsobj_dupssvc_dupsrI   r  r   svc	type_dupss                  rS   r  zFbsRepository.load  s    	 77=="X,,X6 #WW\\(DII6T^^+'..r2 NI# WW^^H%t~~-#**84 Q	H_#+>>##6 	]"$''"4"4_"E77>>/2&dnn<+22?CSZZ[jkl&'C'J'J?'[\\	] KRRS[\]]	 & 	(B )tR 8F ++- 299+NI-1DKK		*2 {{))+ /88tzz)MH+.DJJsxx(/ --/ 388t~~-MH/2DNN388,3 "(DNN29	(< (83	)##rU   c                    |rt        | j                  j                               t        | j                  j                               t        | j                  j                               t        | j
                  j                               dS t        | j                        t        | j                        t        | j                        t        | j
                        dS )N)schematar  r  r  )r   r"  r   r  r  r  r   )rR   r   s     rS   summaryzFbsRepository.summary%  s    "4>>#6#6#89tzz01 0 0 23"4>>#6#6#89	   /DJJT[[)/	 rU   c                 D   d}d}d}| j                   j                         D ]  \  }}|j                  j                  d| j                        }|j                  d      d   }|j                  rdn|}dj                  |j                  rd	nd
|      }	t        dj                  t        dj                  d|	ddt        |	      z
  z        |                   |r.t        dj                  t        |      t        |                   n#t        dj                  t        |                   t                t        t        j                  |j                  dddddddddd             t                |j                  D ]7  }
t        j                  |
j                  dddddddddd      }|
j                   j"                  t$        j&                  k(  rq|
j                   j(                  j                  d      d   }| j                   |
j                   j(                     j                  rt        |d      }nt        ||      }n|
j                   j"                  t$        j*                  k(  rDdj                  t$        j,                  |
j                   j.                           }t        |d      }n4t$        j,                  |
j                   j"                     }t        |d      }|
j                  rcddj1                  |
j                  j3                               z   dz   }t        ||      }d j1                  ||g      }d j1                  ||g      }n|}|}t        d!j                  t        |
j4                        |d d"t        |      z
  z  z   |r|d#   nd             |d$d  D ]  }t        d%|z           : t                 | j6                  j                         D ]  \  }}|j                  j                  d| j                        }|j                  j                  d&d       }|j                  d      d   }d'j                  |      }t        dj                  t        dj                  d|ddt        |      z
  z        d(                   t        d)j                  t        |                   t        d*j                  t        |      t        d+|      t        d,d-                   t                t        t        j                  |j                  dddddddddd             |j8                  j3                         D ]I  }t                |j8                  |   }|j                  d.   }d-|d/j                  |d      }d0j                  t        |j                  j                  d|j4                        d1            }t        d2j                  t        ||      |t        |j:                  j4                  j                  d      d   dd3      t        |j<                  j4                  j                  d      d   dd3                   t                t        t        j                  |j                  d4d5d5ddddddd             L t                 y )6N)3      r  )r     $   )rI  rI  rI  wampurirm   rn   bluez{} {}StructTablez{}
z   {} {} {}z=====v   )colorz    Type URI:  {}.{}z    Type URI:  {}d   z    TF   )
r  initial_indentsubsequent_indentexpand_tabsreplace_whitespacefix_sentence_endingsbreak_long_wordsdrop_whitespacebreak_on_hyphenstabsizeF   r   z
Vector[{}]white(, )r   z    {:<36} {} {}   r   r4  z9                                                         rl   zInterface {}yellowz    Interface UUID:  {}z    Interface URIs:  {}.({}|{})	proceduretopicgreenr   )re  rd  rr   )r  r  r  z      {} {} ({}) -> {})rQ  boldZ   z
          )r  r   rg   r   r!  ru   r  rt   r9  r   r   textwrapfillr   r   wrapr   rK   r   rF   rN   rE   r   rL   r   r   rd   r  r  r	  r
  )rR   brownorangepinkobj_keyr   
prefix_urir\  	obj_color	obj_labelr   r   type_desc_str	type_descattrs_text_str
attrs_texttype_text_str	type_textlinesvc_keyrA  ifx_uuidifc_name	ifc_labeluriepep_typeep_color	uri_shorts                                rS   print_summaryzFbsRepository.print_summary5  s      IIOO- C	LGSy$2B2BCJ}}S)"-H"%--UI3==xgxXI&--m&:&:69cUX[^_h[iUiNj&k,5!7 8 9 ,33E*4EuXWX)00xABG(--&)/528,0375:150415()
+ 
, G)) (+}}UZZ+-4679158<:?6:596:-.
0 ::&&'++5$)JJ$6$6$<$<S$A"$EMyy!3!34>>$)-v$F	$)-u$E	ZZ((GNN:$0$7$7

HZHZ8[$\M %m7 CI$+OOEJJ4G4G$HM %m7 CI;;%(499U[[5E5E5G+H%H3%NN!&~T!BJ$'HHm^-L$MM #)Z)@ AI$1M )I (//ejj0A09C2MHZCZ<[0[;?QRI J !H +D(T/*+O(+R GGC	J !MM//1 .	LGSy$2B2BCJyy}}VT2H}}S)"-H&--h7I&--m&:&:69cUX[^_h[iUiNj&k,4!6 7 8+225?CD3::5;LeT_gmNn;@PW;XZ [G(--&)/528,0375:150415()
+ 
, yy~~' 0!$3((6*%,6BFFwPWX !KKbhhll9bgg.NVe(fg	.55eG86T6?6;BJJOO<Q<QRU<VWY<Zbhot6u6;BKK<L<L<R<RSV<WXZ<[cipu6vx y hmmBGG*,3?6B047;9>594859,-
/ 
000 G].	rU   c           
         | j                   j                         | j                  j                         | j                  j                         d}i }i }i }|j	                         D ]h  \  }}	|	D ]\  }
t        |
t              s?t        |
t              s/t        |
t              sJ dj                  t        |
                   |
}dj                  |j                  j                  d      dd       }||_        |j                  j                  d      d   j                         |_        |j                  d      d   |_        ||v}||f|v}|rd|||f<   |dk(  r|j%                  dj                  |            }|j'                  | |t(        ||| j*                  	      }|j%                  d
j                  |            }|j'                  | |t(        ||| j*                  	      }n|dk(  rJ|j%                  dj                  |            }|j'                  | |t(        ||| j*                  	      }d}d}nJ|dk(  r+t-        j.                  |j1                         dddd      }d}nt3        dj                  |            ||vr
g ||<   g ||<   ||   j5                  |       |r||   j5                  |       I||   j5                  d       _ k i }|j7                         D ]m  }|j                  d      }t9        t;        |            D ]C  }||   }dj                  |d|       }||vrg ||<   |s(|||   vs0||   j5                  |       E o t=        dj                  t?        |                   d}tA               }|j	                         D ]G  \  }}dj                  |      }|rdg|j                  d      dd z   }ndg}t9        t;        |            D ]  }tC        jD                  j                  |g|d|dz     }tB        jD                  jG                  |      stC        jH                  |       |dk(  sdtB        jD                  j                  |d      }dj                  |d|dz          dd }||   }|j%                  d      }|j'                  | ||| j*                        } | jK                  d      }!tB        jD                  jM                  |      s]tO        |d      5 }"|"jQ                  |!       ddd       t=        dj                  t;        |!      |             |jS                  |       `tO        |d      5 }"|"jQ                  |!       ddd        |dk(  rN|rGdj                  |j                  d      d         }#d j                  |j                  d      d         }$n9d}#d}$n4|dk(  r+|r$d!j                  |j                  d      d         }#nd"}#d}$nd}#d}$|#r	 tU        |      d   }|jK                  d      }!tC        jD                  j                  ||#gz    }tB        jD                  j                  ||      }tO        |d      5 }&|&jQ                  |!       ddd       t=        d$j                  t;        |!      |             |$s
||   }'dj                  |'      }	 tU        |      d   }|jK                  d      }!tC        jD                  j                  ||$gz    }tB        jD                  j                  ||      }||vrztB        jD                  jM                  |      r[tC        jX                  |       tO        |d      5 }&|&jQ                  d%jK                  d             ddd       |jS                  |       tO        |d      5 }&|&jQ                  |!       ddd       t=        d$j                  t;        |!      |             J y# 1 sw Y   xY w# 1 sw Y   xY w# tV        $ r%}%t=        d#j                  |%             Y d}%~%$d}%~%ww xY w# 1 sw Y   xY w# tV        $ r%}%t=        d#j                  |%             Y d}%~%d}%~%ww xY w# 1 sw Y   xY w# 1 sw Y   xY w)&zm

        :param jinja2_env:
        :param output_dir:
        :param output_lang:
        :return:
        )r   r  r  zunexpected type {}rm   r   rn   Trk   zpy-autobahn/{}.py.jinja2)repometadatar   render_importsis_first_by_categoryrender_to_basemodulezpy-autobahn/test_{}.py.jinja2eip712zso-eip712/{}-eip712.sol.jinja2Njson)r`  z: FrS  )
separatorsensure_asciiindent	sort_keysz)invalid language "{}" for code generationzNamespaces:
{}
z


r   r4  z__init__.pyzpy-autobahn/module.py.jinja2)r  r?  importsr  r   wbz3Ok, rendered "module.py.jinja2" in {} bytes to "{}"abz{}.pyz
test_{}.pyz{}.jsonz	init.jsonz error during formatting code: {}zOk, written {} bytes to {}z# Copyright (c) ...
)-r  r  r  r  r   
isinstancer  r  rq  rt   r   r   rd   ru   r?  r   r@  rA  get_templaterenderr   r  r  dumpsr   rz   r   r   r   r   r9  r   setr  r  r6  mkdirencodeexistsr  writeaddr   	Exceptionremove)(rR   
jinja2_env
output_diroutput_langworkcode_modulestest_code_modulesis_first_by_category_modulescategoryr  itemr  r?  is_firstr  tmplcode	test_tmpl	test_code
namespaces	code_file
name_partsr   pnnsinitializedcode_sectionscode_file_dirdr<  _modulename_imports	init_coder   fcode_file_nametest_code_file_nameer  test_code_sectionss(                                           rS   r  zFbsRepository.render  sP    99##%JJ%%'}}++-
 ')$ $

 M	?Hf  I?!$	2jw6OS]^bdnSo  Y  rF  rM  rM  NR  SW  NX  rY  Yo   !XXhmm&9&9#&>q&DE
&0# &.]]%8%8%=b%A%G%G%I" -7,<,<S,A",E)%\9(2H'=Ea'a$'KO0*h1GH (*%223M3T3TU]3^_D;;D8W6><P<@OO ' MD !+ 7 78W8^8^_g8h iI ) 0 0dXW^@HFZFJoo !1 !WI
 !H,%223S3Z3Z[c3deD;;D8W6><P<@OO ' MD !%I $I F*::h&6&6&81=38-.04	6D
 !%I&'R'Y'YZe'fgg \1/1L,46%j1Z(//5%j188C%j188>SI?	M	?` 
%**, 	.I"-J3z?+ .]XXj!n-Z'%'JrN"JrN2rN))"-.	. 	!(()<=> e(4(:(:(< _	J$I}==/D!#ys';Ab'A A!# 3}-. *GGLLF}Va!e/DFww}}Q'HHQK(*a7B"%((=!a%+@"A!""EK)+6H%223QRD $+W_AE !, !RI$++F3D77>>"-!"d^ *qGGDM*SZZ[^_c[dfhij#+!"d^ *qGGDM* *)*. h&%,^^IOOC4H4L%MN*6*=*=iooc>RSU>V*W'%2N*.'&%.%5%5iooc6J26N%ON%0N&*#!%&*# H%d+A.D {{6*WW\\M^4D$DFWW\\*b1 "d^ #rHHTN# 299#d)RHI #%6y%A"$MM*<=	H *9 5a 8I !''/WW\\M5H4I$IKWW\\*b1[(RWW^^B-?IIbMb$ I2!8!?!?!GHIOOB'"d^ #rHHTN# 299#d)RHI_	J.* *
* *2 ! H<CCAFGGH# # ! H<CCAFGGHI I# #sl   +__+/_8`)3`6!a'a3_(+_58	`&`!!`&)`3	6	a$?aa$'a0	3a<	validation_typer6  c                 	   |y|| j                   vr$t        dj                  | j                               | j                   |   }t        |      t        k(  rt        |j                  j                               }|j                         D ]  \  }}||j                  vr%t        dj                  ||j                              |j                  |       |j                  |   }|j                  j                  t        j                  k(  r'| j                  |j                  j                   |       |j                  j                  t        j"                  k(  r	 t%        d       |j                  j                  t        j&                  k(  rt)        |t*              st)        |t,              rt%        d       0t)        |t.              r/|D ](  }| j                  |j                  j0                  |       * ot        dj                  t        |      |j                              t3        ||        |j4                  r1|r.t        dj                  t7        |      |j                              yyt        |      t8        t6        fv r|j4                  s.t        dj                  t        |      |j                              d	}	|j:                  D ]  }|	t=        |      k\  r/t        d
j                  |j                  |j                              ||	   }|	dz  }	|j                  j                  t        j                  k(  r'| j                  |j                  j                   |       |j                  j                  t        j"                  k(  r	 t%        d       |j                  j                  t        j&                  k(  rt)        |t*              st)        |t,              rt%        d       !t)        |t.              rO|D ]H  }t%        |j                  j0                  |       | j                  |j                  j0                  |       J t%        d       t3        ||        t=        |      |	kD  r$t        dj                  |j                              yt        dj                  t        |      |j                              )a  
        Validate value against the validation type given.

        If the application payload does not validate against the provided type,
        an :class:`autobahn.wamp.exception.InvalidPayload` is raised.

        :param validation_type: Flatbuffers type (fully qualified) against to validate application payload.
        :param value: Value to validate.
        :return:
        Nz+validation type "{}" not found in inventoryz9unexpected argument "{}" in value of validation type "{}"FIXME-003-UnionzFIXME-003-1-VectorzNinvalid type {} for value (expected Vector/List/Tuple) of validation type "{}"z.missing argument(s) {} in validation type "{}"z9**: invalid type {} for (non-struct) validation type "{}"r   z"missing argument "{}" in type "{}"r4  zFIXME-005-UnionFIXME-005-1-VectorFIXME-005-3-Vectorz.unexpected argument(s) in validation type "{}"z1invalid type {} for value of validation type "{}")r  rz   rt   r   r   r  r  r   r   r   rd   discardrK   r   rF   validate_objrN   r   r9  rE   r  r    r   r   rO   r  r  r   tupler   r   )
rR   r  r6  vt	vt_kwargsr   r   r   veidxs
             rS   r  zFbsRepository.validate_obj  s    "$))+LSSTXT]T]^__ 		/2;$BIINN,-I .1BII%()d)k)klmoqovov)wxx!!!$		! ::&&'++5%%ejj&8&8!<ZZ((GMM9+,ZZ((GNN:!!S)Z5-A23#Ax0"# JB --ejj.D.DbIJ - .GGMvdSTgWYW^W^G_a a $E1-5.8 ||	$%U%\%\]abk]lnpnunu%vww !*| %[UDM)<<$%`%g%ghlmrhsuwu|u|%}~~C .#e*$()M)T)TUZU_U_acahah)ijj#Jq ::&&'++5%%ejj&8&8!<ZZ((GMM9+,ZZ((GNN:!!S)Z5-A23#Ax0"# JB!%**"8"8"= --ejj.D.DbIJ 23 $E1-5.8 5zC$%U%\%\]_]d]d%eff   !!T![![\`af\gikipip!qrrrU   argskwargsc                 0   |y|| j                   vr.t        dj                  |t        | j                                     | j                   |   }d}t	        |r|j                         ng       }|j                  D ]  }|j                  sd|j                  v sd|j                  vr||t        |      k\  r/t        dj                  |j                  |j                              ||   }|dz  }|j                  j                  t        j                  k(  r'| j                  |j                  j                   |       |j                  j                  t        j"                  k(  r	 t%        d       |j                  j                  t        j&                  k(  rt)        |t*              st)        |t,              rt%        d	       Lt)        |t.              rO|D ]H  }	t%        |j                  j0                  |	       | j                  |j                  j0                  |	       J t%        d
       t3        ||       d|j                  v rG|j                  |v s||j                     }t%        d       |j5                  |j                         J d        t        |      |kD  r1t        dj                  t        |      |z
  |j                              |r8t        dj                  t        |      t7        |      |j                              |S )a  
        Validate the WAMP application payload provided in positional argument in ``args``
        and in keyword-based arguments in ``kwargs`` against the FlatBuffers table
        type ``validation_type`` from this repository.

        If the application payload does not validate against the provided type,
        an :class:`autobahn.wamp.exception.InvalidPayload` is raised.

        :param validation_type: Flatbuffers type (fully qualified) against to validate application payload.
        :param args: The application payload WAMP positional arguments.
        :param kwargs: The application payload WAMP keyword-based arguments.
        :return: The validation type object from this repository (reference in ``validation_type``)
            which has been used for validation.
        Nz<validation type "{}" not found in inventory (among {} types)r   argkwargz-missing positional argument "{}" in type "{}"r4  r  r  r  z	FIXME-003zshould not arrive herez/{} unexpected positional arguments in type "{}"z/{} unexpected keyword arguments {} in type "{}")r  rz   rt   r   r  r   r   rh   rg   r   rd   r   rK   r   rF   r  rN   r   r9  rE   r  r    r   r   rO   r  r  r   )
rR   r  r  r  r  args_idxkwargs_keysr   r6  r  s
             rS   validatezFbsRepository.validate  s     "$))+]ddetvyz~  {D  {D  wE   F  G  G 		/2  6&++-r: __ (	7E ~~%++!59S<8s4y#8()X)_)_`e`j`jlnlsls)tuuXA ::&&'++5%%ejj&8&8%@ZZ((GMM9+,ZZ((GNN:!%-E51I23#E84"' JB!%**"8"8"= --ejj.D.DbIJ 23 $E51 EKK'::,"5::.E+&''

3666uQ(	7T t9x !R!Y!YZ]^bZcfnZnprpwpw!xyy !R!Y!YZ]^iZjlpq|l}  @B  @G  @G  "H  I  I	rU   N)F) r   r   r   r   r    rT   ra  r&  r*  r   r  r   rJ   r-  r  r  r  r  rq  r  r2  r   r   r  rE  r  r  r   r
   r  r   r  r   rU   rS   rH   rH     s   33 3 s    c o    C     c9n-   d3	>*   tCL)   $sJ/   H HK$S K$U38_ K$Z ~@VJp`sHSM `s(3- `sDR R49 Rd3PS8n RYabkYl RrU   rH   rQ   )2r  r  r  r   r  ri  pathlibr   r   typingr   r   r   r   r	   r
   r   collections.abcr   yapf.yapflib.yapf_apir   r  autobahn.wamp.exceptionr   autobahn.utilr   #zlmdb.flatbuffers.reflection.Schemar   r  %zlmdb.flatbuffers.reflection.BaseTyper   r   "zlmdb.flatbuffers.reflection.Fieldr   r!   r   r   r   r   r   r   r7  r  r  rq  r  r  rJ   r  rH   r   rU   rS   <module>r     s   4  	 	      > > > $ -  2  A G 4vf vr	6 av aH	G(TVrR RjA AHD DNA6 AH`f `Fz zz		(3- 	\
F \
rU   