Variables containing "." (dot) in their names
Closed this issue · 2 comments
Shashank-Pandey-ML commented
- ucscsdk version: v0.9.0.5
- Python version: Python3.10
- Operating System: Windows/Linux
Description
We are using ucscsdk to connect to the UCS central instance and fetch all the relevant objects to do a migration to Intersight using the IMM Transition Tool
Using the latest release v0.9.05, we have noticed some syntax errors occurring when importing some files.
What I Did
>>> from ucscsdk.mometa.ether import EtherServerIntFIo
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Projects\GitHub\easy-ucs\venv\lib\site-packages\ucscsdk\mometa\ether\EtherServerIntFIo.py", line 170
XCVR_TYPE_QSFP100GSR1.2 = "qsfp100gsr1.2"
^^
SyntaxError: invalid syntax
This variable XCVR_TYPE_QSFP100GSR1.2
is defined in 5 files:
- ucscsdk/mometa/ether/EtherServerIntFIo.py
- ucscsdk/mometa/ether/EtherPlo.py
- ucscsdk/mometa/ether/EtherSwitchIntFlo.py
- ucscsdk/mometa/equipment/EquipmentXcvr.py
- ucscsdk/mometa/fc/FcPlo.py
All these files will give a syntax error due to the presence of "." in its variable name.
Shashank-Pandey-ML commented
Similar code in ucsmsdk is named with an underscore:
ucscsdk:
XCVR_TYPE_QSFP100GSR1.2 = "qsfp100gsr1.2"
ucsmsdk:
XCVR_TYPE_QSFP100GSR1_2 = "qsfp100gsr1.2"