org.python.indexer.ast
Class NModule
- java.lang.Object
-
- org.python.indexer.ast.NNode
-
- org.python.indexer.ast.NModule
-
- All Implemented Interfaces:
- java.io.Serializable
public class NModule extends NNode
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NModule()NModule(NBlock body, int start, int end)NModule(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.List<NStr>getExportedNameNodes()If the module defines an__all__variable, returns the string elements of the variable's list value.java.util.List<java.lang.String>getExportedNames()Attempt to determine the actual value of the "__all__" variable in the target module.java.lang.StringgetFile()java.lang.StringgetMD5()NTyperesolve(Scope s)Node should set the resolved type in itsNNode.typefield and also return it.voidsetFile(java.io.File path)voidsetFile(java.lang.String file)voidsetFileAndMD5(java.lang.String path, java.lang.String md5)Used when module is parsed from an in-memory string.java.lang.StringtoLongString()java.lang.StringtoString()voidvisit(NNodeVisitor v)Visits this node and optionally its children.-
Methods inherited from class org.python.indexer.ast.NNode
addChildren, addChildren, addType, bindsName, end, getAstRoot, getDeepestNodeAtOffset, getEnclosingNamespace, getParent, getTable, getType, isCall, isClassDef, isFunctionDef, isLambda, isModule, isName, length, resolveExpr, setEnd, setParent, setStart, setType, start
-
-
-
-
Field Detail
-
name
public java.lang.String name
-
body
public NBody body
-
-
Constructor Detail
-
NModule
public NModule()
-
NModule
public NModule(java.lang.String name)
-
NModule
public NModule(NBlock body, int start, int end)
-
-
Method Detail
-
setFile
public void setFile(java.lang.String file) throws java.lang.Exception- Throws:
java.lang.Exception
-
setFile
public void setFile(java.io.File path) throws java.lang.Exception- Throws:
java.lang.Exception
-
setFileAndMD5
public void setFileAndMD5(java.lang.String path, java.lang.String md5) throws java.lang.ExceptionUsed when module is parsed from an in-memory string.- Parameters:
path- file pathmd5- md5 message digest for source contents- Throws:
java.lang.Exception
-
getFile
public java.lang.String getFile()
-
getMD5
public java.lang.String getMD5()
-
resolve
public NType resolve(Scope s) throws java.lang.Exception
Description copied from class:NNodeNode should set the resolved type in itsNNode.typefield and also return it.
-
getExportedNames
public java.util.List<java.lang.String> getExportedNames() throws java.lang.ExceptionAttempt 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:
- the list of exported names. Returns
nullif __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. - Throws:
java.lang.Exception
-
getExportedNameNodes
public java.util.List<NStr> getExportedNameNodes() throws java.lang.Exception
If the module defines an__all__variable, returns the string elements of the variable's list value.- Returns:
- any exported name nodes found, or an empty list if none found
- Throws:
java.lang.Exception
-
toLongString
public java.lang.String toLongString()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
visit
public void visit(NNodeVisitor v)
Description copied from class:NNodeVisits this node and optionally its children.
-
-
DMelt 3.0 © DataMelt by jWork.ORG