Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface/decorator for ValueType class #38

Open
capsulecorplab opened this issue Aug 19, 2018 · 0 comments
Open

Interface/decorator for ValueType class #38

capsulecorplab opened this issue Aug 19, 2018 · 0 comments
Labels
Hacktoberfest In celebration of open source help wanted Extra attention is needed needs design feedback Design implementation needs feedback

Comments

@capsulecorplab
Copy link
Contributor

capsulecorplab commented Aug 19, 2018

The ValueType class (in parametrics.py module) should inherit the UnitRegistry behavior from pint and astropy and still be a subclass of ModelElement. ValueType can be implemented as either a decorated class or subclass that inherits from both UnitRegistry objects/classes.

e.g.,

>>> kesselrun = 12*ValueType('parsecs')
>>> kesselrun
<ValueType(12, 'parsec')>
>>> kesselrun.magnitude
12
>>> str(kesselrun.units)
'parsec'
>>> kesselrun.to('lightyear')
<ValueType(39.138799173399406, 'light_year')>
>>> 2*kesselrun
<ValueType(24, 'parsec')>
>>> type(kesselrun)
ValueType
>>> isinstance(kesselrun, ModelElement)
True

Additional unit tests welcome.

@capsulecorplab capsulecorplab added the needs design feedback Design implementation needs feedback label Aug 19, 2018
@capsulecorplab capsulecorplab added the SysML Domain-knowledge of SysML is recommended for working on this issue label Sep 10, 2018
@capsulecorplab capsulecorplab changed the title Implement ValueType() class Implement ValueType() class - such that it inherits from pint's UnitRegistry and abc's ABC Oct 3, 2018
@capsulecorplab capsulecorplab changed the title Implement ValueType() class - such that it inherits from pint's UnitRegistry and abc's ABC Implement ValueType() Oct 16, 2018
@capsulecorplab capsulecorplab added help wanted Extra attention is needed Hacktoberfest In celebration of open source labels Oct 16, 2018
@capsulecorplab capsulecorplab changed the title Implement ValueType() Interface/decorator for ValueType class Jan 23, 2019
@capsulecorplab capsulecorplab removed the SysML Domain-knowledge of SysML is recommended for working on this issue label Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest In celebration of open source help wanted Extra attention is needed needs design feedback Design implementation needs feedback
Projects
None yet
Development

No branches or pull requests

1 participant