MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / printable_dependency_version

Function printable_dependency_version

archivebox/logging_util.py:638–665  ·  view source on GitHub ↗
(name: str, dependency: Dict)

Source from the content-addressed store, hash-verified

636
637@enforce_types
638def 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 ))

Callers 1

versionFunction · 0.85

Calls 1

pretty_pathFunction · 0.85

Tested by

no test coverage detected