1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
19 # Copyright (c) 2016-2022 Intra2net AG <info@intra2net.com>
22 model: Cnf classes, collection of Cnf classes and multiple filtering methods.
25 - Cnf: class representing a CNF variable
26 - CnfList: a collection of `Cnf` instances
28 The classes above inherit from their base types with added mixins which
29 extend them with extra functionality.
31 .. seealso:: Overview Diagram linked to from doc main page
33 .. codeauthor:: Intra2net
38 from .. import cnfvar_old, arnied_api
40 #: value used to detect unspecified arguments
42 #: encoding used by the get_cnf and set_cnf binaries
46 ###############################################################################
48 ###############################################################################
53 Custom string where comparisons are case-insensitive.
55 With this class we do not have to worry about case when comparing against
56 the name of cnfvars when filtering. The cnfvar backend is already case-
60 def __eq__(self, other):
61 if not isinstance(other, str):
63 return self.lower() == other.lower()
65 def __contains__(self, name):
66 return name.lower() in self.lower()
68 def startswith(self, prefix, *args, **kwargs):
69 return self.lower().startswith(prefix.lower(), *args, **kwargs)
71 def endswith(self, suffix, *args, **kwargs):
72 return self.lower().endswith(suffix.lower(), *args, **kwargs)
74 def replace(self, old, new, *args, **kwargs):
75 return self.lower().replace(old.lower(), new.lower(), *args, **kwargs)
78 ###############################################################################
80 ###############################################################################
83 class BaseCnfList(list):
84 """Base class representing a CNF list with minimal functionality."""
86 def __init__(self, cnf_iter=None, renumber=False):
90 :param cnf_iter: iterator producing CNF elements or arguments for the
91 constructor of the :py:class:`Cnf` class
92 :type: :py:class:`collections.abc.Iterator` producing elements of type
94 :param bool renumber: whether to fix up the number/ids of the CNFs
97 cnf = Cnf("my_cnf", "value")
100 ("other_cnf", "other value"),
101 ("user", "john", instance=3)
104 # Map the values of the iterator to support constructing this list
105 # from Cnf instances or arguments to the Cnf constructor
106 if cnf_iter is not None:
107 iter_ = map(lambda c: c if isinstance(c, Cnf) else Cnf(*c), cnf_iter)
110 super().__init__(iter_)
111 self._renumber_counter = None # initialized and used in renumber
116 """Fix line numbers of CNF variables from this list."""
117 # NOTE: we don't keep track of operations that change the list as this
118 # would require us to reimplement most of the methods. At least for now
119 # this method should be called again when serializing.
120 self._renumber_counter = 0
122 def renumber_fn(cnf):
123 self._renumber_counter += 1
124 cnf.lineno = self._renumber_counter
126 self.for_each_all(renumber_fn)
128 def where(self, where_filter):
130 Filter CNFs matching a given predicate.
132 :param where_filter: predicate to apply against CNFs
133 :type where_filter: function accepting a CNF and returning a boolean
134 :returns: an instance of this class with filtered members
135 :rtype: :py:class:`CnfList`
137 return CnfList(c for c in self if where_filter(c))
139 def where_child(self, where_filter):
141 Filter CNFs with children matching a given predicate.
143 :param where_filter: predicate to apply against children
144 :type where_filter: function accepting a CNF and returning a boolean
145 :returns: an instance of this class with filtered members
146 :rtype: :py:class:`CnfList`
148 def upper_filter(cnf):
149 return any(ch for ch in cnf.children if where_filter(ch))
150 return self.where(upper_filter)
152 def remove_where(self, where_filter):
154 Remove all CNFs from this list matching the given predicate.
156 :param where_filter: predicate to apply against children
157 :type where_filter: function accepting a CNF and returning a boolean
158 :returns: a list of the removed CNF variables
159 :rtype: [:py:class:`Cnf`]
162 # iterate by index for speed and in reverse to keep indexes valid
163 for i in range(len(self) - 1, -1, -1):
165 if where_filter(cnf):
170 def for_each(self, fn):
172 Apply a function to each element of this list.
174 :param fn: function to apply to the elements
175 :type fn: function accepting a CNF (result value is ignored)
176 :returns: this same instance
177 :rtype: :py:class:`CnfList`
179 .. note:: this is mostly the same as the built-in map() function,
180 except that it changes the list in place.
185 except StopIteration:
190 def for_each_child(self, fn):
192 Apply a function to each child of the elements of this list.
194 :param fn: function to apply to the elements
195 :type fn: function accepting a CNF (result value is ignored)
196 :returns: this same instance
197 :rtype: :py:class:`CnfList`
199 .. note:: if a CNF does not have children, it is ignored
202 children = c.children or CnfList()
206 except StopIteration:
209 # apply recursively, too
210 children.for_each_child(fn)
213 def for_each_all(self, fn):
215 Apply a function to every CNF of this list, parent or child.
217 :param fn: function to apply to the elements
218 :type fn: function accepting a CNF (result value is ignored)
219 :returns: this same instance
220 :rtype: :py:class:`CnfList`
225 except StopIteration:
228 children = c.children or CnfList()
229 children.for_each_all(fn)
234 Get a string representation of this instance.
236 :returns: a string in the cnfvar format
239 return "\n".join((str(c) for c in self))
241 def __add__(self, other):
242 return CnfList(super().__add__(other))
244 def add(self, *args, **kwargs):
246 Add a CNF variable to the list.
248 Arguments can either be a single instance of the :py:class:`Cnf`
249 class or a list of arguments to be passed to the constructor of
250 that class. Similar to the :py:func:`add_child` method for a `Cnf`.
252 :returns: the instance that was created
253 :rtype: :py:class:`Cnf`
255 # support passing a Cnf instance
256 if len(args) == 1 and not kwargs:
258 assert isinstance(cnf, Cnf), "A Cnf instance is mandatory with one argument"
260 cnf = Cnf(*args, **kwargs)
267 """Base class representing a CNF variable with minimal functionality."""
269 _PARENT_TEMPLATE = "{lineno} {name},{instance}: \"{value}\""
270 _CHILD_TEMPLATE = "{lineno} {indent}({parent}) {name},{instance}: \"{value}\""
273 def __init__(self, name, value, instance=0, parent=None,
274 lineno=None, comment=None):
276 Create this instance.
278 :param str name: name of the cnfvar (case does not matter)
279 :param str value: value for this cnfvar (will be converted to string
280 if it is not of this type)
281 :param int instance: instance of this cnfvar
282 :param parent: a parent Cnf instance
283 :type parent: :py:class:`BaseCnf`
284 :param int lineno: line number
285 :param str comment: cnfvar comment
287 self.name = CnfName(name)
289 self.instance = int(instance)
291 self.lineno = int(lineno or 0)
292 self.comment = comment
293 self.__children = CnfList()
295 # Use getters and setters to keep internal consistency and fail-fast
296 # preventing invalid data from being sent to the cnfvar backend.
301 def _set_name(self, value):
302 # convert Python strings passed as name to our custom string
303 self.__name = CnfName(value)
304 name = property(_get_name, _set_name)
306 def _get_instance(self):
307 return self.__instance
309 def _set_instance(self, value):
310 # fail-fast and make sure instance is a valid integer
311 self.__instance = int(value)
312 instance = property(_get_instance, _set_instance)
314 def _get_lineno(self):
317 def _set_lineno(self, value):
318 # fail-fast and make sure lineno is a valid integer
319 self.__lineno = int(value)
320 lineno = property(_get_lineno, _set_lineno)
322 def _get_children(self):
323 return self.__children
324 # No setter to sure that the children property will not
325 # be replaced by something other than a `CnfList`
326 children = property(_get_children)
328 def _get_value(self):
331 def _set_value(self, value):
332 # Make sure the value is always stored as a string
333 # (no other types make sense to the cnfvar backend)
334 self.__value = str(value)
335 value = property(_get_value, _set_value)
337 def add_child(self, *args, **kwargs):
339 Add a child CNF variable.
341 Arguments can either be a single instance of the :py:class:`Cnf`
342 class or a list of arguments to be passed to the constructor of
345 :returns: the instance that was created
346 :rtype: :py:class:`Cnf`
350 cnf = Cnf("my_parent_cnf", "parent")
351 cnf2 = Cnf("my_child_cnf", "john")
353 # adding a child as a CNF instance
356 # adding a child passing arguments of the Cnf constructor
357 cnf.add_child("my_child_cnf", "jane", instance=2)
359 # support passing a Cnf instance
360 if len(args) == 1 and not kwargs:
362 assert isinstance(cnf, Cnf), "A Cnf instance is mandatory with one argument"
364 cnf = Cnf(*args, **kwargs)
366 # store a reference to parent to easily access it
369 # It seems the CNF backend (at least using set_cnf as opposed to the varlink
370 # API) only accepts instance with value of -1 for top-level variables, so
371 # just in case fix up instances when adding children with the default value.
372 if cnf.instance == -1:
374 for c in self.children:
375 if c.name == cnf.name:
378 self.children.append(cnf)
381 def add_children(self, *children):
383 Add multiple child CNF variables.
385 Each argument must be either an instance of the :py:class:`Cnf` class
386 or a tuple/list to be expanded and passed to construct that instance.
388 :returns: a list of the instances that were created
389 :rtype: :py:class:`CnfList`
392 cnf = Cnf("my_parent_cnf", "parent")
393 cnf2 = Cnf("my_child_cnf", "john")
396 cnf2, # cnf instance directly
397 ("my_child_cnf", "jane", instance=2), # pass a tuple with args
398 ["my_child_cnf", "jack", instance=3]) # pass a list with args
400 # adding a child passing arguments of the Cnf constructor
401 cnf.add_child("my_child_cnf", "jane", instance=2)
403 added_children = CnfList()
405 if isinstance(c, Cnf):
406 new_child = self.add_child(c)
407 elif isinstance(c, tuple) or isinstance(c, list):
408 new_child = self.add_child(*c)
410 raise ValueError(f"Children item {c} must be either a Cnf, a tuple or a list")
411 added_children.append(new_child)
412 return added_children
414 def __eq__(self, other):
416 Equality implementation.
418 :param other: object to compare this instance against
420 :returns: whether `other` is equal to this instance
423 This is particularly useful when comparing instances of
426 if not isinstance(other, Cnf):
429 # NOTE: we try to define two variables as equal in the same way as the
430 # set_cnf binary would if we were passing it an updated CNF variable.
431 # It does not take comments, children and lineno into account when we
432 # pass it a variable; it will rather compare the data we compare here,
433 # and if it finds a match it will update it with the changed children.
434 return self.name == other.name \
435 and self.value == other.value \
436 and self.instance == other.instance \
437 and self.parent == other.parent
441 Get a string representation of this instance.
443 :returns: a string in the cnfvar format
446 if self.parent is None:
447 this_str = self._PARENT_TEMPLATE.format(
449 name=self.name.upper(),
450 instance=self.instance,
456 while curr.parent is not None:
460 this_str = self._CHILD_TEMPLATE.format(
462 indent=self._NEST_INDENT * depth,
463 parent=self.parent.lineno,
464 name=self.name.upper(),
465 instance=self.instance,
469 if self.comment is not None:
470 this_str += f" # {self.comment}"
472 for child in self.children:
473 this_str += f"\n{child}"
479 Get a printable representation of this instance.
481 :returns: a string in the cnfvar format
484 repr_ = self._PARENT_TEMPLATE.format(
486 name=self.name.upper(),
487 instance=self.instance,
489 ) if self.parent is None else self._CHILD_TEMPLATE.format(
492 parent=self.parent.lineno,
493 name=self.name.upper(),
494 instance=self.instance,
497 return f"Cnf{{ {repr_} [children={len(self.children)}] }}"
500 ###############################################################################
502 ###############################################################################
504 # These mixins add functionality to the base API without polluting it.
507 class CnfListSerializationMixin(BaseCnfList):
508 """Add serialization support to BaseCnfList."""
510 def to_cnf_structure(self, renumber=True):
512 Convert this list to an object meaningful to :py:mod:`cnfvar`.
514 :param bool renumber: whether to fix up the number/ids of the CNFs
515 :returns: a dictionary with the converted values
516 :rtype: {str, {str, str or int}}
520 return {"cnf": [x.to_cnf_structure() for x in self]}
522 def to_cnf_file(self, path, renumber=True, encoding=ENCODING):
524 Dump a string representation of this list in the cnfvar format to a file.
526 :param str path: path to the file to write to
527 :param bool renumber: whether to fix the lineno of the cnfvars
528 :param str encoding: encoding to use to save the file
532 with open(path, "w", encoding=encoding) as fp:
535 def to_json_string(self, renumber=True):
537 Generate a JSON representation of this list in the cnfvar format.
539 :param bool renumber: whether to fix the lineno of the cnfvars
540 :returns: the JSON string
545 "number": cnf.lineno,
548 "instance": cnf.instance
550 if cnf.parent and cnf.parent.lineno:
551 d["parent"] = cnf.parent.lineno
552 if cnf.comment is not None:
553 d["comment"] = cnf.comment
554 if len(cnf.children) > 0:
555 d["children"] = [_to_dict(c) for c in cnf.children]
559 json_list = [_to_dict(c) for c in self]
560 return json.dumps({"cnf": json_list})
562 def to_json_file(self, path, renumber=True):
564 Dump a JSON representation of this list to a file.
566 :param str path: path to the file to write to
567 :param bool renumber: whether to fix the lineno of the cnfvars
569 with open(path, "w", encoding="utf8") as fp:
570 fp.write(self.to_json_string(renumber=renumber))
573 def from_cnf_structure(cls, obj):
575 Create a list from a cnfvar object from the :py:mod:`cnfvar` module.
577 :param obj: an object as defined in the :py:mod:`cnfvar`
578 :type obj: {str, {str, str or int}}
579 :returns: a list of cnfvars
580 :rtype: :py:class:`CnfList`
582 return cls(map(Cnf.from_cnf_structure, obj["cnf"]))
585 def from_cnf_string(cls, data):
587 Create a list from a cnfvar string.
589 :param str data: string to generate the list from
590 :returns: a list of cnfvars
591 :rtype: :py:class:`CnfList`
593 cnf_obj = cnfvar_old.read_cnf(data)
594 return CnfList.from_cnf_structure(cnf_obj)
597 def from_json_string(cls, data):
599 Create a list from a json string.
601 :param str data: string to generate the list from
602 :returns: a list of cnfvars
603 :rtype: :py:class:`CnfList`
605 cnf_obj = json.loads(data)
606 return CnfList.from_cnf_structure(cnf_obj)
609 def from_cnf_file(cls, path, encoding=ENCODING):
611 Create a list from a cnfvar file.
613 :param str path: path to the file to read
614 :param str encoding: encoding to use to open the file (defaults to
615 latin1 as this is the default encoding)
616 :returns: a list of cnfvars
617 :rtype: :py:class:`CnfList`
619 with open(path, "r", encoding=encoding) as fp:
620 return CnfList.from_cnf_string(fp.read())
623 def from_json_file(cls, path):
625 Create a list from a json file.
627 :param str path: path to the file to read
628 :returns: a list of cnfvars
629 :rtype: :py:class:`CnfList`
631 with open(path, "r", encoding="utf8") as fp:
632 return CnfList.from_json_string(fp.read())
635 class CnfSerializationMixin(BaseCnf):
636 """Add serialization support to BaseCnf."""
638 def to_cnf_structure(self):
640 Convert this instance to dictionary from the :py:mod:`cnfvar` module.
642 :returns: the dictionary created
643 :rtype: {str, str or int}
645 .. todo:: this method is still needed because dumping cnf variables
646 to strings (json or not) is still delegated to the old cnfvar module.
649 "number": self.lineno,
650 "varname": self.name,
652 "instance": self.instance
654 if self.parent and self.parent.lineno:
655 d["parent"] = self.parent.lineno
656 if self.comment is not None:
657 d["comment"] = self.comment
658 if len(self.children) > 0:
659 d["children"] = [c.to_cnf_structure() for c in self.children]
662 def to_json_string(self, renumber=True):
664 Convert this instance to a JSON string.
666 :param bool renumber: whether to fix the lineno of the cnfvars
667 :returns: the JSON string
670 return CnfList([self]).to_json_string(renumber=renumber)
672 def to_cnf_file(self, path, renumber=True, encoding=ENCODING):
674 Dump a string representation of this instance to a file.
676 :param str path: path to the file to write to
677 :param bool renumber: whether to fix the lineno of this cnfvar and its children
678 :param str encoding: encoding to use to save the file
680 CnfList([self]).to_cnf_file(path, renumber=renumber, encoding=encoding)
682 def to_json_file(self, path, renumber=True):
684 Dump a JSON representation of this instance to a file.
686 :param str path: path to the file to write to
687 :param bool renumber: whether to fix the lineno of this cnfvar and its children
689 CnfList([self]).to_json_file(path, renumber=renumber)
692 def from_cnf_structure(cls, obj):
694 Create an instance from a dictionary from the :py:mod:`cnfvar` module.
696 :param obj: dictionary to convert to this instance
697 :type obj: {str, str or int}
698 :returns: the cnf instance created
699 :rtype: :py:class:`Cnf`
701 cnf = Cnf(obj["varname"], obj["data"],
702 instance=obj["instance"], lineno=obj["number"],
703 comment=obj.get("comment", None))
704 for ch_obj in obj.get("children", []):
705 child_cnf = Cnf.from_cnf_structure(ch_obj)
706 cnf.add_child(child_cnf)
710 def from_cnf_string(cls, data):
712 Create an instance of this class from a cnfvar string.
714 :param str data: cnfvar string to convert
715 :returns: the cnf instance created
716 :rtype: :py:class:`Cnf`
718 return CnfListSerializationMixin.from_cnf_string(data).single()
721 def from_json_string(cls, data):
723 Create an instance of this class from a JSON string.
725 :param str data: JSON string to convert
726 :returns: the cnf instance created
727 :rtype: :py:class:`Cnf`
729 return CnfListSerializationMixin.from_json_string(data).single()
732 def from_cnf_file(cls, path, encoding=ENCODING):
734 Create an instance of this class from a cnfvar file.
736 :param str path: path to the file to read
737 :param str encoding: encoding to use to read the file
738 :returns: the cnf instance created
739 :rtype: :py:class:`Cnf`
741 return CnfListSerializationMixin.from_cnf_file(path, encoding=encoding).single()
744 def from_json_file(cls, path):
746 Create an instance of this class from a json file.
748 :param str path: path to the file to read
749 :returns: the cnf instance created
750 :rtype: :py:class:`Cnf`
752 return CnfListSerializationMixin.from_json_file(path).single()
755 class CnfListArniedApiMixin(BaseCnfList):
756 """Add support for converting this class to and from Arnied API classes."""
758 def to_api_structure(self):
760 Convert this list to the corresponding object in the arnied API.
762 :returns: the converted object
763 :rtype: [:py:class:`arnied_api.CnfVar`]
765 return [c.to_api_structure() for c in self]
768 def from_api_structure(cls, cnfvar_list):
770 Convert a list from the arnied API into a list of this type.
772 :param cnfvar_list: list to convert
773 :type cnfvar_list: [:py:class:`arnied_api.CnfVar`]
774 :returns: the list created
775 :rtype: :py:class:`CnfList`
777 return CnfList((Cnf.from_api_structure(c) for c in cnfvar_list),
781 class CnfArniedApiMixin(BaseCnf):
782 """Add support for converting this class to and from Arnied API classes."""
784 def to_api_structure(self):
786 Convert this instance to the corresponding object in the arnied API.
788 :returns: the converted object
789 :rtype: :py:class:`arnied_api.CnfVar`
791 return arnied_api.CnfVar(
795 False, # default here to False
796 children=[c.to_api_structure() for c in self.children])
799 def from_api_structure(cls, cnfobj):
801 Convert an object from the arnied API into an instance of this type.
803 :param cnfobj: object to convert
804 :type cnfobj: :py:class:`arnied_api.CnfVar`
805 :returns: the instance created
806 :rtype: :py:class:`Cnf`
808 cnf = Cnf(cnfobj.name, cnfobj.data, cnfobj.instance)
809 children = CnfList((Cnf.from_api_structure(c) for c in cnfobj.children))
812 cnf.children.extend(children)
816 class CnfShortcutsMixin(BaseCnf):
817 """Extend the base CNF class with useful methods."""
820 """Treat this variable as a boolean var and set its value to 1."""
824 """Treat this variable as a boolean var and set its value to 0."""
827 def is_enabled(self):
828 """Treat this variable as a boolean var and check if its value is 1."""
829 return self.value == "1"
831 def enable_child_flag(self, name):
833 Set the value of the child CNF matching `name` to "1".
835 :param str name: name of the child whose value to enable
837 .. note:: child will be created if it does not exist.
839 cnf = self.children.first_with_name(name, default=None)
841 self.add_child(name, "1")
845 def disable_child_flag(self, name):
847 Set the value of the child CNF matching `name` to "0".
849 :param str name: name of the child whose value to disable
851 .. note:: child will be created if it does not exist.
853 cnf = self.children.first_with_name(name, default=None)
855 self.add_child(name, "0")
859 def child_flag_enabled(self, name):
861 Check if a given child has a value equal to `1`.
863 :param str name: name of the child to check
864 :returns: whether the value of the given child, if it exists, is 1
867 cnf = self.children.first_with_name(name, default=None)
868 return cnf.is_enabled() if cnf is not None else False
871 class CnfListQueryingMixin(BaseCnfList):
872 """Mixing adding shortcuts for common filter operations."""
874 def single(self, where_filter=None, default=DEFAULT):
876 Get the only CNF of this list or raise if none or more than one exist.
878 :param where_filter: predicate to apply against CNFs beforehand
879 :type where_filter: function accepting a CNF and returning a boolean
880 :param default: value to return in case the list is empty
882 :raises: :py:class:`ValueError` if a single value cannot be found and
883 a default value was not specified
884 :returns: the first and only element of this list, or default if set
885 and no element is present
886 :rtype: :py:class:`Cnf`
888 list_ = self.where(where_filter) if where_filter is not None else self
892 elif len(list_) == 0 and default != DEFAULT:
895 raise ValueError(f"CnfList does not contain a single item (len={len(list_)})")
897 def first(self, where_filter=None, default=DEFAULT):
899 Get the first element in this list or raise if the list is empty.
901 :param where_filter: predicate to apply against CNFs beforehand
902 :type where_filter: function accepting a CNF and returning a boolean
903 :param default: value to return in case the list is empty
905 :raises: :py:class:`ValueError` if a single value cannot be found and
906 a default value was not specified
907 :returns: the first element of this list, or default if set and
908 no element is present
909 :rtype: :py:class:`Cnf`
911 list_ = self.where(where_filter) if where_filter is not None else self
914 elif default != DEFAULT:
917 raise ValueError("Cannot get the first item - CnfList is empty")
919 def with_value(self, value):
920 """Shortcut method for filtering by value."""
921 return self.where(lambda c: c.value == value)
923 def with_name(self, name):
924 """Shortcut method for filtering by name."""
925 return self.where(lambda c: c.name == name)
927 def with_instance(self, instance):
928 """Shortcut method for filtering by instance."""
929 return self.where(lambda c: c.instance == instance)
931 def single_with_name(self, name, default=DEFAULT):
932 """Shortcut method for getting the single item with a given name."""
933 return self.with_name(name).single(default=default)
935 def single_with_value(self, value, default=DEFAULT):
936 """Shortcut method for getting the single item with a given value."""
937 return self.with_value(value).single(default=default)
939 def single_with_instance(self, instance, default=DEFAULT):
940 """Shortcut method for getting the single item with a given instance."""
941 return self.with_instance(instance).single(default=default)
943 def first_with_name(self, name, default=DEFAULT):
944 """Shortcut method for getting the first item with a given name."""
945 return self.with_name(name).first(default=default)
947 def first_with_value(self, value, default=DEFAULT):
948 """Shortcut method for getting the first item with a given value."""
949 return self.with_value(value).first(default=default)
951 def first_with_instance(self, instance, default=DEFAULT):
952 """Shortcut method for getting the first item with a given instance."""
953 return self.with_instance(instance).first(default=default)
955 def highest_instance(self):
956 """Shortcut method for getting the next instance in a list of items."""
957 return max([c.instance for c in self]) if len(self) > 0 else -1
960 ###############################################################################
962 ###############################################################################
964 # Set up the classes with the mixins we want to be available by default.
968 class CnfList(CnfListSerializationMixin, CnfListArniedApiMixin, CnfListQueryingMixin):
969 """Collection of Cnf variables."""
974 class Cnf(CnfSerializationMixin, CnfArniedApiMixin, CnfShortcutsMixin):
975 """Class representing a cnfvar."""
980 __all__ = ["CnfList", "Cnf"]