Remove names from VectorFunction init signature

This is a rare backwards compatibility break, risked only because
`VectorFunction` initialization never been documented, and because a
search of GitHub revealed not projects that were instantiating it
directly.  Eliminating the need to define and copy these two strings
from object to object makes the code more tractable, especially as I get
Kepler orbits closer to production status.  The attributes ``center``
and ``target`` themselves will now, when needed, be strings explaining
what celestial bodies are involved.
This commit is contained in:
Brandon Rhodes 2020-06-10 11:45:05 -04:00
parent 165a3e0778
commit 9a313a3b23
2 changed files with 2 additions and 5 deletions

View File

@ -169,7 +169,7 @@ class SpiceKernel(object):
chain = chain[::-1]
center = chain[0].center
target = chain[-1].target
return VectorSum(center, target, None, None, chain, ())
return VectorSum(center, target, chain, ())
def __contains__(self, name_or_code):
if isinstance(name_or_code, int):

View File

@ -39,7 +39,6 @@ class VectorFunction(object):
othern = getattr(other, 'negatives', ())
return VectorSum(self.center, other.target,
self.center_name, other.target_name,
selfp + otherp, selfn + othern)
def __sub__(self, other):
@ -56,7 +55,6 @@ class VectorFunction(object):
othern = getattr(other, 'negatives', ())
return VectorSum(other.target, self.target,
other.target_name, self.target_name,
selfp + othern, selfn + otherp)
@raise_error_for_deprecated_time_arguments
@ -159,8 +157,7 @@ previously hiding inside the old method:
class VectorSum(VectorFunction):
def __init__(self, center, target, center_name, target_name,
positives, negatives):
def __init__(self, center, target, positives, negatives):
self.center = center
self.target = target
self.positives = positives