def discover_modules(self):
        ''' Return module sequence discovered from ``self.package_name``


        Parameters
        ----------
        None

        Returns
        -------
        mods : sequence
            Sequence of module names within ``self.package_name``

        Examples
        --------
        >>> dw = ApiDocWriter('sphinx')
        >>> mods = dw.discover_modules()
        >>> 'sphinx.util' in mods
        True
        >>> dw.skip_patterns.append('\.util$')
        >>> 'sphinx.util' in dw.discover_modules()
        False
        >>>
        '''
        modules = [self.package_name]
        # raw directory parsing
        for dirpath, dirnames, filenames in os.walk(self.root_path,
                                                    topdown=False):
            # Check directory names for packages
            root_uri = self._path2uri(os.path.join(self.root_path,
                                                   dirpath))
            filenames = [f for f in filenames if f.endswith('.py')]
            uris = [u.strip('.py') for u in dirnames + filenames]
            for uri in uris:
                package_uri = '.'.join((root_uri, uri))
                if (self._uri2path(package_uri) and
                    self._survives_exclude(package_uri)):
                    try:
                        mod = __import__(package_uri, fromlist=['cesium'])
                        mod.__all__
                        modules.append(package_uri)
                    except (__HOLE__, AttributeError):
                        pass
        return sorted(modules)
dataset/ETHPy150Open cesium-ml/cesium/doc/tools/apigen.py/ApiDocWriter.discover_modules