Browse Source

Just use get() instead of pop()

Now that these are functions we don't need to
destroy the incoming configuration dictionary
by popping things from it.

Change-Id: I5d0ff032f0e7c9e79d39c3f5d533c43801502a8c
Joshua Harlow 4 years ago
parent
commit
87bcf0bb32
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      doc8/main.py

+ 4
- 4
doc8/main.py View File

@@ -151,10 +151,10 @@ def setup_logging(verbose):
151 151
 def scan(cfg):
152 152
     print("Scanning...")
153 153
     files = collections.deque()
154
-    ignored_paths = cfg.pop('ignore_path')
154
+    ignored_paths = cfg.get('ignore_path', [])
155 155
     files_ignored = 0
156
-    file_iter = utils.find_files(cfg.pop('paths', []),
157
-                                 cfg.pop('extension', []), ignored_paths)
156
+    file_iter = utils.find_files(cfg.get('paths', []),
157
+                                 cfg.get('extension', []), ignored_paths)
158 158
     for filename, ignoreable in file_iter:
159 159
         if ignoreable:
160 160
             files_ignored += 1
@@ -170,7 +170,7 @@ def scan(cfg):
170 170
 def validate(cfg, files):
171 171
     print("Validating...")
172 172
     error_counts = {}
173
-    ignoreables = frozenset(cfg.pop('ignore', []))
173
+    ignoreables = frozenset(cfg.get('ignore', []))
174 174
     while files:
175 175
         f = files.popleft()
176 176
         if cfg.get('verbose'):

Loading…
Cancel
Save