Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

# encoding: utf-8 

from __future__ import print_function, division, absolute_import 

 

import os 

 

from .bunch import Bunch 

 

 

""" 

# Some principles: 

 

- We implement "duplicate" classes for domain objects (which eg are created by parsing yaml files) 

and dbo objects from sqlalchemy, because sqlalchemy objects sometimes do some confusing "magic". 

Althouth this can be circumvented the resulting fixes makes code hard to understand and dangerous 

to modify if someone is not aware of this "magic". 

 

- We try to keep the domain objects and dbo objects as slick as possible. 

""" 

 

 

class RelPathMixin: 

 

def set_rel_path(self, rel_path): 

self._rel_path = rel_path 

 

@property 

def file_name(self): 

if self._rel_path is not None: 

return os.path.basename(self._rel_path) 

 

@property 

def rel_path(self): 

return self._rel_path 

 

 

class BunchBasedDomainObject(Bunch, RelPathMixin): 

 

def __init__(self, bunch, rel_path=None): 

super().__init__(bunch) 

self.set_rel_path(rel_path) 

 

 

class Site(BunchBasedDomainObject): 

pass 

 

 

class Signal(Bunch): 

pass 

 

 

class Picture(Bunch): 

pass 

 

 

class Parameter(Bunch): 

pass 

 

 

class Parameters(RelPathMixin): 

 

def __init__(self, parameters, rel_path): 

self.parameters = parameters 

self.set_rel_path(rel_path) 

 

def __str__(self): 

return str(self.Parameters) 

 

def __repr__(self): 

return repr(self.Parameters) 

 

def __iter__(self): 

return iter(self.parameters) 

 

 

class ParameterAveraging(BunchBasedDomainObject): 

pass 

 

 

class Source(BunchBasedDomainObject): 

pass 

 

 

class SourceType(BunchBasedDomainObject): 

pass 

 

 

class SpecialValueDefinition(BunchBasedDomainObject): 

pass 

 

 

class SignalQuality(BunchBasedDomainObject): 

pass 

 

 

class Quality(BunchBasedDomainObject): 

pass 

 

 

class Comment(BunchBasedDomainObject): 

pass