1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The Lipari-Szabo model-free analysis base data functions."""
25
26
27
28 from re import search
29
30
31 from lib.errors import RelaxError
32
33
35 """Compare the contents of the two objects and raise RelaxErrors if they are not the same.
36
37 @param object_from: The first object.
38 @type object_from: any object
39 @param object_to: The second object.
40 @type object_to: any object
41 @param pipe_from: The name of the data pipe containing the first object.
42 @type pipe_from: str
43 @param pipe_to: The name of the data pipe containing the second object.
44 @type pipe_to: str
45 """
46
47
48 for data_name in dir(object_from):
49
50 if search('^_', data_name) or data_name in list(object_from.__class__.__dict__.keys()) or (hasattr(object_from.__class__, '__bases__') and len(object_from.__class__.__bases__) and data_name in list(object_from.__class__.__bases__[0].__dict__.keys())):
51 continue
52
53
54 if data_name in ['structural_data']:
55 continue
56
57
58 data_from = None
59 if hasattr(object_from, data_name):
60 data_from = getattr(object_from, data_name)
61
62
63 if data_from and not hasattr(object_to, data_name):
64 raise RelaxError("The structural object " + repr(data_name) + " of the " + repr(pipe_from) + " data pipe is not located in the " + repr(pipe_to) + " data pipe.")
65 elif data_from:
66 data_to = getattr(object_to, data_name)
67 else:
68 continue
69
70
71 if data_from != data_to:
72 raise RelaxError("The object " + repr(data_name) + " is not consistent between the pipes " + repr(pipe_from) + " and " + repr(pipe_to) + ".")
73