eric6/DebugClients/Python/coverage/config.py

changeset 7702
f8b97639deb5
parent 7427
362cd1b6f81a
equal deleted inserted replaced
7701:25f42e208e08 7702:f8b97639deb5
70 d = {} 70 d = {}
71 for opt in self.options(section): 71 for opt in self.options(section):
72 d[opt] = self.get(section, opt) 72 d[opt] = self.get(section, opt)
73 return d 73 return d
74 74
75 def get(self, section, option, *args, **kwargs): # pylint: disable=arguments-differ 75 def get(self, section, option, *args, **kwargs):
76 """Get a value, replacing environment variables also. 76 """Get a value, replacing environment variables also.
77 77
78 The arguments are the same as `RawConfigParser.get`, but in the found 78 The arguments are the same as `RawConfigParser.get`, but in the found
79 value, ``$WORD`` or ``${WORD}`` are replaced by the value of the 79 value, ``$WORD`` or ``${WORD}`` are replaced by the value of the
80 environment variable ``WORD``. 80 environment variable ``WORD``.
193 self.plugins = [] 193 self.plugins = []
194 self.relative_files = False 194 self.relative_files = False
195 self.run_include = None 195 self.run_include = None
196 self.run_omit = None 196 self.run_omit = None
197 self.source = None 197 self.source = None
198 self.source_pkgs = []
198 self.timid = False 199 self.timid = False
199 self._crash = None 200 self._crash = None
200 201
201 # Defaults for [report] 202 # Defaults for [report]
202 self.exclude_list = DEFAULT_EXCLUDE[:] 203 self.exclude_list = DEFAULT_EXCLUDE[:]
209 self.precision = 0 210 self.precision = 0
210 self.report_contexts = None 211 self.report_contexts = None
211 self.show_missing = False 212 self.show_missing = False
212 self.skip_covered = False 213 self.skip_covered = False
213 self.skip_empty = False 214 self.skip_empty = False
215 self.sort = None
214 216
215 # Defaults for [html] 217 # Defaults for [html]
216 self.extra_css = None 218 self.extra_css = None
217 self.html_dir = "htmlcov" 219 self.html_dir = "htmlcov"
218 self.html_title = "Coverage report" 220 self.html_title = "Coverage report"
323 else: 325 else:
324 used = any_set 326 used = any_set
325 327
326 if used: 328 if used:
327 self.config_file = os.path.abspath(filename) 329 self.config_file = os.path.abspath(filename)
328 with open(filename) as f: 330 with open(filename, "rb") as f:
329 self._config_contents = f.read() 331 self._config_contents = f.read()
330 332
331 return used 333 return used
332 334
333 def copy(self): 335 def copy(self):
358 ('plugins', 'run:plugins', 'list'), 360 ('plugins', 'run:plugins', 'list'),
359 ('relative_files', 'run:relative_files', 'boolean'), 361 ('relative_files', 'run:relative_files', 'boolean'),
360 ('run_include', 'run:include', 'list'), 362 ('run_include', 'run:include', 'list'),
361 ('run_omit', 'run:omit', 'list'), 363 ('run_omit', 'run:omit', 'list'),
362 ('source', 'run:source', 'list'), 364 ('source', 'run:source', 'list'),
365 ('source_pkgs', 'run:source_pkgs', 'list'),
363 ('timid', 'run:timid', 'boolean'), 366 ('timid', 'run:timid', 'boolean'),
364 ('_crash', 'run:_crash'), 367 ('_crash', 'run:_crash'),
365 368
366 # [report] 369 # [report]
367 ('exclude_list', 'report:exclude_lines', 'regexlist'), 370 ('exclude_list', 'report:exclude_lines', 'regexlist'),
419 section of the config file would be indicated with `"run:branch"`. 422 section of the config file would be indicated with `"run:branch"`.
420 423
421 `value` is the new value for the option. 424 `value` is the new value for the option.
422 425
423 """ 426 """
427 # Special-cased options.
428 if option_name == "paths":
429 self.paths = value
430 return
424 431
425 # Check all the hard-coded options. 432 # Check all the hard-coded options.
426 for option_spec in self.CONFIG_FILE_OPTIONS: 433 for option_spec in self.CONFIG_FILE_OPTIONS:
427 attr, where = option_spec[:2] 434 attr, where = option_spec[:2]
428 if where == option_name: 435 if where == option_name:
446 section of the config file would be indicated with `"run:branch"`. 453 section of the config file would be indicated with `"run:branch"`.
447 454
448 Returns the value of the option. 455 Returns the value of the option.
449 456
450 """ 457 """
458 # Special-cased options.
459 if option_name == "paths":
460 return self.paths
461
451 # Check all the hard-coded options. 462 # Check all the hard-coded options.
452 for option_spec in self.CONFIG_FILE_OPTIONS: 463 for option_spec in self.CONFIG_FILE_OPTIONS:
453 attr, where = option_spec[:2] 464 attr, where = option_spec[:2]
454 if where == option_name: 465 if where == option_name:
455 return getattr(self, attr) 466 return getattr(self, attr)

eric ide

mercurial