| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c0a7837 commit 517ae80
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,12 @@ class AbstractEdits: | |||
| 22 | 22 | "cut_buffer": "there", | |
| 23 | 23 | } | |
| 24 | 24 | ||
| 25 | + def __init__(self, simple_edits=None, cut_buffer_edits=None): | ||
| 26 | + self.simple_edits = {} if simple_edits is None else simple_edits | ||
| 27 | + self.cut_buffer_edits = ( | ||
| 28 | + {} if cut_buffer_edits is None else cut_buffer_edits | ||
| 29 | + ) | ||
| 30 | + self.awaiting_config = {} | ||
| 25 | 31 | ||
| 26 | 32 | def add(self, key, func, overwrite=False): | |
| 27 | 33 | if key in self: | |
@@ -104,11 +110,6 @@ class UnconfiguredEdits(AbstractEdits): | |||
| 104 | 110 | Keys can't be added twice, config attributes can't be added twice. | |
| 105 | 111 | """ | |
| 106 | 112 | ||
| 107 | - def __init__(self): | ||
| 108 | - self.simple_edits = {} | ||
| 109 | - self.cut_buffer_edits = {} | ||
| 110 | - self.awaiting_config = {} | ||
| 111 | - | ||
| 112 | 113 | def mapping_with_config(self, config, key_dispatch): | |
| 113 | 114 | """Creates a new mapping object by applying a config object""" | |
| 114 | 115 | return ConfiguredEdits( | |
@@ -147,8 +148,7 @@ def __init__( | |||
| 147 | 148 | config, | |
| 148 | 149 | key_dispatch, | |
| 149 | 150 | ): | |
| 150 | - self.simple_edits = dict(simple_edits) | ||
| 151 | - self.cut_buffer_edits = dict(cut_buffer_edits) | ||
| 151 | + super().__init__(dict(simple_edits), dict(cut_buffer_edits)) | ||
| 152 | 152 | for attr, func in awaiting_config.items(): | |
| 153 | 153 | for key in key_dispatch[getattr(config, attr)]: | |
| 154 | 154 | super().add(key, func, overwrite=True) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments