+
    bIi8                        R+t RtRt^ RIHtHtHt ^ RIHtH	t	H
t
HtHtHt ^ RIt^ R	IHtHtHtHtHtHt ^ R
IHt ^ RIHt R tR tR tR tR,t]! ]4      ^,
          t R-R lt!R.R lt"R/R lt#R t$R t%R0R lt&R0R lt' ! R R4      t(R t)R t*R1R lt+ ! R R4      t, ! R R]-4      t.. R2Ot/R% t0]1! R!R"R#R$RRRR R&R'7	      t2R( t3R) t4]5R*8X  d   ^ RI6t6]6Pn                  ! 4        R# R# )3angle2cornerCustomDrawChangerDrawTimeCollectorFillPairedDataz3.4.8zUtilities used here and there.)mktimegmtimestrftime)log10pifloorsincoshypotN)transformPointsinverseEllipseGroupStringnumericXShift)flatten)stringWidthc                    ^ .^	,          p\        \        \        V P                  R4      4      4      w  r#pWCV.VR&   \	        V4      # )zNConvert a 'dd/mm/yyyy' formatted string to a tuple for use in the time module./N   N)listmapintsplittuple)
timeStringLddmmyyyys   &    ڈC:\Users\petid\OneDrive\Desktop\Maestro\MAESTRO CLAUDE\MAESTRO\maestro-backend\venv\Lib\site-packages\reportlab/graphics/charts/utils.pymkTimeTupler&   %   sE     
aAC!1!1#!678LBDrNAbE8O    c                *    \        \        V 4      4      # )z?Convert a number of seconds since the epoch into a date string.)r   r&   )r    s   &r%   str2secondsr)   .   s     +j)**r'   c                ,    \        R\        V 4      4      # )zAConvert a date string into the number of seconds since the epoch.z%Y-%m-%d)r   r   )secondss   &r%   seconds2strr,   3   s     Jw00r'   c                f   V R9   d   V # V ^ 8  d   R\        V ) 4      ,          # \        \        V 4      4      pV^ 8X  d   V ^8  d   RpM$RpM!V^ 8  d   RV^,
          ,          pM	RV,          pW 8  d
   VR,          # V^,          V 8  d
   VR,          # V^,          V 8  d
   VR,          # VR,          # )aG  Return the first 'nice round number' greater than or equal to x

Used in selecting apropriate tick mark intervals; we say we want
an interval which places ticks at least 10 points apart, work out
what that is in chart space, and ask for the nextRoundNumber().
Tries the series 1,2,5,10,20,50,100.., going up or down as needed.
g      ?皙?      $@g       @g      @)       g      )nextRoundNumberr   r	   )xlgbases   &  r%   r2   r2   9   s     	F{1uoqb)))q]71u!VBF#D2:D 9#:Qh1_#:Qh1_#:$;r'   c                F   W8  d1   W8X  d    V ^ 8X  d   Rp RpMRV ,          p RV,          pM\        R4      hW,
          \        V4      ,          pV^ 8  ;'       d>    V^8  ;'       g    V^
8  ;'       d$    ^
\        \        V4      4      ,          ;'       g    ^pTp W4,          pV\        R,          8:  d   MV^
,          pK'  ^ pV\        V,          8  d   V^,           pK   \        V,          V,          pW,          p\        V4      V^ 8  ,
          p	Wy,          pWyV,           ,          pW',          pV^ 8  d   WQ8  d   RpTpMV^ 8  d   V) pW8  d   Tp^ pW8:  d   W8:  d   M#V^,           pV\        8  g   K  ^ pV^
,          pK  WWpV,
          V,           V,
          3# )z>determine tick parameters for range [lo, hi] using I intervalsr.   g?g?zlo>hig        g)
