Exemple #1
0
class Logs(object):
    """ Service for accessing logs.
    """

    MATCH_ALL = {'match_all': {}}

    es = require('logzen.es:Connection')

    users = require('logzen.db.users:Users')
    streams = require('logzen.db.streams:Streams')

    def query(self, stream, query=None):
        """ Search for logs using the passed stream and query.

            The returned log list is filtered by the filter assigned to the
            user owning the stream and by an optional filter assigned to a stream.

            The returned value is the unmodified result of the executed
            ElasticSearch query.
        """

        request = {}

        # Add the filters to the request
        if stream.user.filter and stream.filter:
            # Create a combined filter using the user filter and stream filter
            request.update(
                {'filter': {
                    'and': [stream.user.filter, stream.filter]
                }})

        elif stream.user.filter:
            # Use only the user filter
            request.update({'filter': stream.user.filter})

        elif stream.filter is not None:
            # Use only the stream filter
            request.update({'filter': stream.filter})

        # Add the query to the request - if any
        if query:
            request.update({
                'query': query,
            })

        # Execute the search
        return self.es.search(request)
Exemple #2
0
def include_defs(filename, globals=None):
  """
  Uses :mod:`require` to load a Python file and then copies all symbols
  that do not start with an underscore into the *globals* dictionary. If
  *globals* is not specified, it will fall back to the globals of the frame
  that calls the function.
  """

  module = require(filename, _stackdepth=1)
  if globals is None:
    globals = _sys._getframe(1).f_globals
  for key, value in vars(module).items():
    if not key.startswith('_'):
      globals[key] = value
