Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No frames3 #1097

Merged
merged 4 commits into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,18 @@ def machine_generator(
return txrx.get_machine_details(), txrx


def _parse_bmp_cabinet_and_frame(bmp_cabinet_and_frame):
def _parse_bmp_cabinet_and_frame(bmp_str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be renamed I suppose!

"""
:param str bmp_cabinet_and_frame:
:rtype: tuple(int or str, int or str, str, str or None)
:param str bmp_str:
:rtype: tuple(str, str or None)
"""
split_string = bmp_cabinet_and_frame.split(";", 2)
if len(split_string) == 1:
host = split_string[0].split(",")
if len(host) == 1:
return 0, 0, split_string[0], None
return 0, 0, host[0], host[1]
if len(split_string) == 2:
host = split_string[1].split(",")
if len(host) == 1:
return 0, split_string[0], host[0], None
return 0, split_string[0], host[0], host[1]
host = split_string[2].split(",")
if ";" in bmp_str:
raise NotImplementedError(
"cfg bmp_names no longer supports cabinet and frame")
host = bmp_str.split(",")
if len(host) == 1:
return split_string[0], split_string[1], host[0], None
return split_string[0], split_string[1], host[0], host[1]
return bmp_str, None
return host[0], host[1]


def _parse_bmp_boards(bmp_boards):
Expand Down Expand Up @@ -153,12 +145,11 @@ def _parse_bmp_connection(bmp_detail):
:rtype: ~.BMPConnectionData
"""
pieces = bmp_detail.split("/")
(cabinet, frame, hostname, port_num) = \
_parse_bmp_cabinet_and_frame(pieces[0])
(hostname, port_num) = _parse_bmp_cabinet_and_frame(pieces[0])
# if there is no split, then assume its one board, located at 0
boards = [0] if len(pieces) == 1 else _parse_bmp_boards(pieces[1])
port_num = None if port_num is None else int(port_num)
return BMPConnectionData(cabinet, frame, hostname, boards, port_num)
return BMPConnectionData(hostname, boards, port_num)


def _parse_bmp_details(bmp_string):
Expand All @@ -168,9 +159,11 @@ def _parse_bmp_details(bmp_string):

:param str bmp_string: the BMP string to be converted
:return: the BMP connection data
:rtype: list(~.BMPConnectionData) or None
:rtype: ~.BMPConnectionData or None
"""
if bmp_string is None or bmp_string == "None":
return None
return [_parse_bmp_connection(bmp_connection)
for bmp_connection in bmp_string.split(":")]
if ":" in bmp_string:
raise NotImplementedError(
"bmp_names can no longer contain multiple bmps")
return _parse_bmp_connection(bmp_string)