ValueErrorfloatr   r	   
_intervalsr   _j_max)
lohiIr3   bajssnls
   &&&       r%   find_intervalrE   a   s{    
x61uVVW%%	waA	!61"662uU1X#6;;!A	A
CjnebD	A
JqM/q1u1
]1_EFAaCLD!HDQ3uTAt5QUEEV8A"A!VaZ"_$$r'   c                    V'       d@   \        W4      ^ ,          V,          p\        W4      w  rVVR8  d
   V^,           pWS,          pMF V^ ,           RpV F4  p\	        WV4      pV^,          V8  g   K  VR,          w  rEpV^,          pK6  	  XXV3#   \         d2    \        \        ^T^,
          4      \        T^,           ^4      4      p L|i ; i)r0   :0yE>gr   )divmod	TypeErrorrangemaxrE   )	lowerupperrC   gridtr=   zwis	   &&&&     r%   find_good_gridrS      s    5q!D(u"T612W	-aD AE*AtAvetA$	 
 b$;  	-c!AaCjQqS,A	-s   		B 9CCc                   \        WW%4      w  rxp\        \        V4      4      p	V	^ 8X  d   ^p	VRV	,          ,          p
\        V
4      V
8g  p
V	^8  g   V	R
8  d"   R\	        V
^,           4      ,           R,           pM|V	^ 8  d-   \        V	4      V
,           pR\	        V4      ,           R,           pMIV
\        V	4      ,
          pR\	        V^,           4      ,           R,           \	        V4      ,           R,           pV'       d
   VR,           p. p\        \        W,
          4      V,          R	,           4      ^,           pV'       dW   . p\        V4       FB  pWuV,          ,           pVP                  V4       VP                  VVV,           ,          4       KD  	  W3# \        V4       F3  pWuV,          ,           pVP                  VVVV,           ,          34       K5  	  V# )z
return tick positions and labels for range lower<=x<=upper
n=number of intervals to try (can be a list or sequence)
split=1 return ticks then labels else (tick,label) pairs
r/   z%+z.0e%z.0f.fz%%r.   )rS   r   r	   r   reprr9   rJ   append)rL   rM   rC   r   percentrN   labelVOffsetrO   r=   powerrQ   formatdigitsTlabelsrR   vs   &&&&&&&          r%   ticksrc      sw    !q7KA4%+EaxS%ZAA	AqyEBJd1Q3i%A:Z\F4<'-Fs5z\FfQh'+DL8<Fvd{
AE"$KS !!#AqAq&AHHQKMM&AlN34  yqAq&AHHa1\>234  r'   c                    \        V 4      pR V 9   d   ^ pW!8  d   W,          f   V^,          pK  W!8X  d   V # V^,
          pW,          f   V^,          pK  V^,          pV'       g	   V'       d   WV p \        \        V 4      4       Uu. uF  q@V,          e   K  VNK  	  ppV F/  pRW^,
          ,          W^,           ,          ,           ,          W&   K1  	  W#V 3# ^ W3# u upi )N      ?)lenrJ   )datamr?   rD   rR   r>   s   &     r%   	findNonesri      s    D	At|cdgoFA4aCgoFA	1$)4c$i(<(1GQQ(<A4!9TA#Y./DG TzQ8O	 =s   	CCc                    V  Uu. uF  q^,          NK  	  pp\        V4      w  r4p\        V4      pV'       g   WF8  g   WR8w  d:   V'       g   WF8  d   WV p \        W4       UUu. uF  w  rV^ ,          V3NK  	  p ppV # u upi u uppi r1   )ri   rf   zip)pairsr3   Yr?   rD   nYrh   ys   &       r%   pairFixNonesrq      s{    u!1uAq\FAAAAC25UQZU%(]3]ca!A$q]3L 	
 4s   B %Bc           
          V^,
          V ^ ,          .,          V ,           p \        V\        V 4      ^,           4       Uu. uF'  p\        \        WV,
          V 4      4      V,          NK)  	  p pV # u upi rk   )rJ   rf   r9   sum)rg   rC   rR   s   && r%   maveragert      sd    aC$q'?4D/4Qs4y{/CD/C!E#dQ3qk"#A%%/CDDK Es   -A/c           
          \        T \        V  Uu. uF  q"^,          NK  	  upV4      4       UUu. uF  w  r#V^ ,          V3NK  	  upp# u upi u uppi rk   )rl   rt   )rg   rC   r3   ss   &&  r%   pairMaveragerw      sJ     #D($3G$QaDD$3G*J KL KQqT!H KLL3GLs
   A
Ac                      a  ] tR t^t o RtR.3R ltR tR tR t]	R 4       t
]	R 4       t]R	 4       tR
 tR tRtV tR# )r   za
generic mechanism for collecting information about nodes at the time they are about to be drawn
gifc                    \         P                  ! 4       V n        V P                  4        R V n        Wn        RV n        R # )NF)weakrefWeakKeyDictionary_nodesclear_pmcanvformatsdisabled)selfr   s   &&r%   __init__DrawTimeCollector.__init__   s.    //1

r'   c                J    . V n         V P                   P                  V n        R # N)_inforZ   _info_appendr   s   &r%   r~   DrawTimeCollector.clear   s    
 JJ--r'   c                D    WV3V P                   V&   WP                  R &   R# )_drawTimeCallbackN)r}   __dict__)r   funcnodeargskwdss   &&&*,r%   recordDrawTimeCollector.record   s"    !t,D-1)*r'   c                    V P                   P                  VR 4      pV'       d,   Vw  rEpV! WV.VO5/ VB pVe   V P                  V4       R # R # R # r   )r}   getr   )r   r   canvasrendererr   r   r   rR   s   &&&&    r%   __call__DrawTimeCollector.__call__   sR    {{tD)#DT9D9D9A}d//2} r'   c                   \        VR R4      pV'       g   R# V P                  pV P                  pWPP                  ,           pW`P                  ,           pVP                  4       p	\        P                  WEV3Wx334      V	R&   V	# )ctmNrect)getattrr3   rp   widthheightcopyr   transformAndFlatten)
r   r   r   r   Ax1y1x2y2Ds
   &&&,      r%   rectDrawTimeCallback&DrawTimeCollector.rectDrawTimeCallback  sm    F5&&VVVV**_++IIK#77r7B7:KL&	r'   c                v    \        V 4      R8w  d   \        V 4      p\        W!4      p\        \        V4      4      # )zftransform an flatten a list of points
A   transformation matrix
p   points [(x0,y0),....(xk,yk).....]
)r1   r0   r0   r1   r0   r0   )r   r   r   r   )r   piAs   && r%   r   %DrawTimeCollector.transformAndFlatten  s2     8]"B%AWQZ  r'   c                t    V P                   '       g   ^ RIpVP                  ^^4      V n         V P                   # )r0   N)r   renderPMPMCanvas)r   r   s   & r%   pmcanvDrawTimeCollector.pmcanv  s,    |||#,,Qq1DL||r'   c                N   \        VR R4      pV'       g   R# \        V\        4      '       dv   V P                  pVP	                  VP
                  VP                  VP                  VP                  4       VP                  pV Uu. uF  q^,          V^,          3NK  	  ppMTVP                  4       P                  p\        ^ \        V4      ^4       U	u. uF  qV	,          Wy^,           ,          3NK  	  pp	VP                  4       p
