def _get_matching_sub_namespace()

in chalice/analyzer.py [0:0]


    def _get_matching_sub_namespace(self, name, lineno):
        # type: (str, int) -> Optional[symtable.SymbolTable]
        namespaces = [t for t in self._symbol_table.get_sub_namespaces()
                      if t.get_name() == name]
        if len(namespaces) == 1:
            # if there's only one match for the name, return it
            return namespaces[0]
        for namespace in namespaces:
            # otherwise disambiguate by using the line number
            if namespace.get_lineno() == lineno:
                return namespace
        return None