Skip to content

Commit

Permalink
use both methods (load/__setstate__ dumps/__getstate__) available for…
Browse files Browse the repository at this point in the history
… all python versions
  • Loading branch information
looooo committed Nov 10, 2024
1 parent 8893371 commit 4d87de3
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions freecad/gears/basegear.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,21 @@ def getIcon(self):
self._check_attr()
return self.icon_fn

if sys.version_info[0] == 3 and sys.version_info[1] >= 11:

def dumps(self):
self._check_attr()
return {"icon_fn": self.icon_fn}
def dumps(self):
self._check_attr()
return {"icon_fn": self.icon_fn}

def loads(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]
else:
def loads(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]

def __getstate__(self):
self._check_attr()
return {"icon_fn": self.icon_fn}
def __getstate__(self):
self._check_attr()
return {"icon_fn": self.icon_fn}

def __setstate__(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]
def __setstate__(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]


class BaseGear:
Expand Down Expand Up @@ -162,20 +159,18 @@ def generate_gear_shape(self, fp):
"""
raise NotImplementedError("generate_gear_shape not implemented")

if sys.version_info[0] == 3 and sys.version_info[1] >= 11:

def loads(self, state):
pass
def loads(self, state):
pass

def dumps(self):
pass
else:
def dumps(self):
pass

def __setstate__(self, state):
pass
def __setstate__(self, state):
pass

def __getstate__(self):
pass
def __getstate__(self):
pass


def part_arc_from_points_and_center(point_1, point_2, center):
Expand Down

0 comments on commit 4d87de3

Please sign in to comment.