--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2017 by Frank Brehm, Berlin
+@summary: The module for the application object.
+"""
+from __future__ import absolute_import
+
+# Standard modules
+import sys
+import os
+import logging
+import re
+import traceback
+import textwrap
+import datetime
+
+# Third party modules
+import six
+
+import argparse
+
+# Own modules
+try:
+ from .global_version import __version__ as __global_version__
+except (SystemError, ImportError):
+ from global_version import __version__ as __global_version__
+
+try:
+ from .errors import FunctionNotImplementedError, PpAppError
+except (SystemError, ImportError):
+ from errors import FunctionNotImplementedError, PpAppError
+
+try:
+ from .common import pp, terminal_can_colors
+except (SystemError, ImportError):
+ from common import pp, terminal_can_colors
+
+try:
+ from .colored import ColoredFormatter, colorstr
+except (SystemError, ImportError):
+ from colored import ColoredFormatter, colorstr
+
+try:
+ from .obj import PpBaseObjectError, PpBaseObject
+except (SystemError, ImportError):
+ from obj import PpBaseObjectError, PpBaseObject
+
+__version__ = '0.1.0'
+LOG = logging.getLogger(__name__)
+
+
+# =============================================================================
+class PpApplication(PpBaseObject):
+ """
+ Class for the application objects.
+ """
+
+ pass
+
+# =============================================================================
+
+if __name__ == "__main__":
+
+ pass
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list
import errno
-__version__ = '0.2.2'
+__version__ = '0.3.1'
# =============================================================================
class PpError(Exception):
return msg
+# =============================================================================
+class FunctionNotImplementedError(PpError, NotImplementedError):
+ """
+ Error class for not implemented functions.
+ """
+
+ # -------------------------------------------------------------------------
+ def __init__(self, function_name, class_name):
+ """
+ Constructor.
+
+ @param function_name: the name of the not implemented function
+ @type function_name: str
+ @param class_name: the name of the class of the function
+ @type class_name: str
+
+ """
+
+ self.function_name = function_name
+ if not function_name:
+ self.function_name = '__unkown_function__'
+
+ self.class_name = class_name
+ if not class_name:
+ self.class_name = '__unkown_class__'
+
+ # -------------------------------------------------------------------------
+ def __str__(self):
+ """
+ Typecasting into a string for error output.
+ """
+
+ msg = "Function {func}() has to be overridden in class {cls!r}."
+ return msg.format(func=self.function_name, cls=self.class_name)
+
+
# =============================================================================
if __name__ == "__main__":
--- /dev/null
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2017 by Frank Brehm, Berlin
+@summary: Modules global version number
+"""
+
+__author__ = 'Frank Brehm <frank.brehm@pixelpark.com>'
+__contact__ = 'frank.brehm@pixelpark.com'
+__version__ = '0.1.1'
+__license__ = 'LGPL3+'
+
+# vim: fileencoding=utf-8 filetype=python ts=4
if v >= 0:
self._verbose = v
else:
- log.warn(_("Wrong verbose level %r, must be >= 0"), value)
+ LOG.warn(_("Wrong verbose level %r, must be >= 0"), value)
# -----------------------------------------------------------
@property
value = os.path.expanduser(value)
if not os.path.exists(value):
msg = _("Base directory %r does not exists.") % (value)
- log.error(msg)
+ LOG.error(msg)
elif not os.path.isdir(value):
msg = _("Base directory %r is not a directory.") % (value)
- log.error(msg)
+ LOG.error(msg)
else:
self._base_dir = value
has_handlers = True
if has_handlers:
- log.error(msg)
+ LOG.error(msg)
if do_traceback:
- log.error(traceback.format_exc())
+ LOG.error(traceback.format_exc())
if not has_handlers:
curdate = datetime.datetime.now()
has_handlers = True
if has_handlers:
- log.info(msg)
+ LOG.info(msg)
if not has_handlers:
curdate = datetime.datetime.now()