
This will likely also be very useful to use since it ensures we safely use/parse yaml. Change-Id: Ibc0f7dee46d2f199e2d65d9bc6444bfa72383704
25 lines
649 B
Python
25 lines
649 B
Python
# Copyright 2015 Canonical Ltd.
|
|
# This file is part of cloud-init. See LICENCE file for license information.
|
|
#
|
|
# vi: ts=4 expandtab
|
|
|
|
from cloudinit import logging
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
def load_file(path, encoding='utf8'):
|
|
LOG.blather("Loading file from path '%s' (%s)", path, encoding)
|
|
with open(path, 'rb') as fh:
|
|
return fh.read().decode(encoding)
|
|
|
|
|
|
class abstractclassmethod(classmethod):
|
|
"""A backport for abc.abstractclassmethod from Python 3."""
|
|
|
|
__isabstractmethod__ = True
|
|
|
|
def __init__(self, func):
|
|
func.__isabstractmethod__ = True
|
|
super(abstractclassmethod, self).__init__(func)
|