# Path: Graphyne/DatabaseDrivers/SQLDictionary.py
# class SyntaxDefSQLite(object):
# class SyntaxDefMSSQL(object):
# class SyntaxSAPHana(object):
#     def createRuntimeDB(self, db):
#     def resetRuntimeDB(self, db):
#     def createTestDB(self, db):
#     def createRuntimeDB(self, db):
#     def resetRuntimeDB(self, db):
#     def createTestDB(self, db):
# 
# Path: Graphyne/Exceptions.py
# class TagError(ValueError):
# class TraverseFilterError(ValueError):
# class EmptyFileError(ValueError):
# class UndefinedPersistenceError(ValueError):
# class PersistenceQueryError(ValueError):
# class EnhancementError(ValueError):
# class EventScriptFailure(ValueError):
# class XMLSchemavalidationError(ValueError):
# class UndefinedValueListError(ValueError):
# class DuplicateValueListError(ValueError):
# class UndefinedOperatorError(ValueError):
# class DisallowedCloneError(ValueError):
# class UndefinedUUIDError(ValueError):
# class TemplatePathError(ValueError):
# class MetaMemePropertyNotDefinedError(ValueError):
# class MemePropertyValidationError(ValueError):
# class MemePropertyValueError(ValueError):
# class MemePropertyValueTypeError(ValueError):
# class MemePropertyValueOutOfBoundsError(ValueError):
# class MemeMembershipValidationError(ValueError):
# class NonInstantiatedSingletonError(ValueError):
# class MemeMemberCardinalityError(ValueError):
# class EntityPropertyMissingValueError(ValueError):
# class EntityPropertyValueTypeError(ValueError):
# class EntityPropertyDuplicateError(ValueError):
# class EntityPropertyValueOutOfBoundsError(ValueError):
# class EntityMemberDuplicateError(ValueError):
# class EntityMemberMissingError(ValueError):
# class EntityInitializationError(ValueError):
# class UnknownLinkError(ValueError):
# class UnanchoredReferenceError(ValueError):
# class UndefinedReferenceDirectionalityError(ValueError):
# class UndefinedReferenceValueComparisonOperator(ValueError):
# class ScriptError(ValueError):
# class GeneratorError(ValueError):
# class StateEventScriptInitError(ValueError):
# class SourceMemeManipulationError(ValueError):
# class EntityNotInLinkError(ValueError):
# class EntityLinkFailureError(ValueError):
# class EntityDuplicateLinkError(ValueError):
# class QueueError(ValueError):
# class NoSuchZoneError(ValueError):
# class NoSuchEntityError(ValueError):
# class MissingImlpicitMemeDatabase(ValueError):
# class UndefinedSQLSyntax(Exception):
# class InconsistentPersistenceArchitecture(Exception): 
# class MalformedArgumentPathError(ValueError):
# class MismatchedArgumentPathError(ValueError):
# class MissingArgumentError(ValueError):
# class MissingAgentPathError(ValueError):
# class MissingAgentError(ValueError):
# class MalformedConditionalError(ValueError):
# class UtilityError(Exception):
#     def __init__(self, persistenceType, persistenceArg, nestedTraceback = None):
#     def __str__(self):
# 
# Path: Graphyne/Condition.py
# class Condition(threading.Thread):
#     ''' An abstract class for defining the three types of conditions, String, Int and Float '''
#     className = "Condition"
#     entityLock = threading.RLock()
# 
#     def initializeCondition(self, conditionContainerUUID, path, operator, valueList = None):
#         self.uuid = conditionContainerUUID
#         self.meme = path
#         self.valueList = valueList
#         self.operator = operator
# 
# Path: Graphyne/Fileutils.py
# def ensureDirectory(targetDir):
# def getModuleFromResolvedPath(fullModuleName):
# def listFromFile(listFileName):
# def getCodePageFromFile(fileURI):
# def walkDirectory(workingDir, packagePath):
# def walkRepository(dataLocation, pathSet, dynamicPackage = None):
# def defaultCSS():
# def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'):
# class Promise(object):


from ast import Str
from uuid import UUID
from xml.dom import minidom
from os.path import expanduser
from .DatabaseDrivers import SQLDictionary
from Graphyne import Exceptions
from Graphyne import Condition
from Graphyne import Fileutils
    from . import Logger
        from .DatabaseDrivers import NonPersistent as persistenceNone
                from .DatabaseDrivers import RelationalDatabase  as persistenceMemory
                from .DatabaseDrivers import RelationalDatabase as persistenceExisting
                from .DatabaseDrivers import RelationalDatabase as persistenceNew
                from .DatabaseDrivers import RelationalDatabase as persistenceMSSQL
