# apt_inst - pydoc - phpman

Help on module apt_inst:

## NAME
    apt_inst - Functions for working with ar/tar archives and .deb packages.

## DESCRIPTION
    This module provides useful classes and functions to work with
    archives, modelled after the 'TarFile' class in the 'tarfile' module.

## CLASSES
    builtins.object
        ArArchive
            DebFile
        ArMember
        TarFile
        TarMember

### class ArArchive
     |  ArArchive(file: str/int/file)
     |
     |  Represent an archive in the 4.4 BSD ar format,
     |  which is used for e.g. deb packages.
     |
     |  The parameter 'file' may be a string specifying the path of a file, or
     |  a file-like object providing the fileno() method. It may also be an int
     |  specifying a file descriptor (returned by e.g. os.open()).
     |  The recommended way of using it is to pass in the path to the file.
     |
     |  Methods defined here:
     |
     |  __contains__(self, key, /)
     |      Return key in self.
     |
     |  __getitem__(self, key, /)
     |      Return self[key].
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  extract(...)
     |      extract(name: str[, target: str]) -> bool
     |
     |      Extract the member given by 'name' into the directory given
     |      by 'target'. If the extraction fails, raise OSError. In case
     |      of success, return True if the file owner could be set or
     |      False if this was not possible. If the requested member
     |      does not exist, raise LookupError.
     |
     |  extractall(...)
     |      extractall([target: str]) -> bool
     |
     |      Extract all archive contents into the directory given by 'target'. If
     |      the extraction fails, raise an error. Otherwise, return True if the
     |      owner could be set or False if the owner could not be changed.
     |
     |  extractdata(...)
     |      extractdata(name: str) -> bytes
     |
     |      Return the contents of the member, as a bytes object. Raise
     |      LookupError if there is no ArMember with the given name.
     |
     |  getmember(...)
     |      getmember(name: str) -> ArMember
     |
     |      Return an ArMember object for the member given by 'name'. Raise
     |      LookupError if there is no ArMember with the given name.
     |
     |  getmembers(...)
     |      getmembers() -> list
     |
     |      Return a list of all members in the archive.
     |
     |  getnames(...)
     |      getnames() -> list
     |
     |      Return a list of the names of all members in the archive.
     |
     |  gettar(...)
     |      gettar(name: str, comp: str) -> TarFile
     |
     |      Return a TarFile object for the member given by 'name' which will be
     |      decompressed using the compression algorithm given by 'comp'.
     |      This is almost equal to:
     |
     |         member = [arfile.getmember(name)](https://www.chedong.com/phpMan.php/man/arfile.getmember/name/markdown)
     |         tarfile = TarFile(file, member.start, member.size, 'gzip')'
     |
     |      It just opens a new TarFile on the given position in the stream.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.

### class ArMember
     |  Represent a single file within an AR archive. For
     |  Debian packages this can be e.g. control.tar.gz. This class provides
     |  information about this file, such as the mode and size.
     |
     |  Methods defined here:
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  gid
     |      The group id of the owner.
     |
     |  mode
     |      The mode of the file.
     |
     |  mtime
     |      Last time of modification.
     |
     |  name
     |      The name of the file.
     |
     |  size
     |      The size of the files.
     |
     |  start
     |      The offset in the archive where the file starts.
     |
     |  uid
     |      The user ID of the owner.

### class DebFile
     |  DebFile(file: str/int/file)
     |
     |  A DebFile object represents a file in the .deb package format.
     |
     |  The parameter 'file' may be a string specifying the path of a file, or
     |  a file-like object providing the fileno() method. It may also be an int
     |  specifying a file descriptor (returned by e.g. os.open()).
     |  The recommended way of using it is to pass in the path to the file.
     |
     |  It differs from ArArchive by providing the members 'control', 'data'
     |  and 'version' for accessing the control.tar.gz, data.tar.$compression
     |  (all apt compression methods are supported), and debian-binary members
     |  in the archive.
     |
     |  Method resolution order:
     |      DebFile
     |      ArArchive
     |      builtins.object
     |
     |  Static methods defined here:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  control
     |      The TarFile object associated with the control.tar.gz member.
     |
     |  data
     |      The TarFile object associated with the data.tar.$compression member. All apt compression methods are supported.
     |
     |  debian_binary
     |      The package version, as contained in debian-binary.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from ArArchive:
     |
     |  __contains__(self, key, /)
     |      Return key in self.
     |
     |  __getitem__(self, key, /)
     |      Return self[key].
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  extract(...)
     |      extract(name: str[, target: str]) -> bool
     |
     |      Extract the member given by 'name' into the directory given
     |      by 'target'. If the extraction fails, raise OSError. In case
     |      of success, return True if the file owner could be set or
     |      False if this was not possible. If the requested member
     |      does not exist, raise LookupError.
     |
     |  extractall(...)
     |      extractall([target: str]) -> bool
     |
     |      Extract all archive contents into the directory given by 'target'. If
     |      the extraction fails, raise an error. Otherwise, return True if the
     |      owner could be set or False if the owner could not be changed.
     |
     |  extractdata(...)
     |      extractdata(name: str) -> bytes
     |
     |      Return the contents of the member, as a bytes object. Raise
     |      LookupError if there is no ArMember with the given name.
     |
     |  getmember(...)
     |      getmember(name: str) -> ArMember
     |
     |      Return an ArMember object for the member given by 'name'. Raise
     |      LookupError if there is no ArMember with the given name.
     |
     |  getmembers(...)
     |      getmembers() -> list
     |
     |      Return a list of all members in the archive.
     |
     |  getnames(...)
     |      getnames() -> list
     |
     |      Return a list of the names of all members in the archive.
     |
     |  gettar(...)
     |      gettar(name: str, comp: str) -> TarFile
     |
     |      Return a TarFile object for the member given by 'name' which will be
     |      decompressed using the compression algorithm given by 'comp'.
     |      This is almost equal to:
     |
     |         member = [arfile.getmember(name)](https://www.chedong.com/phpMan.php/man/arfile.getmember/name/markdown)
     |         tarfile = TarFile(file, member.start, member.size, 'gzip')'
     |
     |      It just opens a new TarFile on the given position in the stream.

### class TarFile
     |  TarFile(file: str/int/file[, min: int, max: int, comp: str])
     |
     |  The parameter 'file' may be a string specifying the path of a file, or
     |  a file-like object providing the fileno() method. It may also be an int
     |  specifying a file descriptor (returned by e.g. os.open()).
     |
     |  The parameter 'min' describes the offset in the file where the archive
     |  begins and the parameter 'max' is the size of the archive.
     |
     |  The compression of the archive is set by the parameter 'comp'. It can
     |  be set to any program supporting the -d switch, the default being gzip.
     |
     |  Methods defined here:
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  extractall(...)
     |      extractall([rootdir: str]) -> True
     |
     |      Extract the archive in the current directory. The argument 'rootdir'
     |      can be used to change the target directory.
     |
     |  extractdata(...)
     |      extractdata(member: str) -> bytes
     |
     |      Return the contents of the member, as a bytes object. Raise
     |      LookupError if there is no member with the given name.
     |
     |  go(...)
     |      go(callback: callable[, member: str]) -> True
     |
     |      Go through the archive and call the callable 'callback' for each
     |      member with 2 arguments. The first argument is the TarMember and
     |      the second one is the data, as bytes.
     |
     |      The optional parameter 'member' can be used to specify the member for
     |      which to call the callback. If not specified, it will be called for all
     |      members. If specified and not found, LookupError will be raised.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.

### class TarMember
     |  Represent a single member of a 'tar' archive.
     |
     |  This class, which has been modelled after 'tarfile.TarInfo', represents
     |  information about a given member in an archive.
     |
     |  Methods defined here:
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  isblk(...)
     |      Determine whether the member is a block device.
     |
     |  ischr(...)
     |      Determine whether the member is a character device.
     |
     |  isdev(...)
     |      Determine whether the member is a device (block, character or FIFO).
     |
     |  isdir(...)
     |      Determine whether the member is a directory.
     |
     |  isfifo(...)
     |      Determine whether the member is a FIFO.
     |
     |  isfile(...)
     |      Determine whether the member is a regular file.
     |
     |  islnk(...)
     |      Determine whether the member is a hardlink.
     |
     |  isreg(...)
     |      Determine whether the member is a regular file, same as isfile().
     |
     |  issym(...)
     |      Determine whether the member is a symbolic link.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  gid
     |      The owner's group ID.
     |
     |  linkname
     |      The target of the link.
     |
     |  major
     |      The major ID of the device.
     |
     |  minor
     |      The minor ID of the device.
     |
     |  mode
     |      The mode (permissions).
     |
     |  mtime
     |      Last time of modification.
     |
     |  name
     |      The name of the file.
     |
     |  size
     |      The size of the file.
     |
     |  uid
     |      The owner's user ID.

## FILE
    /usr/lib/python3/dist-packages/apt_inst.cpython-310-x86_64-linux-gnu.so


