def find_dependencies(self, source_path):
        source = self.get_source(source_path)
        source_dir = posixpath.dirname(source_path)
        dependencies = set()
        imported_files = set()
        for import_path in self.find_imports(source):
            if import_path.endswith(".styl"):
                # @import "foo.styl"
                imported_files.add(self.locate_imported_file(source_dir, import_path))
            elif import_path.endswith("/*"):
                # @import "foo/*"
                imported_dir = posixpath.join(source_dir, import_path[:-2])
                try:
                    imported_dir_full_path = self.get_full_source_path(imported_dir)
                except ValueError:
                    raise exceptions.StaticCompilationError(
                        "Can't locate the imported directory: {0}".format(import_path)
                    )
                if not os.path.isdir(imported_dir_full_path):
                    raise exceptions.StaticCompilationError(
                        "Imported path is not a directory: {0}".format(import_path)
                    )
                for filename in os.listdir(imported_dir_full_path):
                    if filename.endswith(".styl"):
                        imported_files.add(self.locate_imported_file(imported_dir, filename))
            else:
                try:
                    # @import "foo" -> @import "foo/index.styl"
                    imported_dir = posixpath.join(source_dir, import_path)
                    imported_dir_full_path = self.get_full_source_path(imported_dir)
                    if os.path.isdir(imported_dir_full_path):
                        imported_files.add(self.locate_imported_file(imported_dir, "index.styl"))
                except __HOLE__:
                    # @import "foo" -> @import "foo.styl"
                    imported_files.add(self.locate_imported_file(source_dir, import_path + ".styl"))

        dependencies.update(imported_files)
        for imported_file in imported_files:
            dependencies.update(self.find_dependencies(imported_file))

        return sorted(dependencies)
dataset/ETHPy150Open andreyfedoseev/django-static-precompiler/static_precompiler/compilers/stylus.py/Stylus.find_dependencies