serena.util.inspection#


iter_subclasses(cls, recursive=True, inclusion_predicate=<function <lambda>>)[source]#

Iterate over all subclasses of a class.

Parameters:
  • cls (type[T]) – The class whose subclasses to iterate over.

  • recursive (bool) – If True, also iterate over all subclasses of all subclasses.

  • inclusion_predicate (Callable[[type[T]], bool]) – a predicate function to decide whether to include a subclass in the result

Return type:

Iterator[type[T]]

compute_language_server_support_composition(repo_path, ls_ids=None)[source]#

Determine the composition of a repository in terms of the language servers that can be used to analyze it.

Percentages are computed relative to the number of files that match at least one supported language server, not the total file count. This prevents files that belong to no supported language (images, plain text, licenses, lock files, etc.) from diluting language percentages in repositories where such files dominate.

Parameters:
  • repo_path (str) – path to the repository to analyze

  • ls_ids (list[LanguageServerId] | None) – the list of language servers to consider; if None, use default (non-experimental ones)

Returns:

dictionary mapping language servers to percentages of recognised source files (denominator = files matched by at least one language server)

Return type:

dict[LanguageServerId, float]