Return a configs for that section.
(self, name, section)
| 501 | return "<PackageConfigYaml %s>" % self.name |
| 502 | |
| 503 | def get(self, name, section): |
| 504 | """Return a configs for that section.""" |
| 505 | result = self.data.get(name) |
| 506 | |
| 507 | if result is not None: |
| 508 | result = result.get(section, ()) |
| 509 | else: |
| 510 | result = () |
| 511 | |
| 512 | if section in ( |
| 513 | "options", |
| 514 | "variables", |
| 515 | "constants", |
| 516 | ) and type( |
| 517 | result |
| 518 | ) in (dict, OrderedDict): |
| 519 | result = (result,) |
| 520 | |
| 521 | if type(result) is list: |
| 522 | result = tuple(result) |
| 523 | |
| 524 | # Ensure result is a tuple; otherwise exit with an error |
| 525 | if not isinstance(result, tuple): |
| 526 | self.logger.sysexit( |
| 527 | "Error, unexpected result type %s for %s module %s section %s." |
| 528 | % (type(result), self.name, name, section) |
| 529 | ) |
| 530 | |
| 531 | if result and (name, section) not in self.checked_sections: |
| 532 | checkSectionValues(self.logger, self.name, name, section, result) |
| 533 | self.checked_sections.add((name, section)) |
| 534 | |
| 535 | return result |
| 536 | |
| 537 | def keys(self): |
| 538 | return self.data.keys() |
no test coverage detected