# 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

def get_openfile():
    if sys.platform == "darwin":
        return "open"
    else:
        return select_app("xdg-open", "exo-open", "gnome-open") or ""

def get_sys_encoding():
    if sys.platform.startswith("win"):
        return "utf-8"
    return locale.getpreferredencoding()

class Config(configuration.Config):
    LOG_LEVEL = Enum('CRITICAL',
                     ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'),
                     'Sets the verbosity of logging output')
    LOG_TARGET = String('-',
                        'Target of logging output. Set to - to log stderr')
    LOG_FORMAT = String('%(levelname)s:%(name)s:%(message)s',
                        'Format of logging output. '
                        'See http://docs.python.org/lib/node422.html '
                        'for format description')
    BROADCAST_IP = String("255.255.255.255",
            "IP to use for udp broadcasts")
    PORT = Integer(31337, "Port to use for both UDP and TCP")
    CLIENT_PORT = Integer(31338, "Port for the clients udp sockets")
    SEARCH_TIMEOUT = Integer(5,
            "Time to wait for search results in seconds")
    DISCOVER_TIMEOUT = Integer(5,
            "Time to wait for new hosts to answer in seconds")

# 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


def get_openfile():
    if sys.platform == "darwin":
        return "open"
    else:
        return select_app("xdg-open", "exo-open", "gnome-open") or ""

def get_sys_encoding():
    if sys.platform.startswith("win"):
        return "utf-8"
    return locale.getpreferredencoding()

class Config(configuration.Config):
    LOG_LEVEL = Enum('CRITICAL',
                     ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'),
                     'Sets the verbosity of logging output')
    LOG_TARGET = String('-',
                        'Target of logging output. Set to - to log stderr')
    LOG_FORMAT = String('%(levelname)s:%(name)s:%(message)s',
                        'Format of logging output. '
                        'See http://docs.python.org/lib/node422.html '
                        'for format description')
    BROADCAST_IP = String("255.255.255.255",
            "IP to use for udp broadcasts")
    PORT = Integer(31337, "Port to use for both UDP and TCP")
    CLIENT_PORT = Integer(31338, "Port for the clients udp sockets")
    SEARCH_TIMEOUT = Integer(5,
            "Time to wait for search results in seconds")
    DISCOVER_TIMEOUT = Integer(5,
            "Time to wait for new hosts to answer in seconds")

    DISCOVER_INTERVAL = Integer(60,