# Path: sark/exceptions.py
# class SarkException(Exception):
# class SarkError(SarkException):
# class SarkNoSelection(SarkError):
# class SarkNoFunction(SarkError):
# class SarkAddFunctionFailed(SarkError):
# class SarkFunctionExists(SarkError):
# class SarkStructError(SarkError):
# class SarkInvalidRegisterName(SarkError):
# class SarkStructAlreadyExists(SarkStructError):
# class SarkStructCreationFailed(SarkStructError):
# class SarkStructNotFound(SarkStructError):
# class SarkErrorAddStructMemeberFailed(SarkStructError):
# class SarkErrorStructMemberName(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberOffset(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberSize(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberTinfo(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberStruct(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberUnivar(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberVarlast(SarkErrorAddStructMemeberFailed):
# class SarkEnumError(SarkError):
# class SarkErrorAddEnumMemeberFailed(SarkEnumError):
# class SarkErrorEnumMemberName(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberValue(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberEnum(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberMask(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberIllv(SarkErrorAddEnumMemeberFailed):
# class EnumNotFound(SarkEnumError):
# class EnumCreationFailed(SarkEnumError):
# class EnumAlreadyExists(SarkEnumError):
# class CantRenameEnumMember(SarkEnumError):
# class CantSetEnumMemberComment(SarkEnumError):
# class SarkErrorNameAlreadyExists(SarkError):
# class SarkSetNameFailed(SarkError):
# class SarkSwitchError(SarkError):
# class SarkNotASwitch(SarkSwitchError):
# class SarkNoInstruction(SarkError):
# class SarkOperandError(SarkError):
# class SarkOperandWithoutReg(SarkOperandError):
# class CantSetEnumComment(SarkEnumError):
# class CantDeleteEnumMember(SarkEnumError):
# class CantSetEnumBitfield(SarkEnumError):
# class CantRenameEnum(SarkEnumError):
# class SarkGuiError(SarkError):
# class SarkMenuError(SarkGuiError):
# class MenuAlreadyExists(SarkMenuError):
# class MenuNotFound(SarkMenuError):
# class FormNotFound(SarkGuiError):
# class InvalidStructOffset(SarkStructError):
# class SegmentError(SarkError):
# class NoMoreSegments(SegmentError):
# class InvalidBitness(SegmentError):
# class NoFileOffset(SarkError):
# class SarkNoString(SarkError):
# class SarkExpectedPatchedByte(SarkError):
# class PhraseError(SarkOperandError):
# class OperandNotPhrase(PhraseError):
# class PhraseNotSupported(PhraseError):
# class PhraseProcessorNotSupported(PhraseNotSupported):
# class SetTypeFailed(SarkError):
#     def __init__(self, ea, c_signature):


from itertools import repeat
from contextlib import suppress
from collections import deque
from sark import exceptions
import sark
import idaapi
import networkx as nx
        if idaapi.get_widget_type(form) == idaapi.BWN_DISASM:
            idaapi.attach_action_to_popup(form, popup, ShowXrefsGraphFrom.get_name(), '')
            idaapi.attach_action_to_popup(form, popup, ShowXrefsGraphTo.get_name(), '')


class XrefsGraphPlugins(idaapi.plugin_t):
    flags = 0
    comment = 'Show xref graphs'
    help = 'Shows xref graphs.'
    wanted_name = 'Xref Graphs'
    wanted_hotkey = ""

    def init(self):
        ShowXrefsGraphTo.register()
        ShowXrefsGraphFrom.register()
        idaapi.attach_action_to_menu(MENU_PATH_GRAPHS, ShowXrefsGraphTo.get_name(), 0)
        idaapi.attach_action_to_menu(MENU_PATH_GRAPHS, ShowXrefsGraphFrom.get_name(), 0)

        self.hooks = Hooks()
        self.hooks.hook()

        return idaapi.PLUGIN_KEEP

    def term(self):
        self.hooks.unhook()
        idaapi.detach_action_from_menu(MENU_PATH_GRAPHS, ShowXrefsGraphTo.get_name())
        idaapi.detach_action_from_menu(MENU_PATH_GRAPHS, ShowXrefsGraphFrom.get_name())
        ShowXrefsGraphTo.unregister()
        ShowXrefsGraphFrom.unregister()


# Path: sark/exceptions.py
# class SarkException(Exception):
# class SarkError(SarkException):
# class SarkNoSelection(SarkError):
# class SarkNoFunction(SarkError):
# class SarkAddFunctionFailed(SarkError):
# class SarkFunctionExists(SarkError):
# class SarkStructError(SarkError):
# class SarkInvalidRegisterName(SarkError):
# class SarkStructAlreadyExists(SarkStructError):
# class SarkStructCreationFailed(SarkStructError):
# class SarkStructNotFound(SarkStructError):
# class SarkErrorAddStructMemeberFailed(SarkStructError):
# class SarkErrorStructMemberName(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberOffset(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberSize(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberTinfo(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberStruct(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberUnivar(SarkErrorAddStructMemeberFailed):
# class SarkErrorStructMemberVarlast(SarkErrorAddStructMemeberFailed):
# class SarkEnumError(SarkError):
# class SarkErrorAddEnumMemeberFailed(SarkEnumError):
# class SarkErrorEnumMemberName(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberValue(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberEnum(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberMask(SarkErrorAddEnumMemeberFailed):
# class SarkErrorEnumMemberIllv(SarkErrorAddEnumMemeberFailed):
# class EnumNotFound(SarkEnumError):
# class EnumCreationFailed(SarkEnumError):
# class EnumAlreadyExists(SarkEnumError):
# class CantRenameEnumMember(SarkEnumError):
# class CantSetEnumMemberComment(SarkEnumError):
# class SarkErrorNameAlreadyExists(SarkError):
# class SarkSetNameFailed(SarkError):
# class SarkSwitchError(SarkError):
# class SarkNotASwitch(SarkSwitchError):
# class SarkNoInstruction(SarkError):
# class SarkOperandError(SarkError):
# class SarkOperandWithoutReg(SarkOperandError):
# class CantSetEnumComment(SarkEnumError):
# class CantDeleteEnumMember(SarkEnumError):
# class CantSetEnumBitfield(SarkEnumError):
# class CantRenameEnum(SarkEnumError):
# class SarkGuiError(SarkError):
# class SarkMenuError(SarkGuiError):
# class MenuAlreadyExists(SarkMenuError):
# class MenuNotFound(SarkMenuError):
# class FormNotFound(SarkGuiError):
# class InvalidStructOffset(SarkStructError):
# class SegmentError(SarkError):
# class NoMoreSegments(SegmentError):
# class InvalidBitness(SegmentError):
# class NoFileOffset(SarkError):
# class SarkNoString(SarkError):
# class SarkExpectedPatchedByte(SarkError):
# class PhraseError(SarkOperandError):
# class OperandNotPhrase(PhraseError):
# class PhraseNotSupported(PhraseError):
# class PhraseProcessorNotSupported(PhraseNotSupported):
# class SetTypeFailed(SarkError):
#     def __init__(self, ea, c_signature):


# Path: plugins/xrefsgraph.py
from itertools import repeat
from contextlib import suppress
from collections import deque
from sark import exceptions
import sark
import idaapi
import networkx as nx

        if idaapi.get_widget_type(form) == idaapi.BWN_DISASM:
            idaapi.attach_action_to_popup(form, popup, ShowXrefsGraphFrom.get_name(), '')
            idaapi.attach_action_to_popup(form, popup, ShowXrefsGraphTo.get_name(), '')


class XrefsGraphPlugins(idaapi.plugin_t):
    flags = 0
    comment = 'Show xref graphs'
    help = 'Shows xref graphs.'
    wanted_name = 'Xref Graphs'
    wanted_hotkey = ""

    def init(self):
        ShowXrefsGraphTo.register()
        ShowXrefsGraphFrom.register()
        idaapi.attach_action_to_menu(MENU_PATH_GRAPHS, ShowXrefsGraphTo.get_name(), 0)
        idaapi.attach_action_to_menu(MENU_PATH_GRAPHS, ShowXrefsGraphFrom.get_name(), 0)

        self.hooks = Hooks()
        self.hooks.hook()

        return idaapi.PLUGIN_KEEP

    def term(self):
        self.hooks.unhook()
        idaapi.detach_action_from_menu(MENU_PATH_GRAPHS, ShowXrefsGraphTo.get_name())
        idaapi.detach_action_from_menu(MENU_PATH_GRAPHS, ShowXrefsGraphFrom.get_name())
        ShowXrefsGraphTo.unregister()
        ShowXrefsGraphFrom.unregister()


    def run(self, arg):