Conditions | 1 |
Total Lines | 86 |
Code Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | """Module to overwrite all the needed methods to test the KytosGraph in graph.py""" |
||
69 | @staticmethod |
||
70 | def _add_metadata_to_links(links): |
||
71 | links["S1:1<->S2:1"].extend_metadata( |
||
72 | {"reliability": 5, "bandwidth": 100, "delay": 105}) |
||
73 | |||
74 | links["S1:2<->User1:1"].extend_metadata( |
||
75 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
76 | |||
77 | links["S2:2<->User4:1"].extend_metadata( |
||
78 | {"reliability": 5, "bandwidth": 100, "delay": 10}) |
||
79 | |||
80 | links["S3:1<->S5:1"].extend_metadata( |
||
81 | {"reliability": 5, "bandwidth": 10, "delay": 112}) |
||
82 | |||
83 | links["S3:2<->S7:1"].extend_metadata( |
||
84 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
85 | |||
86 | links["S3:3<->S8:1"].extend_metadata( |
||
87 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
88 | |||
89 | links["S3:4<->S11:1"].extend_metadata( |
||
90 | {"reliability": 3, "bandwidth": 100, "delay": 6}) |
||
91 | |||
92 | links["S3:5<->User3:1"].extend_metadata( |
||
93 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
94 | |||
95 | links["S3:6<->User4:2"].extend_metadata( |
||
96 | {"reliability": 5, "bandwidth": 100, "delay": 10}) |
||
97 | |||
98 | links["S4:1<->S5:2"].extend_metadata( |
||
99 | {"reliability": 1, "bandwidth": 100, "delay": 30, |
||
100 | "ownership": "A"}) |
||
101 | |||
102 | links["S4:2<->User1:2"].extend_metadata( |
||
103 | {"reliability": 3, "bandwidth": 100, "delay": 110, |
||
104 | "ownership": "A"}) |
||
105 | |||
106 | links["S5:3<->S6:1"].extend_metadata( |
||
107 | {"reliability": 1, "bandwidth": 100, "delay": 40}) |
||
108 | |||
109 | links["S5:4<->S6:2"].extend_metadata( |
||
110 | {"reliability": 3, "bandwidth": 100, "delay": 40, |
||
111 | "ownership": "A"}) |
||
112 | |||
113 | links["S5:5<->S8:2"].extend_metadata( |
||
114 | {"reliability": 5, "bandwidth": 100, "delay": 112}) |
||
115 | |||
116 | links["S5:6<->User1:3"].extend_metadata( |
||
117 | {"reliability": 3, "bandwidth": 100, "delay": 60}) |
||
118 | |||
119 | links["S6:3<->S9:1"].extend_metadata( |
||
120 | {"reliability": 3, "bandwidth": 100, "delay": 60}) |
||
121 | |||
122 | links["S6:4<->S9:2"].extend_metadata( |
||
123 | {"reliability": 5, "bandwidth": 100, "delay": 62}) |
||
124 | |||
125 | links["S6:5<->S10:1"].extend_metadata( |
||
126 | {"bandwidth": 100, "delay": 108, "ownership": "A"}) |
||
127 | |||
128 | links["S7:2<->S8:3"].extend_metadata( |
||
129 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
130 | |||
131 | links["S8:4<->S9:3"].extend_metadata( |
||
132 | {"reliability": 3, "bandwidth": 100, "delay": 32}) |
||
133 | |||
134 | links["S8:5<->S9:4"].extend_metadata( |
||
135 | {"reliability": 3, "bandwidth": 100, "delay": 110}) |
||
136 | |||
137 | links["S8:6<->S10:2"].extend_metadata( |
||
138 | {"reliability": 5, "bandwidth": 100, "ownership": "A"}) |
||
139 | |||
140 | links["S8:7<->S11:2"].extend_metadata( |
||
141 | {"reliability": 3, "bandwidth": 100, "delay": 7}) |
||
142 | |||
143 | links["S8:8<->User3:2"].extend_metadata( |
||
144 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
145 | |||
146 | links["S10:3<->User2:1"].extend_metadata( |
||
147 | {"reliability": 3, "bandwidth": 100, "delay": 10, |
||
148 | "ownership": "A"}) |
||
149 | |||
150 | links["S11:3<->User2:2"].extend_metadata( |
||
151 | {"reliability": 3, "bandwidth": 100, "delay": 6}) |
||
152 | |||
153 | links["User1:4<->User4:3"].extend_metadata( |
||
154 | {"reliability": 5, "bandwidth": 10, "delay": 105}) |
||
155 | |||
210 | links["User1:4<->User4:3"] = Link(interfaces["User1:4"], interfaces["User4:3"]) |