| Conditions | 1 |
| Total Lines | 56 |
| Code Lines | 51 |
| 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 help to create tests.""" |
||
| 47 | def topology_setting(): |
||
| 48 | """Set the default values associated |
||
| 49 | to a "real" topology.""" |
||
| 50 | switches_to_interface_counts = {"S1": 2, "S2": 2, "S3": 6, "S4": 2, |
||
| 51 | "S5": 6, "S6": 5, "S7": 2, "S8": 8, |
||
| 52 | "S9": 4, "S10": 3, "S11": 3, |
||
| 53 | "User1": 4, "User2": 2, |
||
| 54 | "User3": 2, "User4": 3} |
||
| 55 | |||
| 56 | links_to_interfaces = [["S1:1", "S2:1"], ["S1:2", "User1:1"], |
||
| 57 | ["S2:2", "User4:1"], ["S3:1", "S5:1"], |
||
| 58 | ["S3:2", "S7:1"], ["S3:3", "S8:1"], |
||
| 59 | ["S3:4", "S11:1"], |
||
| 60 | ["S3:5", "User3:1"], ["S3:6", "User4:2"], |
||
| 61 | ["S4:1", "S5:2"], ["S4:2", "User1:2"], |
||
| 62 | ["S5:3", "S6:1"], |
||
| 63 | ["S5:4", "S6:2"], ["S5:5", "S8:2"], |
||
| 64 | ["S5:6", "User1:3"], ["S6:3", "S9:1"], |
||
| 65 | ["S6:4", "S9:2"], ["S6:5", "S10:1"], |
||
| 66 | ["S7:2", "S8:3"], |
||
| 67 | ["S8:4", "S9:3"], ["S8:5", "S9:4"], |
||
| 68 | ["S8:6", "S10:2"], |
||
| 69 | ["S8:7", "S11:2"], ["S8:8", "User3:2"], |
||
| 70 | ["S10:3", "User2:1"], ["S11:3", "User2:2"], |
||
| 71 | ["User1:4", "User4:3"]] |
||
| 72 | |||
| 73 | links_to_metadata = [ |
||
| 74 | {"reliability": 5, "bandwidth": 100, "delay": 105}, |
||
| 75 | {"reliability": 5, "bandwidth": 100, "delay": 1}, |
||
| 76 | {"reliability": 5, "bandwidth": 100, "delay": 10}, |
||
| 77 | {"reliability": 5, "bandwidth": 10, "delay": 112}, |
||
| 78 | {"reliability": 5, "bandwidth": 100, "delay": 1}, |
||
| 79 | {"reliability": 5, "bandwidth": 100, "delay": 1}, |
||
| 80 | {"reliability": 3, "bandwidth": 100, "delay": 6}, |
||
| 81 | {"reliability": 5, "bandwidth": 100, "delay": 1}, |
||
| 82 | {"reliability": 5, "bandwidth": 100, "delay": 10}, |
||
| 83 | {"reliability": 1, "bandwidth": 100, "delay": 30, "ownership": "A"}, |
||
| 84 | {"reliability": 3, "bandwidth": 100, "delay": 110, "ownership": "A"}, |
||
| 85 | {"reliability": 1, "bandwidth": 100, "delay": 40}, |
||
| 86 | {"reliability": 3, "bandwidth": 100, "delay": 40, "ownership": "A"}, |
||
| 87 | {"reliability": 5, "bandwidth": 100, "delay": 112}, |
||
| 88 | {"reliability": 3, "bandwidth": 100, "delay": 60}, |
||
| 89 | {"reliability": 3, "bandwidth": 100, "delay": 60}, |
||
| 90 | {"reliability": 5, "bandwidth": 100, "delay": 62}, |
||
| 91 | {"bandwidth": 100, "delay": 108, "ownership": "A"}, |
||
| 92 | {"reliability": 5, "bandwidth": 100, "delay": 1}, |
||
| 93 | {"reliability": 3, "bandwidth": 100, "delay": 32}, |
||
| 94 | {"reliability": 3, "bandwidth": 100, "delay": 110}, |
||
| 95 | {"reliability": 5, "bandwidth": 100, "ownership": "A"}, |
||
| 96 | {"reliability": 3, "bandwidth": 100, "delay": 7}, |
||
| 97 | {"reliability": 5, "bandwidth": 100, "delay": 1}, |
||
| 98 | {"reliability": 3, "bandwidth": 100, "delay": 10, "ownership": "A"}, |
||
| 99 | {"reliability": 3, "bandwidth": 100, "delay": 6}, |
||
| 100 | {"reliability": 5, "bandwidth": 10, "delay": 105}] |
||
| 101 | |||
| 102 | return links_to_interfaces, links_to_metadata, switches_to_interface_counts |
||
| 103 | |||
| 189 |