MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / ModifiedAttributeDict

Class ModifiedAttributeDict

eos/modifiedAttributeDict.py:101–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100
101class ModifiedAttributeDict(MutableMapping):
102 overrides_enabled = False
103
104 class CalculationPlaceholder:
105 def __init__(self):
106 pass
107
108 def __init__(self, fit=None, parent=None):
109 self.__fit = fit
110 self.parent = parent
111 # Stores original values of the entity
112 self.__original = None
113 # Modified values during calculations
114 self.__intermediary = {}
115 # Final modified values
116 self.__modified = {}
117 # Affected by entities
118 # Format:
119 # {attr name: {modifying fit: (
120 # modifying item, operation, stacking group, pre-resist amount,
121 # post-resist amount, affects result or not)}}
122 self.__affectedBy = {}
123 # Overrides (per item)
124 self.__overrides = {}
125 # Mutators (per module)
126 self.__mutators = {}
127 # Dictionaries for various value modification types
128 self.__forced = {}
129 self.__preAssigns = {}
130 self.__preIncreases = {}
131 self.__multipliers = {}
132 self.__penalizedMultipliers = {}
133 self.__postIncreases = {}
134 # We sometimes override the modifier (for things like skill handling). Store it here instead of registering it
135 # with the fit (which could cause bug for items that have both item bonuses and skill bonus, ie Subsystems)
136 self.__tmpModifier = None
137
138 def clear(self):
139 self.__intermediary.clear()
140 self.__modified.clear()
141 self.__affectedBy.clear()
142 self.__forced.clear()
143 self.__preAssigns.clear()
144 self.__preIncreases.clear()
145 self.__multipliers.clear()
146 self.__penalizedMultipliers.clear()
147 self.__postIncreases.clear()
148
149 @property
150 def fit(self):
151 # self.fit is usually set during fit calculations when the item is registered with the fit. However,
152 # under certain circumstances, an effect will not work as it will try to modify an item which has NOT
153 # yet been registered and thus has not had self.fit set. In this case, use the modules owner attribute
154 # to point to the correct fit. See GH Issue #434
155 if self.__fit is not None:
156 return self.__fit
157 if hasattr(self.parent, 'owner'):
158 return self.parent.owner

Callers 9

__init__Method · 0.90
__init__Method · 0.90
buildMethod · 0.90
buildMethod · 0.90
buildMethod · 0.90
buildMethod · 0.90
__init__Method · 0.90
initMethod · 0.90
buildMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected