Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias Assign NameStore NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore BinOpDiv Num Call NameLoad AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Global identifier If NameLoad body AugAssignAdd AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareGt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr BinOpMult Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad If BoolOpOr CompareLt BinOpSub NameLoad AttributeLoad NameLoad attr NameLoad UnaryOpNot AttributeLoad AttributeLoad NameLoad attr attr body If BoolOpOr UnaryOpNot NameLoad UnaryOpNot AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Return orelse If UnaryOpNot NameLoad body If NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If BoolOpAnd AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr If AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call NameLoad GeneratorExp TupleLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr CompareIn NameLoad TupleLoad Str Str Str Str Str Str Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Global identifier If CompareIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str Call NameLoad body Expr Str Global identifier If UnaryOpNot NameLoad body ImportFrom alias identifier Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num Assign NameStore Call NameLoad NameLoad NameLoad If UnaryOpNot NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Expr Str If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareIn AttributeLoad NameLoad attr NameLoad body Delete SubscriptDel NameLoad Index AttributeLoad NameLoad attr Delete NameDel decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str For NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Delete NameDel Assign NameStore Dict decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareIn NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotIn NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr SubscriptLoad NameLoad Index NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return Call NameLoad Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr keyword NameLoad BoolOpAnd Call NameLoad NameLoad Str CompareEq AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad NameLoad If UnaryOpNot NameLoad body Return Call NameLoad NameLoad TupleLoad Dict orelse If UnaryOpNot Call NameLoad NameLoad Str body Return TupleLoad NameLoad TupleLoad Dict If CompareEq NameLoad Num body Return TupleLoad SubscriptLoad NameLoad Index Num TupleLoad Dict orelse If CompareEq NameLoad Num body If Call NameLoad SubscriptLoad NameLoad Index Num NameLoad body Return TupleLoad SubscriptLoad NameLoad Index Num TupleLoad Call NameLoad SubscriptLoad NameLoad Index Num orelse If Call NameLoad SubscriptLoad NameLoad Index Num TupleLoad NameLoad NameLoad body Return TupleLoad SubscriptLoad NameLoad Index Num Call NameLoad SubscriptLoad NameLoad Index Num Dict orelse Return TupleLoad SubscriptLoad NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num Dict orelse Return TupleLoad SubscriptLoad NameLoad Index Num Call NameLoad SubscriptLoad NameLoad Index Num Call NameLoad SubscriptLoad NameLoad Index Num decorator_list If Call NameLoad NameLoad Str body If BoolOpAnd NameLoad Call NameLoad SubscriptLoad NameLoad Index Num NameLoad body Return TupleLoad Call NameLoad Call NameLoad NameLoad orelse Assign NameStore ListLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Return TupleLoad Call NameLoad NameLoad Return TupleLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str kwarg body Expr Str If NameLoad body Assign NameStore Call NameLoad If CompareGt AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpSub NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr CompareLt NameLoad Num If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return AugAssignAdd AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad keyword NameLoad NameLoad orelse If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad kwarg body Expr Str If NameLoad body If CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr keyword NameLoad NameLoad decorator_list decorator_list Assign NameStore Call NameLoad
N/A N/A 
Sessionhandler for portal sessions
 __future__ print_function __future__ division time time collections deque twisted.internet reactor django.conf settings evennia.server.sessionhandler SessionHandler PCONN PDISCONN PCONNSYNC N/A _MOD_IMPORT None N/A _MAX_CONNECTION_RATE N/A float N/A settings MAX_CONNECTION_RATE N/A _MAX_COMMAND_RATE N/A float N/A settings MAX_COMMAND_RATE N/A _MIN_TIME_BETWEEN_CONNECTS N/A 1.0 N/A float N/A settings MAX_CONNECTION_RATE N/A _ERROR_COMMAND_OVERFLOW N/A settings COMMAND_RATE_WARNING N/A _CONNECTION_QUEUE N/A deque PortalSessionHandler N/A SessionHandler N/A N/A 
    This object holds the sessions connected to the portal at any time.
    It is synced with the server's equivalent SessionHandler over the AMP
    connection.

    Sessions register with the handler using the connect() method. This
    will assign a new unique sessionid to the session and send that sessid
    to the server using the AMP connection.

     __init__ N/A N/A self N/A args kwargs N/A N/A 
        Init the handler

         N/A N/A N/A N/A super PortalSessionHandler self __init__ args kwargs N/A N/A self portal None N/A N/A self latest_sessid 0 N/A N/A self uptime N/A time N/A N/A self connection_time 0 N/A N/A self connection_last N/A time N/A N/A self connection_task None N/A N/A self command_counter 0 N/A N/A self command_counter_reset N/A time N/A N/A self command_overflow False N/A at_server_connection N/A N/A self N/A N/A N/A 
        Called when the Portal establishes connection with the Server.
        At this point, the AMP connection is already established.

         N/A N/A self connection_time N/A time N/A connect N/A N/A self session N/A N/A N/A 
        Called by protocol at first connect. This adds a not-yet
        authenticated session using an ever-increasing counter for
        sessid.

        Args:
            session (PortalSession): The Session connecting.

        Notes:
            We implement a throttling mechanism here to limit the speed at
            which new connections are accepted - this is both a stop
            against DoS attacks as well as helps using the Dummyrunner
            tester with a large number of connector dummies.

         N/A _CONNECTION_QUEUE N/A session N/A N/A N/A self latest_sessid 1 N/A N/A session sessid N/A self latest_sessid N/A N/A session server_connected False N/A N/A N/A _CONNECTION_QUEUE appendleft session N/A N/A N/A len _CONNECTION_QUEUE 1 N/A N/A N/A N/A session data_out N/A %s DoS protection is active. You are queued to connect in %g seconds ... N/A N/A settings SERVERNAME N/A N/A len _CONNECTION_QUEUE _MIN_TIME_BETWEEN_CONNECTS N/A now N/A time N/A N/A N/A N/A now N/A self connection_last _MIN_TIME_BETWEEN_CONNECTS N/A N/A N/A self portal amp_protocol N/A N/A N/A N/A session N/A N/A self connection_task N/A N/A N/A self connection_task N/A N/A reactor callLater _MIN_TIME_BETWEEN_CONNECTS N/A self connect None N/A N/A self connection_last now N/A N/A N/A N/A session N/A N/A _CONNECTION_QUEUE N/A N/A N/A self connection_task N/A N/A reactor callLater _MIN_TIME_BETWEEN_CONNECTS N/A self connect None N/A N/A N/A self connection_task None N/A N/A self connection_last now N/A _CONNECTION_QUEUE N/A N/A session N/A N/A _CONNECTION_QUEUE pop N/A sessdata N/A N/A session get_sync_data N/A N/A self N/A N/A session sessid session N/A N/A session server_connected True N/A N/A N/A N/A N/A self portal amp_protocol send_AdminPortal2Server session operation PCONN sessiondata sessdata N/A sync N/A N/A self session N/A N/A N/A 
        Called by the protocol of an already connected session. This
        can be used to sync the session info in a delayed manner, such
        as when negotiation and handshakes are delayed.

        Args:
            session (PortalSession): Session to sync.

         N/A N/A N/A session sessid N/A session server_connected N/A N/A sessdata N/A N/A session get_sync_data N/A N/A N/A self portal amp_protocol N/A N/A sessdata N/A dict N/A N/A key val N/A N/A key val N/A N/A sessdata items N/A key N/A protocol_key address sessid suid conn_time protocol_flags server_data N/A N/A N/A N/A N/A self portal amp_protocol send_AdminPortal2Server session operation PCONNSYNC sessiondata sessdata N/A disconnect N/A N/A self session N/A N/A N/A 
        Called from portal when the connection is closed from the
        portal side.

        Args:
            session (PortalSession): Session to disconnect.

         N/A _CONNECTION_QUEUE N/A N/A session _CONNECTION_QUEUE N/A N/A N/A N/A _CONNECTION_QUEUE remove session N/A N/A N/A N/A N/A N/A self portal amp_protocol send_AdminPortal2Server session operation PDISCONN N/A server_connect N/A N/A self protocol_path config N/A N/A dict N/A N/A 
        Called by server to force the initialization of a new protocol
        instance. Server wants this instance to get a unique sessid
        and to be connected back as normal. This is used to initiate
        irc/imc2/rss etc connections.

        Args:
            protocol_path (st): Full python path to the class factory
                for the protocol used, eg
                'evennia.server.portal.irc.IRCClientFactory'
            config (dict): Dictionary of configuration options, fed as
                **kwarg to protocol class' __init__ method.

        Raises:
            RuntimeError: If The correct factory class is not found.

        Notes:
            The called protocol class must have a method start()
            that calls the portalsession.connect() as a normal protocol.

         N/A _MOD_IMPORT N/A N/A _MOD_IMPORT N/A evennia.utils.utils variable_from_module _MOD_IMPORT N/A N/A path clsname N/A N/A protocol_path rsplit . 1 N/A cls N/A _MOD_IMPORT path clsname N/A N/A cls N/A N/A N/A RuntimeError N/A ServerConnect: protocol factory '%s' not found. protocol_path N/A protocol N/A cls self config N/A N/A N/A protocol start N/A server_disconnect N/A N/A self session reason N/A N/A N/A 
        Called by server to force a disconnect by sessid.

        Args:
            sessid (int): Session id to disconnect.
            reason (str, optional): Motivation for disconect.

         N/A session N/A N/A N/A N/A session disconnect reason N/A N/A N/A session sessid self N/A N/A N/A self N/A N/A session sessid N/A session N/A server_disconnect_all N/A N/A self reason N/A N/A N/A 
        Called by server when forcing a clean disconnect for everyone.

        Args:
            reason (str, optional): Motivation for disconnect.

         N/A session N/A N/A self values N/A N/A N/A N/A session disconnect reason N/A session N/A self N/A N/A server_logged_in N/A N/A self session data N/A N/A N/A 
        The server tells us that the session has been authenticated.
        Update it. Called by the Server.

        Args:
            session (Session): Session logging in.
            data (dict): The session sync data.

         N/A N/A N/A session load_sync_data data N/A server_session_sync N/A N/A self serversessions N/A N/A N/A 
        Server wants to save data to the portal, maybe because it's
        about to shut down. We don't overwrite any sessions here, just
        update them in-place and remove any that are out of sync
        (which should normally not be the case)

        Args:
            serversessions (dict): This is a dictionary

                `{sessid:{property:value},...}` describing
                the properties to sync on all sessions.
         N/A to_save N/A sessid N/A sessid serversessions N/A sessid self N/A to_delete N/A sessid N/A sessid self N/A sessid to_save N/A sessid to_save N/A N/A N/A N/A N/A self N/A sessid load_sync_data N/A serversessions N/A sessid N/A sessid to_delete N/A N/A N/A N/A self server_disconnect sessid N/A count_loggedin N/A N/A self include_unloggedin N/A False N/A N/A 
        Count loggedin connections, alternatively count all connections.

        Args:
            include_unloggedin (bool): Also count sessions that have
            not yet authenticated.

        Returns:
            count (int): Number of sessions.

         N/A N/A len N/A N/A self get_sessions include_unloggedin include_unloggedin N/A session_from_suid N/A N/A self suid N/A N/A N/A 
        Given a session id, retrieve the session (this is primarily
        intended to be called by web clients)

        Args:
            suid (int): Session id.

        Returns:
            session (list): The matching session, if found.

         N/A N/A sess N/A sess N/A N/A self get_sessions include_unloggedin True N/A N/A hasattr sess suid N/A N/A sess suid suid N/A announce_all N/A N/A self message N/A N/A N/A 
        Send message to all connected sessions.

        Args:
            message (str):  Message to relay.

         N/A session N/A N/A self values N/A N/A N/A N/A session data_out message N/A oobstruct_parser N/A N/A self oobstruct N/A N/A N/A 
         Helper method for each session to use to parse oob structures
         (The 'oob' kwarg of the msg() method).

         Args:
            oobstruct (str or iterable): A structure representing
                an oob command on one of the following forms:
                    - "cmdname"
                    - "cmdname", "cmdname"
                    - ("cmdname", arg)
                    - ("cmdname",(args))
                    - ("cmdname",{kwargs}
                    - ("cmdname", (args), {kwargs})
                    - (("cmdname", (args,), {kwargs}), ("cmdname", (args,), {kwargs}))
            and any combination of argument-less commands or commands with only
            args, only kwargs or both.

        Returns:
            structure (tuple): A generic OOB structure on the form
                `((cmdname, (args,), {kwargs}), ...)`, where the two last
                args and kwargs may be empty

         _parse N/A N/A oobstruct N/A N/A N/A slen N/A len oobstruct N/A N/A oobstruct N/A N/A N/A tuple None N/A N/A N/A N/A N/A N/A hasattr oobstruct __iter__ N/A N/A N/A oobstruct N/A N/A N/A N/A slen 1 N/A N/A N/A N/A oobstruct N/A 0 N/A N/A N/A N/A N/A slen 2 N/A N/A N/A isinstance N/A oobstruct N/A 1 dict N/A N/A N/A N/A oobstruct N/A 0 N/A N/A dict N/A oobstruct N/A 1 N/A N/A N/A isinstance N/A oobstruct N/A 1 N/A tuple list N/A N/A N/A N/A oobstruct N/A 0 N/A tuple N/A oobstruct N/A 1 N/A N/A N/A N/A N/A oobstruct N/A 0 N/A N/A oobstruct N/A 1 N/A N/A N/A N/A N/A oobstruct N/A 0 N/A tuple N/A oobstruct N/A 1 N/A dict N/A oobstruct N/A 2 N/A N/A N/A hasattr oobstruct __iter__ N/A N/A N/A oobstruct N/A isinstance N/A oobstruct N/A 0 basestring N/A N/A N/A N/A list N/A _parse oobstruct N/A N/A out N/A N/A oobpart oobstruct N/A N/A N/A N/A out append N/A _parse oobpart N/A N/A N/A list out N/A N/A N/A _parse oobstruct N/A data_in N/A N/A self session text N/A kwargs N/A N/A 
        Called by portal sessions for relaying data coming
        in from the protocol to the server.

        Args:
            session (PortalSession): Session receiving data.

        Kwargs:
            text (str): Text from protocol.
            kwargs (any): Other data from protocol.

        Notes:
            Data is serialized before passed on.

         N/A session N/A N/A now N/A time N/A N/A N/A self command_counter _MAX_COMMAND_RATE N/A N/A dT N/A now N/A self command_counter_reset N/A N/A self command_counter 0 N/A N/A self command_counter_reset now N/A N/A self command_overflow N/A dT 1.0 N/A N/A self command_overflow N/A N/A N/A N/A reactor callLater 1.0 N/A self data_in None N/A N/A self command_overflow N/A N/A N/A N/A self data_out session text _ERROR_COMMAND_OVERFLOW N/A N/A N/A self command_counter 1 N/A N/A session cmd_last now N/A N/A N/A N/A N/A self portal amp_protocol send_MsgPortal2Server session text text kwargs N/A N/A N/A self command_overflow N/A N/A N/A self command_overflow False N/A N/A N/A reactor callLater 1.0 N/A self data_in None N/A data_out N/A N/A self session text N/A None kwargs N/A N/A 
        Called by server for having the portal relay messages and data
        to the correct session protocol. We also convert oob input to
        a generic form here.

        Args:
            session (Session): Session sending data.

        Kwargs:
            text (str): Text from protocol.
            kwargs (any): Other data from protocol.

         N/A session N/A N/A N/A oob kwargs N/A N/A N/A kwargs N/A oob N/A N/A self oobstruct_parser N/A kwargs N/A oob N/A N/A N/A session data_out text text kwargs N/A N/A N/A PORTAL_SESSIONS N/A PortalSessionHandler