Exemple #3
0
def createNewrequire(self, wherex, wherey, screenCoordinates=1):
    self.fromClass = None
    self.toClass = None
    # try the global constraints...
    res = self.ASGroot.preCondition(ASG.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    new_semantic_obj = require(self)
    res = new_semantic_obj.preCondition(ASGNode.CREATE)
    if res: return self.constraintViolation(res)
    new_semantic_obj.preAction(ASGNode.CREATE)

    ne = len(self.ASGroot.listNodes["require"])
    if new_semantic_obj.keyword_:
        new_semantic_obj.keyword_.setValue(
            new_semantic_obj.keyword_.toString() + str(ne))
    if screenCoordinates:
        new_obj = graph_require(self.UMLmodel.canvasx(wherex),
                                self.UMLmodel.canvasy(wherey),
                                new_semantic_obj)
    else:  # already in canvas coordinates
        new_obj = graph_require(wherex, wherey, new_semantic_obj)
    new_obj.DrawObject(self.UMLmodel, self.editGGLabel)
    self.UMLmodel.addtag_withtag("require", new_obj.tag)
    new_semantic_obj.graphObject_ = new_obj
    self.ASGroot.addNode(new_semantic_obj)
    res = self.ASGroot.postCondition(ASG.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    res = new_semantic_obj.postCondition(ASGNode.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return
    new_semantic_obj.postAction(ASGNode.CREATE)

    self.mode = self.IDLEMODE
    if self.editGGLabel:
        self.statusbar.event(StatusBar.TRANSFORMATION, StatusBar.CREATE)
    else:
        self.statusbar.event(StatusBar.MODEL, StatusBar.CREATE)
    return new_semantic_obj
Exemple #4
0
class Connection:
    """ Connection to ElasticSearch.

        Creates a (pooled) low-level connection to the ElasticSearch cluster.
    """
    logger = require('logzen.util:Logger')

    def __init__(self):
        servers = [
            'localhost'
        ]  #[value for key, value in config.system.es if key.startswith('server_')]

        username = None  #config.system.es['username']
        password = None  #config.system.es['password']

        if username and password:
            auth = (username, password)

        else:
            auth = None

        self.__connection = Elasticsearch(
            servers, connection_class=Urllib3HttpConnection, http_auth=auth)

    def search(self, body):
        """ Execute a search query.

            The passed query must be a valid ElasticSearch query. This query is
            passed to the connection with the according index and the result is
            returned.
        """
        self.logger.debug('Execute search: %s', JSONSerializer().dumps(body))

        return self.__connection.search(
            body=body, index='syslog')  #config.system.es.index)

    def get(self, id):
        """ Fetches an document.

            The document with the passed id is fetched from the according index
            and is returned.
        """
        return self.__connection.get(id=id,
                                     index='syslog')  #config.system.es.index)
Exemple #5
0
    def msg_handler(self, msg):
        """Called when the bot recieves a message."""
        print "Minion recieved: %s" % msg
        simplemsg = simplify(msg)

        # Check to see if any of the registered matches match this message.
        for (match, callback, requires) in self.matches:
            if simplemsg.find(match) > -1:

                # Test if all of the requires for the match succeed.
                if min([require(self, simplemsg) for require in requires]):

                    print "Calling callback for %s" % match
                    # Call the callback, if it returns a string, send it to the client.
                    result = callback()
                    if isinstance(result, str):
                        self.write(result)
                    else:
                        print "Callback didn't return a string."
Exemple #6
0
    def runChecker(self):
        size = int(self.tableSize)
        myarray = [0] * size
        f = open(self.pathToInput, 'r')
        lines = f.readlines()
        mypath = require(self.pathToFunct)

        #    mod = importlib.import_module(self.pathToFunct)
        hash_it = getattr(mypath, self.functName)

        for st in lines:
            a = hash_it(st, size)
            myarray[a] += 1

        f.close()

        win = Window(myarray)
        win.setWindowTitle("Results")
        win.show()
Exemple #7
0
class SessionPlugin(object):
    """ A bottle plugin creating a session for each request.

        For each incoming request, a sqlalchemy session is created and attached
        to the requests.
    """

    sessionFactory = require('logzen.db:SessionFactory')

    def apply(self, callback, route):
        def wrapper(*args, **kwargs):
            session = self.sessionFactory()
            setattr(bottle.local, 'session', session)

            try:
                return callback(*args, **kwargs)

            finally:
                session.close()

        return wrapper
Exemple #8
0
import unittest
import require
MusicService = require("../server/MusicService.py").MusicService


class TestSpotifyPlay(unittest.TestCase):
    @unittest.skip("Manually run this test")
    def testDetectSongAndArtist(self):
        voice_command = "play dab of ranch by migos"
        self.assertEqual("dab of ranch,migos", MusicService.parse_voice_command(MusicService, voice_command))

    @unittest.skip("Manually run this test")
    def testDetectSong(self):
        voice_command = "play dab of ranch"
        self.assertEqual("dab of ranch", MusicService.parse_voice_command(MusicService, voice_command))

    def testGetPreviewUrl(self):
        print(MusicService.get_preview_url(MusicService, "dab of ranch + migos"))

    def test_play_song(self):
        MusicService.play_song(MusicService, "play dab of ranch by migos")


def main():
    unittest.main(verbosity=2)


if __name__ == '__main__':
    main()

Exemple #9
0
code1 = '''
msg = "This is old code"
print(msg)
'''

code2 = '''
msg = "This is new code"
print(msg)
'''


def save(name, code):
    fp = open(name, "w")
    fp.write(code)
    fp.flush()
    fp.close()


save("test-force-item.py", code1)
m = require("test-force-item")
assert m.msg == "This is old code"

# wait pycache to refresh
time.sleep(1)

save("test-force-item.py", code2)
m2 = require("test-force-item", force=True)
assert m2.msg == "This is new code"

os.remove("test-force-item.py")
    def __init__(self, parent):
        GGrule.__init__(self, 4)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_omacs(parent)

        self.obj1568 = Agent(parent)
        self.obj1568.preAction(self.LHS.CREATE)
        self.obj1568.isGraphObjectVisual = True

        if (hasattr(self.obj1568, '_setHierarchicalLink')):
            self.obj1568._setHierarchicalLink(False)

        # price
        self.obj1568.price.setNone()

        # name
        self.obj1568.name.setValue('')
        self.obj1568.name.setNone()

        self.obj1568.GGLabel.setValue(1)
        self.obj1568.graphClass_ = graph_Agent
        if parent.genGraphics:
            new_obj = graph_Agent(20.0, 20.0, self.obj1568)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1568.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1568)
        self.obj1568.postAction(self.LHS.CREATE)

        self.obj1569 = Capabilitie(parent)
        self.obj1569.preAction(self.LHS.CREATE)
        self.obj1569.isGraphObjectVisual = True

        if (hasattr(self.obj1569, '_setHierarchicalLink')):
            self.obj1569._setHierarchicalLink(False)

        # name
        self.obj1569.name.setValue('')
        self.obj1569.name.setNone()

        self.obj1569.GGLabel.setValue(3)
        self.obj1569.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(140.0, 160.0, self.obj1569)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1569.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1569)
        self.obj1569.postAction(self.LHS.CREATE)

        self.obj1570 = Role(parent)
        self.obj1570.preAction(self.LHS.CREATE)
        self.obj1570.isGraphObjectVisual = True

        if (hasattr(self.obj1570, '_setHierarchicalLink')):
            self.obj1570._setHierarchicalLink(False)

        # name
        self.obj1570.name.setValue('')
        self.obj1570.name.setNone()

        self.obj1570.GGLabel.setValue(2)
        self.obj1570.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(380.0, 180.0, self.obj1570)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1570.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1570)
        self.obj1570.postAction(self.LHS.CREATE)

        self.obj1571 = posses(parent)
        self.obj1571.preAction(self.LHS.CREATE)
        self.obj1571.isGraphObjectVisual = True

        if (hasattr(self.obj1571, '_setHierarchicalLink')):
            self.obj1571._setHierarchicalLink(False)

        # rate
        self.obj1571.rate.setNone()

        self.obj1571.GGLabel.setValue(4)
        self.obj1571.graphClass_ = graph_posses
        if parent.genGraphics:
            new_obj = graph_posses(78.5, 145.75, self.obj1571)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1571.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1571)
        self.obj1571.postAction(self.LHS.CREATE)

        self.obj1572 = CapableOf(parent)
        self.obj1572.preAction(self.LHS.CREATE)
        self.obj1572.isGraphObjectVisual = True

        if (hasattr(self.obj1572, '_setHierarchicalLink')):
            self.obj1572._setHierarchicalLink(False)

        # rate
        self.obj1572.rate.setNone()

        self.obj1572.GGLabel.setValue(6)
        self.obj1572.graphClass_ = graph_CapableOf
        if parent.genGraphics:
            new_obj = graph_CapableOf(295.25, 111.25, self.obj1572)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1572.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1572)
        self.obj1572.postAction(self.LHS.CREATE)

        self.obj1573 = require(parent)
        self.obj1573.preAction(self.LHS.CREATE)
        self.obj1573.isGraphObjectVisual = True

        if (hasattr(self.obj1573, '_setHierarchicalLink')):
            self.obj1573._setHierarchicalLink(False)

        self.obj1573.GGLabel.setValue(5)
        self.obj1573.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(291.0, 171.5, self.obj1573)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1573.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1573)
        self.obj1573.postAction(self.LHS.CREATE)

        self.obj1568.out_connections_.append(self.obj1571)
        self.obj1571.in_connections_.append(self.obj1568)
        self.obj1568.graphObject_.pendingConnections.append(
            (self.obj1568.graphObject_.tag, self.obj1571.graphObject_.tag,
             [45.0, 82.0, 49.5, 126.5, 78.5, 145.75], 2, True))
        self.obj1568.out_connections_.append(self.obj1572)
        self.obj1572.in_connections_.append(self.obj1568)
        self.obj1568.graphObject_.pendingConnections.append(
            (self.obj1568.graphObject_.tag, self.obj1572.graphObject_.tag,
             [45.0, 82.0, 205.5, 86.5, 295.25, 111.25], 2, True))
        self.obj1570.out_connections_.append(self.obj1573)
        self.obj1573.in_connections_.append(self.obj1570)
        self.obj1570.graphObject_.pendingConnections.append(
            (self.obj1570.graphObject_.tag, self.obj1573.graphObject_.tag,
             [404.0, 181.0, 374.0, 146.0, 291.0, 171.5], 2, True))
        self.obj1571.out_connections_.append(self.obj1569)
        self.obj1569.in_connections_.append(self.obj1571)
        self.obj1571.graphObject_.pendingConnections.append(
            (self.obj1571.graphObject_.tag, self.obj1569.graphObject_.tag,
             [161.0, 159.0, 107.5, 165.0, 78.5, 145.75], 2, True))
        self.obj1572.out_connections_.append(self.obj1570)
        self.obj1570.in_connections_.append(self.obj1572)
        self.obj1572.graphObject_.pendingConnections.append(
            (self.obj1572.graphObject_.tag, self.obj1570.graphObject_.tag,
             [404.0, 181.0, 385.0, 136.0, 295.25, 111.25], 2, True))
        self.obj1573.out_connections_.append(self.obj1569)
        self.obj1569.in_connections_.append(self.obj1573)
        self.obj1573.graphObject_.pendingConnections.append(
            (self.obj1573.graphObject_.tag, self.obj1569.graphObject_.tag,
             [161.0, 199.0, 208.0, 197.0, 291.0, 171.5], 2, True))

        self.RHS = ASG_omacs(parent)

        self.obj1575 = Agent(parent)
        self.obj1575.preAction(self.RHS.CREATE)
        self.obj1575.isGraphObjectVisual = True

        if (hasattr(self.obj1575, '_setHierarchicalLink')):
            self.obj1575._setHierarchicalLink(False)

        # price
        self.obj1575.price.setNone()

        # name
        self.obj1575.name.setValue('')
        self.obj1575.name.setNone()

        self.obj1575.GGLabel.setValue(1)
        self.obj1575.graphClass_ = graph_Agent
        if parent.genGraphics:
            new_obj = graph_Agent(20.0, 20.0, self.obj1575)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1575.graphObject_ = new_obj
        self.obj15750 = AttrCalc()
        self.obj15750.Copy = ATOM3Boolean()
        self.obj15750.Copy.setValue(('Copy from LHS', 1))
        self.obj15750.Copy.config = 0
        self.obj15750.Specify = ATOM3Constraint()
        self.obj15750.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1575.GGset2Any['price'] = self.obj15750
        self.obj15751 = AttrCalc()
        self.obj15751.Copy = ATOM3Boolean()
        self.obj15751.Copy.setValue(('Copy from LHS', 1))
        self.obj15751.Copy.config = 0
        self.obj15751.Specify = ATOM3Constraint()
        self.obj15751.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1575.GGset2Any['name'] = self.obj15751

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1575)
        self.obj1575.postAction(self.RHS.CREATE)

        self.obj1576 = Capabilitie(parent)
        self.obj1576.preAction(self.RHS.CREATE)
        self.obj1576.isGraphObjectVisual = True

        if (hasattr(self.obj1576, '_setHierarchicalLink')):
            self.obj1576._setHierarchicalLink(False)

        # name
        self.obj1576.name.setValue('')
        self.obj1576.name.setNone()

        self.obj1576.GGLabel.setValue(3)
        self.obj1576.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(140.0, 160.0, self.obj1576)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1576.graphObject_ = new_obj
        self.obj15760 = AttrCalc()
        self.obj15760.Copy = ATOM3Boolean()
        self.obj15760.Copy.setValue(('Copy from LHS', 1))
        self.obj15760.Copy.config = 0
        self.obj15760.Specify = ATOM3Constraint()
        self.obj15760.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1576.GGset2Any['name'] = self.obj15760

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1576)
        self.obj1576.postAction(self.RHS.CREATE)

        self.obj1577 = Role(parent)
        self.obj1577.preAction(self.RHS.CREATE)
        self.obj1577.isGraphObjectVisual = True

        if (hasattr(self.obj1577, '_setHierarchicalLink')):
            self.obj1577._setHierarchicalLink(False)

        # name
        self.obj1577.name.setValue('')
        self.obj1577.name.setNone()

        self.obj1577.GGLabel.setValue(2)
        self.obj1577.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(380.0, 180.0, self.obj1577)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1577.graphObject_ = new_obj
        self.obj15770 = AttrCalc()
        self.obj15770.Copy = ATOM3Boolean()
        self.obj15770.Copy.setValue(('Copy from LHS', 1))
        self.obj15770.Copy.config = 0
        self.obj15770.Specify = ATOM3Constraint()
        self.obj15770.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1577.GGset2Any['name'] = self.obj15770

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1577)
        self.obj1577.postAction(self.RHS.CREATE)

        self.obj1578 = posses(parent)
        self.obj1578.preAction(self.RHS.CREATE)
        self.obj1578.isGraphObjectVisual = True

        if (hasattr(self.obj1578, '_setHierarchicalLink')):
            self.obj1578._setHierarchicalLink(False)

        # rate
        self.obj1578.rate.setNone()

        self.obj1578.GGLabel.setValue(4)
        self.obj1578.graphClass_ = graph_posses
        if parent.genGraphics:
            new_obj = graph_posses(78.5, 145.75, self.obj1578)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1578.graphObject_ = new_obj
        self.obj15780 = AttrCalc()
        self.obj15780.Copy = ATOM3Boolean()
        self.obj15780.Copy.setValue(('Copy from LHS', 1))
        self.obj15780.Copy.config = 0
        self.obj15780.Specify = ATOM3Constraint()
        self.obj15780.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1578.GGset2Any['rate'] = self.obj15780

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1578)
        self.obj1578.postAction(self.RHS.CREATE)

        self.obj1579 = CapableOf(parent)
        self.obj1579.preAction(self.RHS.CREATE)
        self.obj1579.isGraphObjectVisual = True

        if (hasattr(self.obj1579, '_setHierarchicalLink')):
            self.obj1579._setHierarchicalLink(False)

        # rate
        self.obj1579.rate.setNone()

        self.obj1579.GGLabel.setValue(6)
        self.obj1579.graphClass_ = graph_CapableOf
        if parent.genGraphics:
            new_obj = graph_CapableOf(295.25, 111.25, self.obj1579)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1579.graphObject_ = new_obj
        self.obj15790 = AttrCalc()
        self.obj15790.Copy = ATOM3Boolean()
        self.obj15790.Copy.setValue(('Copy from LHS', 1))
        self.obj15790.Copy.config = 0
        self.obj15790.Specify = ATOM3Constraint()
        self.obj15790.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1579.GGset2Any['rate'] = self.obj15790

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1579)
        self.obj1579.postAction(self.RHS.CREATE)

        self.obj1580 = require(parent)
        self.obj1580.preAction(self.RHS.CREATE)
        self.obj1580.isGraphObjectVisual = True

        if (hasattr(self.obj1580, '_setHierarchicalLink')):
            self.obj1580._setHierarchicalLink(False)

        self.obj1580.GGLabel.setValue(5)
        self.obj1580.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(291.0, 171.5, self.obj1580)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1580.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1580)
        self.obj1580.postAction(self.RHS.CREATE)

        self.obj1575.out_connections_.append(self.obj1578)
        self.obj1578.in_connections_.append(self.obj1575)
        self.obj1575.graphObject_.pendingConnections.append(
            (self.obj1575.graphObject_.tag, self.obj1578.graphObject_.tag,
             [57.0, 82.0, 78.5, 145.75], 2, 0))
        self.obj1575.out_connections_.append(self.obj1579)
        self.obj1579.in_connections_.append(self.obj1575)
        self.obj1575.graphObject_.pendingConnections.append(
            (self.obj1575.graphObject_.tag, self.obj1579.graphObject_.tag,
             [57.0, 82.0, 295.25, 111.25], 2, 0))
        self.obj1577.out_connections_.append(self.obj1580)
        self.obj1580.in_connections_.append(self.obj1577)
        self.obj1577.graphObject_.pendingConnections.append(
            (self.obj1577.graphObject_.tag, self.obj1580.graphObject_.tag,
             [411.0, 180.0, 291.0, 171.5], 2, 0))
        self.obj1578.out_connections_.append(self.obj1576)
        self.obj1576.in_connections_.append(self.obj1578)
        self.obj1578.graphObject_.pendingConnections.append(
            (self.obj1578.graphObject_.tag, self.obj1576.graphObject_.tag,
             [171.0, 163.0, 78.5, 145.75], 2, 0))
        self.obj1579.out_connections_.append(self.obj1577)
        self.obj1577.in_connections_.append(self.obj1579)
        self.obj1579.graphObject_.pendingConnections.append(
            (self.obj1579.graphObject_.tag, self.obj1577.graphObject_.tag,
             [411.0, 180.0, 295.25, 111.25], 2, 0))
        self.obj1580.out_connections_.append(self.obj1576)
        self.obj1576.in_connections_.append(self.obj1580)
        self.obj1580.graphObject_.pendingConnections.append(
            (self.obj1580.graphObject_.tag, self.obj1576.graphObject_.tag,
             [171.0, 163.0, 291.0, 171.5], 2, 0))
    def __init__(self, parent):
        GGrule.__init__(self, 1)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_omacs(parent)

        self.obj1509 = Agent(parent)
        self.obj1509.preAction(self.LHS.CREATE)
        self.obj1509.isGraphObjectVisual = True

        if (hasattr(self.obj1509, '_setHierarchicalLink')):
            self.obj1509._setHierarchicalLink(False)

        # price
        self.obj1509.price.setNone()

        # name
        self.obj1509.name.setValue('')
        self.obj1509.name.setNone()

        self.obj1509.GGLabel.setValue(1)
        self.obj1509.graphClass_ = graph_Agent
        if parent.genGraphics:
            new_obj = graph_Agent(80.0, 20.0, self.obj1509)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1509.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1509)
        self.obj1509.postAction(self.LHS.CREATE)

        self.obj1510 = Capabilitie(parent)
        self.obj1510.preAction(self.LHS.CREATE)
        self.obj1510.isGraphObjectVisual = True

        if (hasattr(self.obj1510, '_setHierarchicalLink')):
            self.obj1510._setHierarchicalLink(False)

        # name
        self.obj1510.name.setValue('')
        self.obj1510.name.setNone()

        self.obj1510.GGLabel.setValue(2)
        self.obj1510.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(160.0, 180.0, self.obj1510)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1510.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1510)
        self.obj1510.postAction(self.LHS.CREATE)

        self.obj1511 = Role(parent)
        self.obj1511.preAction(self.LHS.CREATE)
        self.obj1511.isGraphObjectVisual = True

        if (hasattr(self.obj1511, '_setHierarchicalLink')):
            self.obj1511._setHierarchicalLink(False)

        # name
        self.obj1511.name.setValue('')
        self.obj1511.name.setNone()

        self.obj1511.GGLabel.setValue(3)
        self.obj1511.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(280.0, 40.0, self.obj1511)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1511.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1511)
        self.obj1511.postAction(self.LHS.CREATE)

        self.obj1512 = posses(parent)
        self.obj1512.preAction(self.LHS.CREATE)
        self.obj1512.isGraphObjectVisual = True

        if (hasattr(self.obj1512, '_setHierarchicalLink')):
            self.obj1512._setHierarchicalLink(False)

        # rate
        self.obj1512.rate.setNone()

        self.obj1512.GGLabel.setValue(4)
        self.obj1512.graphClass_ = graph_posses
        if parent.genGraphics:
            new_obj = graph_posses(143.0, 130.5, self.obj1512)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1512.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1512)
        self.obj1512.postAction(self.LHS.CREATE)

        self.obj1513 = require(parent)
        self.obj1513.preAction(self.LHS.CREATE)
        self.obj1513.isGraphObjectVisual = True

        if (hasattr(self.obj1513, '_setHierarchicalLink')):
            self.obj1513._setHierarchicalLink(False)

        self.obj1513.GGLabel.setValue(5)
        self.obj1513.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(242.5, 132.5, self.obj1513)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1513.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1513)
        self.obj1513.postAction(self.LHS.CREATE)

        self.obj1509.out_connections_.append(self.obj1512)
        self.obj1512.in_connections_.append(self.obj1509)
        self.obj1509.graphObject_.pendingConnections.append(
            (self.obj1509.graphObject_.tag, self.obj1512.graphObject_.tag,
             [105.0, 82.0, 143.0, 130.5], 0, True))
        self.obj1511.out_connections_.append(self.obj1513)
        self.obj1513.in_connections_.append(self.obj1511)
        self.obj1511.graphObject_.pendingConnections.append(
            (self.obj1511.graphObject_.tag, self.obj1513.graphObject_.tag,
             [304.0, 86.0, 242.5, 132.5], 0, True))
        self.obj1512.out_connections_.append(self.obj1510)
        self.obj1510.in_connections_.append(self.obj1512)
        self.obj1512.graphObject_.pendingConnections.append(
            (self.obj1512.graphObject_.tag, self.obj1510.graphObject_.tag,
             [181.0, 179.0, 143.0, 130.5], 0, True))
        self.obj1513.out_connections_.append(self.obj1510)
        self.obj1510.in_connections_.append(self.obj1513)
        self.obj1513.graphObject_.pendingConnections.append(
            (self.obj1513.graphObject_.tag, self.obj1510.graphObject_.tag,
             [181.0, 179.0, 242.5, 132.5], 0, True))

        self.RHS = ASG_omacs(parent)

        self.obj1515 = Agent(parent)
        self.obj1515.preAction(self.RHS.CREATE)
        self.obj1515.isGraphObjectVisual = True

        if (hasattr(self.obj1515, '_setHierarchicalLink')):
            self.obj1515._setHierarchicalLink(False)

        # price
        self.obj1515.price.setNone()

        # name
        self.obj1515.name.setValue('')
        self.obj1515.name.setNone()

        self.obj1515.GGLabel.setValue(1)
        self.obj1515.graphClass_ = graph_Agent
        if parent.genGraphics:
            new_obj = graph_Agent(80.0, 20.0, self.obj1515)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1515.graphObject_ = new_obj
        self.obj15150 = AttrCalc()
        self.obj15150.Copy = ATOM3Boolean()
        self.obj15150.Copy.setValue(('Copy from LHS', 1))
        self.obj15150.Copy.config = 0
        self.obj15150.Specify = ATOM3Constraint()
        self.obj15150.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1515.GGset2Any['price'] = self.obj15150
        self.obj15151 = AttrCalc()
        self.obj15151.Copy = ATOM3Boolean()
        self.obj15151.Copy.setValue(('Copy from LHS', 1))
        self.obj15151.Copy.config = 0
        self.obj15151.Specify = ATOM3Constraint()
        self.obj15151.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1515.GGset2Any['name'] = self.obj15151

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1515)
        self.obj1515.postAction(self.RHS.CREATE)

        self.obj1516 = Capabilitie(parent)
        self.obj1516.preAction(self.RHS.CREATE)
        self.obj1516.isGraphObjectVisual = True

        if (hasattr(self.obj1516, '_setHierarchicalLink')):
            self.obj1516._setHierarchicalLink(False)

        # name
        self.obj1516.name.setValue('')
        self.obj1516.name.setNone()

        self.obj1516.GGLabel.setValue(2)
        self.obj1516.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(160.0, 180.0, self.obj1516)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1516.graphObject_ = new_obj
        self.obj15160 = AttrCalc()
        self.obj15160.Copy = ATOM3Boolean()
        self.obj15160.Copy.setValue(('Copy from LHS', 1))
        self.obj15160.Copy.config = 0
        self.obj15160.Specify = ATOM3Constraint()
        self.obj15160.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1516.GGset2Any['name'] = self.obj15160

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1516)
        self.obj1516.postAction(self.RHS.CREATE)

        self.obj1517 = Role(parent)
        self.obj1517.preAction(self.RHS.CREATE)
        self.obj1517.isGraphObjectVisual = True

        if (hasattr(self.obj1517, '_setHierarchicalLink')):
            self.obj1517._setHierarchicalLink(False)

        # name
        self.obj1517.name.setValue('')
        self.obj1517.name.setNone()

        self.obj1517.GGLabel.setValue(3)
        self.obj1517.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(280.0, 40.0, self.obj1517)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1517.graphObject_ = new_obj
        self.obj15170 = AttrCalc()
        self.obj15170.Copy = ATOM3Boolean()
        self.obj15170.Copy.setValue(('Copy from LHS', 1))
        self.obj15170.Copy.config = 0
        self.obj15170.Specify = ATOM3Constraint()
        self.obj15170.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1517.GGset2Any['name'] = self.obj15170

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1517)
        self.obj1517.postAction(self.RHS.CREATE)

        self.obj1518 = posses(parent)
        self.obj1518.preAction(self.RHS.CREATE)
        self.obj1518.isGraphObjectVisual = True

        if (hasattr(self.obj1518, '_setHierarchicalLink')):
            self.obj1518._setHierarchicalLink(False)

        # rate
        self.obj1518.rate.setNone()

        self.obj1518.GGLabel.setValue(4)
        self.obj1518.graphClass_ = graph_posses
        if parent.genGraphics:
            new_obj = graph_posses(143.0, 130.5, self.obj1518)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1518.graphObject_ = new_obj
        self.obj15180 = AttrCalc()
        self.obj15180.Copy = ATOM3Boolean()
        self.obj15180.Copy.setValue(('Copy from LHS', 1))
        self.obj15180.Copy.config = 0
        self.obj15180.Specify = ATOM3Constraint()
        self.obj15180.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1518.GGset2Any['rate'] = self.obj15180

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1518)
        self.obj1518.postAction(self.RHS.CREATE)

        self.obj1519 = CapableOf(parent)
        self.obj1519.preAction(self.RHS.CREATE)
        self.obj1519.isGraphObjectVisual = True

        if (hasattr(self.obj1519, '_setHierarchicalLink')):
            self.obj1519._setHierarchicalLink(False)

        # rate
        self.obj1519.rate.setValue(0.0)

        self.obj1519.GGLabel.setValue(7)
        self.obj1519.graphClass_ = graph_CapableOf
        if parent.genGraphics:
            new_obj = graph_CapableOf(214.0, 83.5, self.obj1519)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1519.graphObject_ = new_obj
        self.obj15190 = AttrCalc()
        self.obj15190.Copy = ATOM3Boolean()
        self.obj15190.Copy.setValue(('Copy from LHS', 1))
        self.obj15190.Copy.config = 0
        self.obj15190.Specify = ATOM3Constraint()
        self.obj15190.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1519.GGset2Any['rate'] = self.obj15190

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1519)
        self.obj1519.postAction(self.RHS.CREATE)

        self.obj1520 = require(parent)
        self.obj1520.preAction(self.RHS.CREATE)
        self.obj1520.isGraphObjectVisual = True

        if (hasattr(self.obj1520, '_setHierarchicalLink')):
            self.obj1520._setHierarchicalLink(False)

        self.obj1520.GGLabel.setValue(5)
        self.obj1520.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(242.5, 132.5, self.obj1520)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1520.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1520)
        self.obj1520.postAction(self.RHS.CREATE)

        self.obj1515.out_connections_.append(self.obj1518)
        self.obj1518.in_connections_.append(self.obj1515)
        self.obj1515.graphObject_.pendingConnections.append(
            (self.obj1515.graphObject_.tag, self.obj1518.graphObject_.tag,
             [117.0, 82.0, 143.0, 130.5], 2, 0))
        self.obj1515.out_connections_.append(self.obj1519)
        self.obj1519.in_connections_.append(self.obj1515)
        self.obj1515.graphObject_.pendingConnections.append(
            (self.obj1515.graphObject_.tag, self.obj1519.graphObject_.tag,
             [117.0, 82.0, 214.0, 83.5], 0, True))
        self.obj1517.out_connections_.append(self.obj1520)
        self.obj1520.in_connections_.append(self.obj1517)
        self.obj1517.graphObject_.pendingConnections.append(
            (self.obj1517.graphObject_.tag, self.obj1520.graphObject_.tag,
             [311.0, 85.0, 242.5, 132.5], 2, 0))
        self.obj1518.out_connections_.append(self.obj1516)
        self.obj1516.in_connections_.append(self.obj1518)
        self.obj1518.graphObject_.pendingConnections.append(
            (self.obj1518.graphObject_.tag, self.obj1516.graphObject_.tag,
             [191.0, 183.0, 143.0, 130.5], 2, 0))
        self.obj1519.out_connections_.append(self.obj1517)
        self.obj1517.in_connections_.append(self.obj1519)
        self.obj1519.graphObject_.pendingConnections.append(
            (self.obj1519.graphObject_.tag, self.obj1517.graphObject_.tag,
             [311.0, 85.0, 214.0, 83.5], 0, True))
        self.obj1520.out_connections_.append(self.obj1516)
        self.obj1516.in_connections_.append(self.obj1520)
        self.obj1520.graphObject_.pendingConnections.append(
            (self.obj1520.graphObject_.tag, self.obj1516.graphObject_.tag,
             [191.0, 183.0, 242.5, 132.5], 2, 0))
