Skip to content

Commit

Permalink
Remove usage of past.builtins.long
Browse files Browse the repository at this point in the history
long has been equivalent to int since PEP-237 (Python 2.2)
  • Loading branch information
thebeanogamer committed Sep 3, 2024
1 parent 8cd96f7 commit 6d8a323
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
29 changes: 14 additions & 15 deletions omdrivers/lifecycle/iDRAC/iDRACConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from omsdk.simulator.devicesim import Simulator
from omdrivers.lifecycle.iDRAC.SCPParsers import XMLParser
from omdrivers.lifecycle.iDRAC.RAIDHelper import RAIDHelper
from past.builtins import long
import sys
import logging
import tempfile
Expand Down Expand Up @@ -2130,24 +2129,24 @@ def format_enum_wsman(enval):
]},
"Args": {
"file_type": FileTypeEnum,
"in_session_id": long,
"in_session_id": int,
"chunk_size": type(1),
"file_size": long,
"file_size": int,
"txfr_descriptor": TxfrDescriptorEnum,
"payload": type(""),
"crc": type(""),
"payload_encoding": PayLoadEncodingEnum
},
"Return": {
"SessionID": long
"SessionID": int
},
"Parameters": [
("ChunkSize", "chunk_size", None, int, None),
("FileType", "file_type", None, FileTypeEnum, None),
# ("ImportFileName", "filename", None, ResetForceEnum, None),
("InSessionID", "in_session_id", None, long, None),
("InSessionID", "in_session_id", None, int, None),
("CRC", "crc", None, str, None),
("FileSize", "file_size", None, long, None),
("FileSize", "file_size", None, int, None),
("TxfrDescriptor", "txfr_descriptor", None, TxfrDescriptorEnum, None),
("PayLoad", "payload", None, str, None),
("PayLoadEncoding", "payload_encoding", None, PayLoadEncodingEnum, None)
Expand All @@ -2165,27 +2164,27 @@ def format_enum_wsman(enval):
]},
"Args": {
"file_type": FileTypeEnum,
"in_session_id": long,
"in_session_id": int,
"in_chunk_size": type(1),
"file_offset": long,
"tx_data_size": long,
"file_offset": int,
"tx_data_size": int,
"payload_encoding": PayLoadEncodingEnum
},
"Return": {
"file_size": long,
"file_size": int,
"txfr_descriptor": TxfrDescriptorEnum,
"payload": type(""),
"crc": type(""),
"chunk_size": type(1),
"session_id": type(""),
"ret_file_offset": long,
"ret_tx_data_size": long
"ret_file_offset": int,
"ret_tx_data_size": int
},
"Parameters": [
("FileOffset", "file_offset", None, long, None),
("TxDataSize", "tx_data_size", None, long, None),
("FileOffset", "file_offset", None, int, None),
("TxDataSize", "tx_data_size", None, int, None),
("FileType", "file_type", None, FileTypeEnum, None),
("InSessionID", "in_session_id", None, long, None),
("InSessionID", "in_session_id", None, int, None),
("InChunkSize", "in_chunk_size", None, int, None),
("PayLoadEncoding", "payload_encoding", None, PayLoadEncodingEnum, None),
]
Expand Down
25 changes: 12 additions & 13 deletions omdrivers/lifecycle/iDRAC/iDRACStreaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from omsdk.sdkprint import Prettifyer
from omsdk.sdkcenum import EnumWrapper
from omdrivers.enums.iDRAC.iDRACEnums import *
from past.builtins import long

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -234,9 +233,9 @@ def export_data(self, file_type=FileTypeEnum.SystemConfigXML, export_file="", **
# Export the first chunk of data
logger.debug("Exporting the first Chunk...")

session_id = long(0)
file_offset = long(0)
tx_data_size = long(0)
session_id = int(0)
file_offset = int(0)
tx_data_size = int(0)

export_data_resp = self._config_mgr.export_data(
file_type=file_type,
Expand All @@ -258,9 +257,9 @@ def export_data(self, file_type=FileTypeEnum.SystemConfigXML, export_file="", **

crc = export_data_output["CRC"]
payload = export_data_output["PayLoad"]
ret_file_offset = long(export_data_output["RetFileOffset"])
ret_tx_Data_size = long(export_data_output["RetTxDataSize"])
session_id = long(export_data_output["SessionID"])
ret_file_offset = int(export_data_output["RetFileOffset"])
ret_tx_Data_size = int(export_data_output["RetTxDataSize"])
session_id = int(export_data_output["SessionID"])
txfr_descriptor = export_data_output["TxfrDescriptor"]

payloads_list = list()
Expand Down Expand Up @@ -290,9 +289,9 @@ def export_data(self, file_type=FileTypeEnum.SystemConfigXML, export_file="", **

# chunk_size = export_data_output["ChunkSize"]
payload = export_data_output["PayLoad"]
ret_file_offset = long(export_data_output["RetFileOffset"])
ret_tx_Data_size = long(export_data_output["RetTxDataSize"])
session_id = long(export_data_output["SessionID"])
ret_file_offset = int(export_data_output["RetFileOffset"])
ret_tx_Data_size = int(export_data_output["RetTxDataSize"])
session_id = int(export_data_output["SessionID"])
txfr_descriptor = export_data_output["TxfrDescriptor"]

payloads_list.append(payload)
Expand Down Expand Up @@ -366,7 +365,7 @@ def import_data(self, import_file_type=FileTypeEnum.SystemConfigXML, import_file

import_data = import_file_content.encode("utf-8")

file_size = long(len(import_data))
file_size = int(len(import_data))

clear_transfer_session_resp = self._config_mgr.clear_transfer_session(
file_operation=FileOperationEnum.Import,
Expand Down Expand Up @@ -403,7 +402,7 @@ def import_data(self, import_file_type=FileTypeEnum.SystemConfigXML, import_file
logger.debug(payload_chunks)

number_of_chunks = len(payload_chunks)
session_id = long(0)
session_id = int(0)

# Import the Base64 Encoded Config XML data chunk-by-chunk
for count in range(1, number_of_chunks + 1):
Expand Down Expand Up @@ -439,7 +438,7 @@ def import_data(self, import_file_type=FileTypeEnum.SystemConfigXML, import_file
import_chunk_resp["Message"]
}

session_id = long(import_chunk_resp["Data"]["ImportData_OUTPUT"]["SessionID"])
session_id = int(import_chunk_resp["Data"]["ImportData_OUTPUT"]["SessionID"])

# Import the last chunk
elif count == number_of_chunks:
Expand Down

0 comments on commit 6d8a323

Please sign in to comment.