python

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Extensions = []string{
	"py",
	"pyi",
	"pyx",
}

Functions

func MakePythonLanguage

func MakePythonLanguage(cfg *Config) (language.Language, error)

Types

type Config added in v0.17.4

type Config struct {
	PythonPath                 []string `yaml:"pythonPath"`
	ExcludeConditionalImports  bool     `yaml:"excludeConditionalImports"`
	IgnoreFromImportsAsExports bool
	IgnoreDirectoryImports     bool
}

type DirectoryResult

type DirectoryResult struct {
	Path        string
	PythonFiles []string
}

type FileResult

type FileResult struct {
	Path string
}

type InitModuleResult

type InitModuleResult struct {
	Path        string
	PythonFiles []string
}

type Language

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

func (*Language) ParseExports

func (l *Language) ParseExports(file *language.FileInfo) (*language.ExportsResult, error)

func (*Language) ParseFile

func (l *Language) ParseFile(id string) (*language.FileInfo, error)

func (*Language) ParseImports

func (l *Language) ParseImports(file *language.FileInfo) (*language.ImportsResult, error)

func (*Language) ResolveAbsolute

func (l *Language) ResolveAbsolute(slices []string, currDir string) *ResolveResult

ResolveAbsolute never fails, if nothing is found it just returns nil.

This is fine because we assume that an un-resolved absolute import is pointing to a library or something like that, so no need to take it into account.

type ResolveResult

type ResolveResult struct {
	InitModule *InitModuleResult
	Directory  *DirectoryResult
	File       *FileResult
}

func ResolveRelative

func ResolveRelative(slices []string, dir string, stepsBack int) (*ResolveResult, error)

ResolveRelative cannot return an empty []string, unless an error happened.

In contrary to ResolveAbsolute, this method can return an error as a relative import is always expected to be found.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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