Exemple #12
0
import os
import time

code1 = '''
msg = "This is old code"
print(msg)
'''

code2 = '''
msg = "This is new code"
print(msg)
'''

def save(name, code):
    fp=open(name,"w")
    fp.write(code)
    fp.flush()
    fp.close()

save("test-force-item.py", code1)
m = require("test-force-item")
assert m.msg == "This is old code"

# wait pycache to refresh
time.sleep(1)

save("test-force-item.py", code2)
m2 = require("test-force-item", force=True)
assert m2.msg == "This is new code"

os.remove("test-force-item.py")
    def __init__(self, parent):
        GGrule.__init__(self, 3)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_omacs(parent)

        self.obj1548 = Agent(parent)
        self.obj1548.preAction(self.LHS.CREATE)
        self.obj1548.isGraphObjectVisual = True

        if (hasattr(self.obj1548, '_setHierarchicalLink')):
            self.obj1548._setHierarchicalLink(False)

        # price
        self.obj1548.price.setNone()

        # name
        self.obj1548.name.setValue('')
        self.obj1548.name.setNone()

        self.obj1548.GGLabel.setValue(1)
        self.obj1548.graphClass_ = graph_Agent
        if parent.genGraphics:
            new_obj = graph_Agent(100.0, 20.0, self.obj1548)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1548.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1548)
        self.obj1548.postAction(self.LHS.CREATE)

        self.obj1549 = Capabilitie(parent)
        self.obj1549.preAction(self.LHS.CREATE)
        self.obj1549.isGraphObjectVisual = True

        if (hasattr(self.obj1549, '_setHierarchicalLink')):
            self.obj1549._setHierarchicalLink(False)

        # name
        self.obj1549.name.setValue('')
        self.obj1549.name.setNone()

        self.obj1549.GGLabel.setValue(3)
        self.obj1549.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(340.0, 40.0, self.obj1549)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1549.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1549)
        self.obj1549.postAction(self.LHS.CREATE)

        self.obj1550 = Capabilitie(parent)
        self.obj1550.preAction(self.LHS.CREATE)
        self.obj1550.isGraphObjectVisual = True

        if (hasattr(self.obj1550, '_setHierarchicalLink')):
            self.obj1550._setHierarchicalLink(False)

        # name
        self.obj1550.name.setValue('')
        self.obj1550.name.setNone()

        self.obj1550.GGLabel.setValue(4)
        self.obj1550.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(140.0, 160.0, self.obj1550)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1550.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1550)
        self.obj1550.postAction(self.LHS.CREATE)

        self.obj1551 = Role(parent)
        self.obj1551.preAction(self.LHS.CREATE)
        self.obj1551.isGraphObjectVisual = True

        if (hasattr(self.obj1551, '_setHierarchicalLink')):
            self.obj1551._setHierarchicalLink(False)

        # name
        self.obj1551.name.setValue('')
        self.obj1551.name.setNone()

        self.obj1551.GGLabel.setValue(2)
        self.obj1551.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(300.0, 140.0, self.obj1551)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1551.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1551)
        self.obj1551.postAction(self.LHS.CREATE)

        self.obj1552 = posses(parent)
        self.obj1552.preAction(self.LHS.CREATE)
        self.obj1552.isGraphObjectVisual = True

        if (hasattr(self.obj1552, '_setHierarchicalLink')):
            self.obj1552._setHierarchicalLink(False)

        # rate
        self.obj1552.rate.setNone()

        self.obj1552.GGLabel.setValue(5)
        self.obj1552.graphClass_ = graph_posses
        if parent.genGraphics:
            new_obj = graph_posses(143.0, 120.5, self.obj1552)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1552.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1552)
        self.obj1552.postAction(self.LHS.CREATE)

        self.obj1553 = CapableOf(parent)
        self.obj1553.preAction(self.LHS.CREATE)
        self.obj1553.isGraphObjectVisual = True

        if (hasattr(self.obj1553, '_setHierarchicalLink')):
            self.obj1553._setHierarchicalLink(False)

        # rate
        self.obj1553.rate.setNone()

        self.obj1553.GGLabel.setValue(8)
        self.obj1553.graphClass_ = graph_CapableOf
        if parent.genGraphics:
            new_obj = graph_CapableOf(224.5, 111.5, self.obj1553)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1553.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1553)
        self.obj1553.postAction(self.LHS.CREATE)

        self.obj1554 = require(parent)
        self.obj1554.preAction(self.LHS.CREATE)
        self.obj1554.isGraphObjectVisual = True

        if (hasattr(self.obj1554, '_setHierarchicalLink')):
            self.obj1554._setHierarchicalLink(False)

        self.obj1554.GGLabel.setValue(7)
        self.obj1554.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(242.5, 192.5, self.obj1554)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1554.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1554)
        self.obj1554.postAction(self.LHS.CREATE)

        self.obj1555 = require(parent)
        self.obj1555.preAction(self.LHS.CREATE)
        self.obj1555.isGraphObjectVisual = True

        if (hasattr(self.obj1555, '_setHierarchicalLink')):
            self.obj1555._setHierarchicalLink(False)

        self.obj1555.GGLabel.setValue(9)
        self.obj1555.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(351.0, 111.5, self.obj1555)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1555.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1555)
        self.obj1555.postAction(self.LHS.CREATE)

        self.obj1548.out_connections_.append(self.obj1552)
        self.obj1552.in_connections_.append(self.obj1548)
        self.obj1548.graphObject_.pendingConnections.append(
            (self.obj1548.graphObject_.tag, self.obj1552.graphObject_.tag,
             [137.0, 82.0, 143.0, 120.5], 2, 0))
        self.obj1548.out_connections_.append(self.obj1553)
        self.obj1553.in_connections_.append(self.obj1548)
        self.obj1548.graphObject_.pendingConnections.append(
            (self.obj1548.graphObject_.tag, self.obj1553.graphObject_.tag,
             [125.0, 82.0, 224.5, 111.5], 0, True))
        self.obj1551.out_connections_.append(self.obj1554)
        self.obj1554.in_connections_.append(self.obj1551)
        self.obj1551.graphObject_.pendingConnections.append(
            (self.obj1551.graphObject_.tag, self.obj1554.graphObject_.tag,
             [324.0, 186.0, 242.5, 192.5], 0, True))
        self.obj1551.out_connections_.append(self.obj1555)
        self.obj1555.in_connections_.append(self.obj1551)
        self.obj1551.graphObject_.pendingConnections.append(
            (self.obj1551.graphObject_.tag, self.obj1555.graphObject_.tag,
             [331.0, 140.0, 351.0, 111.5], 0, True))
        self.obj1552.out_connections_.append(self.obj1550)
        self.obj1550.in_connections_.append(self.obj1552)
        self.obj1552.graphObject_.pendingConnections.append(
            (self.obj1552.graphObject_.tag, self.obj1550.graphObject_.tag,
             [161.0, 159.0, 143.0, 120.5], 0, True))
        self.obj1553.out_connections_.append(self.obj1551)
        self.obj1551.in_connections_.append(self.obj1553)
        self.obj1553.graphObject_.pendingConnections.append(
            (self.obj1553.graphObject_.tag, self.obj1551.graphObject_.tag,
             [324.0, 141.0, 224.5, 111.5], 0, True))
        self.obj1554.out_connections_.append(self.obj1550)
        self.obj1550.in_connections_.append(self.obj1554)
        self.obj1554.graphObject_.pendingConnections.append(
            (self.obj1554.graphObject_.tag, self.obj1550.graphObject_.tag,
             [161.0, 199.0, 242.5, 192.5], 0, True))
        self.obj1555.out_connections_.append(self.obj1549)
        self.obj1549.in_connections_.append(self.obj1555)
        self.obj1555.graphObject_.pendingConnections.append(
            (self.obj1555.graphObject_.tag, self.obj1549.graphObject_.tag,
             [371.0, 83.0, 351.0, 111.5], 0, True))

        self.RHS = ASG_omacs(parent)

        self.obj1557 = Agent(parent)
        self.obj1557.preAction(self.RHS.CREATE)
        self.obj1557.isGraphObjectVisual = True

        if (hasattr(self.obj1557, '_setHierarchicalLink')):
            self.obj1557._setHierarchicalLink(False)

        # price
        self.obj1557.price.setNone()

        # name
        self.obj1557.name.setValue('')
        self.obj1557.name.setNone()

        self.obj1557.GGLabel.setValue(1)
        self.obj1557.graphClass_ = graph_Agent
        if parent.genGraphics:
            new_obj = graph_Agent(100.0, 20.0, self.obj1557)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1557.graphObject_ = new_obj
        self.obj15570 = AttrCalc()
        self.obj15570.Copy = ATOM3Boolean()
        self.obj15570.Copy.setValue(('Copy from LHS', 1))
        self.obj15570.Copy.config = 0
        self.obj15570.Specify = ATOM3Constraint()
        self.obj15570.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1557.GGset2Any['price'] = self.obj15570
        self.obj15571 = AttrCalc()
        self.obj15571.Copy = ATOM3Boolean()
        self.obj15571.Copy.setValue(('Copy from LHS', 1))
        self.obj15571.Copy.config = 0
        self.obj15571.Specify = ATOM3Constraint()
        self.obj15571.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1557.GGset2Any['name'] = self.obj15571

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1557)
        self.obj1557.postAction(self.RHS.CREATE)

        self.obj1558 = Capabilitie(parent)
        self.obj1558.preAction(self.RHS.CREATE)
        self.obj1558.isGraphObjectVisual = True

        if (hasattr(self.obj1558, '_setHierarchicalLink')):
            self.obj1558._setHierarchicalLink(False)

        # name
        self.obj1558.name.setValue('')
        self.obj1558.name.setNone()

        self.obj1558.GGLabel.setValue(3)
        self.obj1558.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(340.0, 40.0, self.obj1558)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1558.graphObject_ = new_obj
        self.obj15580 = AttrCalc()
        self.obj15580.Copy = ATOM3Boolean()
        self.obj15580.Copy.setValue(('Copy from LHS', 1))
        self.obj15580.Copy.config = 0
        self.obj15580.Specify = ATOM3Constraint()
        self.obj15580.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1558.GGset2Any['name'] = self.obj15580

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1558)
        self.obj1558.postAction(self.RHS.CREATE)

        self.obj1559 = Capabilitie(parent)
        self.obj1559.preAction(self.RHS.CREATE)
        self.obj1559.isGraphObjectVisual = True

        if (hasattr(self.obj1559, '_setHierarchicalLink')):
            self.obj1559._setHierarchicalLink(False)

        # name
        self.obj1559.name.setValue('')
        self.obj1559.name.setNone()

        self.obj1559.GGLabel.setValue(4)
        self.obj1559.graphClass_ = graph_Capabilitie
        if parent.genGraphics:
            new_obj = graph_Capabilitie(140.0, 160.0, self.obj1559)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1559.graphObject_ = new_obj
        self.obj15590 = AttrCalc()
        self.obj15590.Copy = ATOM3Boolean()
        self.obj15590.Copy.setValue(('Copy from LHS', 1))
        self.obj15590.Copy.config = 0
        self.obj15590.Specify = ATOM3Constraint()
        self.obj15590.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1559.GGset2Any['name'] = self.obj15590

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1559)
        self.obj1559.postAction(self.RHS.CREATE)

        self.obj1560 = Role(parent)
        self.obj1560.preAction(self.RHS.CREATE)
        self.obj1560.isGraphObjectVisual = True

        if (hasattr(self.obj1560, '_setHierarchicalLink')):
            self.obj1560._setHierarchicalLink(False)

        # name
        self.obj1560.name.setValue('')
        self.obj1560.name.setNone()

        self.obj1560.GGLabel.setValue(2)
        self.obj1560.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(300.0, 140.0, self.obj1560)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1560.graphObject_ = new_obj
        self.obj15600 = AttrCalc()
        self.obj15600.Copy = ATOM3Boolean()
        self.obj15600.Copy.setValue(('Copy from LHS', 1))
        self.obj15600.Copy.config = 0
        self.obj15600.Specify = ATOM3Constraint()
        self.obj15600.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1560.GGset2Any['name'] = self.obj15600

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1560)
        self.obj1560.postAction(self.RHS.CREATE)

        self.obj1561 = posses(parent)
        self.obj1561.preAction(self.RHS.CREATE)
        self.obj1561.isGraphObjectVisual = True

        if (hasattr(self.obj1561, '_setHierarchicalLink')):
            self.obj1561._setHierarchicalLink(False)

        # rate
        self.obj1561.rate.setNone()

        self.obj1561.GGLabel.setValue(5)
        self.obj1561.graphClass_ = graph_posses
        if parent.genGraphics:
            new_obj = graph_posses(143.0, 120.5, self.obj1561)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1561.graphObject_ = new_obj
        self.obj15610 = AttrCalc()
        self.obj15610.Copy = ATOM3Boolean()
        self.obj15610.Copy.setValue(('Copy from LHS', 1))
        self.obj15610.Copy.config = 0
        self.obj15610.Specify = ATOM3Constraint()
        self.obj15610.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1561.GGset2Any['rate'] = self.obj15610

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1561)
        self.obj1561.postAction(self.RHS.CREATE)

        self.obj1562 = require(parent)
        self.obj1562.preAction(self.RHS.CREATE)
        self.obj1562.isGraphObjectVisual = True

        if (hasattr(self.obj1562, '_setHierarchicalLink')):
            self.obj1562._setHierarchicalLink(False)

        self.obj1562.GGLabel.setValue(7)
        self.obj1562.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(242.5, 192.5, self.obj1562)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1562.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1562)
        self.obj1562.postAction(self.RHS.CREATE)

        self.obj1563 = require(parent)
        self.obj1563.preAction(self.RHS.CREATE)
        self.obj1563.isGraphObjectVisual = True

        if (hasattr(self.obj1563, '_setHierarchicalLink')):
            self.obj1563._setHierarchicalLink(False)

        self.obj1563.GGLabel.setValue(9)
        self.obj1563.graphClass_ = graph_require
        if parent.genGraphics:
            new_obj = graph_require(351.0, 111.5, self.obj1563)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1563.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1563)
        self.obj1563.postAction(self.RHS.CREATE)

        self.obj1557.out_connections_.append(self.obj1561)
        self.obj1561.in_connections_.append(self.obj1557)
        self.obj1557.graphObject_.pendingConnections.append(
            (self.obj1557.graphObject_.tag, self.obj1561.graphObject_.tag,
             [137.0, 82.0, 143.0, 120.5], 2, 0))
        self.obj1560.out_connections_.append(self.obj1562)
        self.obj1562.in_connections_.append(self.obj1560)
        self.obj1560.graphObject_.pendingConnections.append(
            (self.obj1560.graphObject_.tag, self.obj1562.graphObject_.tag,
             [331.0, 185.0, 242.5, 192.5], 2, 0))
        self.obj1560.out_connections_.append(self.obj1563)
        self.obj1563.in_connections_.append(self.obj1560)
        self.obj1560.graphObject_.pendingConnections.append(
            (self.obj1560.graphObject_.tag, self.obj1563.graphObject_.tag,
             [331.0, 140.0, 351.0, 111.5], 0, True))
        self.obj1561.out_connections_.append(self.obj1559)
        self.obj1559.in_connections_.append(self.obj1561)
        self.obj1561.graphObject_.pendingConnections.append(
            (self.obj1561.graphObject_.tag, self.obj1559.graphObject_.tag,
             [171.0, 163.0, 143.0, 120.5], 2, 0))
        self.obj1562.out_connections_.append(self.obj1559)
        self.obj1559.in_connections_.append(self.obj1562)
        self.obj1562.graphObject_.pendingConnections.append(
            (self.obj1562.graphObject_.tag, self.obj1559.graphObject_.tag,
             [171.0, 203.0, 242.5, 192.5], 2, 0))
        self.obj1563.out_connections_.append(self.obj1558)
        self.obj1558.in_connections_.append(self.obj1563)
        self.obj1563.graphObject_.pendingConnections.append(
            (self.obj1563.graphObject_.tag, self.obj1558.graphObject_.tag,
             [371.0, 83.0, 351.0, 111.5], 0, True))