V P                  WW4      V
R&   V
# u upi u up	i )r   Npoly)r   
isinstancer   r   ellipsecxcyrxryvpath	asPolygonpointsrJ   rf   r   r   )r   r   r   r   r   r   cr   r3   rR   r   s   &&&&,      r%   wedgeDrawTimeCallback'DrawTimeCollector.wedgeDrawTimeCallback&  s    F5&&d7##AIIdggtww8A&'(aA$qtaA(A ''A(-aAq(9:(91A$q1v(9A:IIK,,Q1&	 ) ;s   D D"c                    ^ RI p\        VR,           R4      p VP                  V P                  V4       VP                  4        R#   TP                  4        i ; i)z
save the current information known to this collector
fnroot is the root name of a resource to name the saved info
override this to get the right semantics for your collector
Nz.default-collector.outrQ   )pprintopenr   close)r   fnrootr   rW   s   &&  r%   saveDrawTimeCollector.save6  sC     	
v..s
3	MM$**Q'GGIAGGIs   A A)r   r   r}   r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r~   r   r   staticmethodr   r   propertyr   r   r   __static_attributes____classdictcell____classdict__s   @r%   r   r      sp       %g .23 
 
 ! !    r'   c                B    V w  r#Vw  rE\        WB,
          WS,
          4      # )z"return distance between two points)r   )xxx_todo_changemexxx_todo_changeme1x0y0r   r   s   &&    r%   xyDistr   C  s!    GR GR"%"%!!r'   c                 F   V w  rEVw  rgVw  rVw  rWE3pWd,
          Wu,
          3pW3pW,
          W,
          3p\        V^ ,          V^,          ,          V^,          V^ ,          ,          ,
          4      pV^ ,          V^ ,          ,
          V^,          V^,          ,
          3pV^ ,          V^,          ,          V^,          V^ ,          ,          ,
          pV^ ,          V^,          ,          V^,          V^ ,          ,          ,
          p\        V4      R8  d   \        V4      R8  d   R# R# VV,          pVV,          p^ Tu;8:  d   ^8:  dV   M R# ^ Tu;8:  d   ^8:  dA   M R# V^ ,          VV^ ,          ,          ,           V^,          VV^,          ,          ,           3# R# R# )r0   rG   	collinearN)r9   abs)xxx_todo_changeme2xxx_todo_changeme3xxx_todo_changeme4xxx_todo_changeme5x00y00x01y01x10y10x11y11r   rqrv   rsqpqprqpsrO   us   &&&&                  r%   lineSegmentIntersectr   I  sM   "IS"IS"IS"ISAA 	AA	qtAaDy1ad"	#B	
1ad1Q4!9	B
Q%!*RU1Q4Z
C
Q%!*RU1Q4Z
C
2wt|s8D=BABA!wQww1a777tAadF{AaD1Q4K'' wr'   c
                   V'       g   \        4       pVR,          p\        ^,          p
W:,          p\        WEV4      pT;'       d    R	;'       g    ^pVR,          pV^Z,          pV	R8w  d   V	R8X  d   WRV,          ,          V,          ,          pMYV	R8X  d!   W\        V4      ,          V,          ,          pM2V	R8X  d,   W\        \	        WWVR4      4      ,          V,          ,          pV F  p\        VWV4      p\        V4      V,          p\        4       pVP                  \        ^ ^ VWVRR7      4       VP                  V \        V4      V,          ,           V\        V4      V,          ,           4       VP                  WV,          ,
          V
,          V,
          4       VP                  V4       WV,          ,          pK  	  V# )
z%make a group with circular text in ith  re   startmiddleendnumericN)fontNamefontSize
textAnchorr7   )r   r
   r   r9   r   addr   	translater   r   rotate)r3   rp   radiusangletextr   r   insideGr   pi180phir   sighsigsig90letterbetahs   &&&&&&&&&&         r%   makeCircularStringr	  f  sj   %'a	SLEsFE
+C1E
--R

1Cs7DFE7xE	?6))CuU|#F**C"u]:5(SWXYYZ```CFH7U|F"G	fQ6HRYZ[	Ac#hvo%aC&78	#4i-&u,-	a4x  Hr'   c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )r   i  z1
a class to simplify making changes at draw time
c                    R V n         R # r   storer   s   &r%   r   CustomDrawChanger.__init__  s	    
r'   c                V   V'       d[   V P                  V4      V n        \        V P                  \        4      '       g#   Q R V P                  P
                  ,          4       hR# V P                  e9   V P                  P                  4        F  w  r4\        W#V4       K  	  RV n        R# R# )z5%s.changer should return a dict of changed attributesN)_changerr  r   dict	__class__r   itemssetattr)r   changeobjr@   rb   s   &&&  r%   r   CustomDrawChanger.__call__  s    s+DJdjj..  B0gjnjxjx  kB  kB  1B  B.ZZ#zz'')a  *DJ $r'   c                    \        R4      h)z
When implemented this method should return a dictionary of
original attribute values so that a future self(False,obj)
can restore them.
zAbstract method _changer called)RuntimeError)r   r  s   &&r%   r  CustomDrawChanger._changer  s     <==r'   r  N)
r   r   r   r   r   r   r   r  r   r   r   s   @r%   r   r     s     > >r'   c                   *   a  ] tR tRt o RR ltRtV tR# )r   i  c                <    \         P                  W4       W n        R # r   )r   r   other)r   rb   r  s   &&&r%   r   FillPairedData.__init__  s    d
r'   )r  N)r0   )r   r   r   r   r   r   r   r   s   @r%   r   r     s      r'   enerC   nwrQ   swrv   sec                b    V R,          p\          F  w  r#pY!u;8  d   V8:  g   K  Vu #  K  	  R# )aJ  converts mathematical angle to a compass point from a math angle where
0 degrees lies along the x axis ie east==0 degrees

