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, prefix, *args, **kwargs):
72 return self.lower().endswith(prefix.lower(), *args, **kwargs)
75 ###############################################################################
77 ###############################################################################
80 class BaseCnfList(list):
81 """Base class representing a CNF list with minimal functionality."""
83 def __init__(self, cnf_iter=None, renumber=False):
87 :param cnf_iter: iterator producing CNF elements or arguments for the
88 constructor of the :py:class:`Cnf` class
89 :type: :py:class:`collections.abc.Iterator` producing elements of type
91 :param bool renumber: whether to fix up the number/ids of the CNFs
94 cnf = Cnf("my_cnf", "value")
97 ("other_cnf", "other value"),
98 ("user", "john", instance=3)
101 # Map the values of the iterator to support constructing this list
102 # from Cnf instances or arguments to the Cnf constructor
103 if cnf_iter is not None:
104 iter_ = map(lambda c: c if isinstance(c, Cnf) else Cnf(*c), cnf_iter)
107 super().__init__(iter_)
108 self._renumber_counter = None # initialized and used in renumber
113 """Fix line numbers of CNF variables from this list."""
114 # NOTE: we don't keep track of operations that change the list as this
115 # would require us to reimplement most of the methods. At least for now
116 # this method should be called again when serializing.
117 self._renumber_counter = 0
119 def renumber_fn(cnf):
120 self._renumber_counter += 1
121 cnf.lineno = self._renumber_counter
123 self.for_each_all(renumber_fn)
125 def where(self, where_filter):
127 Filter CNFs matching a given predicate.
129 :param where_filter: predicate to apply against CNFs
130 :type where_filter: function accepting a CNF and returning a boolean
131 :returns: an instance of this class with filtered members
132 :rtype: :py:class:`CnfList`
134 return CnfList(c for c in self if where_filter(c))
136 def where_child(self, where_filter):
138 Filter CNFs with children matching a given predicate.
140 :param where_filter: predicate to apply against children
141 :type where_filter: function accepting a CNF and returning a boolean
142 :returns: an instance of this class with filtered members
143 :rtype: :py:class:`CnfList`
145 def upper_filter(cnf):
146 return any(ch for ch in cnf.children if where_filter(ch))
147 return self.where(upper_filter)
149 def remove_where(self, where_filter):
151 Remove all CNFs from this list matching the given predicate.
153 :param where_filter: predicate to apply against children
154 :type where_filter: function accepting a CNF and returning a boolean
155 :returns: a list of the removed CNF variables
156 :rtype: [:py:class:`Cnf`]
159 # iterate by index for speed and in reverse to keep indexes valid
160 for i in range(len(self) - 1, -1, -1):
162 if where_filter(cnf):
167 def for_each(self, fn):
169 Apply a function to each element of this list.
171 :param fn: function to apply to the elements
172 :type fn: function accepting a CNF (result value is ignored)
173 :returns: this same instance
174 :rtype: :py:class:`CnfList`
176 .. note:: this is mostly the same as the built-in map() function,
177 except that it changes the list in place.
182 except StopIteration:
187 def for_each_child(self, fn):
189 Apply a function to each child of the elements of this list.
191 :param fn: function to apply to the elements
192 :type fn: function accepting a CNF (result value is ignored)
193 :returns: this same instance
194 :rtype: :py:class:`CnfList`
196 .. note:: if a CNF does not have children, it is ignored
199 children = c.children or CnfList()
203 except StopIteration:
206 # apply recursively, too
207 children.for_each_child(fn)
210 def for_each_all(self, fn):
212 Apply a function to every CNF of this list, parent or child.
214 :param fn: function to apply to the elements
215 :type fn: function accepting a CNF (result value is ignored)
216 :returns: this same instance
217 :rtype: :py:class:`CnfList`
222 except StopIteration:
225 children = c.children or CnfList()
226 children.for_each_all(fn)
231 Get a string representation of this instance.
233 :returns: a string in the cnfvar format
236 return "\n".join((str(c) for c in self))
238 def __add__(self, other):
239 return CnfList(super().__add__(other))
241 def add(self, *args, **kwargs):
243 Add a CNF variable to the list.
245 Arguments can either be a single instance of the :py:class:`Cnf`
246 class or a list of arguments to be passed to the constructor of
247 that class. Similar to the :py:func:`add_child` method for a `Cnf`.
249 :returns: the instance that was created
250 :rtype: :py:class:`Cnf`
252 # support passing a Cnf instance
253 if len(args) == 1 and not kwargs:
255 assert isinstance(cnf, Cnf), "A Cnf instance is mandatory with one argument"
257 cnf = Cnf(*args, **kwargs)
264 """Base class representing a CNF variable with minimal functionality."""
266 _PARENT_TEMPLATE = "{lineno} {name},{instance}: \"{value}\""
267 _CHILD_TEMPLATE = "{lineno} {indent}({parent}) {name},{instance}: \"{value}\""
270 def __init__(self, name, value, instance=0, parent=None,
271 lineno=None, comment=None):
273 Create this instance.
275 :param str name: name of the cnfvar (case does not matter)
276 :param str value: value for this cnfvar (will be converted to string
277 if it is not of this type)
278 :param int instance: instance of this cnfvar
279 :param parent: a parent Cnf instance
280 :type parent: :py:class:`BaseCnf`
281 :param int lineno: line number
282 :param str comment: cnfvar comment
284 self.name = CnfName(name)
286 self.instance = int(instance)
288 self.lineno = int(lineno or 0)
289 self.comment = comment
290 self.__children = CnfList()
292 # Use getters and setters to keep internal consistency and fail-fast
293 # preventing invalid data from being sent to the cnfvar backend.
298 def _set_name(self, value):
299 # convert Python strings passed as name to our custom string
300 self.__name = CnfName(value)
301 name = property(_get_name, _set_name)
303 def _get_instance(self):
304 return self.__instance
306 def _set_instance(self, value):
307 # fail-fast and make sure instance is a valid integer
308 self.__instance = int(value)
309 instance = property(_get_instance, _set_instance)
311 def _get_lineno(self):
314 def _set_lineno(self, value):
315 # fail-fast and make sure lineno is a valid integer
316 self.__lineno = int(value)
317 lineno = property(_get_lineno, _set_lineno)
319 def _get_children(self):
320 return self.__children
321 # No setter to sure that the children property will not
322 # be replaced by something other than a `CnfList`
323 children = property(_get_children)
325 def _get_value(self):
328 def _set_value(self, value):
329 # Make sure the value is always stored as a string
330 # (no other types make sense to the cnfvar backend)
331 self.__value = str(value)
332 value = property(_get_value, _set_value)
334 def add_child(self, *args, **kwargs):
336 Add a child CNF variable.
338 Arguments can either be a single instance of the :py:class:`Cnf`
339 class or a list of arguments to be passed to the constructor of
342 :returns: the instance that was created
343 :rtype: :py:class:`Cnf`
347 cnf = Cnf("my_parent_cnf", "parent")
348 cnf2 = Cnf("my_child_cnf", "john")
350 # adding a child as a CNF instance
353 # adding a child passing arguments of the Cnf constructor
354 cnf.add_child("my_child_cnf", "jane", instance=2)
356 # support passing a Cnf instance
357 if len(args) == 1 and not kwargs:
359 assert isinstance(cnf, Cnf), "A Cnf instance is mandatory with one argument"
361 cnf = Cnf(*args, **kwargs)
363 # store a reference to parent to easily access it
366 # It seems the CNF backend (at least using set_cnf as opposed to the varlink
367 # API) only accepts instance with value of -1 for top-level variables, so
368 # just in case fix up instances when adding children with the default value.
369 if cnf.instance == -1:
371 for c in self.children:
372 if c.name == cnf.name:
375 self.children.append(cnf)
378 def add_children(self, *children):
380 Add multiple child CNF variables.
382 Each argument must be either an instance of the :py:class:`Cnf` class
383 or a tuple/list to be expanded and passed to construct that instance.
385 :returns: a list of the instances that were created
386 :rtype: :py:class:`CnfList`
389 cnf = Cnf("my_parent_cnf", "parent")
390 cnf2 = Cnf("my_child_cnf", "john")
393 cnf2, # cnf instance directly
394 ("my_child_cnf", "jane", instance=2), # pass a tuple with args
395 ["my_child_cnf", "jack", instance=3]) # pass a list with args
397 # adding a child passing arguments of the Cnf constructor
398 cnf.add_child("my_child_cnf", "jane", instance=2)
400 added_children = CnfList()
402 if isinstance(c, Cnf):
403 new_child = self.add_child(c)
404 elif isinstance(c, tuple) or isinstance(c, list):
405 new_child = self.add_child(*c)
407 raise ValueError(f"Children item {c} must be either a Cnf, a tuple or a list")
408 added_children.append(new_child)
409 return added_children
411 def __eq__(self, other):
413 Equality implementation.
415 :param other: object to compare this instance against
417 :returns: whether `other` is equal to this instance
420 This is particularly useful when comparing instances of
423 if not isinstance(other, Cnf):
426 # NOTE: we try to define two variables as equal in the same way as the
427 # set_cnf binary would if we were passing it an updated CNF variable.
428 # It does not take comments, children and lineno into account when we
429 # pass it a variable; it will rather compare the data we compare here,
430 # and if it finds a match it will update it with the changed children.
431 return self.name == other.name \
432 and self.value == other.value \
433 and self.instance == other.instance \
434 and self.parent == other.parent
438 Get a string representation of this instance.
440 :returns: a string in the cnfvar format
443 if self.parent is None:
444 this_str = self._PARENT_TEMPLATE.format(
446 name=self.name.upper(),
447 instance=self.instance,
453 while curr.parent is not None:
457 this_str = self._CHILD_TEMPLATE.format(
459 indent=self._NEST_INDENT * depth,
460 parent=self.parent.lineno,
461 name=self.name.upper(),
462 instance=self.instance,
466 if self.comment is not None:
467 this_str += f" # {self.comment}"
469 for child in self.children:
470 this_str += f"\n{child}"
476 Get a printable representation of this instance.
478 :returns: a string in the cnfvar format
481 repr_ = self._PARENT_TEMPLATE.format(
483 name=self.name.upper(),
484 instance=self.instance,
486 ) if self.parent is None else self._CHILD_TEMPLATE.format(
489 parent=self.parent.lineno,
490 name=self.name.upper(),
491 instance=self.instance,
494 return f"Cnf{{ {repr_} [children={len(self.children)}] }}"
497 ###############################################################################
499 ###############################################################################
501 # These mixins add functionality to the base API without polluting it.
504 class CnfListSerializationMixin(BaseCnfList):
505 """Add serialization support to BaseCnfList."""
507 def to_cnf_structure(self, renumber=True):
509 Convert this list to an object meaningful to :py:mod:`cnfvar`.
511 :param bool renumber: whether to fix up the number/ids of the CNFs
512 :returns: a dictionary with the converted values
513 :rtype: {str, {str, str or int}}
517 return {"cnf": [x.to_cnf_structure() for x in self]}
519 def to_cnf_file(self, path, renumber=True, encoding=ENCODING):
521 Dump a string representation of this list in the cnfvar format to a file.
523 :param str path: path to the file to write to
524 :param bool renumber: whether to fix the lineno of the cnfvars
525 :param str encoding: encoding to use to save the file
529 with open(path, "w", encoding=encoding) as fp:
532 def to_json_string(self, renumber=True):
534 Generate a JSON representation of this list in the cnfvar format.
536 :param bool renumber: whether to fix the lineno of the cnfvars
537 :returns: the JSON string
542 "number": cnf.lineno,
545 "instance": cnf.instance
547 if cnf.parent and cnf.parent.lineno:
548 d["parent"] = cnf.parent.lineno
549 if cnf.comment is not None:
550 d["comment"] = cnf.comment
551 if len(cnf.children) > 0:
552 d["children"] = [_to_dict(c) for c in cnf.children]
556 json_list = [_to_dict(c) for c in self]
557 return json.dumps({"cnf": json_list})
559 def to_json_file(self, path, renumber=True):
561 Dump a JSON representation of this list to a file.
563 :param str path: path to the file to write to
564 :param bool renumber: whether to fix the lineno of the cnfvars
566 with open(path, "w", encoding="utf8") as fp:
567 fp.write(self.to_json_string(renumber=renumber))
570 def from_cnf_structure(cls, obj):
572 Create a list from a cnfvar object from the :py:mod:`cnfvar` module.
574 :param obj: an object as defined in the :py:mod:`cnfvar`
575 :type obj: {str, {str, str or int}}
576 :returns: a list of cnfvars
577 :rtype: :py:class:`CnfList`
579 return cls(map(Cnf.from_cnf_structure, obj["cnf"]))
582 def from_cnf_string(cls, data):
584 Create a list from a cnfvar string.
586 :param str data: string to generate the list from
587 :returns: a list of cnfvars
588 :rtype: :py:class:`CnfList`
590 cnf_obj = cnfvar_old.read_cnf(data)
591 return CnfList.from_cnf_structure(cnf_obj)
594 def from_json_string(cls, data):
596 Create a list from a json string.
598 :param str data: string to generate the list from
599 :returns: a list of cnfvars
600 :rtype: :py:class:`CnfList`
602 cnf_obj = json.loads(data)
603 return CnfList.from_cnf_structure(cnf_obj)
606 def from_cnf_file(cls, path, encoding=ENCODING):
608 Create a list from a cnfvar file.
610 :param str path: path to the file to read
611 :param str encoding: encoding to use to open the file (defaults to
612 latin1 as this is the default encoding)
613 :returns: a list of cnfvars
614 :rtype: :py:class:`CnfList`
616 with open(path, "r", encoding=encoding) as fp:
617 return CnfList.from_cnf_string(fp.read())
620 def from_json_file(cls, path):
622 Create a list from a json file.
624 :param str path: path to the file to read
625 :returns: a list of cnfvars
626 :rtype: :py:class:`CnfList`
628 with open(path, "r", encoding="utf8") as fp:
629 return CnfList.from_json_string(fp.read())
632 class CnfSerializationMixin(BaseCnf):
633 """Add serialization support to BaseCnf."""
635 def to_cnf_structure(self):
637 Convert this instance to dictionary from the :py:mod:`cnfvar` module.
639 :returns: the dictionary created
640 :rtype: {str, str or int}
642 .. todo:: this method is still needed because dumping cnf variables
643 to strings (json or not) is still delegated to the old cnfvar module.
646 "number": self.lineno,
647 "varname": self.name,
649 "instance": self.instance
651 if self.parent and self.parent.lineno:
652 d["parent"] = self.parent.lineno
653 if self.comment is not None:
654 d["comment"] = self.comment
655 if len(self.children) > 0:
656 d["children"] = [c.to_cnf_structure() for c in self.children]
659 def to_json_string(self, renumber=True):
661 Convert this instance to a JSON string.
663 :param bool renumber: whether to fix the lineno of the cnfvars
664 :returns: the JSON string
667 return CnfList([self]).to_json_string(renumber=renumber)
669 def to_cnf_file(self, path, renumber=True, encoding=ENCODING):
671 Dump a string representation of this instance to a file.
673 :param str path: path to the file to write to
674 :param bool renumber: whether to fix the lineno of this cnfvar and its children
675 :param str encoding: encoding to use to save the file
677 CnfList([self]).to_cnf_file(path, renumber=renumber, encoding=encoding)
679 def to_json_file(self, path, renumber=True):
681 Dump a JSON representation of this instance to a file.
683 :param str path: path to the file to write to
684 :param bool renumber: whether to fix the lineno of this cnfvar and its children
686 CnfList([self]).to_json_file(path, renumber=renumber)
689 def from_cnf_structure(cls, obj):
691 Create an instance from a dictionary from the :py:mod:`cnfvar` module.
693 :param obj: dictionary to convert to this instance
694 :type obj: {str, str or int}
695 :returns: the cnf instance created
696 :rtype: :py:class:`Cnf`
698 cnf = Cnf(obj["varname"], obj["data"],
699 instance=obj["instance"], lineno=obj["number"],
700 comment=obj.get("comment", None))
701 for ch_obj in obj.get("children", []):
702 child_cnf = Cnf.from_cnf_structure(ch_obj)
703 cnf.add_child(child_cnf)
707 def from_cnf_string(cls, data):
709 Create an instance of this class from a cnfvar string.
711 :param str data: cnfvar string to convert
712 :returns: the cnf instance created
713 :rtype: :py:class:`Cnf`
715 return CnfListSerializationMixin.from_cnf_string(data).single()
718 def from_json_string(cls, data):
720 Create an instance of this class from a JSON string.
722 :param str data: JSON string to convert
723 :returns: the cnf instance created
724 :rtype: :py:class:`Cnf`
726 return CnfListSerializationMixin.from_json_string(data).single()
729 def from_cnf_file(cls, path, encoding=ENCODING):
731 Create an instance of this class from a cnfvar file.
733 :param str path: path to the file to read
734 :param str encoding: encoding to use to read the file
735 :returns: the cnf instance created
736 :rtype: :py:class:`Cnf`
738 return CnfListSerializationMixin.from_cnf_file(path, encoding=encoding).single()
741 def from_json_file(cls, path):
743 Create an instance of this class from a json file.
745 :param str path: path to the file to read
746 :returns: the cnf instance created
747 :rtype: :py:class:`Cnf`
749 return CnfListSerializationMixin.from_json_file(path).single()
752 class CnfListArniedApiMixin(BaseCnfList):
753 """Add support for converting this class to and from Arnied API classes."""
755 def to_api_structure(self):
757 Convert this list to the corresponding object in the arnied API.
759 :returns: the converted object
760 :rtype: [:py:class:`arnied_api.CnfVar`]
762 return [c.to_api_structure() for c in self]
765 def from_api_structure(cls, cnfvar_list):
767 Convert a list from the arnied API into a list of this type.
769 :param cnfvar_list: list to convert
770 :type cnfvar_list: [:py:class:`arnied_api.CnfVar`]
771 :returns: the list created
772 :rtype: :py:class:`CnfList`
774 return CnfList((Cnf.from_api_structure(c) for c in cnfvar_list),
778 class CnfArniedApiMixin(BaseCnf):
779 """Add support for converting this class to and from Arnied API classes."""
781 def to_api_structure(self):
783 Convert this instance to the corresponding object in the arnied API.
785 :returns: the converted object
786 :rtype: :py:class:`arnied_api.CnfVar`
788 return arnied_api.CnfVar(
792 False, # default here to False
793 children=[c.to_api_structure() for c in self.children])
796 def from_api_structure(cls, cnfobj):
798 Convert an object from the arnied API into an instance of this type.
800 :param cnfobj: object to convert
801 :type cnfobj: :py:class:`arnied_api.CnfVar`
802 :returns: the instance created
803 :rtype: :py:class:`Cnf`
805 cnf = Cnf(cnfobj.name, cnfobj.data, cnfobj.instance)
806 children = CnfList((Cnf.from_api_structure(c) for c in cnfobj.children))
809 cnf.children.extend(children)
813 class CnfShortcutsMixin(BaseCnf):
814 """Extend the base CNF class with useful methods."""
817 """Treat this variable as a boolean var and set its value to 1."""
821 """Treat this variable as a boolean var and set its value to 0."""
824 def is_enabled(self):
825 """Treat this variable as a boolean var and check if its value is 1."""
826 return self.value == "1"
828 def enable_child_flag(self, name):
830 Set the value of the child CNF matching `name` to "1".
832 :param str name: name of the child whose value to enable
834 .. note:: child will be created if it does not exist.
836 cnf = self.children.first_with_name(name, default=None)
838 self.add_child(name, "1")
842 def disable_child_flag(self, name):
844 Set the value of the child CNF matching `name` to "0".
846 :param str name: name of the child whose value to disable
848 .. note:: child will be created if it does not exist.
850 cnf = self.children.first_with_name(name, default=None)
852 self.add_child(name, "0")
856 def child_flag_enabled(self, name):
858 Check if a given child has a value equal to `1`.
860 :param str name: name of the child to check
861 :returns: whether the value of the given child, if it exists, is 1
864 cnf = self.children.first_with_name(name, default=None)
865 return cnf.is_enabled() if cnf is not None else False
868 class CnfListQueryingMixin(BaseCnfList):
869 """Mixing adding shortcuts for common filter operations."""
871 def single(self, where_filter=None, default=DEFAULT):
873 Get the only CNF of this list or raise if none or more than one exist.
875 :param where_filter: predicate to apply against CNFs beforehand
876 :type where_filter: function accepting a CNF and returning a boolean
877 :param default: value to return in case the list is empty
879 :raises: :py:class:`ValueError` if a single value cannot be found and
880 a default value was not specified
881 :returns: the first and only element of this list, or default if set
882 and no element is present
883 :rtype: :py:class:`Cnf`
885 list_ = self.where(where_filter) if where_filter is not None else self
889 elif len(list_) == 0 and default != DEFAULT:
892 raise ValueError(f"CnfList does not contain a single item (len={len(list_)})")
894 def first(self, where_filter=None, default=DEFAULT):
896 Get the first element in this list or raise if the list is empty.
898 :param where_filter: predicate to apply against CNFs beforehand
899 :type where_filter: function accepting a CNF and returning a boolean
900 :param default: value to return in case the list is empty
902 :raises: :py:class:`ValueError` if a single value cannot be found and
903 a default value was not specified
904 :returns: the first element of this list, or default if set and
905 no element is present
906 :rtype: :py:class:`Cnf`
908 list_ = self.where(where_filter) if where_filter is not None else self
911 elif default != DEFAULT:
914 raise ValueError("Cannot get the first item - CnfList is empty")
916 def with_value(self, value):
917 """Shortcut method for filtering by value."""
918 return self.where(lambda c: c.value == value)
920 def with_name(self, name):
921 """Shortcut method for filtering by name."""
922 return self.where(lambda c: c.name == name)
924 def with_instance(self, instance):
925 """Shortcut method for filtering by instance."""
926 return self.where(lambda c: c.instance == instance)
928 def single_with_name(self, name, default=DEFAULT):
929 """Shortcut method for getting the single item with a given name."""
930 return self.with_name(name).single(default=default)
932 def single_with_value(self, value, default=DEFAULT):
933 """Shortcut method for getting the single item with a given value."""
934 return self.with_value(value).single(default=default)
936 def single_with_instance(self, instance, default=DEFAULT):
937 """Shortcut method for getting the single item with a given instance."""
938 return self.with_instance(instance).single(default=default)
940 def first_with_name(self, name, default=DEFAULT):
941 """Shortcut method for getting the first item with a given name."""
942 return self.with_name(name).first(default=default)
944 def first_with_value(self, value, default=DEFAULT):
945 """Shortcut method for getting the first item with a given value."""
946 return self.with_value(value).first(default=default)
948 def first_with_instance(self, instance, default=DEFAULT):
949 """Shortcut method for getting the first item with a given instance."""
950 return self.with_instance(instance).first(default=default)
952 def highest_instance(self):
953 """Shortcut method for getting the next instance in a list of items."""
954 return max([c.instance for c in self]) if len(self) > 0 else -1
957 ###############################################################################
959 ###############################################################################
961 # Set up the classes with the mixins we want to be available by default.
965 class CnfList(CnfListSerializationMixin, CnfListArniedApiMixin, CnfListQueryingMixin):
966 """Collection of Cnf variables."""
971 class Cnf(CnfSerializationMixin, CnfArniedApiMixin, CnfShortcutsMixin):
972 """Class representing a cnfvar."""
977 __all__ = ["CnfList", "Cnf"]