
    W|hO              
          S SK r S SKrS SKrS SKrS SKr S SKrS r \R                  " \R                  \R                  5        \R                  " SS9r\R                  SSSS	9  \R                  S
SSSSR                  \R                   5      -  S9  \R                  SSSS9  \R                  SSSSS9  \R                  SSSSS9  \R                  SSSSS9  \R#                  5       u  rr\R(                  (       Ga   \" \5      S :X  a"  \R-                  5         \R.                  " S5        \" \5      S:X  a,  \S    R1                  S5      S :  a  \S    R3                  S5      rS rS r\" \R:                  \5       H%  u  rr\ " S\< S\< S\< S 35        \S-  r\\-  rM'     S!\S"-  -   \S"-  -   r!\"" \RF                  " \!S#-  5      S$-  5      r$\ " S%\" \!5      < S&\$< S'35        S( H  r%\ " S)\%< S*\" \%S+-  \$-  5      < 35        M!     \R.                  " S 5        \" \5      S,:  a"  \RM                  5         \R.                  " S5        \S    r'\SS  V s/ s H  n \R;                  U 5      PM     sn r\ RN                  RQ                  \'5      (       a.  \RR                  (       a  \ " S-\'-  5        \ RT                  " \'5         \RV                  " \'\\RX                  \RZ                  \R\                  \R^                  S.9  \ Rf                  " \'5      Rh                  r!\ " S0\'\!4-  5        g! \ a	    \" S5      ef = f! \ a     GNf = fs  sn f ! \R`                   a  r1\" S/\2" \15      -  5      eSr1C1ff = f)1    Nz6[ERROR] Please make sure whisper is installed properlyc                 H    S H  nU S:  a  SX4-  s  $ U S-  n M     SU S4-  $ )N)bytesKBMBg      @z%.3f%sGB )numxs     U/home/james-whalen/.local/lib/python3.13/site-packages/../../../bin/whisper-create.pybyte_formatr      s:     a
V|  6MC ! 
S$K	    a  %prog path timePerPoint:timeToStore [timePerPoint:timeToStore]*
%prog --estimate timePerPoint:timeToStore [timePerPoint:timeToStore]*

timePerPoint and timeToStore specify lengths of time, for example:

60:1440      60 seconds per datapoint, 1440 datapoints = 1 day of retention
15m:8        15 minutes per datapoint, 8 datapoints = 2 hours of retention
1h:7d        1 hour per datapoint, 7 days of retention
12h:2y       12 hours per datapoint, 2 years of retention
)usagez--xFilesFactorg      ?float)defaulttypez--aggregationMethodaveragestringz,Function to use when aggregating values (%s)z, )r   r   helpz--overwriteF
store_true)r   actionz
--estimatezWDon't create a whisper file, estimate storage requirements based on archive definitions)r   r   r   z--sparsez!Create new whisper as sparse filez--fallocatez$Create new whisper and use fallocate   ,zArchive z: z points of zs precision      g      @i   z
Estimated Whisper DB Size: z (z bytes on disk with 4k blocks)
)r      
   2   d   i  z"Estimated storage requirement for zk metrics: i     zOverwriting existing file: %s)xFilesFactoraggregationMethodsparseuseFallocatez
[ERROR] %szCreated: %s (%d bytes))5ossyssignaloptparsemathwhisperImportError
SystemExitr   SIGPIPESIG_DFLAttributeErrorOptionParseroption_parser
add_optionjoinaggregationMethods
parse_argsoptionsargsestimatelenprint_usageexitfindsplitarchivestotal_pointsmapparseRetentionDef	precisionpointsprintsizeintceil	disk_sizer
   
print_helppathexists	overwriteunlinkcreater    r!   r"   	fallocateWhisperExceptionexcstrstatst_size)retentionDefs   0r   <module>rU      s   
 
   M
 --/
 %%	
   )3W  E   .	&L7#=#=>?  @   l  K   u\J  K   U<A  C   lD  F  **,$
Y!^HHQKY!^QS)A-7==D(, !:!:DAy&	h	
RSMHFL B
 
x"}	!2	3$$))D6M*T12)	T	I	' (#a	k!d(Y./1 2 $ ((1+t9q=((1+Aw $QR* ( %%l3 (* 77>>$G--'$./))D/,	..xg.B.B#*#<#<W^^%//1 
wwt} $- .s  MKLLM  v*  ,<#c(*++,s:   L. 'M  M=M .L= M
	M
M8"M33M8