diff options
author | Steve 'Ashcrow' Milner <stevem@gnulinux.net> | 2008-01-13 14:35:45 -0500 |
---|---|---|
committer | Steve 'Ashcrow' Milner <stevem@gnulinux.net> | 2008-01-13 14:35:45 -0500 |
commit | b77fbdd90f46b3d1602aa43e99abec096d93888e (patch) | |
tree | 9d8ac00601e056ac79f5679b88cc19bb65293190 /func/config.py | |
parent | 63170952d465a8acf8355e7b346733e4f6ddcace (diff) | |
download | func-b77fbdd90f46b3d1602aa43e99abec096d93888e.tar.gz func-b77fbdd90f46b3d1602aa43e99abec096d93888e.tar.xz func-b77fbdd90f46b3d1602aa43e99abec096d93888e.zip |
removed a lot of misplaced shebangs.
Diffstat (limited to 'func/config.py')
-rw-r--r-- | func/config.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/func/config.py b/func/config.py index 6dbdc61..8202457 100644 --- a/func/config.py +++ b/func/config.py @@ -1,5 +1,3 @@ -#!/usr/bin/python -t - # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -34,7 +32,8 @@ class ConfigError(exceptions.Exception): self.value = value def __str__(self): return "%s" %(self.value,) - + + class Option(object): ''' This class handles a single Yum configuration file option. Create @@ -123,6 +122,7 @@ class Option(object): ''' return str(value) + def Inherit(option_obj): '''Clone an Option instance for the purposes of inheritance. The returned instance has all the same properties as the input Option and shares items @@ -136,6 +136,7 @@ def Inherit(option_obj): new_option.inherit = True return new_option + class ListOption(Option): def __init__(self, default=None): @@ -157,6 +158,7 @@ class ListOption(Option): def tostring(self, value): return '\n '.join(value) + class UrlOption(Option): ''' This option handles lists of URLs with validation of the URL scheme. @@ -195,6 +197,7 @@ class UrlOption(Option): else: return '%s or %s' % (', '.join(self.schemes[:-1]), self.schemes[-1]) + class UrlListOption(ListOption): ''' Option for handling lists of URLs with validation of the URL scheme. @@ -220,6 +223,7 @@ class IntOption(Option): except (ValueError, TypeError), e: raise ValueError('invalid integer value') + class BoolOption(Option): def parse(self, s): s = s.lower() @@ -236,6 +240,7 @@ class BoolOption(Option): else: return "0" + class FloatOption(Option): def parse(self, s): try: @@ -243,6 +248,7 @@ class FloatOption(Option): except (ValueError, TypeError): raise ValueError('invalid float value') + class SelectionOption(Option): '''Handles string values where only specific values are allowed ''' @@ -303,6 +309,7 @@ class BytesOption(Option): return int(n * mult) + class ThrottleOption(BytesOption): def parse(self, s): @@ -457,6 +464,7 @@ class BaseConfig(object): else: raise ConfigError, 'No such option %s' % option + def read_config(config_file, BaseConfigDerived): confparser = ConfigParser() opts = BaseConfigDerived() |