diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-07-13 12:50:43 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-07-13 12:50:43 -0400 |
commit | c83c4e3820fbb716c5e7dd7560a148052a8eaa0a (patch) | |
tree | e6fcaed4ccad3803c90337bef63cefc0b363f0b7 /cobbler/yaml | |
parent | bea30de4beb585b5c79d10c6164e65713f1611bc (diff) | |
download | third_party-cobbler-c83c4e3820fbb716c5e7dd7560a148052a8eaa0a.tar.gz third_party-cobbler-c83c4e3820fbb716c5e7dd7560a148052a8eaa0a.tar.xz third_party-cobbler-c83c4e3820fbb716c5e7dd7560a148052a8eaa0a.zip |
action_sync now outputs kickstart_sys files in PXE-encoded format for consistancy
Fixed setup.py version
trailing spaces
Diffstat (limited to 'cobbler/yaml')
-rw-r--r-- | cobbler/yaml/ordered_dict.py | 32 | ||||
-rw-r--r-- | cobbler/yaml/redump.py | 2 | ||||
-rw-r--r-- | cobbler/yaml/timestamp.py | 16 |
3 files changed, 25 insertions, 25 deletions
diff --git a/cobbler/yaml/ordered_dict.py b/cobbler/yaml/ordered_dict.py index 32dc9b4..b3788b7 100644 --- a/cobbler/yaml/ordered_dict.py +++ b/cobbler/yaml/ordered_dict.py @@ -1,29 +1,29 @@ # This is extremely crude implementation of an OrderedDict. # If you know of a better implementation, please send it to -# the author Steve Howell. You can find my email via +# the author Steve Howell. You can find my email via # the YAML mailing list or wiki. -class OrderedDict(dict): - def __init__(self): - self._keys = [] - - def __setitem__(self, key, val): - self._keys.append(key) - dict.__setitem__(self, key, val) - - def keys(self): - return self._keys - +class OrderedDict(dict): + def __init__(self): + self._keys = [] + + def __setitem__(self, key, val): + self._keys.append(key) + dict.__setitem__(self, key, val) + + def keys(self): + return self._keys + def items(self): return [(key, self[key]) for key in self._keys] - -if __name__ == '__main__': + +if __name__ == '__main__': data = OrderedDict() data['z'] = 26 data['m'] = 13 data['a'] = 1 - for key in data.keys(): - print "The value for %s is %s" % (key, data[key]) + for key in data.keys(): + print "The value for %s is %s" % (key, data[key]) print data diff --git a/cobbler/yaml/redump.py b/cobbler/yaml/redump.py index dab8b7f..418e5d3 100644 --- a/cobbler/yaml/redump.py +++ b/cobbler/yaml/redump.py @@ -11,4 +11,4 @@ def redump(stream): dumper = Dumper() dumper.alphaSort = 0 return dumper.dump(*docs) - + diff --git a/cobbler/yaml/timestamp.py b/cobbler/yaml/timestamp.py index e8e5c72..abcb2e6 100644 --- a/cobbler/yaml/timestamp.py +++ b/cobbler/yaml/timestamp.py @@ -7,7 +7,7 @@ PRIVATE_NOTICE = """ objects and methods exported to the top level yaml package. """ -# +# # Time specific operations # @@ -77,13 +77,13 @@ class _timestamp: def strftime(self,format): return time.strftime(format,self.__tval) def mktime(self): return time.mktime(self.__tval) def asctime(self): return time.asctime(self.__tval) - def isotime(self): + def isotime(self): return "%04d-%02d-%02dT%02d:%02d:%02d.00Z" % self.__tval[:6] - def __repr__(self): return "yaml.timestamp('%s')" % self.isotime() + def __repr__(self): return "yaml.timestamp('%s')" % self.isotime() def __str__(self): return self.isotime() def to_yaml_implicit(self): return self.isotime() - def __hash__(self): return hash(self.__tval[:6]) - def __cmp__(self,other): + def __hash__(self): return hash(self.__tval[:6]) + def __cmp__(self,other): try: return cmp(self.__tval[:6],other.__tval[:6]) except AttributeError: @@ -99,18 +99,18 @@ try: # inherit from mx.DateTime functionality if available return getattr(self.__mxdt, name) except: class timestamp(_timestamp): pass - + def unquote(expr): """ summary: > Simply returns the unquoted string, and the - length of the quoted string token at the + length of the quoted string token at the beginning of the expression. """ tok = expr[0] - if "'" == tok: + if "'" == tok: idx = 1 odd = 0 ret = "" |