ortk95 / planetmapper

PlanetMapper: An open source Python package for visualising, navigating and mapping Solar System observations
https://planetmapper.readthedocs.io
MIT License
10 stars 1 forks source link

Add `replace` method to objects #347

Closed ortk95 closed 4 months ago

ortk95 commented 4 months ago

Adds a replace method to objects, to allow e.g. a new Body instance to be created with some parameters replaced:

body = planetmapper.Body('jupiter', '2020-01-01', observer='earth')
new = body.replace(utc='2020-01-01T12:34:56', observer='hst')
print(body)
# Body('JUPITER', '2020-01-01T00:00:00.000000', observer='EARTH')
print(new)
# Body('JUPITER', '2020-01-01T12:34:56.000000', observer='HST')

This also adds the corresponding __replace__ method to properly interface with the stdlib's copy.replace.

345

Pull request checklist

See CONTRIBUTING.md for more details.

coveralls commented 4 months ago

Pull Request Test Coverage Report for Build 8722245095

Details


Totals Coverage Status
Change from base Build 8554926061: 0.0%
Covered Lines: 2894
Relevant Lines: 2906

💛 - Coveralls