Coverage for /usr/lib/python3/dist-packages/sympy/core/core.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-14 15:55 +0200

1""" The core's core. """ 

2from __future__ import annotations 

3 

4 

5# used for canonical ordering of symbolic sequences 

6# via __cmp__ method: 

7# FIXME this is *so* irrelevant and outdated! 

8ordering_of_classes = [ 

9 # singleton numbers 

10 'Zero', 'One', 'Half', 'Infinity', 'NaN', 'NegativeOne', 'NegativeInfinity', 

11 # numbers 

12 'Integer', 'Rational', 'Float', 

13 # singleton symbols 

14 'Exp1', 'Pi', 'ImaginaryUnit', 

15 # symbols 

16 'Symbol', 'Wild', 'Temporary', 

17 # arithmetic operations 

18 'Pow', 'Mul', 'Add', 

19 # function values 

20 'Derivative', 'Integral', 

21 # defined singleton functions 

22 'Abs', 'Sign', 'Sqrt', 

23 'Floor', 'Ceiling', 

24 'Re', 'Im', 'Arg', 

25 'Conjugate', 

26 'Exp', 'Log', 

27 'Sin', 'Cos', 'Tan', 'Cot', 'ASin', 'ACos', 'ATan', 'ACot', 

28 'Sinh', 'Cosh', 'Tanh', 'Coth', 'ASinh', 'ACosh', 'ATanh', 'ACoth', 

29 'RisingFactorial', 'FallingFactorial', 

30 'factorial', 'binomial', 

31 'Gamma', 'LowerGamma', 'UpperGamma', 'PolyGamma', 

32 'Erf', 

33 # special polynomials 

34 'Chebyshev', 'Chebyshev2', 

35 # undefined functions 

36 'Function', 'WildFunction', 

37 # anonymous functions 

38 'Lambda', 

39 # Landau O symbol 

40 'Order', 

41 # relational operations 

42 'Equality', 'Unequality', 'StrictGreaterThan', 'StrictLessThan', 

43 'GreaterThan', 'LessThan', 

44] 

45 

46 

47class Registry: 

48 """ 

49 Base class for registry objects. 

50 

51 Registries map a name to an object using attribute notation. Registry 

52 classes behave singletonically: all their instances share the same state, 

53 which is stored in the class object. 

54 

55 All subclasses should set `__slots__ = ()`. 

56 """ 

57 __slots__ = () 

58 

59 def __setattr__(self, name, obj): 

60 setattr(self.__class__, name, obj) 

61 

62 def __delattr__(self, name): 

63 delattr(self.__class__, name)