Text Representation¶
Text representation commands are used to determine how objects are printed on the Python command line.
Other Classes¶
- class TextReprOptions[source]¶
Bases:
object
The TextReprOptions object is used to configure the output of the Python str() command within Abaqus/CAE. (The str() command is used by the Python print function.) The TextReprOptions object stores the various settings that determine how objects are printed on the Python command line. The TextReprOptions object has no constructor. Abaqus creates the textReprOptions member when a session is started.
Note
This object can be accessed by:
import textRepr - textReprOptions session.textReprOptions
Note
Member Details:
- setValues(
- style=
None
, - maxRecursionDepth=
None
, - maxRecursionString=
''
, - maxElementsInSequence=
None
, This method modifies the TextReprOptions object.
Note
- Parameters:¶
- style=
None
¶ A SymbolicConstant specifying the style of the text representation. Possible values are:RECURSIVE: return a recursive representation of the object.SIMPLE: return a String representing the object as either ‘interface object’, ‘dictionary object’, or ‘sequence object’.The initial value is RECURSIVE.
- maxRecursionDepth=
None
¶ An Int, SymbolicConstant, or None specifying the maximum depth to which the object will be printed. Possible values for the depth are Ints ≥ 0, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. If object is not an Abaqus object, maxRecursionDepth has no effect. The default value is None.
- maxRecursionString=
''
¶ A String specifying the string to be returned when the maximum depth of recursion is reached. The string can include a format specifier (%s), which will be substituted by the object type. The initial value is ‘%s object’.
- maxElementsInSequence=
None
¶ An Int or the SymbolicConstant UNLIMITED specifying the maximum number of elements of a sequence to return. Possible values are UNLIMITED or Ints > 0. The initial value is 100. After the maximum number of elements, the remainder are indicated by the string ‘…’.
- style=
-
indentFile(path, indent=
''
, backup=False
, runTest=False
)[source]¶ This method outputs the indented file to the terminal window or backs up the specified file and replaces it.
Note
- Parameters:¶
- path¶
A String specifying the file to be processed.
- indent=
''
¶ A String specifying the amount of indentation to be used. The default value is four spaces of indentation. Custom indentation strings must be flanked by quotation marks (” “).
- backup=
False
¶ A Boolean specifying whether to back up the file specified in the path argument if changes are made. The default value is False.
- runTest=
False
¶ A Boolean specifying whether to test the newly indented file to ensure that it is semantically the same after any changes. The default value is False.
- Returns:¶
A Boolean. True, if the indentation is successful; otherwise, False.
- Return type:¶
Boolean
- getIndentedRepr(
- object,
- maxRecursionDepth=
None
, - maxElementsInSequence=
None
, - significantDigits=
6
, This method returns a String with each level of parentheses indented.
Note
- Parameters:¶
- object¶
A Python object to be processed. (The Python object can be an Abaqus object.) This argument can also be a String representation of a Python object obtained from str(object).
- maxRecursionDepth=
None
¶ An Int specifying the maximum depth to which the object will be printed, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. If object is not an Abaqus object, maxRecursionDepth has no effect. The default value is None.You should take care when setting maxRecursionDepth = UNLIMITED because the resulting output can be very large. To limit the output, you should set maxElementsInSequence to a small number.
- maxElementsInSequence=
None
¶ An Int specifying the maximum number of elements of a sequence to return or the SymbolicConstant UNLIMITED. The initial value is 100. After the maximum number of elements have been printed, the remainder are indicated by the string ‘…’.
- significantDigits=
6
¶ An Int specifying the number of significant digits for Floats in the output. Possible values are 0 < significantDigits ≤ 15. The default value is 6.
- Returns:¶
A String.
- Return type:¶
-
getPaths(object, maxRecursionDepth=
None
, maxElementsInSequence=None
, pathRoot=''
)[source]¶ This method processes the argument and interprets its structure. It then returns a String containing the object paths of all the child objects found.
Note
- Parameters:¶
- object¶
A Python object to be processed. (The Python object can be an Abaqus object.) This argument can also be a String representation of a Python object.
- maxRecursionDepth=
None
¶ An Int specifying the maximum depth to which the object will be printed, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. If object is not an Abaqus object, maxRecursionDepth has no effect. The default value is None.You should take care when setting maxRecursionDepth = UNLIMITED because the resulting output can be very large. To limit the output, you should set maxElementsInSequence to a small number.
- maxElementsInSequence=
None
¶ An Int specifying the maximum number of elements of a sequence to return or the SymbolicConstant UNLIMITED. The initial value is 100. After the maximum number of elements have been printed, the remainder are indicated by the string ‘…’.
- pathRoot=
''
¶ A String specifying the root of the paths. This String is prepended to each path found. The default value is None, implying that the path to object will be used unless object is a String.
- Returns:¶
A String.
- Return type:¶
-
getTypes(object, maxRecursionDepth=
None
, maxElementsInSequence=None
, pathRoot=''
)[source]¶ This method processes the argument, interprets its structure, and returns a String containing all the object types within the object in the form ‘TypeName Path’.
Note
- Parameters:¶
- object¶
An Abaqus object.
- maxRecursionDepth=
None
¶ An Int specifying the maximum depth to which the object will be printed, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. The default value is None.You should take care when setting maxRecursionDepth = UNLIMITED because the resulting output can be very large. To limit the output, you should set maxElementsInSequence to a small number.
- maxElementsInSequence=
None
¶ An Int specifying the maximum number of elements of a sequence to return or the SymbolicConstant UNLIMITED. The initial value is 100. After the maximum number of elements have been printed, the remainder are indicated by the string ‘…’.
- pathRoot=
''
¶ A String specifying the root of the paths. This String is prepended to each path found. The default value is None, implying that the path to object will be used unless object is a String.
- Returns:¶
A String.
- Return type:¶
- prettyPrint(
- object,
- maxRecursionDepth=
None
, - maxElementsInSequence=
None
, - significantDigits=
6
, This method prints a formatted version of the object. The prettyPrint function uses getIndentedRepr to format the String representation, but does not save the full text output of getIndentedRepr. Therefore this function can be used in cases where getIndentedRepr would run out of memory.
Note
- Parameters:¶
- object¶
An Abaqus object.
- maxRecursionDepth=
None
¶ An Int specifying the maximum depth to which the object will be printed, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. The default value is None.You should take care when setting maxRecursionDepth = UNLIMITED because the resulting output can be very large. To limit the output, you should set maxElementsInSequence to a small number.
- maxElementsInSequence=
None
¶ An Int specifying the maximum number of elements of a sequence to return or the SymbolicConstant UNLIMITED. The initial value is 100. After the maximum number of elements have been printed, the remainder are indicated by the string ‘…’.
- significantDigits=
6
¶ An Int specifying the number of significant digits for Floats in the output. Possible values are 0 < significantDigits ≤ 15. The default value is 6.
-
printPaths(object, maxRecursionDepth=
None
, maxElementsInSequence=None
, pathRoot=''
)[source]¶ This method prints the object path of the object argument and its members, depending on the maxRecursionDepth argument. The printPaths function uses getPaths to print a list of paths to each of the child objects in object.
Note
- Parameters:¶
- object¶
An Abaqus object. This argument can also be a String representation of an Abaqus object obtained from str(object).
- maxRecursionDepth=
None
¶ An Int specifying the maximum depth to which the object will be printed, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. The default value is None.You should take care when setting maxRecursionDepth = UNLIMITED because the resulting output can be very large. To limit the output, you should set maxElementsInSequence to a small number.
- maxElementsInSequence=
None
¶ An Int specifying the maximum number of elements of a sequence to return or the SymbolicConstant UNLIMITED. The initial value is 100. After the maximum number of elements have been printed, the remainder are indicated by the string ‘…’.
- pathRoot=
''
¶ A String specifying the root of the paths to be printed. This String is prepended to each path found. The default value is None, implying that the path to object will be used.
-
printTypes(object, maxRecursionDepth=
None
, maxElementsInSequence=None
, pathRoot=''
)[source]¶ This method prints the object type. The printTypes function uses getTypes to print a list of all the object types in object.
Note
- Parameters:¶
- object¶
An Abaqus object.
- maxRecursionDepth=
None
¶ An Int specifying the maximum depth to which the object will be printed, the SymbolicConstant UNLIMITED, or None. A value of None implies that the current setting in the TextReprOptions object will be used. The default value is None.You should take care when setting maxRecursionDepth = UNLIMITED because the resulting output can be very large. To limit the output, you should set maxElementsInSequence to a small number.
- maxElementsInSequence=
None
¶ An Int specifying the maximum number of elements of a sequence to return or the SymbolicConstant UNLIMITED. The initial value is 100. After the maximum number of elements have been printed, the remainder are indicated by the string ‘…’.
- pathRoot=
''
¶ A String specifying the root of the paths to be printed. This String is prepended to each path found. The default value is None, implying that the path to object will be used.