base.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:solaris-ips 作者: oracle 项目源码 文件源码
def __init__(self, config):

                self.classification_data = None

                self.classification_path = config.get(
                    "pkglint", "info_classification_path")
                self.skip_classification_check = False

                # a default error message used if we've parsed the
                # data file, but haven't thrown any exceptions
                self.bad_classification_data = _("no sections found in data "
                    "file {0}").format(self.classification_path)

                if os.path.exists(self.classification_path):
                        try:
                                if six.PY2:
                                        self.classification_data = \
                                            configparser.SafeConfigParser()
                                        self.classification_data.readfp(
                                            open(self.classification_path))
                                else:
                                        # SafeConfigParser has been renamed to
                                        # ConfigParser in Python 3.2.
                                        self.classification_data = \
                                            configparser.ConfigParser()
                                        self.classification_data.read_file(
                                            open(self.classification_path))
                        except Exception as err:
                                # any exception thrown here results in a null
                                # classification_data object.  We deal with that
                                # later.
                                self.bad_classification_data = _(
                                    "unable to parse data file {path}: "
                                    "{err}").format(
                                    path=self.classification_path,
                                    err=err)
                                pass
                else:
                        self.bad_classification_data = _("missing file {0}").format(
                            self.classification_path)
                super(ManifestChecker, self).__init__(config)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号