sugarsdk/modval.py
def _runner_cmp_meta(self, ifc, meta, uri):
        """
        Compare meta to the interface.

        :param ifc: interface
        :param meta: meta (doc/examples/scheme)
        :param uri: URI of the module.
        :return:
        """
        mod_type = self._cli_args.type
        methods = []
        for node in ifc["interface"].body:
            if isinstance(node, astroid.ClassDef):
                for func_node in node.body:
                    methods.append(func_node)

        self._console.info("Verifying scheme")
        scheme = meta.get("scheme")
        self._console.warning("  (unsupported yet)")

        self._console.info("Verifying documentation")
        doc = meta.get("doc")

        tasks = doc.get("tasks")
        if tasks is None:
            self.errors.append(("Documentation in '{}' {} module has no 'tasks' section", (uri, mod_type)))

        ifc_method_names = set()
        for mtd in methods:
            ifc_method_names.add(mtd.name)
            if mtd.name not in tasks:
                self.errors.append(("Function '{}' is not documented in {} module", (mtd.name, mod_type)))
            is_abstract = False
            if mtd.decorators is not None:
                for decorator in mtd.decorators.nodes:
                    if decorator.attrname == "abstractmethod":
                        is_abstract = True
                        break
            if not is_abstract:
                self.errors.append(("Function '{}' is not abstract in the {} module interface", (mtd.name, mod_type)))

            self._common_cmp_signature(uri, mtd, tasks.get(mtd.name, {}))

        for task in tasks:
            if task not in ifc_method_names:
                self.errors.append(("Documentation in '{}' {} module contains superfluous data. "
                                    "The interface has less methods than "
                                    "the documentation describes", (uri, mod_type)))
                break

        self._console.info("Verifying examples")
        example = meta.get("example")
        for mt_name in ifc_method_names:
            if mt_name not in example:
                self.errors.append(("Example does not contain usage of function '{}'.", (mt_name,)))
            else:
                for section in ["commandline", "description", "states"]:
                    if section not in example[mt_name]:
                        self.errors.append(("Example does not contain '{}' section in function '{}'.",
                                            (section, mt_name,)))

        Compare meta to the interface.

        :param ifc: interface
        :param meta: meta (doc/examples/scheme)
        :param uri: URI of the module.
        :return:
        
Compare meta to the interface.
Compare meta to the interface .
def _runner_cmp_meta(self, ifc, meta, uri):
        mod_type = self._cli_args.type
        methods = []
        for node in ifc["interface"].body:
            if isinstance(node, astroid.ClassDef):
                for func_node in node.body:
                    methods.append(func_node)
        self._console.info("Verifying scheme")
        scheme = meta.get("scheme")
        self._console.warning("  (unsupported yet)")
        self._console.info("Verifying documentation")
        doc = meta.get("doc")
        tasks = doc.get("tasks")
        if tasks is None:
            self.errors.append(("Documentation in '{}' {} module has no 'tasks' section", (uri, mod_type)))
        ifc_method_names = set()
        for mtd in methods:
            ifc_method_names.add(mtd.name)
            if mtd.name not in tasks:
                self.errors.append(("Function '{}' is not documented in {} module", (mtd.name, mod_type)))
            is_abstract = False
            if mtd.decorators is not None:
                for decorator in mtd.decorators.nodes:
                    if decorator.attrname == "abstractmethod":
                        is_abstract = True
                        break
            if not is_abstract:
                self.errors.append(("Function '{}' is not abstract in the {} module interface", (mtd.name, mod_type)))
            self._common_cmp_signature(uri, mtd, tasks.get(mtd.name, {}))
        for task in tasks:
            if task not in ifc_method_names:
                self.errors.append(("Documentation in '{}' {} module contains superfluous data. "
                                    "The interface has less methods than "
                                    "the documentation describes", (uri, mod_type)))
                break
        self._console.info("Verifying examples")
        example = meta.get("example")
        for mt_name in ifc_method_names:
            if mt_name not in example:
                self.errors.append(("Example does not contain usage of function '{}'.", (mt_name,)))
            else:
                for section in ["commandline", "description", "states"]:
                    if section not in example[mt_name]:
                        self.errors.append(("Example does not contain '{}' section in function '{}'.",
                                            (section, mt_name,)))
def _runner_cmp_meta ( self , ifc , meta , uri ) : mod_type = self . _cli_args . type methods = [ ] for node in ifc [ "interface" ] . body : if isinstance ( node , astroid . ClassDef ) : for func_node in node . body : methods . append ( func_node ) self . _console . info ( "Verifying scheme" ) scheme = meta . get ( "scheme" ) self . _console . warning ( "  (unsupported yet)" ) self . _console . info ( "Verifying documentation" ) doc = meta . get ( "doc" ) tasks = doc . get ( "tasks" ) if tasks is None : self . errors . append ( ( "Documentation in '{}' {} module has no 'tasks' section" , ( uri , mod_type ) ) ) ifc_method_names = set ( ) for mtd in methods : ifc_method_names . add ( mtd . name ) if mtd . name not in tasks : self . errors . append ( ( "Function '{}' is not documented in {} module" , ( mtd . name , mod_type ) ) ) is_abstract = False if mtd . decorators is not None : for decorator in mtd . decorators . nodes : if decorator . attrname == "abstractmethod" : is_abstract = True break if not is_abstract : self . errors . append ( ( "Function '{}' is not abstract in the {} module interface" , ( mtd . name , mod_type ) ) ) self . _common_cmp_signature ( uri , mtd , tasks . get ( mtd . name , { } ) ) for task in tasks : if task not in ifc_method_names : self . errors . append ( ( "Documentation in '{}' {} module contains superfluous data. " "The interface has less methods than " "the documentation describes" , ( uri , mod_type ) ) ) break self . _console . info ( "Verifying examples" ) example = meta . get ( "example" ) for mt_name in ifc_method_names : if mt_name not in example : self . errors . append ( ( "Example does not contain usage of function '{}'." , ( mt_name , ) ) ) else : for section in [ "commandline" , "description" , "states" ] : if section not in example [ mt_name ] : self . errors . append ( ( "Example does not contain '{}' section in function '{}'." , ( section , mt_name , ) ) )
Compare meta to the interface.
Compare meta to the interface .
"""
        Compare meta to the interface.

        :param ifc: interface
        :param meta: meta (doc/examples/scheme)
        :param uri: URI of the module.
        :return:
        """
None
self
ifc
None
meta
None
uri
URI of the module.
URI of the module .