-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
94 lines (86 loc) · 3.77 KB
/
utils.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
Chanel_name = []
for n in range(0, 100):
Chanel_name.append(f"CH_{n}")
class Utils:
# конструктор
def __init__(self, name):
self.name = name # устанавливаем имя
self.base = []
self.m1_50 = ""
self.m51_100 = ""
self.m101_150 = ""
self.m151_200 = ""
self.connectors=["p1","p2","p3","p4"]
def add_module_pxi2569(self):
# m1_50
if self.m1_50 == "p1":
for i in range(1, 51):
self.base.append([f"M_{i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m1_50 == "p2":
for i in range(1, 51):
self.base.append([f"M_{51 - i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m1_50 == "p3":
for i in range(1, 51):
self.base.append([f"M_{i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
if self.m1_50 == "p4":
for i in range(1, 51):
self.base.append([f"M_{51 - i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
# m51_100
if self.m51_100 == "p1":
for i in range(1, 51):
self.base.append([f"M_{50 + i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m51_100 == "p2":
for i in range(1, 51):
self.base.append([f"M_{101 - i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m51_100 == "p3":
for i in range(1, 51):
self.base.append([f"M_{50 + i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
if self.m51_100 == "p4":
for i in range(1, 51):
self.base.append([f"M_{101 - i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
# m101_150
if self.m101_150 == "p1":
for i in range(1, 51):
self.base.append([f"M_{100 + i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m101_150 == "p2":
for i in range(1, 51):
self.base.append([f"M_{151 - i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m101_150 == "p3":
for i in range(1, 51):
self.base.append([f"M_{100 + i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
if self.m101_150 == "p4":
for i in range(1, 51):
self.base.append([f"M_{151 - i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
# m151_200
if self.m151_200 == "p1":
for i in range(1, 51):
self.base.append([f"M_{150 + i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m151_200 == "p2":
for i in range(1, 51):
self.base.append([f"M_{201 - i}", Chanel_name[100 - i * 2 + 1], Chanel_name[100 - i * 2 + 1]])
if self.m151_200 == "p3":
for i in range(1, 51):
self.base.append([f"M_{150 + i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
if self.m151_200 == "p4":
for i in range(1, 51):
self.base.append([f"M_{201 - i}", Chanel_name[100 - i * 2], Chanel_name[100 - i * 2]])
def generate_links(self):
self.add_module_pxi2569()
def process_node(self, node):
links = []
for link in self.base:
if link[0] == node:
links.append(link)
for link2 in self.base:
if link2[1] == link[1] and link2[0] != link[0]:
links.append(link2)
return links
def display_info(self):
print("", self.name)
# ut = Utils("ss")
# ut.m151_200 = "p2"
# ut.m1_50 = "p1"
#
# ut.add_module_pxi2569()
# print(ut.process_node("M_156"))
# print(ut.base)