/usr/lib/rads/venv/lib/python3.13/site-packages/restic/__pycache__
NameSizeModeActions
base.cpython-313.pyc306980644editdlrm
data.cpython-313.pyc222580644editdlrm
exc.cpython-313.pyc79170644editdlrm
__init__.cpython-313.pyc8450644editdlrm
Edit: /usr/lib/rads/venv/lib/python3.13/site-packages/restic/__pycache__/base.cpython-313.pyc (30698B)
j_nSrSSKJrJrJr SSKJr SSKJrJ r SSK r SSK J r SSKrSSKJrJr SSKrSSKrSSKJr SS KJrJr SS KJr SSKrS S KJrJ r J!r!J"r"J#r#J$r$ S S KJ%r%J&r&J'r'J(r( S SKJ)r)J*r* S SK+J,r,J-r-J.r. \ "S5R_5(aSr0OSr0Sr1"SS5r2"SS5r3g)z!Main Restic objects and functions)LiteralTextIOoverload) Generator)PurePathPathN)quote)CalledProcessErrorPIPE)Config) BotoCoreError ClientError)ServiceResource) ResticRepoSnapshot ResticCmdSnapPathSnapFileSnapDir)BackupSQLBackupGroup SQLBackupItemUserBackupDicts) UserBackups _tag_quote) ResticErrorResticBadIndexErrorResticLockedErrorz/usr/bin/imh-resticz/usr/bin/resticcF^[R"T5U4Sj5nU$)zFWraps a function and makes it automatically retry on ResticLockedErrorc>T"U/UQ70UD6$![a nUR5(deSnAOSnAff=fUR5 T"U/UQ70UD6$N)r unlock_okunlock)selfargskwargsexcfuncs >/usr/lib/rads/venv/lib/python3.13/site-packages/restic/base.py _locked_retry#locked_retry.._locked_retry s` .t.v. .  ==??#  D*4*6**s  949) functoolswraps)r)r+s` r* locked_retryr/s(__T++ c\rSrSrSrSrSSSSSS.S \S \S-S \S \\-\ R-S-S \ \-S\ \-S-S\S-4Sjjr Sr \S\\\44Sj5rSGS\4SjjrS\S-4SjrS\4SjrS\4SjrSr\S5r\SHS\4Sjj5rS\4Sjr\S\\4Sj5r\SSS.S \\S-S!\\-S-S\\4S"jj5r SSSSS#.S$\\\ -S \\S%\S-S&\\\ -S-S'\\\ -S-S(\S\4S)jjr!SIS*\\ -S \\S%\S-S(\S+\\"-SS4 S,jjr#SIS*\\ -S \\S%\S-S(\S\4 S-jjr$S.\\-S/\\ -S\4S0jr%SSS1S2.S.\\-S3\\\ -S-S&\\\ -S-S4\\ -S\4 S5jjr&\'S \\S%\S-S(\S\\4S6j5r(\S7SS8.S9\S\4S:jj5r)S.\\-S*\\ -S\\*\+-4S;jr,\S.\\-S*\\ -S\-\*\+-SS44S<j5r.\/SJSSS=.S>\S-S!\\-S-S?\0SS@\\S-S\\\144 SAjjj5r2\/SJSSS=.S>\S-S!\\-S-S?\0S7S@\\S-S\\\344 SBjjj5r2SJSSSSC.S>\S-S!\\-S-S?\S@\\S-S\\\\\444 SDjjjr2\'SE5r4SFr5g)KRestic-aHandles restic commands Args: endpoint (str): S3 server base url with https:// (excluding s3: prefix) cluster (str | None): Optional cluster name. Only used by repr() repo (ResticRepo): dataclass containing bucket name and key info lim (int, float, ProcLimit, None): max load limit. This can be a static limit if you set it to a float or int, or for more flexibility, use a ``ProcLimit`` instance. If unset, processes will not be ratelimited tmp_dir (Path | str): TMPDIR to use. Defaults to '/var/tmp/restic'. cache_dir (Path, str | None): RESTIC_CACHE_DIR to use. Set this to None to disable cache. Defaults to '/var/cache/restic/%(bucket)s' gomaxprocs (int, None): max CPU cores to allow restic to use resticNz/var/tmp/resticz/var/cache/restic/%(bucket)s)clusterlimtmp_dir cache_dir gomaxprocsendpointr6repor7r8r9r:cXlX lX0lX@l[ U5UlXplUcSUlO[ U5SUR0-UlURUl g)Nbucket) r;r6r<r7strr8r:r9r> repair_index rebuild_index)r%r;r6r<r7r8r9r:s r*__init__Restic.__init__@s\!   7| $  !DN ^x.EEDN!..r0cUR(a'SURSURRS3$SURRS3$)NzRestic<:>)r6r<r>)r%s r*__repr__Restic.__repr__WsG <<T\\N!DII,<,<+=Q? ?))*!,,r0returncLURSURRURRURRS.nUR (aUR US'UR b(UR S:a[UR 5US'U$)z Restic environment variable dict1)TMPDIRGOGCRESTIC_PASSWORDAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYRESTIC_CACHE_DIRr GOMAXPROCS)r8r< restic_pass access_key secret_keyr9r:r?)r%rets r*env Restic.env\sll#yy44!%!5!5%)YY%9%9   >>&*nnC" # ?? &4??Q+> #DOO 4C  r0c[USU0US9n[R"SURURR URR US9RURR5$)zGets a boto3 s3.Bucket for this repo Args: timeout (int): network timeout in secs retries (int): times to retry on timeout Returns: s3.Bucket: boto3 resource for this bucket max_attempts)connect_timeoutretries read_timeouts3) endpoint_urlaws_access_key_idaws_secret_access_keyconfig) BotoConfigboto3resourcer;r<rTrUBucketr>)r%timeoutr\rbs r* s3_bucketRestic.s3_bucketlsl##W-   ~~ "ii22"&))"6"6  &!! "  #r0c[[UR5RR SS955S:$![ anS[ U5;aSnAgeSnAff=f)a@Check if the /keys/ path has items in it, meaning that restic has been initialized Raises: botocore.exceptions.ClientError: connection problem botocore.exceptions.BotoCoreError: boto3 error Returns: (bool | None): whether the keys path existed in the bucket, or None if the bucket did not exist at all zkeys/)Prefixr NoSuchBucketN)lenlistrhobjectsfilterrr?r%r(s r*init_key_existsRestic.init_key_existss] D)11888HIJQN  S)  s;> A"AAA"cUR5 UR5 g![[4a6n[R"SU[ U5R U5 SnAgSnAf[aknUR5(d'[R"SURU5 SnAgUR5 SnAN![a SnANf=fSnAf[a/nUR5 SnAN![a SnANf=fSnAf[a,n[R"SURU5 SnAgSnAff=f![[4a6n[R"SU[ U5R U5 SnAgSnAf[a,n[R"SURU5 SnAgSnAff=f)zPrepare access to this repo if needed and preemptively fix issues connecting to it. Plugins should probably run this first Returns: bool: whether this repo is ready for access z %s %s: %sNFz%%s: could not automatically unlock %sz%s: %sT) init_repor rloggingerrortype__name__rr#namer$rrrArqs r*prepareRestic.preparesO  NN ,  NN ;{+  MM+tT#Y-?-? E ==?? rVs r*ruRestic.init_repos))+ +6 + >^^%F MMO  $ $ &jj $$D$> CJJ . &cjj 8c" "r0cURS5RSSS9 g![an[U5UeSnAff=f)zORun restic unlock Raises: ResticError: if the restic unlock command fails r$TcheckrNrrr rrqs r*r$ Restic.unlocks@  , JJx $ $4 $ =! ,c" + ,s" = 8=cURSSS5RSSS9 g![an[U5UeSnAff=f)zGRun restic repair index Raises: ResticError: if the command fails repairindexz--read-all-packsTrNrrqs r*r@Restic.repair_indexsM , JJx*< = A A4 B " ,c" + ,s!$ ? :?TrcUR(aSnOSnUR"U6RSUS9 g![an[ U5UeSnAff=f)zRun restic prune Args: no_lim (bool): do not CPU limit the command as it runs regardless of the lim arg in Restic Raises: ResticError: if the command fails )prune--cleanup-cache)rTrN)r9rrr r)r%rr&r(s r*r Restic.prunesS >>/DD , JJ  ! !V ! <! ,c" + ,s6 A A  AcNURnURU5 [X S9$)zBuild a ResticCmd object that can be used to execute the requested restic command Args: *args (tuple[str]): restic subcommand and args Returns: ResticCmd: a restic command executor )r4)_basecmdextendr)r%r&cmds r*r Restic.builds$mm 4**r0c[SURSURR3/nUR(dUR S5 U$)Nz --repo=s3:/z --no-cache) RESTIC_PATHr;r<r>r9append)r%rs r*rRestic._basecmdsG q)9)9(: ; ~~ JJ| $ r0tagsrgrrgcjSS/nU(a*UH$nURS[U[5/5 M& UR"U6R [ SSUS9n[R"UR5Vs/sH n[XS9PM sn$![ an[U5UeSnAff=fs snf)a}Get a list of restic snapshots in this repo. If this server is a Backup Manager client, see the ``get_backups()`` function instead args: tags (list[str], optional): only consider snapshots which include this tag list. To check with AND logic, specify a single tag as ``["tag1,tag2"]``. To check for either tag, specify independently as ``["tag1", "tag2"]`` timeout (float | int | None): optional command timeout Raises: ResticError: if the restic snapshots command failed subprocess.TimeoutExpired: if timeout was specified and exceeded Returns: list[Snapshot]: Snapshots found in the repo snapshots--json--tagT)rrrrgNr4data) rr url_quoterrr r rjsonloadsrr)r%rrgr&tagrVr(xs r*rRestic.snapshots s0X&  Wji&@AB ,**d#''4g(C 8?zz4  r0snapfilenamec[U[5(a UROUnURSU[ U55$)zCrafts a ResticCmd to dump a file from the specified snapshot ID Args: snap (Snapshot | str): snapshot or snapshot ID to dump data from filename (str | PurePath): filename to retrieve Returns: ResticCmd: restic command executor dump)rridrr?)r%rrsnap_ids r*r Restic.dumps2(h77$''Tzz&'3x=99r0r)includesrtargetrrcD[U[5(a UROUnSS[U5/nUb%UHnUR S[U5/5 M! Ub%UHnUR S[U5/5 M! UR U5 UR "U6$)aCrafts a ResticCmd to restore a snapshot Args: snap (str): snapshot or snapshot ID to restore from includes (list[str | PurePath], optional): --include paths excludes (list[str | PurePath], optional): --exclude paths target (str | PurePath): base directory prefix to restore to. Defaults to '/', which restores to the original path Returns: ResticCmd: restic command executor restorez--targetz --includer)rrrr?rrr) r%rrrrrr&includers r*rRestic.restores((h77$''T:s6{3  # [#g,78$  # [#g,78$ Gzz4  r0cS/nU(aURS5 Ub"US:aURS[U5/5 UH$nURS[U[5/5 M& U$)z!Builds the base backup subcommandrz--quietrz--limit-uploadr)rrr?rr)rrrr&rs r*rRestic._backup_argssc z  KK "  7Q; KK)3w<8 9C KK*S)"<= > r0F)rrrc S/nU(a6UR(aURSS/5 OURS5 URUVs/sH&n[U[5(a UR OUPM( sn5 UR "U6RSUS9 gs snf![an[U5UeSnAff=f)aRun restic forget Args: *ids (Snapshot | str): snapshots to remove, specified by either a Snapshot object or snapshot ID str prune (bool): whether to automatically run prune if at least one snapshot was removed. Defaults to False no_lim (bool): do not CPU limit the command as it runs regardless of the lim arg in Restic Raises: ResticError: if the restic forget command fails forgetz--prunerTrN) r9rrrrrrrr r)r%rridsr&rr(s r*r Restic.forgetsz ~~ Y(9:; I& SISZ844QTT!;SIJ , JJ  ! !V ! <J" ,c" + ,s-B#B(( C2 B>>Cc2[URXS95$)a Like ``scandir`` but return a list instead of a Generator. Returns files/dirs found in a requested path in a Snapshot Args: snap (Snapshot | str): snapshot to list the contents of, supplied either by its Snapshot instance of snapshot ID path (str | PurePath): full path inside the snapshot to list the contents of Raises: ValueError: requested path was not a full path ResticError: Any error listing snapshot contents from restic Returns: list[SnapFile | SnapDir]: files or directories )rr)rnscandir)r%rrs r*listdirRestic.listdirs&DLLdL677r0c## [U[5(a UROUn[U5nUR S5(d [ S5eUR S5nUS:XaSnURSSSX25nUR[SSS9RR5n[U5S :ag [U[R "UR#S 55S 9nU(aq[R "UR#S 55n[%UUUS USUSUSUSUR'SS 5UR'SS 5S9 v U(aMpg g ![an[U5UeS nAff=f7f)aIterates over files/dirs found in a requested path in a Snapshot Args: snap (Snapshot | str): snapshot to list the contents of, supplied either by its Snapshot instance of snapshot ID path (str | PurePath): full path inside the snapshot to list the contents of Raises: ValueError: requested path was not a full path ResticError: Any error listing snapshot contents from restic Yields: Generator[SnapFile | SnapDir, None, None]: files or directories rzpath must be a full pathlsrz--longT)rrrNr5rrrzrxruidgidmode permissions) snapshotr4rzrxrrrrr)rrrr? startswith ValueErrorrstriprrr r splitlinesr rrmrrpoprget) r%rrrrlinesr(rrs r*rRestic.scandirsZ&(h77$''T4ys##78 8{{3 2:Djjx7A ,GG4fZZ\  u:> 4djj1.FG::eiil+D!&\&\&\KKXXfd+ HH]D9  e " ,c" + ,s1A=F-E#-B2F!F# E>- E99E>>F)rgruser serializercgr"r%rrgrrs r* get_backupsRestic.get_backupsCs&)r0cgr"rrs r*rrMs"%r0)rgrrcUcSOSU3nU(a;UR5nU(a#UVs/sHouUR;dMUPM nnOURUcSOU/US9n0n/n 0n U(Ga[UR 55n [U [5(aU RU 5 OU RU;a0XR'U RXR;a/XRU R'XRU RRU 5 [U [5(a%XU RU RU R4'U(aGMU HHn U RU RU R4n X;dM-XU RU R'MJ U(aUR!U5 U$s snf![ [ 4a GMf=f)aGet backups for a backups 3.x Backup Manager client Args: user (str, optional): only list backups found for this user timeout (int | float | None): timeout for the underlying restic snapshots command serialize (bool): if True, return as a json-serializable dict. If False, return as Backup, SQLBackupGroup, and SQLBackupItem objects snapshots (list[Snapshot], optional): if provided, scan the backups found in this list rather than executing ``restic snapshots`` Returns: dict[str, dict[str, list]]: Top-level keys are usernames. Second-level are the type of backup. Values are a list of backups found which may be dicts or objects depending on the serialize arg Nzuser:r)copyrrrrrKeyErrorrrrrrxrtimedbsdbnamer) r%rrgrrr all_snapsroutsqlssql_mapbakkeys r*rrWs2ld%v !(I(1C 1AFF]Q C!\Tu'I Y]]_-#}-- C 883&$&CM883xx=0.0CM#((+HH chh'..s3c>22>ASXXsxx:;iC88SXXsxx0C~/2   ,  NN3  AD)  sGG2G""G76G7cUHCnXR5H*up#UVs/sHoDR5PM snXU'M, ME gs snf)zOConverts the return of get_backups(serialize=False) to a json-serializable dictN)itemsr)backupsrbak_typeobjsrs r*rRestic.serializesGD")-"5"5"7BF*G$Q;;=$*G h'#8*GsA )r9r6r;r:r7rAr<r8)r5)T)NTr")6ry __module__ __qualname____firstlineno____doc__r?rintfloatcproc ProcLimitrrBrGpropertydictrWS3Bucketrhboolrrr{rur$r/r@rrrrnrrrrrrrrr staticmethodrrrrrrrrrrrrr__static_attributes__rr0r*r2r2-s J #48"3+I!"//t /  / 5[5?? *T 1 /C/c>D(/$J/.-  T#s(^  #(#.*&&P40 ,,, ,D,,& +i +$s)"&&* !O3i$!Out# !O h !O!OP#0459%!C(N#%!3i %! t %! sX~&- %!C(N+d2%!%! %!Z# ,Hn , 3i , t , ,f  ,  ,L# !Hn!3i!t !  !  !2 :C :3> :i :"1504!$ !n!sX~&- ! sX~&- ! h ! !> 3i "%* 59  c  ).t,$,,,48sN8*-.8 h !8*0sN0*-.0 8g%tT1 200d )'++/ )Dj)ut# ) 4= ) >D( ) c?" #)) %'++/ %Dj%ut# % 5> % >D( % c; %% ='++/ =Dj=ut# =  = >D( = c4T ?" #=~HHr0r2cX\rSrSrSrS\4SjrS\S\4SjrS\4S jr S\S\4S jr S r g ) S3ToolizWrapper object for moving items around in an S3 Bucket Args: s3_bucket (S3Bucket): service resource from ``Restic.s3_bucket()`` rhc/UlXlgr")movedr>)r%rhs r*rBS3Tool.__init__s  r0srcdestchURRURRUS.U5$)zCopy an item in the S3 bucket)rfKey)r>rrzr%rrs r*r S3Tool.copys({{4;;+;+;C H$OOr0rchURRURRSSU0/0S9$)zDelete an item in the S3 bucketObjectsr)rfDelete)r>delete_objectsrz)r%rs r*delete S3Tool.deletes8{{));;##Y%,G*  r0c~URX5 URU5 URRU5 g)zMove an item in the S3 bucketN)rr$rrrs r*move S3Tool.moves, # C $r0)r>rN) ryrrr r rrBr?rr$r'rrr0r*rrsH  ( PP3P #   3 r0r)4r typingrrrcollections.abcrpathlibrrr urllib.parser rr- subprocessr r rvrdbotocore.clientr rcbotocore.exceptionsr rboto3.resources.baserrr rrrrrrrrrrrrrr(rrrrrr/r2rrr0r*r1s',,%" +/ 0:< NNHH)DD%%'''K#K  o Ho Hd  r0