Пример #1
0
 def filter(self, translationstore, checkerconfig=None,
            cmdlineoptions=None):
     """Helper that passes a translations store through a filter, and
     returns the resulting store."""
     if cmdlineoptions is None:
         cmdlineoptions = []
     options, args = pofilter.cmdlineparser().parse_args([self.filename] +
                                                         cmdlineoptions)
     checkerclasses = [checks.StandardChecker, checks.StandardUnitChecker]
     if checkerconfig is None:
         checkerconfig = pofilter.build_checkerconfig(options)
     checkfilter = pofilter.pocheckfilter(options, checkerclasses,
                                          checkerconfig)
     tofile = checkfilter.filterfile(translationstore)
     return tofile
Пример #2
0
 def filter(self, translationstore, checkerconfig=None,
            cmdlineoptions=None):
     """Helper that passes a translations store through a filter, and
     returns the resulting store."""
     if cmdlineoptions is None:
         cmdlineoptions = []
     options, args = pofilter.cmdlineparser().parse_args([self.filename] +
                                                         cmdlineoptions)
     checkerclasses = [checks.StandardChecker, checks.StandardUnitChecker]
     if checkerconfig is None:
         checkerconfig = pofilter.build_checkerconfig(options)
     checkfilter = pofilter.pocheckfilter(options, checkerclasses,
                                          checkerconfig)
     tofile = checkfilter.filterfile(translationstore)
     return tofile
Пример #3
0
    def check_po_syntax_error(self, fname):
        """Check po lint in fname.
        :param fname: String with full path of file to check
        :return: Return list of errors.
        """
        newargv = ['pofilter', fname]

        with custom_sys_argv(newargv):
            parser = cmdlineparser()
            options = parser.parse_args()[0]

        with open(options.input, 'r') as pofile:
            fromfile = factory.getobject(pofile)

        polinter = PoLinter(options=options,
                            checkerconfig=build_checkerconfig(options))
        return list(polinter.get_syntax_error(fromfile))
Пример #4
0
    def check_po_syntax_error(self, fname):
        """Check po lint in fname.
        :param fname: String with full path of file to check
        :return: Return list of errors.
        """
        newargv = ['pofilter', fname]

        with custom_sys_argv(newargv):
            parser = cmdlineparser()
            options = parser.parse_args()[0]

        with open(options.input, 'r') as pofile:
            fromfile = factory.getobject(pofile)

        polinter = PoLinter(options=options,
                            checkerconfig=build_checkerconfig(options))
        return list(polinter.get_syntax_error(fromfile))
Пример #5
0
    def check_po_lint(self, fname, enabled, disabled):
        """Check po lint in fname.
        :param fname: String with full path of file to check
        :return: Return list of errors.
        """
        newargv = ['pofilter', fname]

        if enabled:
            newargv.extend(['--test=%s' % f for f in enabled])

        if disabled:
            newargv.extend(['--excludefilter=%s' % f for f in disabled])

        with custom_sys_argv(newargv):
            parser = cmdlineparser()
            options = parser.parse_args()[0]

        with open(options.input, 'r') as pofile:
            fromfile = factory.getobject(pofile)

        polinter = PoLinter(options=options,
                            checkerconfig=build_checkerconfig(options))
        return list(polinter.get_errors_wlno(fromfile))
Пример #6
0
    def check_po_lint(self, fname, enabled, disabled):
        """Check po lint in fname.
        :param fname: String with full path of file to check
        :return: Return list of errors.
        """
        newargv = ['pofilter', fname]

        if enabled:
            newargv.extend(['--test=%s' % f for f in enabled])

        if disabled:
            newargv.extend(['--excludefilter=%s' % f for f in disabled])

        with custom_sys_argv(newargv):
            parser = cmdlineparser()
            options = parser.parse_args()[0]

        with open(options.input, 'r') as pofile:
            fromfile = factory.getobject(pofile)

        polinter = PoLinter(options=options,
                            checkerconfig=build_checkerconfig(options))
        return list(polinter.get_errors_wlno(fromfile))