>>> [angle2dir(_) for _ in [0,360]+[__[0] for __ in _arange2dirs]+[__[1] for __ in _arange2dirs]]
['e', 'e', 'e', 'e', 'ne', 'n', 'nw', 'w', 'sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w', 'sw', 's', 'se', 'e']
r   r   )_arange2dirs)r   r@   r<   r=   ds   &    r%   	angle2dirr'    s-     	A!	88AX8 "r'   r   )	r  r   rC   r!  rQ   r"  rv   r#  r   c                .    \         \        V 4      ,          # )a$  converts a direction angle to a box corner name effectively the reverse direction
>>> [angle2corner(_) for _ in [0,360]+[__[0] for __ in _arange2dirs]+[__[1] for __ in _arange2dirs]]
['w', 'w', 'w', 'w', 'sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w', 'sw', 's', 'se', 'e', 'ne', 'n', 'nw', 'w']
)_cornerNamesr'  )r   s   &r%   r   r     s    
 	%())r'   c                \   V ^ ,          V ^,          8  g   V ^,          V ^,          8  dg   \        V ^ ,          V ^,          4      \        V ^,          V ^,          4      \        V ^ ,          V ^,          4      \        V ^,          V ^,          4      3p VR9  d   \        RV: 24      hVR9   d    V ^ ,          V ^,          ,           ^,          pMVR9   d   V ^,          pM	V ^ ,          pVR9   d"   V ^,          V ^,          ,           ^,          pW#3# VR9   d   V ^,          pW#3# V ^,          pW#3# )aD  return (x,y) for bounding box and corner name
>>> bb=(1,0,0,1);[boxCornerCoords(bb,_) for _ in 'c n ne e se s sw w nw'.split()]
[(0.5, 0.5), (0.5, 1), (1, 1), (1, 0.5), (1, 0), (0.5, 0), (0, 0), (0, 0.5), (0, 1)]
>>> boxCornerCoords(bb,'z')
Traceback (most recent call last):
    ...
ValueError: invalid box corner name 'z'
zinvalid box corner name )	rC   r   r  r#  rv   r"  rQ   r!  r   )r   rv   rC   )r   r  r#  )r  r   rQ   )r!  rC   r   )minrK   r8   )bbcnr3   rp   s   &&  r%   boxCornerCoordsr.    s    
!uRU{beBqEk"Q%1s2a5A/BqE"Q%0@RU2a5AQR	BB3B6:;;	]U2a5[!O		qEqE	]U2a5[!O
 4K	 
	1A 4K qE4Kr'   __main__)r   r'  r.  r   r   r   rS   rE   ri   r   r	  rt   r&   r2   rq   rw   r,   r)   rc   r   )r.   g?g      ?re   )   )   r0           	   N)r1  r1   r0   Nr0   )r3  )r0   Nr   )	)r7        6@r  )r7       P@r   )r8        \@rC   )r9       c@r!  )r:       Pi@rQ   )r;       n@r"  )r<       Hr@rv   )r=       u@r#  )r>  ii  r  )8__all____version__r   timer   r   r   mathr	   r
   r   r   r   r   r{   reportlab.graphics.shapesr   r   r   r   r   r   reportlab.lib.utilsr   reportlab.pdfbase.pdfmetricsr   r&   r)   r,   r2   r:   rf   r;   rE   rS   rc   ri   rq   rt   rw   r   r   r   r	  r   r   r   r%  r'  r  r)  r   r.  r   doctesttestmod r'   r%   <module>rI     s  . ( ) ) 2 2  e e ' 4+
1$L 

:q-%^($L$
MT Tl"(:@> >0T 



  C4#tcTCP*6 ZOO r'   