Fix inconsistent cnf structure method naming
authorPlamen Dimitrov <plamen.dimitrov@intra2net.com>
Sat, 16 Apr 2022 15:12:05 +0000 (18:12 +0300)
committerPlamen Dimitrov <plamen.dimitrov@intra2net.com>
Wed, 11 May 2022 06:25:25 +0000 (09:25 +0300)
Part of the API methods were using "from/to_cnfvar_dict" while the
other part were using "from/to_cnf_structure".

src/cnfvar/model.py

index 168f5db..aff7c38 100644 (file)
@@ -494,7 +494,7 @@ class CnfListSerializationMixin(BaseCnfList):
         """
         if renumber:
             self.renumber()
-        return {"cnf": [x.to_cnfvar_dict() for x in self]}
+        return {"cnf": [x.to_cnf_structure() for x in self]}
 
     def to_cnf_file(self, path, renumber=True, encoding=ENCODING):
         """
@@ -612,7 +612,7 @@ class CnfListSerializationMixin(BaseCnfList):
 class CnfSerializationMixin(BaseCnf):
     """Add serialization support to BaseCnf."""
 
-    def to_cnfvar_dict(self):
+    def to_cnf_structure(self):
         """
         Convert this instance to dictionary from the :py:mod:`cnfvar` module.
 
@@ -633,7 +633,7 @@ class CnfSerializationMixin(BaseCnf):
         if self.comment is not None:
             d["comment"] = self.comment
         if len(self.children) > 0:
-            d["children"] = [c.to_cnfvar_dict() for c in self.children]
+            d["children"] = [c.to_cnf_structure() for c in self.children]
         return d
 
     def to_json_string(self, renumber=True):