Help us shape the future of Go! Take the 2026 Go Developer Survey

python

package
v0.29.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTestFile

func IsTestFile(filePath string) bool

IsTestFile reports whether the given Python path is a test file.

func ResolvePythonAbsoluteImportPath

func ResolvePythonAbsoluteImportPath(absSourcePath, importPath string, suppliedFiles map[string]bool) []string

ResolvePythonAbsoluteImportPath resolves an absolute Python package import (e.g. "dexter.tools.finance.api") to matching project files.

func ResolvePythonImportPath

func ResolvePythonImportPath(sourceFile, importPath string, suppliedFiles map[string]bool) []string

ResolvePythonImportPath resolves a Python import path to possible file paths.

func ResolvePythonProjectImports

func ResolvePythonProjectImports(
	absPath string,
	filePath string,
	ext string,
	suppliedFiles map[string]bool,
	contentReader vcs.ContentReader,
) ([]string, error)

Types

type ExternalImport

type ExternalImport struct {
	// contains filtered or unexported fields
}

ExternalImport represents an external module import.

func (ExternalImport) IsTypeOnly

func (e ExternalImport) IsTypeOnly() bool

func (ExternalImport) Path

func (e ExternalImport) Path() string

type InternalImport

type InternalImport struct {
	// contains filtered or unexported fields
}

InternalImport represents a relative module import.

func (InternalImport) IsTypeOnly

func (i InternalImport) IsTypeOnly() bool

func (InternalImport) Path

func (i InternalImport) Path() string

type Provider added in v0.27.0

type Provider struct{}

func (Provider) Extensions added in v0.27.0

func (Provider) Extensions() []string

func (Provider) IsTestFile added in v0.27.0

func (Provider) IsTestFile(filePath string, _ vcs.ContentReader) bool

func (Provider) Maturity added in v0.27.0

func (Provider) Maturity() moduleapi.MaturityLevel

func (Provider) Name added in v0.27.0

func (Provider) Name() string

func (Provider) NewResolver added in v0.27.0

func (Provider) NewResolver(ctx *moduleapi.Context, contentReader vcs.ContentReader) moduleapi.Resolver

type PythonImport

type PythonImport interface {
	Path() string
	IsTypeOnly() bool
}

PythonImport represents an import in a Python file.

func ParsePythonImports

func ParsePythonImports(sourceCode []byte) ([]PythonImport, error)

ParsePythonImports parses Python source code and extracts imports.

func PythonImports

func PythonImports(filePath string) ([]PythonImport, error)

PythonImports parses a Python file and returns its imports.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL