# Path: lanshark/configuration.py
# class Boolean(Key):
#     """Represents a bool"""
#     keytype = bool
#     def parse(self, value):
#         return (value.lower() != "false")
# 
# class Integer(Key):
#     """Represents a int"""
#     keytype = int
# 
# class String(Key):
#     """Represents a str"""
#     keytype = str
# 
# class StringList(List, String):
#     "list of strings"
#     pass
# 
# class Enum(String):
#     """Represents an enum"""
#     def __init__(self, default, values, doc):
#         """Creates new instance. `values` is a tuple of all valid enum
#         values"""
#         String.__init__(self, default, doc)
#         self.values = values
# 
#     def parse(self, value):
#         retval = String.parse(self, value)
#         if retval not in self.values:
#             raise ValueError('Invalid enum value %s' % retval)
#         return retval
# 
# Path: lanshark/configuration.py
# class Error(Exception):
# class Config(observable.Observable):
# class Key:
# class String(Key):
# class Integer(Key):
# class Float(float):
# class Boolean(Key):
# class Enum(String):
# class List:
# class StringList(List, String):
# class JSON(Key):
#     class TestConfig(Config):
#     def __init__(self, lineno, line, cause):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self):
#     def __setattr__(self, attr, value):
#     def load(self, f):
#     def _load(self, f):
#     def save(self, f):
#     def _save(self, f):
#     def __init__(self, default, doc):
#     def parse(self, value):
#     def dump(self, value):
#     def __repr__(self):
#     def parse(self, value):
#     def __init__(self, default, values, doc):
#     def parse(self, value):
#     def parse(self, value):
#         def parse(value):
#     def dump(self, value):
#         def dump(value):
#     def parse(self, value):
#     def dump(self, value):
# def test():


import os, sys
import socket
import locale
        import _winreg
                import psyco
import logging
from lanshark.configuration import Boolean, Integer, String, StringList, Enum
from lanshark import configuration
        if os.path.exists(path):
            self.load(path)
            if self.VERSION < self.__class__.VERSION.default:
                self.VERSION = self.__class__.VERSION.default
                self.save(path)
        else:
            self.save(path)
        self.set_prefix(os.path.abspath(os.path.join(os.path.dirname(__file__),
                os.pardir, os.pardir)))
        self.path = path
        socket.setdefaulttimeout(self.SOCKET_TIMEOUT/1000.0)
        if self.PSYCO:
            try:
                psyco.profile()
                print "Psyco JIT optimization active"
            except ImportError:
                print "Psyco enabled but not installed"
        sys.path.append(os.path.dirname(__file__))

    @property
    def debug(self):
        return self.LOG_LEVEL == 'DEBUG'

    def set_prefix(self, value):
        """Set the prexif for example /usr"""
        self.PREFIX = value
        self.DATA_PATH = os.path.join(self.PREFIX, "share", "lanshark")
        self.LOCALE_PATH = os.path.join(self.PREFIX, "share", "locale")

    def save(self, path=None):

# Path: lanshark/configuration.py
# class Boolean(Key):
#     """Represents a bool"""
#     keytype = bool
#     def parse(self, value):
#         return (value.lower() != "false")
# 
# class Integer(Key):
#     """Represents a int"""
#     keytype = int
# 
# class String(Key):
#     """Represents a str"""
#     keytype = str
# 
# class StringList(List, String):
#     "list of strings"
#     pass
# 
# class Enum(String):
#     """Represents an enum"""
#     def __init__(self, default, values, doc):
#         """Creates new instance. `values` is a tuple of all valid enum
#         values"""
#         String.__init__(self, default, doc)
#         self.values = values
# 
#     def parse(self, value):
#         retval = String.parse(self, value)
#         if retval not in self.values:
#             raise ValueError('Invalid enum value %s' % retval)
#         return retval
# 
# Path: lanshark/configuration.py
# class Error(Exception):
# class Config(observable.Observable):
# class Key:
# class String(Key):
# class Integer(Key):
# class Float(float):
# class Boolean(Key):
# class Enum(String):
# class List:
# class StringList(List, String):
# class JSON(Key):
#     class TestConfig(Config):
#     def __init__(self, lineno, line, cause):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self):
#     def __setattr__(self, attr, value):
#     def load(self, f):
#     def _load(self, f):
#     def save(self, f):
#     def _save(self, f):
#     def __init__(self, default, doc):
#     def parse(self, value):
#     def dump(self, value):
#     def __repr__(self):
#     def parse(self, value):
#     def __init__(self, default, values, doc):
#     def parse(self, value):
#     def parse(self, value):
#         def parse(value):
#     def dump(self, value):
#         def dump(value):
#     def parse(self, value):
#     def dump(self, value):
# def test():


# Path: lanshark/config.py
import os, sys
import socket
import locale
        import _winreg
                import psyco
import logging
from lanshark.configuration import Boolean, Integer, String, StringList, Enum
from lanshark import configuration

        if os.path.exists(path):
            self.load(path)
            if self.VERSION < self.__class__.VERSION.default:
                self.VERSION = self.__class__.VERSION.default
                self.save(path)
        else:
            self.save(path)
        self.set_prefix(os.path.abspath(os.path.join(os.path.dirname(__file__),
                os.pardir, os.pardir)))
        self.path = path
        socket.setdefaulttimeout(self.SOCKET_TIMEOUT/1000.0)
        if self.PSYCO:
            try:
                psyco.profile()
                print "Psyco JIT optimization active"
            except ImportError:
                print "Psyco enabled but not installed"
        sys.path.append(os.path.dirname(__file__))

    @property
    def debug(self):
        return self.LOG_LEVEL == 'DEBUG'

    def set_prefix(self, value):
        """Set the prexif for example /usr"""
        self.PREFIX = value
        self.DATA_PATH = os.path.join(self.PREFIX, "share", "lanshark")
        self.LOCALE_PATH = os.path.join(self.PREFIX, "share", "locale")

    def save(self, path=None):

        configuration.Config.save(self, path or self.path)