MCPcopy
hub / github.com/pandas-dev/pandas / get_versions

Function get_versions

pandas/_version.py:643–692  ·  view source on GitHub ↗

Get version information or return default if unable to do so.

()

Source from the content-addressed store, hash-verified

641
642
643def get_versions() -> dict:
644 """Get version information or return default if unable to do so."""
645 # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
646 # __file__, we can work backwards from there to the root. Some
647 # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
648 # case we can only use expanded keywords.
649
650 cfg = get_config()
651 verbose = cfg.verbose
652
653 try:
654 return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
655 except NotThisMethod:
656 pass
657
658 try:
659 root = os.path.realpath(__file__)
660 # versionfile_source is the relative path from the top of the source
661 # tree (where the .git directory might live) to this file. Invert
662 # this to find the root from __file__.
663 for _ in cfg.versionfile_source.split("/"):
664 root = os.path.dirname(root)
665 except NameError:
666 return {
667 "version": "0+unknown",
668 "full-revisionid": None,
669 "dirty": None,
670 "error": "unable to find root of source tree",
671 "date": None,
672 }
673
674 try:
675 pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
676 return render(pieces, cfg.style)
677 except NotThisMethod:
678 pass
679
680 try:
681 if cfg.parentdir_prefix:
682 return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
683 except NotThisMethod:
684 pass
685
686 return {
687 "version": "0+unknown",
688 "full-revisionid": None,
689 "dirty": None,
690 "error": "unable to compute version",
691 "date": None,
692 }

Callers 2

__init__.pyFile · 0.90
_get_commit_hashFunction · 0.90

Calls 7

get_configFunction · 0.85
get_keywordsFunction · 0.85
git_pieces_from_vcsFunction · 0.85
renderFunction · 0.85
versions_from_parentdirFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected