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""" |
||
71 | @staticmethod |
||
72 | def _add_metadata_to_links(links): |
||
73 | links["S1:1<->S2:1"].extend_metadata( |
||
74 | {"reliability": 5, "bandwidth": 100, "delay": 105}) |
||
75 | |||
76 | links["S1:2<->User1:1"].extend_metadata( |
||
77 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
78 | |||
79 | links["S2:2<->User4:1"].extend_metadata( |
||
80 | {"reliability": 5, "bandwidth": 100, "delay": 10}) |
||
81 | |||
82 | links["S3:1<->S5:1"].extend_metadata( |
||
83 | {"reliability": 5, "bandwidth": 10, "delay": 112}) |
||
84 | |||
85 | links["S3:2<->S7:1"].extend_metadata( |
||
86 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
87 | |||
88 | links["S3:3<->S8:1"].extend_metadata( |
||
89 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
90 | |||
91 | links["S3:4<->S11:1"].extend_metadata( |
||
92 | {"reliability": 3, "bandwidth": 100, "delay": 6}) |
||
93 | |||
94 | links["S3:5<->User3:1"].extend_metadata( |
||
95 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
96 | |||
97 | links["S3:6<->User4:2"].extend_metadata( |
||
98 | {"reliability": 5, "bandwidth": 100, "delay": 10}) |
||
99 | |||
100 | links["S4:1<->S5:2"].extend_metadata( |
||
101 | {"reliability": 1, "bandwidth": 100, "delay": 30, |
||
102 | "ownership": "A"}) |
||
103 | |||
104 | links["S4:2<->User1:2"].extend_metadata( |
||
105 | {"reliability": 3, "bandwidth": 100, "delay": 110, |
||
106 | "ownership": "A"}) |
||
107 | |||
108 | links["S5:3<->S6:1"].extend_metadata( |
||
109 | {"reliability": 1, "bandwidth": 100, "delay": 40}) |
||
110 | |||
111 | links["S5:4<->S6:2"].extend_metadata( |
||
112 | {"reliability": 3, "bandwidth": 100, "delay": 40, |
||
113 | "ownership": "A"}) |
||
114 | |||
115 | links["S5:5<->S8:2"].extend_metadata( |
||
116 | {"reliability": 5, "bandwidth": 100, "delay": 112}) |
||
117 | |||
118 | links["S5:6<->User1:3"].extend_metadata( |
||
119 | {"reliability": 3, "bandwidth": 100, "delay": 60}) |
||
120 | |||
121 | links["S6:3<->S9:1"].extend_metadata( |
||
122 | {"reliability": 3, "bandwidth": 100, "delay": 60}) |
||
123 | |||
124 | links["S6:4<->S9:2"].extend_metadata( |
||
125 | {"reliability": 5, "bandwidth": 100, "delay": 62}) |
||
126 | |||
127 | links["S6:5<->S10:1"].extend_metadata( |
||
128 | {"bandwidth": 100, "delay": 108, "ownership": "A"}) |
||
129 | |||
130 | links["S7:2<->S8:3"].extend_metadata( |
||
131 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
132 | |||
133 | links["S8:4<->S9:3"].extend_metadata( |
||
134 | {"reliability": 3, "bandwidth": 100, "delay": 32}) |
||
135 | |||
136 | links["S8:5<->S9:4"].extend_metadata( |
||
137 | {"reliability": 3, "bandwidth": 100, "delay": 110}) |
||
138 | |||
139 | links["S8:6<->S10:2"].extend_metadata( |
||
140 | {"reliability": 5, "bandwidth": 100, "ownership": "A"}) |
||
141 | |||
142 | links["S8:7<->S11:2"].extend_metadata( |
||
143 | {"reliability": 3, "bandwidth": 100, "delay": 7}) |
||
144 | |||
145 | links["S8:8<->User3:2"].extend_metadata( |
||
146 | {"reliability": 5, "bandwidth": 100, "delay": 1}) |
||
147 | |||
148 | links["S10:3<->User2:1"].extend_metadata( |
||
149 | {"reliability": 3, "bandwidth": 100, "delay": 10, |
||
150 | "ownership": "A"}) |
||
151 | |||
152 | links["S11:3<->User2:2"].extend_metadata( |
||
153 | {"reliability": 3, "bandwidth": 100, "delay": 6}) |
||
154 | |||
155 | links["User1:4<->User4:3"].extend_metadata( |
||
156 | {"reliability": 5, "bandwidth": 10, "delay": 105}) |
||
157 | |||
242 |