Exemple #14
0
from require import *
print('r1')
require('r2')
Exemple #15
0
from require import *

require("test-require-all2", globals())
print(name)
   def __init__(self, parent):
      GGrule.__init__(self, 2)
      self.TimeDelay = ATOM3Integer(2)
      self.exactMatch = 1
      self.LHS = ASG_omacs(parent)

      self.obj1525=Agent(parent)
      self.obj1525.preAction( self.LHS.CREATE )
      self.obj1525.isGraphObjectVisual = True

      if(hasattr(self.obj1525, '_setHierarchicalLink')):
        self.obj1525._setHierarchicalLink(False)

      # price
      self.obj1525.price.setNone()

      # name
      self.obj1525.name.setValue('')
      self.obj1525.name.setNone()

      self.obj1525.GGLabel.setValue(1)
      self.obj1525.graphClass_= graph_Agent
      if parent.genGraphics:
         new_obj = graph_Agent(60.0,20.0,self.obj1525)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1525.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1525)
      self.obj1525.postAction( self.LHS.CREATE )

      self.obj1526=Capabilitie(parent)
      self.obj1526.preAction( self.LHS.CREATE )
      self.obj1526.isGraphObjectVisual = True

      if(hasattr(self.obj1526, '_setHierarchicalLink')):
        self.obj1526._setHierarchicalLink(False)

      # name
      self.obj1526.name.setValue('')
      self.obj1526.name.setNone()

      self.obj1526.GGLabel.setValue(2)
      self.obj1526.graphClass_= graph_Capabilitie
      if parent.genGraphics:
         new_obj = graph_Capabilitie(80.0,180.0,self.obj1526)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1526.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1526)
      self.obj1526.postAction( self.LHS.CREATE )

      self.obj1527=Capabilitie(parent)
      self.obj1527.preAction( self.LHS.CREATE )
      self.obj1527.isGraphObjectVisual = True

      if(hasattr(self.obj1527, '_setHierarchicalLink')):
        self.obj1527._setHierarchicalLink(False)

      # name
      self.obj1527.name.setValue('')
      self.obj1527.name.setNone()

      self.obj1527.GGLabel.setValue(3)
      self.obj1527.graphClass_= graph_Capabilitie
      if parent.genGraphics:
         new_obj = graph_Capabilitie(300.0,20.0,self.obj1527)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1527.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1527)
      self.obj1527.postAction( self.LHS.CREATE )

      self.obj1528=Role(parent)
      self.obj1528.preAction( self.LHS.CREATE )
      self.obj1528.isGraphObjectVisual = True

      if(hasattr(self.obj1528, '_setHierarchicalLink')):
        self.obj1528._setHierarchicalLink(False)

      # name
      self.obj1528.name.setValue('')
      self.obj1528.name.setNone()

      self.obj1528.GGLabel.setValue(4)
      self.obj1528.graphClass_= graph_Role
      if parent.genGraphics:
         new_obj = graph_Role(320.0,180.0,self.obj1528)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1528.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1528)
      self.obj1528.postAction( self.LHS.CREATE )

      self.obj1529=posses(parent)
      self.obj1529.preAction( self.LHS.CREATE )
      self.obj1529.isGraphObjectVisual = True

      if(hasattr(self.obj1529, '_setHierarchicalLink')):
        self.obj1529._setHierarchicalLink(False)

      # rate
      self.obj1529.rate.setNone()

      self.obj1529.GGLabel.setValue(5)
      self.obj1529.graphClass_= graph_posses
      if parent.genGraphics:
         new_obj = graph_posses(203.0,70.5,self.obj1529)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1529.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1529)
      self.obj1529.postAction( self.LHS.CREATE )

      self.obj1530=posses(parent)
      self.obj1530.preAction( self.LHS.CREATE )
      self.obj1530.isGraphObjectVisual = True

      if(hasattr(self.obj1530, '_setHierarchicalLink')):
        self.obj1530._setHierarchicalLink(False)

      # rate
      self.obj1530.rate.setNone()

      self.obj1530.GGLabel.setValue(6)
      self.obj1530.graphClass_= graph_posses
      if parent.genGraphics:
         new_obj = graph_posses(93.0,130.5,self.obj1530)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1530.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1530)
      self.obj1530.postAction( self.LHS.CREATE )

      self.obj1531=CapableOf(parent)
      self.obj1531.preAction( self.LHS.CREATE )
      self.obj1531.isGraphObjectVisual = True

      if(hasattr(self.obj1531, '_setHierarchicalLink')):
        self.obj1531._setHierarchicalLink(False)

      # rate
      self.obj1531.rate.setNone()

      self.obj1531.GGLabel.setValue(9)
      self.obj1531.graphClass_= graph_CapableOf
      if parent.genGraphics:
         new_obj = graph_CapableOf(209.5,129.5,self.obj1531)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1531.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1531)
      self.obj1531.postAction( self.LHS.CREATE )

      self.obj1532=require(parent)
      self.obj1532.preAction( self.LHS.CREATE )
      self.obj1532.isGraphObjectVisual = True

      if(hasattr(self.obj1532, '_setHierarchicalLink')):
        self.obj1532._setHierarchicalLink(False)

      self.obj1532.GGLabel.setValue(7)
      self.obj1532.graphClass_= graph_require
      if parent.genGraphics:
         new_obj = graph_require(222.5,180.0,self.obj1532)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1532.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1532)
      self.obj1532.postAction( self.LHS.CREATE )

      self.obj1533=require(parent)
      self.obj1533.preAction( self.LHS.CREATE )
      self.obj1533.isGraphObjectVisual = True

      if(hasattr(self.obj1533, '_setHierarchicalLink')):
        self.obj1533._setHierarchicalLink(False)

      self.obj1533.GGLabel.setValue(8)
      self.obj1533.graphClass_= graph_require
      if parent.genGraphics:
         new_obj = graph_require(332.5,120.0,self.obj1533)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1533.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1533)
      self.obj1533.postAction( self.LHS.CREATE )

      self.obj1525.out_connections_.append(self.obj1529)
      self.obj1529.in_connections_.append(self.obj1525)
      self.obj1525.out_connections_.append(self.obj1530)
      self.obj1530.in_connections_.append(self.obj1525)
      self.obj1525.graphObject_.pendingConnections.append((self.obj1525.graphObject_.tag, self.obj1530.graphObject_.tag, [85.0, 82.0, 93.0, 130.5], 0, True))
      self.obj1525.out_connections_.append(self.obj1531)
      self.obj1531.in_connections_.append(self.obj1525)
      self.obj1525.graphObject_.pendingConnections.append((self.obj1525.graphObject_.tag, self.obj1531.graphObject_.tag, [85.0, 82.0, 163.0, 138.0, 209.5, 129.5], 2, True))
      self.obj1528.out_connections_.append(self.obj1532)
      self.obj1532.in_connections_.append(self.obj1528)
      self.obj1528.graphObject_.pendingConnections.append((self.obj1528.graphObject_.tag, self.obj1532.graphObject_.tag, [344.0, 181.0, 222.5, 180.0], 0, True))
      self.obj1528.out_connections_.append(self.obj1533)
      self.obj1533.in_connections_.append(self.obj1528)
      self.obj1528.graphObject_.pendingConnections.append((self.obj1528.graphObject_.tag, self.obj1533.graphObject_.tag, [344.0, 181.0, 332.5, 120.0], 0, True))
      self.obj1529.out_connections_.append(self.obj1527)
      self.obj1527.in_connections_.append(self.obj1529)
      self.obj1529.graphObject_.pendingConnections.append((self.obj1529.graphObject_.tag, self.obj1527.graphObject_.tag, [321.0, 59.0, 203.0, 70.5], 0, True))
      self.obj1530.out_connections_.append(self.obj1526)
      self.obj1526.in_connections_.append(self.obj1530)
      self.obj1530.graphObject_.pendingConnections.append((self.obj1530.graphObject_.tag, self.obj1526.graphObject_.tag, [101.0, 179.0, 93.0, 130.5], 0, True))
      self.obj1531.out_connections_.append(self.obj1528)
      self.obj1528.in_connections_.append(self.obj1531)
      self.obj1531.graphObject_.pendingConnections.append((self.obj1531.graphObject_.tag, self.obj1528.graphObject_.tag, [344.0, 181.0, 256.0, 121.0, 209.5, 129.5], 2, True))
      self.obj1532.out_connections_.append(self.obj1526)
      self.obj1526.in_connections_.append(self.obj1532)
      self.obj1532.graphObject_.pendingConnections.append((self.obj1532.graphObject_.tag, self.obj1526.graphObject_.tag, [101.0, 179.0, 222.5, 180.0], 0, True))
      self.obj1533.out_connections_.append(self.obj1527)
      self.obj1527.in_connections_.append(self.obj1533)

      self.RHS = ASG_omacs(parent)

      self.obj1535=Agent(parent)
      self.obj1535.preAction( self.RHS.CREATE )
      self.obj1535.isGraphObjectVisual = True

      if(hasattr(self.obj1535, '_setHierarchicalLink')):
        self.obj1535._setHierarchicalLink(False)

      # price
      self.obj1535.price.setNone()

      # name
      self.obj1535.name.setValue('')
      self.obj1535.name.setNone()

      self.obj1535.GGLabel.setValue(1)
      self.obj1535.graphClass_= graph_Agent
      if parent.genGraphics:
         new_obj = graph_Agent(60.0,20.0,self.obj1535)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1535.graphObject_ = new_obj
      self.obj15350= AttrCalc()
      self.obj15350.Copy=ATOM3Boolean()
      self.obj15350.Copy.setValue(('Copy from LHS', 1))
      self.obj15350.Copy.config = 0
      self.obj15350.Specify=ATOM3Constraint()
      self.obj15350.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1535.GGset2Any['price']= self.obj15350
      self.obj15351= AttrCalc()
      self.obj15351.Copy=ATOM3Boolean()
      self.obj15351.Copy.setValue(('Copy from LHS', 1))
      self.obj15351.Copy.config = 0
      self.obj15351.Specify=ATOM3Constraint()
      self.obj15351.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1535.GGset2Any['name']= self.obj15351

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1535)
      self.obj1535.postAction( self.RHS.CREATE )

      self.obj1536=Capabilitie(parent)
      self.obj1536.preAction( self.RHS.CREATE )
      self.obj1536.isGraphObjectVisual = True

      if(hasattr(self.obj1536, '_setHierarchicalLink')):
        self.obj1536._setHierarchicalLink(False)

      # name
      self.obj1536.name.setValue('')
      self.obj1536.name.setNone()

      self.obj1536.GGLabel.setValue(2)
      self.obj1536.graphClass_= graph_Capabilitie
      if parent.genGraphics:
         new_obj = graph_Capabilitie(80.0,180.0,self.obj1536)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1536.graphObject_ = new_obj
      self.obj15360= AttrCalc()
      self.obj15360.Copy=ATOM3Boolean()
      self.obj15360.Copy.setValue(('Copy from LHS', 1))
      self.obj15360.Copy.config = 0
      self.obj15360.Specify=ATOM3Constraint()
      self.obj15360.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1536.GGset2Any['name']= self.obj15360

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1536)
      self.obj1536.postAction( self.RHS.CREATE )

      self.obj1537=Capabilitie(parent)
      self.obj1537.preAction( self.RHS.CREATE )
      self.obj1537.isGraphObjectVisual = True

      if(hasattr(self.obj1537, '_setHierarchicalLink')):
        self.obj1537._setHierarchicalLink(False)

      # name
      self.obj1537.name.setValue('')
      self.obj1537.name.setNone()

      self.obj1537.GGLabel.setValue(3)
      self.obj1537.graphClass_= graph_Capabilitie
      if parent.genGraphics:
         new_obj = graph_Capabilitie(300.0,20.0,self.obj1537)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1537.graphObject_ = new_obj
      self.obj15370= AttrCalc()
      self.obj15370.Copy=ATOM3Boolean()
      self.obj15370.Copy.setValue(('Copy from LHS', 1))
      self.obj15370.Copy.config = 0
      self.obj15370.Specify=ATOM3Constraint()
      self.obj15370.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1537.GGset2Any['name']= self.obj15370

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1537)
      self.obj1537.postAction( self.RHS.CREATE )

      self.obj1538=Role(parent)
      self.obj1538.preAction( self.RHS.CREATE )
      self.obj1538.isGraphObjectVisual = True

      if(hasattr(self.obj1538, '_setHierarchicalLink')):
        self.obj1538._setHierarchicalLink(False)

      # name
      self.obj1538.name.setValue('')
      self.obj1538.name.setNone()

      self.obj1538.GGLabel.setValue(4)
      self.obj1538.graphClass_= graph_Role
      if parent.genGraphics:
         new_obj = graph_Role(320.0,180.0,self.obj1538)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1538.graphObject_ = new_obj
      self.obj15380= AttrCalc()
      self.obj15380.Copy=ATOM3Boolean()
      self.obj15380.Copy.setValue(('Copy from LHS', 1))
      self.obj15380.Copy.config = 0
      self.obj15380.Specify=ATOM3Constraint()
      self.obj15380.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1538.GGset2Any['name']= self.obj15380

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1538)
      self.obj1538.postAction( self.RHS.CREATE )

      self.obj1539=posses(parent)
      self.obj1539.preAction( self.RHS.CREATE )
      self.obj1539.isGraphObjectVisual = True

      if(hasattr(self.obj1539, '_setHierarchicalLink')):
        self.obj1539._setHierarchicalLink(False)

      # rate
      self.obj1539.rate.setNone()

      self.obj1539.GGLabel.setValue(5)
      self.obj1539.graphClass_= graph_posses
      if parent.genGraphics:
         new_obj = graph_posses(203.0,70.5,self.obj1539)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1539.graphObject_ = new_obj
      self.obj15390= AttrCalc()
      self.obj15390.Copy=ATOM3Boolean()
      self.obj15390.Copy.setValue(('Copy from LHS', 1))
      self.obj15390.Copy.config = 0
      self.obj15390.Specify=ATOM3Constraint()
      self.obj15390.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1539.GGset2Any['rate']= self.obj15390

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1539)
      self.obj1539.postAction( self.RHS.CREATE )

      self.obj1540=posses(parent)
      self.obj1540.preAction( self.RHS.CREATE )
      self.obj1540.isGraphObjectVisual = True

      if(hasattr(self.obj1540, '_setHierarchicalLink')):
        self.obj1540._setHierarchicalLink(False)

      # rate
      self.obj1540.rate.setNone()

      self.obj1540.GGLabel.setValue(6)
      self.obj1540.graphClass_= graph_posses
      if parent.genGraphics:
         new_obj = graph_posses(93.0,130.5,self.obj1540)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1540.graphObject_ = new_obj
      self.obj15400= AttrCalc()
      self.obj15400.Copy=ATOM3Boolean()
      self.obj15400.Copy.setValue(('Copy from LHS', 1))
      self.obj15400.Copy.config = 0
      self.obj15400.Specify=ATOM3Constraint()
      self.obj15400.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1540.GGset2Any['rate']= self.obj15400

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1540)
      self.obj1540.postAction( self.RHS.CREATE )

      self.obj1541=CapableOf(parent)
      self.obj1541.preAction( self.RHS.CREATE )
      self.obj1541.isGraphObjectVisual = True

      if(hasattr(self.obj1541, '_setHierarchicalLink')):
        self.obj1541._setHierarchicalLink(False)

      # rate
      self.obj1541.rate.setValue(0.0)

      self.obj1541.GGLabel.setValue(9)
      self.obj1541.graphClass_= graph_CapableOf
      if parent.genGraphics:
         new_obj = graph_CapableOf(209.5,129.5,self.obj1541)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1541.graphObject_ = new_obj
      self.obj15410= AttrCalc()
      self.obj15410.Copy=ATOM3Boolean()
      self.obj15410.Copy.setValue(('Copy from LHS', 1))
      self.obj15410.Copy.config = 0
      self.obj15410.Specify=ATOM3Constraint()
      self.obj15410.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1541.GGset2Any['rate']= self.obj15410

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1541)
      self.obj1541.postAction( self.RHS.CREATE )

      self.obj1542=require(parent)
      self.obj1542.preAction( self.RHS.CREATE )
      self.obj1542.isGraphObjectVisual = True

      if(hasattr(self.obj1542, '_setHierarchicalLink')):
        self.obj1542._setHierarchicalLink(False)

      self.obj1542.GGLabel.setValue(7)
      self.obj1542.graphClass_= graph_require
      if parent.genGraphics:
         new_obj = graph_require(222.5,180.0,self.obj1542)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1542.graphObject_ = new_obj

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1542)
      self.obj1542.postAction( self.RHS.CREATE )

      self.obj1543=require(parent)
      self.obj1543.preAction( self.RHS.CREATE )
      self.obj1543.isGraphObjectVisual = True

      if(hasattr(self.obj1543, '_setHierarchicalLink')):
        self.obj1543._setHierarchicalLink(False)

      self.obj1543.GGLabel.setValue(8)
      self.obj1543.graphClass_= graph_require
      if parent.genGraphics:
         new_obj = graph_require(332.5,120.0,self.obj1543)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1543.graphObject_ = new_obj

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1543)
      self.obj1543.postAction( self.RHS.CREATE )

      self.obj1535.out_connections_.append(self.obj1539)
      self.obj1539.in_connections_.append(self.obj1535)
      self.obj1535.out_connections_.append(self.obj1540)
      self.obj1540.in_connections_.append(self.obj1535)
      self.obj1535.graphObject_.pendingConnections.append((self.obj1535.graphObject_.tag, self.obj1540.graphObject_.tag, [97.0, 82.0, 93.0, 130.5], 2, 0))
      self.obj1535.out_connections_.append(self.obj1541)
      self.obj1541.in_connections_.append(self.obj1535)
      self.obj1535.graphObject_.pendingConnections.append((self.obj1535.graphObject_.tag, self.obj1541.graphObject_.tag, [97.0, 82.0, 209.5, 129.5], 2, 0))
      self.obj1538.out_connections_.append(self.obj1542)
      self.obj1542.in_connections_.append(self.obj1538)
      self.obj1538.graphObject_.pendingConnections.append((self.obj1538.graphObject_.tag, self.obj1542.graphObject_.tag, [351.0, 180.0, 222.5, 180.0], 2, 0))
      self.obj1538.out_connections_.append(self.obj1543)
      self.obj1543.in_connections_.append(self.obj1538)
      self.obj1538.graphObject_.pendingConnections.append((self.obj1538.graphObject_.tag, self.obj1543.graphObject_.tag, [351.0, 180.0, 332.5, 120.0], 2, 0))
      self.obj1539.out_connections_.append(self.obj1537)
      self.obj1537.in_connections_.append(self.obj1539)
      self.obj1539.graphObject_.pendingConnections.append((self.obj1539.graphObject_.tag, self.obj1537.graphObject_.tag, [331.0, 63.0, 203.0, 70.5], 2, 0))
      self.obj1540.out_connections_.append(self.obj1536)
      self.obj1536.in_connections_.append(self.obj1540)
      self.obj1540.graphObject_.pendingConnections.append((self.obj1540.graphObject_.tag, self.obj1536.graphObject_.tag, [111.0, 183.0, 93.0, 130.5], 2, 0))
      self.obj1541.out_connections_.append(self.obj1538)
      self.obj1538.in_connections_.append(self.obj1541)
      self.obj1541.graphObject_.pendingConnections.append((self.obj1541.graphObject_.tag, self.obj1538.graphObject_.tag, [351.0, 180.0, 209.5, 129.5], 2, 0))
      self.obj1542.out_connections_.append(self.obj1536)
      self.obj1536.in_connections_.append(self.obj1542)
      self.obj1542.graphObject_.pendingConnections.append((self.obj1542.graphObject_.tag, self.obj1536.graphObject_.tag, [111.0, 183.0, 222.5, 180.0], 2, 0))
      self.obj1543.out_connections_.append(self.obj1537)
      self.obj1537.in_connections_.append(self.obj1543)
