← 输入框|github.com|刷新
Skip to content

VersionInfo string representation #72

Closed

Description

@smarie

It seems that the string representation is not available from VersionInfo. It should be quite straightforward to do with a custom string representation method:

def __str__(self) -> str:
    return (str(version.major) or '') \
           + (('.' + str(version.minor)) if version.minor is not None else '') \
           + (('.' + str(version.patch)) if version.patch is not None else '') \
           + (('-' + str(version.prerelease)) if version.prerelease is not None else '') \
           + (('+' + str(version.build)) if version.build is not None else '')

Note that we can keep __repr__ untouched so that it provides unambiguous representation.

Activity

  1. changed the title [-]Getter for the original string in VersionInfo[/-] [+]VersionInfo string representation[/+] on Mar 8, 2018
  2. s-celles commented on May 11, 2018

    @s-celles
    Member

    __hash__ should also be implemented #73 (probably with a similar method)

  3. added a commit that references this issue on May 15, 2018
    3dfd54f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    SIze

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions