コード例 #1
0
ファイル: __init__.py プロジェクト: FlickDUB/pyenchant
    def __init__(self, tag, pwl=None, pel=None, broker=None):
        """DictWithPWL constructor.

        The argument 'pwl', if not None, names a file containing the
        personal word list.  If this file does not exist, it is created
        with default permissions.

        The argument 'pel', if not None, names a file containing the personal
        exclude list.  If this file does not exist, it is created with
        default permissions.
        """
        super().__init__(tag, broker)
        if pwl is not None:
            if not os.path.exists(pwl):
                f = open(pwl, "wt")
                f.close()
                del f
            self.pwl = self._broker.request_pwl_dict(pwl)
        else:
            self.pwl = PyPWL()
        if pel is not None:
            if not os.path.exists(pel):
                f = open(pel, "wt")
                f.close()
                del f
            self.pel = self._broker.request_pwl_dict(pel)
        else:
            self.pel = PyPWL()