Exemple #17
0
from require import *
m2 = require("2")
print(m2)
Exemple #18
0
class AuthPlugin():
    logger = require('logzen.util:Logger')

    users = require('logzen.db.users:Users')

    def __init__(self):
        self.__serializer = itsdangerous.TimedJSONWebSignatureSerializer(
            'abc', TOKEN_DURATION)

    def __sign(self, username):
        return self.__serializer.dumps(username).decode('ascii')

    def __verify(self, token):
        try:
            return self.__serializer.loads(token.encode('ascii'))

        except itsdangerous.BadData:
            return None

    def apply(self, callback, route):
        def wrapper(*args, **kwargs):
            # Get the token from the request
            token = bottle.request.get_cookie(TOKEN_COOKIE)

            # Check if the token is included in the request
            if token is None:
                self.logger.debug('No token found - not authorized')

            else:
                # Verify the token and extract the username
                username = self.__verify(token)
                if username is None:
                    raise bottle.HTTPError(401, 'Invalid token')

                self.logger.debug('Token validated with username: %s',
                                  username)

                # Get the user object for the username
                user = self.users.getUser(username=username)
                if user is None:
                    raise bottle.HTTPError(401,
                                           'User does not exist: ' + username)

                self.logger.debug('User entry found: %s', user)

                setattr(bottle.local, 'user', user)

            # Call the original route
            body = callback(*args, **kwargs)

            # Get the user object after the real request handler
            user = getattr(bottle.local, 'user', None)

            # Nothing to do if the request does not contain a user
            if user is None:
                self.logger.debug(
                    'No user entry attached to request - unauthorized')

                # Delete the token on the client
                bottle.response.delete_cookie(TOKEN_COOKIE, path='/api/v1')

            else:
                # Generate the token by signing the username
                token = self.__sign(user.username)

                self.logger.debug('Token generated for username: %s',
                                  user.username)

                # Pass the token to the client
                bottle.response.set_cookie(name=TOKEN_COOKIE,
                                           value=token,
                                           path='/api/v1',
                                           max_age=TOKEN_DURATION)

            return body

        return wrapper
