Class PythonParser

java.lang.Object
org.openrewrite.python.PythonParser
All Implemented Interfaces:
org.openrewrite.Parser

public class PythonParser extends Object implements org.openrewrite.Parser
Parser for Python source files.

This parser uses RPC to communicate with a Python process that performs the actual parsing. The Python process uses the Python AST module to parse source code and converts it to the OpenRewrite LST format.

  • Constructor Details

    • PythonParser

      public PythonParser()
  • Method Details

    • parseInputs

      public Stream<org.openrewrite.SourceFile> parseInputs(Iterable<org.openrewrite.Parser.Input> sources, @Nullable Path relativeTo, org.openrewrite.ExecutionContext ctx)
      Specified by:
      parseInputs in interface org.openrewrite.Parser
    • accept

      public boolean accept(Path path)
      Specified by:
      accept in interface org.openrewrite.Parser
    • sourcePathFromSourceText

      public Path sourcePathFromSourceText(Path prefix, String sourceCode)
      Specified by:
      sourcePathFromSourceText in interface org.openrewrite.Parser
    • builder

      public static PythonParser.Builder builder()