Documentation
¶
Index ¶
- Variables
- func MakePythonLanguage(entrypoint string, cfg *Config) (language.Language[python_grammar.File], error)
- type Config
- type DirectoryResult
- type FileResult
- type InitModuleResult
- type Language
- func (l *Language) ParseExports(file *python_grammar.File) (*language.ExportsEntries, error)
- func (l *Language) ParseFile(id string) (*python_grammar.File, error)
- func (l *Language) ParseImports(file *python_grammar.File) (*language.ImportsResult, error)
- func (l *Language) ResolveAbsolute(slices []string) *ResolveResult
- type ResolveResult
Constants ¶
This section is empty.
Variables ¶
View Source
var Extensions = []string{
"py",
"pyi",
"pyx",
}
Functions ¶
func MakePythonLanguage ¶
Types ¶
type DirectoryResult ¶
type FileResult ¶
type FileResult struct {
Path string
}
type InitModuleResult ¶
type Language ¶
type Language struct { PythonPath []string // contains filtered or unexported fields }
func (*Language) ParseExports ¶
func (l *Language) ParseExports(file *python_grammar.File) (*language.ExportsEntries, error)
func (*Language) ParseImports ¶
func (l *Language) ParseImports(file *python_grammar.File) (*language.ImportsResult, error)
func (*Language) ResolveAbsolute ¶
func (l *Language) ResolveAbsolute(slices []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.
Click to show internal directories.
Click to hide internal directories.