import uuid
import decimal
import copy
import re
import threading
import sys
import os
import queue
import functools
import platform
import json
import time
                import sqlite3 as dbDriverMemory
                import sqlite3 as dbDriverExisting
                import sqlite3 as dbDriverNew
                import pyodbc as dbDriverMSSQL
                            import TestUtils   
                            import sqlite3 as dtDBDriverSQLiteDT
                        import sqlite3 as dtDBDriverSQLite2
                    errorMsg = str(fullerror[1])
                    tb = sys.exc_info()[2]
                    try:
                        scriptLoc = getScriptLocation(params[0], "propertyChanged")
                    except Exception as e:
                        innerFullerror = sys.exc_info()
                        innerErrorMsg = str(innerFullerror[1])
                        scriptLoc = "UNKNOWN LOCATION ((%s))" %innerErrorMsg                         
                    errorMessage = "EventScriptFailure!  Entity of type %s experienced an error while trying to execute script at %s during propertyChanged event."  %(self.memePath.fullTemplatePath, scriptLoc)
                    errorMessage = "%s  Nested Traceback %s: %s" %(errorMessage, errorID, errorMsg)
                    logQ.put( [logType , logLevel.WARNING , method , errorMessage])
                    raise Exceptions.EventScriptFailure(errorMessage).with_traceback(tb)
            return returnValue
        #logQ.put( [logType , logLevel.DEBUG , method , "exiting"])
        

    def setStateEventScript(self, scriptLocation, scriptLanguage = "python", state = "execute", propertyID = None):
        """ Set the state event callable object on self.
        scriptLocation = The classpath of the callable object
        scriptLanguage = at the moment, only Python is supported
        Sate = One of the valid values for the restriction Memetic.StateEventType 
        propertyID = If the state is propertyChanged, then the property ID should be passed.
        """
        method = moduleName + '.' +  self.className + '.setStateEventScript'
        logQ.put( [logType , logLevel.DEBUG , method , "entering"])
        if scriptLanguage == "python":
            splitClasspath = scriptLocation.rpartition(".")
            mName = splitClasspath[0]
            cName = splitClasspath[2]
            try:

# Path: Graphyne/DatabaseDrivers/SQLDictionary.py
# class SyntaxDefSQLite(object):
# class SyntaxDefMSSQL(object):
# class SyntaxSAPHana(object):
#     def createRuntimeDB(self, db):
#     def resetRuntimeDB(self, db):
#     def createTestDB(self, db):
#     def createRuntimeDB(self, db):
#     def resetRuntimeDB(self, db):
#     def createTestDB(self, db):
# 
# Path: Graphyne/Exceptions.py
# class TagError(ValueError):
# class TraverseFilterError(ValueError):
# class EmptyFileError(ValueError):
# class UndefinedPersistenceError(ValueError):
# class PersistenceQueryError(ValueError):
# class EnhancementError(ValueError):
# class EventScriptFailure(ValueError):
# class XMLSchemavalidationError(ValueError):
# class UndefinedValueListError(ValueError):
# class DuplicateValueListError(ValueError):
# class UndefinedOperatorError(ValueError):
# class DisallowedCloneError(ValueError):
# class UndefinedUUIDError(ValueError):
# class TemplatePathError(ValueError):
# class MetaMemePropertyNotDefinedError(ValueError):
# class MemePropertyValidationError(ValueError):
# class MemePropertyValueError(ValueError):
# class MemePropertyValueTypeError(ValueError):
# class MemePropertyValueOutOfBoundsError(ValueError):
# class MemeMembershipValidationError(ValueError):
# class NonInstantiatedSingletonError(ValueError):
# class MemeMemberCardinalityError(ValueError):
# class EntityPropertyMissingValueError(ValueError):
# class EntityPropertyValueTypeError(ValueError):
# class EntityPropertyDuplicateError(ValueError):
# class EntityPropertyValueOutOfBoundsError(ValueError):
# class EntityMemberDuplicateError(ValueError):
# class EntityMemberMissingError(ValueError):
# class EntityInitializationError(ValueError):
# class UnknownLinkError(ValueError):
# class UnanchoredReferenceError(ValueError):
# class UndefinedReferenceDirectionalityError(ValueError):
# class UndefinedReferenceValueComparisonOperator(ValueError):
# class ScriptError(ValueError):
# class GeneratorError(ValueError):
# class StateEventScriptInitError(ValueError):
# class SourceMemeManipulationError(ValueError):
# class EntityNotInLinkError(ValueError):
# class EntityLinkFailureError(ValueError):
# class EntityDuplicateLinkError(ValueError):
# class QueueError(ValueError):
# class NoSuchZoneError(ValueError):
# class NoSuchEntityError(ValueError):
# class MissingImlpicitMemeDatabase(ValueError):
# class UndefinedSQLSyntax(Exception):
# class InconsistentPersistenceArchitecture(Exception): 
# class MalformedArgumentPathError(ValueError):
# class MismatchedArgumentPathError(ValueError):
# class MissingArgumentError(ValueError):
# class MissingAgentPathError(ValueError):
# class MissingAgentError(ValueError):
# class MalformedConditionalError(ValueError):
# class UtilityError(Exception):
#     def __init__(self, persistenceType, persistenceArg, nestedTraceback = None):
#     def __str__(self):
# 
# Path: Graphyne/Condition.py
# class Condition(threading.Thread):
#     ''' An abstract class for defining the three types of conditions, String, Int and Float '''
#     className = "Condition"
#     entityLock = threading.RLock()
# 
#     def initializeCondition(self, conditionContainerUUID, path, operator, valueList = None):
#         self.uuid = conditionContainerUUID
#         self.meme = path
#         self.valueList = valueList
#         self.operator = operator
# 
# Path: Graphyne/Fileutils.py
# def ensureDirectory(targetDir):
# def getModuleFromResolvedPath(fullModuleName):
# def listFromFile(listFileName):
# def getCodePageFromFile(fileURI):
# def walkDirectory(workingDir, packagePath):
# def walkRepository(dataLocation, pathSet, dynamicPackage = None):
# def defaultCSS():
# def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'):
# class Promise(object):


