| Conditions | 7 |
| Total Lines | 51 |
| Lines | 0 |
| Ratio | 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 | from collections import OrderedDict |
||
| 97 | continue |
||
| 98 | |||
| 99 | if comment == "" and keys == [] and value == "": |
||
| 100 | self.__add_comment(current_section, "", origin) |
||
| 101 | continue |
||
| 102 | |||
| 103 | if keys != []: |
||
| 104 | current_keys = keys |
||
| 105 | |||
| 106 | for section_override, key in current_keys: |
||
| 107 | if key == "": |
||
| 108 | continue |
||
| 109 | |||
| 110 | if section_override == "": |
||
| 111 | current_section.add_or_create_setting( |
||
| 112 | Setting(key, |
||
| 113 | value, |
||
| 114 | origin, |
||
| 115 | remove_empty_iter_elements= |
||
| 116 | self.__remove_empty_iter_elements), |
||
| 117 | allow_appending=(keys == [])) |
||
| 118 | else: |
||
| 119 | self.get_section( |
||
| 120 | section_override, |
||
| 121 | True).add_or_create_setting( |
||
| 122 | Setting(key, |
||
| 123 | value, |
||
| 124 | origin, |
||
| 125 | remove_empty_iter_elements= |
||
| 126 | self.__remove_empty_iter_elements), |
||
| 127 | allow_appending=(keys == [])) |
||
| 128 | |||
| 129 | def __init_sections(self): |
||
| 130 | self.sections = OrderedDict() |
||
| 131 | self.sections["default"] = Section("Default") |
||
| 132 | self.__rand_helper = 0 |
||
| 133 |