sugarsdk/modval.py
def _runner_cmp_impl(self, impl: dict, uri: str):
        """
        Compare implementations to the interface.

        :param impl: interface to implementations map
        :param uri: URI of the module
        :return:
        """
        ifc = next(iter(impl))
        ifc_func_names = [node.name for node in ifc.body]
        for cls_impl, fname in impl[ifc]:
            impl_func_names = [node.name for node in cls_impl.body]
            for ifc_fname in ifc_func_names:
                if ifc_fname not in impl_func_names:
                    self.errors.append(("Function '{}::{}::{}' is not implemented.",
                                        (fname, cls_impl.name, ifc_fname)))
            for impl_f_node in cls_impl.body:
                for ifc_f_node in ifc.body:
                    if ifc_f_node.name == impl_f_node.name:
                        if ifc_f_node.args.vararg != impl_f_node.args.vararg:
                            self.warnings.append(("Function '{}::{}::{}' has different varargs than the interface.",
                                                  (fname, cls_impl.name, ifc_f_node.name)))
                        if ifc_f_node.args.kwarg != impl_f_node.args.kwarg:
                            self.warnings.append(("Function '{}::{}::{}' has different keyword "
                                                  "arguments than the interface.",
                                                  (fname, cls_impl.name, ifc_f_node.name)))
                        ifc_param_names = [n.name for n in ifc_f_node.args.args if n.name not in ["cls", "self"]]
                        ipl_param_names = [n.name for n in impl_f_node.args.args if n.name not in ["cls", "self"]]
                        if ifc_param_names != ipl_param_names:
                            self.warnings.append(("Function '{}::{}::{}' has different usage parameter names ({}) "
                                                  "than the interface ({}).",
                                                  (fname, cls_impl.name, ifc_f_node.name,
                                                   ", ".join(ipl_param_names), ", ".join(ifc_param_names))))

        Compare implementations to the interface.

        :param impl: interface to implementations map
        :param uri: URI of the module
        :return:
        
Compare implementations to the interface.
Compare implementations to the interface .
def _runner_cmp_impl(self, impl: dict, uri: str):
        ifc = next(iter(impl))
        ifc_func_names = [node.name for node in ifc.body]
        for cls_impl, fname in impl[ifc]:
            impl_func_names = [node.name for node in cls_impl.body]
            for ifc_fname in ifc_func_names:
                if ifc_fname not in impl_func_names:
                    self.errors.append(("Function '{}::{}::{}' is not implemented.",
                                        (fname, cls_impl.name, ifc_fname)))
            for impl_f_node in cls_impl.body:
                for ifc_f_node in ifc.body:
                    if ifc_f_node.name == impl_f_node.name:
                        if ifc_f_node.args.vararg != impl_f_node.args.vararg:
                            self.warnings.append(("Function '{}::{}::{}' has different varargs than the interface.",
                                                  (fname, cls_impl.name, ifc_f_node.name)))
                        if ifc_f_node.args.kwarg != impl_f_node.args.kwarg:
                            self.warnings.append(("Function '{}::{}::{}' has different keyword "
                                                  "arguments than the interface.",
                                                  (fname, cls_impl.name, ifc_f_node.name)))
                        ifc_param_names = [n.name for n in ifc_f_node.args.args if n.name not in ["cls", "self"]]
                        ipl_param_names = [n.name for n in impl_f_node.args.args if n.name not in ["cls", "self"]]
                        if ifc_param_names != ipl_param_names:
                            self.warnings.append(("Function '{}::{}::{}' has different usage parameter names ({}) "
                                                  "than the interface ({}).",
                                                  (fname, cls_impl.name, ifc_f_node.name,
                                                   ", ".join(ipl_param_names), ", ".join(ifc_param_names))))
def _runner_cmp_impl ( self , impl : dict , uri : str ) : ifc = next ( iter ( impl ) ) ifc_func_names = [ node . name for node in ifc . body ] for cls_impl , fname in impl [ ifc ] : impl_func_names = [ node . name for node in cls_impl . body ] for ifc_fname in ifc_func_names : if ifc_fname not in impl_func_names : self . errors . append ( ( "Function '{}::{}::{}' is not implemented." , ( fname , cls_impl . name , ifc_fname ) ) ) for impl_f_node in cls_impl . body : for ifc_f_node in ifc . body : if ifc_f_node . name == impl_f_node . name : if ifc_f_node . args . vararg != impl_f_node . args . vararg : self . warnings . append ( ( "Function '{}::{}::{}' has different varargs than the interface." , ( fname , cls_impl . name , ifc_f_node . name ) ) ) if ifc_f_node . args . kwarg != impl_f_node . args . kwarg : self . warnings . append ( ( "Function '{}::{}::{}' has different keyword " "arguments than the interface." , ( fname , cls_impl . name , ifc_f_node . name ) ) ) ifc_param_names = [ n . name for n in ifc_f_node . args . args if n . name not in [ "cls" , "self" ] ] ipl_param_names = [ n . name for n in impl_f_node . args . args if n . name not in [ "cls" , "self" ] ] if ifc_param_names != ipl_param_names : self . warnings . append ( ( "Function '{}::{}::{}' has different usage parameter names ({}) " "than the interface ({})." , ( fname , cls_impl . name , ifc_f_node . name , ", " . join ( ipl_param_names ) , ", " . join ( ifc_param_names ) ) ) )
Compare implementations to the interface.
Compare implementations to the interface .
"""
        Compare implementations to the interface.

        :param impl: interface to implementations map
        :param uri: URI of the module
        :return:
        """
None
self
impl
dict
interface to implementations map
interface to implementations map
uri
str
URI of the module
URI of the module