# Path: Graphyne/Graph.py
from ast import Str
from uuid import UUID
from xml.dom import minidom
from os.path import expanduser
from .DatabaseDrivers import SQLDictionary
from Graphyne import Exceptions
from Graphyne import Condition
from Graphyne import Fileutils
    from . import Logger
        from .DatabaseDrivers import NonPersistent as persistenceNone
                from .DatabaseDrivers import RelationalDatabase  as persistenceMemory
                from .DatabaseDrivers import RelationalDatabase as persistenceExisting
                from .DatabaseDrivers import RelationalDatabase as persistenceNew
                from .DatabaseDrivers import RelationalDatabase as persistenceMSSQL
import uuid
import decimal
import copy
import re
import threading
import sys
import os
import queue
import functools
import platform
import json
import time
                import sqlite3 as dbDriverMemory
                import sqlite3 as dbDriverExisting
                import sqlite3 as dbDriverNew
                import pyodbc as dbDriverMSSQL
                            import TestUtils   
                            import sqlite3 as dtDBDriverSQLiteDT
                        import sqlite3 as dtDBDriverSQLite2

                    errorMsg = str(fullerror[1])
                    tb = sys.exc_info()[2]
                    try:
                        scriptLoc = getScriptLocation(params[0], "propertyChanged")
                    except Exception as e:
                        innerFullerror = sys.exc_info()
                        innerErrorMsg = str(innerFullerror[1])
                        scriptLoc = "UNKNOWN LOCATION ((%s))" %innerErrorMsg                         
                    errorMessage = "EventScriptFailure!  Entity of type %s experienced an error while trying to execute script at %s during propertyChanged event."  %(self.memePath.fullTemplatePath, scriptLoc)
                    errorMessage = "%s  Nested Traceback %s: %s" %(errorMessage, errorID, errorMsg)
                    logQ.put( [logType , logLevel.WARNING , method , errorMessage])
                    raise Exceptions.EventScriptFailure(errorMessage).with_traceback(tb)
            return returnValue
        #logQ.put( [logType , logLevel.DEBUG , method , "exiting"])
        

    def setStateEventScript(self, scriptLocation, scriptLanguage = "python", state = "execute", propertyID = None):
        """ Set the state event callable object on self.
        scriptLocation = The classpath of the callable object
        scriptLanguage = at the moment, only Python is supported
        Sate = One of the valid values for the restriction Memetic.StateEventType 
        propertyID = If the state is propertyChanged, then the property ID should be passed.
        """
        method = moduleName + '.' +  self.className + '.setStateEventScript'
        logQ.put( [logType , logLevel.DEBUG , method , "entering"])
        if scriptLanguage == "python":
            splitClasspath = scriptLocation.rpartition(".")
            mName = splitClasspath[0]
            cName = splitClasspath[2]
            try:

                mod = Fileutils.getModuleFromResolvedPath(mName)