(name: str, dependency: Dict)
| 636 | |
| 637 | @enforce_types |
| 638 | def printable_dependency_version(name: str, dependency: Dict) -> str: |
| 639 | version = None |
| 640 | if dependency['enabled']: |
| 641 | if dependency['is_valid']: |
| 642 | color, symbol, note, version = 'green', '√', 'valid', '' |
| 643 | |
| 644 | parsed_version_num = re.search(r'[\d\.]+', dependency['version']) |
| 645 | if parsed_version_num: |
| 646 | version = f'v{parsed_version_num[0]}' |
| 647 | |
| 648 | if not version: |
| 649 | color, symbol, note, version = 'red', 'X', 'invalid', '?' |
| 650 | else: |
| 651 | color, symbol, note, version = 'lightyellow', '-', 'disabled', '-' |
| 652 | |
| 653 | path = pretty_path(dependency['path']) |
| 654 | |
| 655 | return ' '.join(( |
| 656 | ANSI[color], |
| 657 | symbol, |
| 658 | ANSI['reset'], |
| 659 | name.ljust(21), |
| 660 | version.ljust(14), |
| 661 | ANSI[color], |
| 662 | note.ljust(8), |
| 663 | ANSI['reset'], |
| 664 | path.ljust(76), |
| 665 | )) |
no test coverage detected