Skip to content

Commit

Permalink
Rename dictionary from properties to properties_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcleod committed Dec 3, 2023
1 parent 5eee956 commit ce47e42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/jsbsim.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ cdef class FGFDMExec(FGJSBBase):
"""@Dox(JSBSim::FGFDMExec)"""

cdef c_FGFDMExec *thisptr # hold a C++ instance which we're wrapping
cdef dict properties # Dictionary cache of property nodes
cdef dict properties_cache # Dictionary cache of property nodes

def __cinit__(self, root_dir, FGPropertyManager pm_root=None, *args,
**kwargs):
Expand Down Expand Up @@ -702,7 +702,7 @@ cdef class FGFDMExec(FGJSBBase):
self.set_aircraft_path("aircraft")
self.set_systems_path("systems")

self.properties = { }
self.properties_cache = { }

def __dealloc__(self) -> None:
del self.thisptr
Expand All @@ -724,13 +724,13 @@ cdef class FGFDMExec(FGJSBBase):
def __getitem__(self, key: str) -> float:
_key = key.strip()
try:
property_node = self.properties[_key]
property_node = self.properties_cache[_key]
return property_node.get_double_value()
except KeyError:
pm = self.get_property_manager()
property_node = pm.get_node(_key)
if property_node is not None:
self.properties[_key] = property_node
self.properties_cache[_key] = property_node
return property_node.get_double_value()
else:
raise KeyError(f'No property named {_key}')
Expand Down

0 comments on commit ce47e42

Please sign in to comment.