This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
BackwardCompatibility.py
120 lines (102 loc) · 4.89 KB
/
BackwardCompatibility.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
from abaqusConstants import *
class BackwardCompatibility:
"""The BackwardCompatibility object enables the user to control access to deprecated
commands in the Abaqus Scripting Interface and to collect data on which deprecated
commands have been used. This enables the user to check that no deprecated methods,
members, or arguments have been used. Data are recorded on any deprecated members,
methods, or arguments that are used.
The BackwardCompatibility object has no constructor. The abaqus module and the odbAccess
module each have a member named backwardCompatibility.
By default, the value of the *includeDeprecated* member is ON, and Abaqus will execute a
script containing deprecated commands with no indication that you should update the
script. You can do either of the following to change the value of the
*includeDeprecated* member and to determine which commands have been deprecated:
- From the command line interface in Abaqus/CAE or from an Abaqus Scripting Interface
script that is run from within Abaqus/CAE, use the following command:
```
backwardCompatibility.setValues(includeDeprecated=OFF)
```
- From an Abaqus Scripting Interface script that is run using `abaqus python` at the
system prompt, use the following two commands:
```
from odbAccess import *
backwardCompatibility.setValues(includeDeprecated=OFF)
```
In addition, the BackwardCompatibility object provides tools to assist you in
determining the deprecated commands that have been used. For example, to determine the
deprecated commands used in the script createLug.py, use the following commands:
backwardCompatibility.resetDeprecatedMethodsUsed()
backwardCompatibility.resetDeprecatedMembersUsed()
backwardCompatibility.resetDeprecatedArgsUsed()
execfile('createLug.py')
print backwardCompatibility.getDeprecatedMethodsUsed()
print backwardCompatibility.getDeprecatedMembersUsed()
print backwardCompatibility.getDeprecatedArgsUsed()
Attributes
----------
includeDeprecated: Boolean
A Boolean specifying whether deprecated members, methods, and arguments can be seen and
used. Possible values are ON and OFF. The default value is ON.
reportDeprecated: Boolean
A Boolean specifying whether a warning is displayed after running a script that contains
deprecated commands. The default value is True.
showKeysInReport: Boolean
A Boolean specifying whether the keys and indices are included in the report that is
displayed when **reportDeprecated** is True. The default value is False.
Notes
-----
This object can be accessed by:
.. code-block:: python
backwardCompatibility
"""
# A Boolean specifying whether deprecated members, methods, and arguments can be seen and
# used. Possible values are ON and OFF. The default value is ON.
includeDeprecated: Boolean = ON
# A Boolean specifying whether a warning is displayed after running a script that contains
# deprecated commands. The default value is True.
reportDeprecated: Boolean = True
# A Boolean specifying whether the keys and indices are included in the report that is
# displayed when *reportDeprecated* is True. The default value is False.
showKeysInReport: Boolean = False
def getDeprecatedMethodsUsed(self):
"""This method returns a list of deprecated methods used since the last call to
resetDeprecatedMethodsUsed.
Returns
-------
A list of Strings.
"""
pass
def getDeprecatedArgsUsed(self):
"""This method returns a list of deprecated arguments used since the last call to
resetDeprecatedArgsUsed.
Returns
-------
A list of Strings.
"""
pass
def resetDeprecatedMethodsUsed(self):
"""This method clears the list of deprecated methods used."""
pass
def resetDeprecatedArgsUsed(self):
"""This method clears the list of deprecated arguments used."""
pass
def setValues(
self,
includeDeprecated: Boolean = ON,
reportDeprecated: Boolean = True,
showKeysInReport: Boolean = False,
):
"""This method modifies the BackwardCompatibility object.
Parameters
----------
includeDeprecated
A Boolean specifying whether deprecated members, methods, and arguments can be seen and
used. The default value is ON.
reportDeprecated
A Boolean specifying whether a warning is displayed after running a script that contains
deprecated commands. The default value is True.
showKeysInReport
A Boolean specifying whether the keys and indices are included in the report that is
displayed when *reportDeprecated* is True. The default value is False.
"""
pass