| Conditions | 1 |
| Total Lines | 128 |
| Code Lines | 72 |
| 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.""" |
||
| 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 | |||
| 75 | links["S1:2<->User1:1"].extend_metadata( |
||
| 76 | {"reliability": 5, "bandwidth": 100, "delay": 1} |
||
| 77 | ) |
||
| 78 | |||
| 79 | links["S2:2<->User4:1"].extend_metadata( |
||
| 80 | {"reliability": 5, "bandwidth": 100, "delay": 10} |
||
| 81 | ) |
||
| 82 | |||
| 83 | links["S3:1<->S5:1"].extend_metadata( |
||
| 84 | {"reliability": 5, "bandwidth": 10, "delay": 112} |
||
| 85 | ) |
||
| 86 | |||
| 87 | links["S3:2<->S7:1"].extend_metadata( |
||
| 88 | {"reliability": 5, "bandwidth": 100, "delay": 1} |
||
| 89 | ) |
||
| 90 | |||
| 91 | links["S3:3<->S8:1"].extend_metadata( |
||
| 92 | {"reliability": 5, "bandwidth": 100, "delay": 1} |
||
| 93 | ) |
||
| 94 | |||
| 95 | links["S3:4<->S11:1"].extend_metadata( |
||
| 96 | {"reliability": 3, "bandwidth": 100, "delay": 6} |
||
| 97 | ) |
||
| 98 | |||
| 99 | links["S3:5<->User3:1"].extend_metadata( |
||
| 100 | {"reliability": 5, "bandwidth": 100, "delay": 1} |
||
| 101 | ) |
||
| 102 | |||
| 103 | links["S3:6<->User4:2"].extend_metadata( |
||
| 104 | {"reliability": 5, "bandwidth": 100, "delay": 10} |
||
| 105 | ) |
||
| 106 | |||
| 107 | links["S4:1<->S5:2"].extend_metadata( |
||
| 108 | { |
||
| 109 | "reliability": 1, |
||
| 110 | "bandwidth": 100, |
||
| 111 | "delay": 30, |
||
| 112 | "ownership": {"A": {}}, |
||
| 113 | } |
||
| 114 | ) |
||
| 115 | |||
| 116 | links["S4:2<->User1:2"].extend_metadata( |
||
| 117 | { |
||
| 118 | "reliability": 3, |
||
| 119 | "bandwidth": 100, |
||
| 120 | "delay": 110, |
||
| 121 | "ownership": {"A": {}}, |
||
| 122 | } |
||
| 123 | ) |
||
| 124 | |||
| 125 | links["S5:3<->S6:1"].extend_metadata( |
||
| 126 | {"reliability": 1, "bandwidth": 100, "delay": 40} |
||
| 127 | ) |
||
| 128 | |||
| 129 | links["S5:4<->S6:2"].extend_metadata( |
||
| 130 | { |
||
| 131 | "reliability": 3, |
||
| 132 | "bandwidth": 100, |
||
| 133 | "delay": 40, |
||
| 134 | "ownership": {"A": {}}, |
||
| 135 | } |
||
| 136 | ) |
||
| 137 | |||
| 138 | links["S5:5<->S8:2"].extend_metadata( |
||
| 139 | {"reliability": 5, "bandwidth": 100, "delay": 112} |
||
| 140 | ) |
||
| 141 | |||
| 142 | links["S5:6<->User1:3"].extend_metadata( |
||
| 143 | {"reliability": 3, "bandwidth": 100, "delay": 60} |
||
| 144 | ) |
||
| 145 | |||
| 146 | links["S6:3<->S9:1"].extend_metadata( |
||
| 147 | {"reliability": 3, "bandwidth": 100, "delay": 60} |
||
| 148 | ) |
||
| 149 | |||
| 150 | links["S6:4<->S9:2"].extend_metadata( |
||
| 151 | {"reliability": 5, "bandwidth": 100, "delay": 62} |
||
| 152 | ) |
||
| 153 | |||
| 154 | links["S6:5<->S10:1"].extend_metadata( |
||
| 155 | {"bandwidth": 100, "delay": 108, "ownership": {"A": {}}} |
||
| 156 | ) |
||
| 157 | |||
| 158 | links["S7:2<->S8:3"].extend_metadata( |
||
| 159 | {"reliability": 5, "bandwidth": 100, "delay": 1} |
||
| 160 | ) |
||
| 161 | |||
| 162 | links["S8:4<->S9:3"].extend_metadata( |
||
| 163 | {"reliability": 3, "bandwidth": 100, "delay": 32} |
||
| 164 | ) |
||
| 165 | |||
| 166 | links["S8:5<->S9:4"].extend_metadata( |
||
| 167 | {"reliability": 3, "bandwidth": 100, "delay": 110} |
||
| 168 | ) |
||
| 169 | |||
| 170 | links["S8:6<->S10:2"].extend_metadata( |
||
| 171 | {"reliability": 5, "bandwidth": 100, "ownership": {"A": {}}} |
||
| 172 | ) |
||
| 173 | |||
| 174 | links["S8:7<->S11:2"].extend_metadata( |
||
| 175 | {"reliability": 3, "bandwidth": 100, "delay": 7} |
||
| 176 | ) |
||
| 177 | |||
| 178 | links["S8:8<->User3:2"].extend_metadata( |
||
| 179 | {"reliability": 5, "bandwidth": 100, "delay": 1} |
||
| 180 | ) |
||
| 181 | |||
| 182 | links["S10:3<->User2:1"].extend_metadata( |
||
| 183 | { |
||
| 184 | "reliability": 3, |
||
| 185 | "bandwidth": 100, |
||
| 186 | "delay": 10, |
||
| 187 | "ownership": {"A": {}}, |
||
| 188 | } |
||
| 189 | ) |
||
| 190 | |||
| 191 | links["S11:3<->User2:2"].extend_metadata( |
||
| 192 | {"reliability": 3, "bandwidth": 100, "delay": 6} |
||
| 193 | ) |
||
| 194 | |||
| 195 | links["User1:4<->User4:3"].extend_metadata( |
||
| 196 | {"reliability": 5, "bandwidth": 10, "delay": 105} |
||
| 197 | ) |
||
| 278 |