spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

Version repr does not reproduce object #71

Open jtniehof opened 3 years ago

jtniehof commented 3 years ago

repr() is meant to product a string that will reproduce the object if eval'd. The current __repr__ for Version doesn't.

Minimal example to reproduce issue:

import dbprocessing.Version
v = dbprocessing.Version.Version(1, 2, 3)
print(repr(v))
q = eval(repr(v))
print(v == q) # never even gets here

Error message/Traceback:

  File "<string>", line 1
    Version: 1.2.3
           ^
SyntaxError: invalid syntax

OS, Python version, and dependency version information:

Linux-4.4.0-98-generic-x86_64-with-Ubuntu-16.04-xenial
sys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0)
sqlalchemy=1.0.11

Version of dbprocessing

Off in a topic branch, but up to date with master from github.

Closure condition

repr is updated (probably should be something like Version(1, 2, 3)) and tested, and verified there are no side-effects (no places in the code that rely on the old behavior--which is the only reason I'm not just fixing it right now.)