Top Fields Constructors Methods
org.python.indexer.ast

public Class NModule

extends NNode
Class Inheritance
Imports
org.python.indexer.Def, .Indexer, .NBinding, .Scope, .Util, org.python.indexer.types.NModuleType, .NType, java.io.File, java.util.ArrayList, .List

Field Summary

Modifier and TypeField and Description
public NBody
private String
private String
public String
pack-priv static final long
Inherited from org.python.indexer.ast.NNode:
parent

Constructor Summary

AccessConstructor and Description
public
public
public
NModule(NBlock body, int start, int end)

Method Summary

Modifier and TypeMethod and Description
public List<NStr>

Returns:

any exported name nodes found, or an empty list if none found
getExportedNameNodes
()

If the module defines an __all__ variable, returns the string elements of the variable's list value.

public List<String>

Returns:

the list of exported names. Returns null if __all__ is missing, or if its initializer is not a simple list of strings. We don't generate a warning, since complex expressions such as __all__ = [name for name in dir() if name[0] == "e"] are valid provided the expr result is a string list.
getExportedNames
()

Attempt to determine the actual value of the "__all__" variable in the target module.

public String
public String
public NType
resolve(Scope s)

Overrides org.python.indexer.ast.NNode.resolve.

Node should set the resolved type in its type field and also return it.

private void
resolveExportedNames()

If the module defines an __all__ variable, resolve references to each of the elements.

public void
public void
setFile(File path)

public void
setFileAndMD5(String
file path
path
,
String
md5 message digest for source contents
md5
)

Used when module is parsed from an in-memory string.

public String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
visit(NNodeVisitor
the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.
v
)

Implements abstract org.python.indexer.ast.NNode.visit.

Visits this node and optionally its children.

Inherited from org.python.indexer.ast.NNode:
addChildrenaddChildrenaddErroraddErroraddTypeaddWarningaddWarningbindNamesbindsNameendgetAstRootgetDeepestNodeAtOffsetgetEnclosingNamespacegetParentgetTablegetTypeisCallisClassDefisFunctionDefisLambdaisModuleisNamelengthresolveExprresolveListresolveListAsUnionsetEndsetParentsetStartsetTypestartvisitNodevisitNodeList

Field Detail

bodyback to summary
public NBody body
fileback to summary
private String file
md5back to summary
private String md5
nameback to summary
public String name
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.python.indexer.ast.NNode.serialVersionUID.

Constructor Detail

NModuleback to summary
public NModule()
NModuleback to summary
public NModule(String name)
NModuleback to summary
public NModule(NBlock body, int start, int end)

Method Detail

getExportedNameNodesback to summary
public List<NStr> getExportedNameNodes() throws Exception

If the module defines an __all__ variable, returns the string elements of the variable's list value.

Returns:List<NStr>

any exported name nodes found, or an empty list if none found

getExportedNamesback to summary
public List<String> getExportedNames() throws Exception

Attempt to determine the actual value of the "__all__" variable in the target module. If we can parse it, return the list of exported names.

Returns:List<String>

the list of exported names. Returns null if __all__ is missing, or if its initializer is not a simple list of strings. We don't generate a warning, since complex expressions such as __all__ = [name for name in dir() if name[0] == "e"] are valid provided the expr result is a string list.

getFileback to summary
public String getFile()

Overrides org.python.indexer.ast.NNode.getFile.

Returns:String

Doc from org.python.indexer.ast.NNode.getFile.

the path to the code that generated this AST

Annotations
@Override

getMD5back to summary
public String getMD5()
resolveback to summary
public NType resolve(Scope s) throws Exception

Overrides org.python.indexer.ast.NNode.resolve.

Doc from org.python.indexer.ast.NNode.resolve.

Node should set the resolved type in its type field and also return it.

Annotations
@Override
resolveExportedNamesback to summary
private void resolveExportedNames() throws Exception

If the module defines an __all__ variable, resolve references to each of the elements.

setFileback to summary
public void setFile(String file) throws Exception
setFileback to summary
public void setFile(File path) throws Exception
setFileAndMD5back to summary
public void setFileAndMD5(String path, String md5) throws Exception

Used when module is parsed from an in-memory string.

Parameters
path:String

file path

md5:String

md5 message digest for source contents

toLongStringback to summary
public String toLongString()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override

visitback to summary
public void visit(NNodeVisitor v)

Implements abstract org.python.indexer.ast.NNode.visit.

Doc from org.python.indexer.ast.NNode.visit.

Visits this node and optionally its children.

Parameters
v:NNodeVisitor

the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.

Annotations
@Override