Exemplo n.º 1
0
def searchdb():
    print '\n'+"================================"
    print "||姓名查找请直接回车||"
    print "||学号输入后两位即可||"+'\n'
    while 1:
        id=raw_input('请输入学号:')
        if id=='':
            name=raw_input('请输入姓名:')
            pass
        elif len(id)!=8 or len(id)!=2 :
            print "学号输入有误,请重新输入!"
        else:
            if len(id)==2:
                pass
            backend.read(student,)
            pass
Exemplo n.º 2
0
 def on_init(self):
     self.fstab = backend.read()
     self._devs, self._vdevs = self._fsc.get_filesystems()
Exemplo n.º 3
0
 def on_init(self):
     self.fstab = backend.read()
     self._devs, self._vdevs = self._fsc.get_filesystems()
Exemplo n.º 4
0
def handle_readable(ops):
    try:
        shim_print(ops)
        connection: Connection = Connection.connection_list[ops.connection_id]

        shim_print(f"HANDLE READABLE - connection {connection.connection_id}")

        if connection.receive_request_queue:
            msg = backend.read(ops, connection.receive_buffer_size)
            shim_print(f'Data received from stream: {ops.stream_id}')
            shim_print(msg)

            if connection.message_framer:
                if connection.framer_placeholder.earmarked_bytes_missing > 0:
                    connection.framer_placeholder.fill_earmarked_bytes(msg)
                    # Case if more data than unfulfilled message is received?
                else:
                    connection.framer_placeholder.inbound_data = msg
                    connection.message_framer.dispatch_handle_received_data(connection)
            else:
                handler, min_length, max_length = connection.receive_request_queue.pop(0)
                message_data_object = MessageDataObject(msg, len(msg))

                # Create a message context to pass to the receive handler
                message_context = MessageContext()
                message_context.remote_endpoint = connection.remote_endpoint
                message_context.local_endpoint = connection.local_endpoint
                if connection.stack_supports_message_boundary_preservation:
                    # "If an incoming Message is larger than the minimum of this size and
                    # the maximum Message size on receive for the Connection's Protocol Stack,
                    #  it will be delivered via ReceivedPartial events"
                    if len(msg) > min(max_length, connection.transport_properties.connection_properties[ConnectionProperties.MAXIMUM_MESSAGE_SIZE_ON_RECEIVE]):
                        partition_size = min(max_length, connection.transport_properties.connection_properties[ConnectionProperties.MAXIMUM_MESSAGE_SIZE_ON_RECEIVE])
                        partitioned_message_data_object = MessageDataObject(partition_size)
                        connection.partitioned_message_data_object = partitioned_message_data_object
                        handler(connection, message_data_object, message_context, False, None)
                    else:
                        handler(connection, message_data_object, message_context, None, None)
                    # Min length does not need to be checked with stacks that deliver complete messages
                    # TODO: Check if there possibly could be scenarios with SCTP where partial messages is delivered
                else:
                    # No message boundary preservation and no framer yields a receive partial event
                    # TODO: Now, a handler must be sent, but should it be possible to pass None, i.e no handler and just discard bytes/message?
                    if connection.buffered_message_data_object:
                        message_data_object.combine_message_data_objects(connection.buffered_message_data_object)
                    if min_length and min_length > message_data_object.length:
                        connection.buffered_message_data_object = message_data_object
                        connection.receive(handler, min_length, max_length)
                    elif max_length < message_data_object.length:
                        # ReceivePartial event - not end of message
                        connection.buffered_message_data_object = None
                        partitioned_message_data_object = message_data_object.partition(max_length)
                        connection.partitioned_message_data_object = partitioned_message_data_object
                        handler(connection, message_data_object, message_context, False, None)
                    else:
                        handler(connection, message_data_object, message_context, True, None)
        else:
            shim_print("READABLE SET TO NONE - receive queue empty", level='error')
            ops.on_readable = None
            neat_set_operations(ops.ctx, ops.flow, ops)
    except SystemError:
        return NEAT_OK
    except Exception as es:
        shim_print("An error occurred in the Python callback: {}  {} - {}".format(sys.exc_info()[0], es.args, inspect.currentframe().f_code.co_name), level='error')
        backend.stop(ops.ctx)

    return NEAT_OK
Exemplo n.º 5
0
 def on_init(self):
     self.fstab = backend.read()
Exemplo n.º 6
0
Arquivo: main.py Projeto: bneg/genesis
 def on_init(self):
     self.fstab = backend.read()
Exemplo n.º 7
0
 def on_init(self):
     self.hosts = backend.read()