C# Class Pytocs.TypeInference.AnalyzerImpl

Analyzes a directory of Python files, collecting and inferring type information as it parses all the files.
Inheritance: Analyzer
Datei anzeigen Open project: uxmal/pytocs Class Usage Examples

Public Properties

Property Type Description
ModuleTable State
options object>.Dictionary

Public Methods

Method Description
AddUncalled ( FunType cl ) : void
Analyze ( string path ) : void

Main entry to the analyzer

AnalyzerImpl ( IFileSystem fs, ILogger logger, object>.Dictionary options, System.DateTime startTime ) : System
AnalyzerImpl ( ILogger logger ) : System
ApplyUncalled ( ) : void
CreateBinding ( string id, Node node, DataType type, BindingKind kind ) : Binding
ExtendPath ( string path, string name ) : string
Finish ( ) : void
FormatTime ( System.TimeSpan span ) : string
GetAllBindings ( ) : List
GetDiagnosticsForFile ( string file ) : List
GetModuleBindings ( ) : IEnumerable
GetModuleQname ( string file ) : string
LoadFile ( string path ) : DataType
LoadFileRecursive ( string fullname ) : void

Load all Python source files recursively if the given fullname is a directory; otherwise just load a file. Looks at file extension to determine whether to load a given file.

LoadModule ( List name, State state ) : DataType
MakeQname ( List names ) : string
ModuleName ( string path ) : string

Given an absolute {@code path} to a file (not a directory), returns the module name for the file. If the file is an __init__.py, returns the last component of the file's parent directory, else returns the filename without path or extension.

Percent ( long num, long total ) : string
RegisterBinding ( Binding b ) : void
RemoveUncalled ( FunType f ) : void
ToString ( ) : string
addFileErr ( string file, int begin, int end, string msg ) : void
addPath ( string p ) : void
addPaths ( List p ) : void
addRef ( AttributeAccess attr, DataType targetType, ISet bs ) : void
banner ( string msg ) : string
close ( ) : void
countFileRecursive ( string fullname ) : int

Count number of .py files

getAnalysisSummary ( ) : string
getAstForFile ( string file ) : Module

Returns the syntax tree for {@code file}.

getBuiltinModule ( string qname ) : ModuleType
getLoadPath ( ) : List
getLoadedFiles ( ) : List
getReferences ( ) : List>.Dictionary
hasOption ( string option ) : bool
inImportStack ( object f ) : bool
inStack ( Exp f ) : bool
locateModule ( string headName ) : string

Find the path that contains modname. Used to find the starting point of locating a qname.

msg ( string m ) : void
msg_ ( string m ) : void
popImportStack ( object f ) : void
popStack ( Exp f ) : void
pushImportStack ( object f ) : void
pushStack ( Exp f ) : void
putProblem ( Node loc, string msg ) : void
putProblem ( string file, int begin, int end, string msg ) : void
putRef ( Node node, Binding b ) : void
putRef ( Node node, ICollection bs ) : void
setCWD ( string cd ) : void
setOption ( string option ) : void
setPath ( List path ) : void

Private Methods

Method Description
AddPythonPath ( ) : void
CopyModels ( ) : void
CreateCacheDirectory ( ) : void
GetAstCache ( ) : AstCache
GetCachedModule ( string file ) : ModuleType
getFileErrs ( string file, Dictionary map ) : List
parseAndResolve ( string file ) : DataType

Method Details

AddUncalled() public method

public AddUncalled ( FunType cl ) : void
cl FunType
return void

Analyze() public method

Main entry to the analyzer
public Analyze ( string path ) : void
path string
return void

AnalyzerImpl() public method

public AnalyzerImpl ( IFileSystem fs, ILogger logger, object>.Dictionary options, System.DateTime startTime ) : System
fs IFileSystem
logger ILogger
options object>.Dictionary
startTime System.DateTime
return System

AnalyzerImpl() public method

public AnalyzerImpl ( ILogger logger ) : System
logger ILogger
return System

ApplyUncalled() public method

public ApplyUncalled ( ) : void
return void

CreateBinding() public method

public CreateBinding ( string id, Node node, DataType type, BindingKind kind ) : Binding
id string
node Node
type DataType
kind BindingKind
return Binding

ExtendPath() public method

public ExtendPath ( string path, string name ) : string
path string
name string
return string

Finish() public method

public Finish ( ) : void
return void

FormatTime() public method

public FormatTime ( System.TimeSpan span ) : string
span System.TimeSpan
return string

GetAllBindings() public method

public GetAllBindings ( ) : List
return List

GetDiagnosticsForFile() public method

public GetDiagnosticsForFile ( string file ) : List
file string
return List

GetModuleBindings() public method

public GetModuleBindings ( ) : IEnumerable
return IEnumerable

GetModuleQname() public method

public GetModuleQname ( string file ) : string
file string
return string

LoadFile() public method

public LoadFile ( string path ) : DataType
path string
return DataType

LoadFileRecursive() public method

Load all Python source files recursively if the given fullname is a directory; otherwise just load a file. Looks at file extension to determine whether to load a given file.
public LoadFileRecursive ( string fullname ) : void
fullname string
return void

LoadModule() public method

public LoadModule ( List name, State state ) : DataType
name List
state State
return DataType

MakeQname() public method

public MakeQname ( List names ) : string
names List
return string

ModuleName() public method

Given an absolute {@code path} to a file (not a directory), returns the module name for the file. If the file is an __init__.py, returns the last component of the file's parent directory, else returns the filename without path or extension.
public ModuleName ( string path ) : string
path string
return string

Percent() public method

public Percent ( long num, long total ) : string
num long
total long
return string

RegisterBinding() public method

public RegisterBinding ( Binding b ) : void
b Binding
return void

RemoveUncalled() public method

public RemoveUncalled ( FunType f ) : void
f FunType
return void

ToString() public method

public ToString ( ) : string
return string

addFileErr() public method

public addFileErr ( string file, int begin, int end, string msg ) : void
file string
begin int
end int
msg string
return void

addPath() public method

public addPath ( string p ) : void
p string
return void

addPaths() public method

public addPaths ( List p ) : void
p List
return void

addRef() public method

public addRef ( AttributeAccess attr, DataType targetType, ISet bs ) : void
attr AttributeAccess
targetType DataType
bs ISet
return void

banner() public method

public banner ( string msg ) : string
msg string
return string

close() public method

public close ( ) : void
return void

countFileRecursive() public method

Count number of .py files
public countFileRecursive ( string fullname ) : int
fullname string
return int

getAnalysisSummary() public method

public getAnalysisSummary ( ) : string
return string

getAstForFile() public method

Returns the syntax tree for {@code file}.

public getAstForFile ( string file ) : Module
file string
return Pytocs.Syntax.Module

getBuiltinModule() public method

public getBuiltinModule ( string qname ) : ModuleType
qname string
return ModuleType

getLoadPath() public method

public getLoadPath ( ) : List
return List

getLoadedFiles() public method

public getLoadedFiles ( ) : List
return List

getReferences() public method

public getReferences ( ) : List>.Dictionary
return List>.Dictionary

hasOption() public method

public hasOption ( string option ) : bool
option string
return bool

inImportStack() public method

public inImportStack ( object f ) : bool
f object
return bool

inStack() public method

public inStack ( Exp f ) : bool
f Exp
return bool

locateModule() public method

Find the path that contains modname. Used to find the starting point of locating a qname.
public locateModule ( string headName ) : string
headName string first module name segment
return string

msg() public method

public msg ( string m ) : void
m string
return void

msg_() public method

public msg_ ( string m ) : void
m string
return void

popImportStack() public method

public popImportStack ( object f ) : void
f object
return void

popStack() public method

public popStack ( Exp f ) : void
f Exp
return void

pushImportStack() public method

public pushImportStack ( object f ) : void
f object
return void

pushStack() public method

public pushStack ( Exp f ) : void
f Exp
return void

putProblem() public method

public putProblem ( Node loc, string msg ) : void
loc Node
msg string
return void

putProblem() public method

public putProblem ( string file, int begin, int end, string msg ) : void
file string
begin int
end int
msg string
return void

putRef() public method

public putRef ( Node node, Binding b ) : void
node Node
b Binding
return void

putRef() public method

public putRef ( Node node, ICollection bs ) : void
node Node
bs ICollection
return void

setCWD() public method

public setCWD ( string cd ) : void
cd string
return void

setOption() public method

public setOption ( string option ) : void
option string
return void

setPath() public method

public setPath ( List path ) : void
path List
return void

Property Details

ModuleTable public_oe property

public State,Pytocs.TypeInference ModuleTable
return State

options public_oe property

public Dictionary options
return object>.Dictionary