conf: Complete ordering functions for ConfigOption class
This commit is contained in:
parent
1147973661
commit
48017a2740
|
@ -68,8 +68,9 @@ import sys
|
||||||
import re
|
import re
|
||||||
from textwrap import TextWrapper
|
from textwrap import TextWrapper
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from functools import cmp_to_key
|
from functools import cmp_to_key, total_ordering
|
||||||
|
|
||||||
|
@total_ordering
|
||||||
class ConfigOption:
|
class ConfigOption:
|
||||||
"""Representing a configuration option or described section in strongswan.conf"""
|
"""Representing a configuration option or described section in strongswan.conf"""
|
||||||
def __init__(self, path, default = None, section = False, commented = False, include = False):
|
def __init__(self, path, default = None, section = False, commented = False, include = False):
|
||||||
|
@ -83,6 +84,9 @@ class ConfigOption:
|
||||||
self.desc = []
|
self.desc = []
|
||||||
self.options = []
|
self.options = []
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.name == other.name
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return self.name < other.name
|
return self.name < other.name
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue