def __init__(self, s: Union[('Version', str)]):
    if isinstance(s, Version):
        s = str(s)
    elif (not isinstance(s, str)):
        raise TypeError('expected Version or str, got {}'.format(type(s).__name__))
    commit_distance: Optional[int]
    sha: Optional[str]
    match = re.match('(.*)-(\\d+)-g([0-9a-f]{7})', s)
    if match:
        s = match.group(1)
        commit_distance = int(match.group(2))
        sha = match.group(3)
    else:
        commit_distance = None
        sha = None
    super().__init__(s)
    self.commit_distance = commit_distance
    self.sha = sha
def __init__(self, s: Union[('Version', str)]):
    if isinstance(s, Version):
        s = str(s)
    elif (not isinstance(s, str)):
        raise TypeError('expected Version or str, got {}'.format(type(s).__name__))
    commit_distance: Optional[int]
    sha: Optional[str]
    match = re.match('(.*)-(\\d+)-g([0-9a-f]{7})', s)
    if match:
        s = match.group(1)
        commit_distance = int(match.group(2))
        sha = match.group(3)
    else:
        commit_distance = None
        sha = None
    super().__init__(s)
    self.commit_distance = commit_distance
    self.sha = sha