def __init__(self, ip, slot=<NUM_LIT:1>, max_slot=<NUM_LIT:32>, parent=None):
super().__init__(parent)<EOL>self.setWindowTitle("<STR_LIT>")<EOL>self.max_dn = max_slot - slot<EOL>assert(isinstance(slot, int))<EOL>ip_nums=[]<EOL>for part in ip.split("<STR_LIT:.>"):<EOL><INDENT>ip_nums.append(int(part))<EOL><DEDENT>self.start_ip_text = ip<EOL>self.min_num = ip_nums.pop(-<NUM_LIT:1>) <EOL>self.max_num = self.min_num + self.max_dn<EOL>self.min_slot = slot<EOL>self.stop_ip_text ="<STR_LIT>"<EOL>for part in ip_nums:<EOL><INDENT>self.stop_ip_text += str(part)+"<STR_LIT:.>"<EOL><DEDENT>self.lay = QtWidgets.QVBoxLayout(self)<EOL>self.field = QtWidgets.QWidget(self)<EOL>self.buttons = QtWidgets.QWidget(self)<EOL>self.lay.addWidget(self.field)<EOL>self.lay.addWidget(self.buttons)<EOL>self.field_lay = QtWidgets.QGridLayout(self.field)<EOL>self.buttons_lay = QtWidgets.QHBoxLayout(self.buttons)<EOL>self.ip_label = QtWidgets.QLabel("<STR_LIT>", self.field)<EOL>self.slot_label = QtWidgets.QLabel("<STR_LIT>", self.field)<EOL>self.field_lay.addWidget(self.ip_label, <NUM_LIT:0>, <NUM_LIT:0>)<EOL>self.field_lay.addWidget(self.slot_label, <NUM_LIT:1>, <NUM_LIT:0>)<EOL>self.ip_field = QtWidgets.QWidget(self.field)<EOL>self.slot_field = QtWidgets.QWidget(self.field)<EOL>self.field_lay.addWidget(self.ip_field, <NUM_LIT:0>, <NUM_LIT:1>)<EOL>self.field_lay.addWidget(self.slot_field, <NUM_LIT:1>, <NUM_LIT:1>)<EOL>self.write_button = QtWidgets.QPushButton("<STR_LIT>", self.buttons)<EOL>self.cancel_button = QtWidgets.QPushButton("<STR_LIT>", self.buttons)<EOL>self.buttons_lay.addWidget(self.write_button, <NUM_LIT:2>, <NUM_LIT:0>)<EOL>self.buttons_lay.addWidget(self.cancel_button, <NUM_LIT:3>, <NUM_LIT:0>)<EOL>self.ip_field_lay = QtWidgets.QHBoxLayout(self.ip_field)<EOL>self.slot_field_lay = QtWidgets.QHBoxLayout(self.slot_field)<EOL>self.ip_field_label = QtWidgets.QLabel(<EOL>self.start_ip_text + <EOL>"<STR_LIT>" + <EOL>self.stop_ip_text)<EOL>self.ip_field_input = QtWidgets.QSpinBox(self.ip_field)<EOL>self.ip_field_lay.addWidget(self.ip_field_label)<EOL>self.ip_field_lay.addWidget(self.ip_field_input)<EOL>self.ip_field_input.setMinimum(self.min_num)<EOL>self.ip_field_input.setMaximum(self.max_num)<EOL>self.slot_field_label = QtWidgets.QLabel(self.slot_field) <EOL>self.slot_field_lay.addWidget(self.slot_field_label)<EOL>self.ip_field_input.valueChanged.connect(self.update_ip_slot)<EOL>self.write_button.clicked.connect(lambda: self.done(<NUM_LIT:1>))<EOL>self.cancel_button.clicked.connect(lambda: self.done(<NUM_LIT:0>))<EOL>self.update_ip_slot(self.min_num)<EOL>
ip corresponds to slot

max ip = ip + (max_slot - slot)