Skip to content

Commit ff11aa1

Browse files
eric-wieserutensil
authored andcommitted
Remove unused and undocumented setGa method (#163)
Storing a ga globally like this isn't a good idea. Additionally, it's very confusing that both `some_dop.ga` and `some_dop.Ga` exist, but the former is always `None`. If anyone was actually using this, they can always use ```python import functools Pdop = functools.partial(Pdop, ga=my_ga) Sdop = functools.partial(Sdop, ga=my_ga) Dop = functools.partial(Dop, ga=my_ga) ```
1 parent 88d20f3 commit ff11aa1

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

galgebra/mv.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,15 +1433,8 @@ class Sdop(object):
14331433

14341434
init_slots = {'ga': (None, 'Associated geometric algebra')}
14351435

1436-
ga = None
14371436
str_mode = False
14381437

1439-
@staticmethod
1440-
def setGa(ga):
1441-
Sdop.ga = ga
1442-
Pdop.setGa(ga)
1443-
return
1444-
14451438
def TSimplify(self):
14461439
return Sdop([
14471440
(metric.Simp.apply(coef), pdiff) for (coef, pdiff) in self.terms
@@ -1566,10 +1559,7 @@ def __init__(self, *args, **kwargs):
15661559
self.Ga = kwargs['ga'] # Associated geometric algebra (coords)
15671560

15681561
if self.Ga is None:
1569-
if Sdop.ga is None:
1570-
raise ValueError('In Sdop.__init__ self.Ga must be defined.')
1571-
else:
1572-
self.Ga = Sdop.ga
1562+
raise ValueError('In Sdop.__init__ self.Ga must be defined.')
15731563

15741564
if len(args[0]) == 1 and isinstance(args[0],Symbol): # Simple Pdop of order 1
15751565
self.terms = ((S(1), self.Ga.pdop(args[0])),)
@@ -1715,15 +1705,8 @@ class Pdop(object):
17151705
total number of differentiations
17161706
"""
17171707

1718-
ga = None
1719-
17201708
init_slots = {'ga': (None, 'Associated geometric algebra')}
17211709

1722-
@staticmethod
1723-
def setGa(ga):
1724-
Pdop.ga = ga
1725-
return
1726-
17271710
@staticmethod
17281711
def compare(pdop1, pdop2): # compare two Pdops
17291712
if pdop1.order > pdop2.order:
@@ -1774,10 +1757,7 @@ def __init__(self, *args, **kwargs):
17741757
self.order = 0
17751758

17761759
if self.Ga is None:
1777-
if Pdop.ga is None:
1778-
raise ValueError('In Pdop.__init__ self.Ga must be defined.')
1779-
else:
1780-
self.Ga = Pdop.ga # use geometric algebra of class Pdop
1760+
raise ValueError('In Pdop.__init__ self.Ga must be defined.')
17811761

17821762
if args[0] is None: # Pdop is the identity (1)
17831763
self.pdiffs = {}
@@ -1976,15 +1956,6 @@ class Dop(object):
19761956
'debug': (False, 'True to print out debugging information'),
19771957
'fmt_dop': (1, '1 for normal dop partial derivative formating')}
19781958

1979-
ga = None
1980-
1981-
1982-
@staticmethod
1983-
def setGa(ga): # set geometric algebra globally for all Dop's
1984-
Dop.ga = ga
1985-
Sdop.setGa(ga)
1986-
return
1987-
19881959
@staticmethod
19891960
def flatten_one_level(lst):
19901961
return [inner for outer in lst for inner in outer]
@@ -1997,10 +1968,7 @@ def __init__(self, *args, **kwargs):
19971968
self.Ga = kwargs['ga']
19981969

19991970
if self.Ga is None:
2000-
if Dop.ga is None:
2001-
raise ValueError('In Dop.__init__ self.Ga must be defined.')
2002-
else:
2003-
self.Ga = Dop.ga
1971+
raise ValueError('In Dop.__init__ self.Ga must be defined.')
20041972

20051973
self.dop_fmt = kwargs['fmt_dop'] # Partial derivative output format (default 1)
20061974
self.title = None

0 commit comments

Comments
 (0)