$89 GRAYBYTE WORDPRESS FILE MANAGER $30

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 147.79.69.33 | ADMIN IP 216.73.216.215
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib/python2.7/site-packages/pymysql/

HOME
Current File : /lib/python2.7/site-packages/pymysql//_socketio.py
"""
SocketIO imported from socket module in Python 3.

Copyright (c) 2001-2013 Python Software Foundation; All Rights Reserved.
"""

from socket import *
import io
import errno

__all__ = ['SocketIO']

EINTR = errno.EINTR
_blocking_errnos = (errno.EAGAIN, errno.EWOULDBLOCK)

class SocketIO(io.RawIOBase):

    """Raw I/O implementation for stream sockets.

    This class supports the makefile() method on sockets.  It provides
    the raw I/O interface on top of a socket object.
    """

    # One might wonder why not let FileIO do the job instead.  There are two
    # main reasons why FileIO is not adapted:
    # - it wouldn't work under Windows (where you can't used read() and
    #   write() on a socket handle)
    # - it wouldn't work with socket timeouts (FileIO would ignore the
    #   timeout and consider the socket non-blocking)

    # XXX More docs

    def __init__(self, sock, mode):
        if mode not in ("r", "w", "rw", "rb", "wb", "rwb"):
            raise ValueError("invalid mode: %r" % mode)
        io.RawIOBase.__init__(self)
        self._sock = sock
        if "b" not in mode:
            mode += "b"
        self._mode = mode
        self._reading = "r" in mode
        self._writing = "w" in mode
        self._timeout_occurred = False

    def readinto(self, b):
        """Read up to len(b) bytes into the writable buffer *b* and return
        the number of bytes read.  If the socket is non-blocking and no bytes
        are available, None is returned.

        If *b* is non-empty, a 0 return value indicates that the connection
        was shutdown at the other end.
        """
        self._checkClosed()
        self._checkReadable()
        if self._timeout_occurred:
            raise IOError("cannot read from timed out object")
        while True:
            try:
                return self._sock.recv_into(b)
            except timeout:
                self._timeout_occurred = True
                raise
            except error as e:
                n = e.args[0]
                if n == EINTR:
                    continue
                if n in _blocking_errnos:
                    return None
                raise

    def write(self, b):
        """Write the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        """
        self._checkClosed()
        self._checkWritable()
        try:
            return self._sock.send(b)
        except error as e:
            # XXX what about EINTR?
            if e.args[0] in _blocking_errnos:
                return None
            raise

    def readable(self):
        """True if the SocketIO is open for reading.
        """
        if self.closed:
            raise ValueError("I/O operation on closed socket.")
        return self._reading

    def writable(self):
        """True if the SocketIO is open for writing.
        """
        if self.closed:
            raise ValueError("I/O operation on closed socket.")
        return self._writing

    def seekable(self):
        """True if the SocketIO is open for seeking.
        """
        if self.closed:
            raise ValueError("I/O operation on closed socket.")
        return super().seekable()

    def fileno(self):
        """Return the file descriptor of the underlying socket.
        """
        self._checkClosed()
        return self._sock.fileno()

    @property
    def name(self):
        if not self.closed:
            return self.fileno()
        else:
            return -1

    @property
    def mode(self):
        return self._mode

    def close(self):
        """Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        """
        if self.closed:
            return
        io.RawIOBase.close(self)
        self._sock._decref_socketios()
        self._sock = None


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
28 Feb 2025 12.50 AM
root / root
0755
constants
--
25 Jan 2024 4.20 PM
root / root
0755
tests
--
25 Jan 2024 4.20 PM
root / root
0755
__init__.py
4.491 KB
20 Dec 2017 12.18 PM
root / root
0644
__init__.pyc
5.47 KB
21 Apr 2022 1.39 PM
root / root
0644
__init__.pyo
5.47 KB
21 Apr 2022 1.39 PM
root / root
0644
_compat.py
0.47 KB
18 May 2016 9.03 AM
root / root
0644
_compat.pyc
0.682 KB
21 Apr 2022 1.39 PM
root / root
0644
_compat.pyo
0.682 KB
21 Apr 2022 1.39 PM
root / root
0644
_socketio.py
3.954 KB
4 Feb 2015 5.38 AM
root / root
0644
_socketio.pyc
4.709 KB
21 Apr 2022 1.39 PM
root / root
0644
_socketio.pyo
4.709 KB
21 Apr 2022 1.39 PM
root / root
0644
charset.py
13.457 KB
29 Aug 2016 8.21 AM
root / root
0644
charset.pyc
13.792 KB
21 Apr 2022 1.39 PM
root / root
0644
charset.pyo
13.792 KB
21 Apr 2022 1.39 PM
root / root
0644
connections.py
56.745 KB
20 Dec 2017 12.38 PM
root / root
0644
connections.pyc
53.451 KB
21 Apr 2022 1.39 PM
root / root
0644
connections.pyo
53.383 KB
21 Apr 2022 1.39 PM
root / root
0644
converters.py
12.443 KB
20 Dec 2017 12.16 PM
root / root
0644
converters.pyc
14.487 KB
21 Apr 2022 1.39 PM
root / root
0644
converters.pyo
14.335 KB
21 Apr 2022 1.39 PM
root / root
0644
cursors.py
16.367 KB
20 Dec 2017 9.29 AM
root / root
0644
cursors.pyc
18.894 KB
21 Apr 2022 1.39 PM
root / root
0644
cursors.pyo
18.814 KB
21 Apr 2022 1.39 PM
root / root
0644
err.py
3.549 KB
20 Dec 2017 9.29 AM
root / root
0644
err.pyc
5.599 KB
21 Apr 2022 1.39 PM
root / root
0644
err.pyo
5.599 KB
21 Apr 2022 1.39 PM
root / root
0644
optionfile.py
0.643 KB
30 Aug 2017 10.38 AM
root / root
0644
optionfile.pyc
1.295 KB
21 Apr 2022 1.39 PM
root / root
0644
optionfile.pyo
1.295 KB
21 Apr 2022 1.39 PM
root / root
0644
times.py
0.352 KB
29 Aug 2016 11.57 AM
root / root
0644
times.pyc
0.922 KB
21 Apr 2022 1.39 PM
root / root
0644
times.pyo
0.922 KB
21 Apr 2022 1.39 PM
root / root
0644
util.py
0.324 KB
29 Jun 2017 7.34 AM
root / root
0644
util.pyc
0.838 KB
21 Apr 2022 1.39 PM
root / root
0644
util.pyo
0.838 KB
21 Apr 2022 1.39 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF