AutoArchive — AutoArchive Developer Manual (ver. 1.0.4)

# AutoArchive

A simple backup utility.

This package does not provide any public library (API) intended to be imported by 3rd-party programs. All its content and content of its subpackages is the implementation of AutoArchive utility.

## Sub-Packages

- AutoArchive._mainf
- AutoArchive._archiving
- AutoArchive._configuration
- AutoArchive._ui
- AutoArchive._services

## Modules

### starter

Initializes Mainf framework and passes the control to it.

class `AutoArchive.starter.` `Starter`

  Bases: `object`

  Fires up the show.

  classmethod `start`()

    Initializes Mainf and starts the program.

`AutoArchive.starter.` `_COMPONENTS` = (<class 'AutoArchive._configuration._core.configuration_component.ConfigurationComponent'>, <class 'AutoArchive._archiving._core.archiving_component.ArchivingComponent'>, <class 'AutoArchive._ui._cmdline._core.cmdline_ui_component.CmdlineUiComponent'>)

  Tuple of component classes (which has to derive from `IComponent`) in dependency order

### _app_environment

`_AppEnvironment` class

class `AutoArchive._app_environment.` `_AppEnvironment`(executableName, options, arguments)

  Bases: `object`

  Container class for various application-related information.

  Parameters: | executableName (`str`) – Name of the startup script. options (`optparse.Values`) – Options passed on the command line. arguments (`list<str>`) – Arguments passed on the command line.

  `arguments`

    Command line arguments.

    Return type: | `list<str>`

  `executableName`

    Name of the script that was used to start this application.

    Return type: | `str`

  `options`

    Command line options.

    Return type: | `optparse.Values`

### _meta

`_Meta` class.

class `AutoArchive._meta.` `_Meta`

  Bases: `object`

  Defines various project metadata like version, license etc.

  `COPYRIGHT` = 'Copyright (C) 2003 - 2017 Robert Cernansky'
  `DESCRIPTION` = 'A simple backup utility.'
  `LICENSE` = 'This program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License version 3 as published by the Free\nSoftware Foundation.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\nA PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with\nthis program. If not, see <http://www.gnu.org/licenses/>.'
  `PACKAGE_NAME` = 'autoarchive'
  `VERSION` = '1.0.4'

### _py_additions

Various enhancements to Python.

class `AutoArchive._py_additions.` `Enum`(*names)

  Bases: `collections.abc.Iterable`

  Simple enum class.

  Example Usage:

      codes = Enum("FOO", "BAR", "BAZ") # codes.BAZ will be 2 and so on and str.BAZ will be "BAZ"

  Parameters: | names (`Iterator<str>`) – Iterable of Enum members.

class `AutoArchive._py_additions.` `event`(eventFunction)

  Bases: `object`

  Decorator that declares a function as an event.

  Implements a C#-like events (a call dispatchers). Decorating a function or method with this decorator declares it as an event. In order to subscribe a handler function to the event, one should use the “+=” operator and to unsubscribe the “-=” operator. Such event can be fired by a calling the decorated function. This will dispatch the event to all subscribers, i.e. subscribed handler methods are called.

  Note

  Decorated function should implement only `pass` as its body.

  Note

  Decorated function can take any number of parameters or keyword parameters. Subscriber functions has to take same parameters as the event.

  Example usage:

      class Button:
         # ...
         @event
         def clicked(self, some_parameter):
             "Fired when the button was clicked."
             pass
         def _fireClicked(self, some_parameter):
             clicked(some_parameter)
         # ...

      class Ui:
          def __init__(self, button):
              button.clicked += self._onButtonClicked
          def _onButtonClicked(self, some_parameter):
              "Handle the button click."
              # play a sound...

  Parameters: | eventFunction (`function`) – Decorated function or method that becomes an event.

class `AutoArchive._py_additions.` `classproperty`

  Bases: `property`

  Decorator that makes the decorated method a class property.

class `AutoArchive._py_additions.` `staticproperty`

  Bases: `property`

  Decorator that makes the decorated method a static property.

### _utils

`_Utils` and `_Constants` classes.

class `AutoArchive._utils.` `_Utils`

  Bases: `object`

  Various utility methods.

  classmethod `fatalExit`(msg, appName=None)

    Prints `msg` to standard error and exits with exit code 2.

  classmethod `printError`(msg, appName=None)

    Prints `msg` as an error to standard error.

  classmethod `printWarning`(msg, appName=None)

    Prints `msg` as a warning to standard error.

  static `uniq`(decorated)

    Decorator that filters out duplicate elements from an iterable returned by decorated function.

class `AutoArchive._utils.` `_Constants`

  Bases: `object`

  Defines various “global” constants.

  `DEBUG` = None

    Debugging support.