Exemple #19
0
import sys

from require import *

require('b')
c = require('d/c')
print(c)
print(dir(c))

for modname in sys.modules:
    print(modname, sys.modules[modname])

print_cached_modules()
Exemple #20
0
from require import *
m2 = require("2")
print (m2)
Exemple #21
0
from require import *
import sys
require('b')
c = require('d/c')
print(c)
print(dir(c))

for modname in sys.modules:
    print(modname, sys.modules[modname])

print('-' * 30, "cache", '-' * 30)
print_cached_modules()
Exemple #22
0
import unittest
import os
import require
import random
from TestDate import *
TTS = require('../server/TTS.py').TTS


class TestCreateMp3Files(unittest.TestCase):
    @unittest.skip("Manually run this test")
    def testSaveFile(self):
        speech_file_name = "test file name"
        if not os.path.exists(TTS.resource_path + speech_file_name + ".mp3"):
            TTS.save_speech_file(speech_file_name)

    @unittest.skip("Manually run this test")
    def testCreateAllFiles(self):
        listLength = len(TTS.speech_list)
        for i in range(0, listLength):
            TTS.save_speech_file(TTS.speech_list[i])

    @unittest.skip("Manually run this test")
    def testPlayRandomVoiceFile(self):
        voice_to_play = random.choice(TTS.speech_list)
        TTS.open_speech_file(voice_to_play)

    def testSpeechDate(self):
        #today = get_todays_date()
        #say(today)
        TTS.say(TTS, "The quick brown fox")