# Path: pynusmv/exception.py
# class NuSMVInitError(PyNuSMVError):
# 
#     """
#     NuSMV initialisation-related exception.
# 
#     """
#     pass
# 
# class PyNuSMVError(Exception):
# 
#     """
#     A generic PyNuSMV Error, superclass of all PyNuSMV Errors.
# 
#     """
#     pass


import weakref
import gc
from pynusmv_lower_interface.nusmv.cinit import cinit as nscinit
from pynusmv_lower_interface.nusmv.opt import opt as nsopt
from pynusmv_lower_interface.nusmv.cmd import cmd as nscmd
from pynusmv_lower_interface.nusmv.dd import dd as nsdd
from .exception import NuSMVInitError, PyNuSMVError
        from . import glob
    """
    A PyNuSMV Context allows to initialize and deinitialize PyNuSMV through
    a `with` Python statement.
    """

    def __enter__(self):
        return None

    def __exit__(self, exc_type, exc_value, traceback):
        # FIXME Why should we avoid shut NuSMV down if an exception occurs?
        #if exc_type is None:
        deinit_nusmv()


def init_nusmv(collecting=True):
    """
    Initialize NuSMV. Must be called only once before calling
    :func:`deinit_nusmv`.

    :param collecting: Whether or not collecting pointer wrappers to free them
                       before deiniting nusmv.

    .. warning: Deactivating the collection of pointer wrappers may provoke
                segmentation faults when deiniting nusmv without correctly
                freeing all pointer wrappers in advance.
                On the other hand, collection may blow memory.

    """
    global __collector, __collecting
    if __collector is not None:

# Path: pynusmv/exception.py
# class NuSMVInitError(PyNuSMVError):
# 
#     """
#     NuSMV initialisation-related exception.
# 
#     """
#     pass
# 
# class PyNuSMVError(Exception):
# 
#     """
#     A generic PyNuSMV Error, superclass of all PyNuSMV Errors.
# 
#     """
#     pass


# Path: pynusmv/init.py
import weakref
import gc
from pynusmv_lower_interface.nusmv.cinit import cinit as nscinit
from pynusmv_lower_interface.nusmv.opt import opt as nsopt
from pynusmv_lower_interface.nusmv.cmd import cmd as nscmd
from pynusmv_lower_interface.nusmv.dd import dd as nsdd
from .exception import NuSMVInitError, PyNuSMVError
        from . import glob

    """
    A PyNuSMV Context allows to initialize and deinitialize PyNuSMV through
    a `with` Python statement.
    """

    def __enter__(self):
        return None

    def __exit__(self, exc_type, exc_value, traceback):
        # FIXME Why should we avoid shut NuSMV down if an exception occurs?
        #if exc_type is None:
        deinit_nusmv()


def init_nusmv(collecting=True):
    """
    Initialize NuSMV. Must be called only once before calling
    :func:`deinit_nusmv`.

    :param collecting: Whether or not collecting pointer wrappers to free them
                       before deiniting nusmv.

    .. warning: Deactivating the collection of pointer wrappers may provoke
                segmentation faults when deiniting nusmv without correctly
                freeing all pointer wrappers in advance.
                On the other hand, collection may blow memory.

    """
    global __collector, __collecting
    if __collector is not None:

        raise NuSMVInitError("Cannot initialize NuSMV twice.")