# Path: src/moddy/fsm.py
# def is_sub_fsm_specification(name_cls_tuple):
#     """
#     Test if the tuple from a transition list (name, classType)
#     is a subFsm specification"""
#     _, cls = name_cls_tuple
#     if isinstance(cls, type):
#         return cls
#     return None
# 
# Path: src/moddy/utils.py
# def create_dirs_and_open_output_file(file_path):
#     '''
#     Create missing directories to <file_path> and open <file_path> for writing
#     @return: file descriptor
#     '''
#     if os.path.dirname(file_path) != "":
#         os.makedirs(os.path.dirname(file_path), exist_ok=True)
#     return open(file_path, 'w')


import subprocess
import os
from .fsm import is_sub_fsm_specification
from .utils import create_dirs_and_open_output_file
        lines.append(
            [
                level + 1,
                'graph [fontname = "helvetica" fontsize=10 '
                "fontnodesep=0.1];",
            ]
        )
        lines.append(
            [
                level + 1,
                'node [fontname = "helvetica" fontsize=10 '
                "shape=ellipse color=black height=.1];",
            ]
        )
        lines.append(
            [
                level + 1,
                'edge [fontname = "helvetica" color=black fontsize=8 '
                "fontcolor=black];",
            ]
        )

        sub_lines, _ = self.fsm_gen(level + 1, self._fsm)
        lines += sub_lines

        # finish
        lines.append([level, "}"])

        # Output the DOT file as filename.dot e.g. test.svg.gv
        dot_file = "%s.gv" % file_name

# Path: src/moddy/fsm.py
# def is_sub_fsm_specification(name_cls_tuple):
#     """
#     Test if the tuple from a transition list (name, classType)
#     is a subFsm specification"""
#     _, cls = name_cls_tuple
#     if isinstance(cls, type):
#         return cls
#     return None
# 
# Path: src/moddy/utils.py
# def create_dirs_and_open_output_file(file_path):
#     '''
#     Create missing directories to <file_path> and open <file_path> for writing
#     @return: file descriptor
#     '''
#     if os.path.dirname(file_path) != "":
#         os.makedirs(os.path.dirname(file_path), exist_ok=True)
#     return open(file_path, 'w')


# Path: src/moddy/dot_fsm.py
import subprocess
import os
from .fsm import is_sub_fsm_specification
from .utils import create_dirs_and_open_output_file

        lines.append(
            [
                level + 1,
                'graph [fontname = "helvetica" fontsize=10 '
                "fontnodesep=0.1];",
            ]
        )
        lines.append(
            [
                level + 1,
                'node [fontname = "helvetica" fontsize=10 '
                "shape=ellipse color=black height=.1];",
            ]
        )
        lines.append(
            [
                level + 1,
                'edge [fontname = "helvetica" color=black fontsize=8 '
                "fontcolor=black];",
            ]
        )

        sub_lines, _ = self.fsm_gen(level + 1, self._fsm)
        lines += sub_lines

        # finish
        lines.append([level, "}"])

        # Output the DOT file as filename.dot e.g. test.svg.gv
        dot_file = "%s.gv" % file_name

        file_desc = create_dirs_and_open_output_file(dot_file)