MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/test/support/asyncore.py:236–266  ·  view source on GitHub ↗
(self, sock=None, map=None)

Source from the content-addressed store, hash-verified

234 ignore_log_types = frozenset({'warning'})
235
236 def __init__(self, sock=None, map=None):
237 if map is None:
238 self._map = socket_map
239 else:
240 self._map = map
241
242 self._fileno = None
243
244 if sock:
245 # Set to nonblocking just to make sure for cases where we
246 # get a socket from a blocking source.
247 sock.setblocking(False)
248 self.set_socket(sock, map)
249 self.connected = True
250 # The constructor no longer requires that the socket
251 # passed be connected.
252 try:
253 self.addr = sock.getpeername()
254 except OSError as err:
255 if err.errno in (ENOTCONN, EINVAL):
256 # To handle the case where we got an unconnected
257 # socket.
258 self.connected = False
259 else:
260 # The socket is broken in some unknown way, alert
261 # the user and remove it from the map (to prevent
262 # polling of broken sockets).
263 self.del_channel(map)
264 raise
265 else:
266 self.socket = None
267
268 def __repr__(self):
269 status = [self.__class__.__module__+"."+self.__class__.__qualname__]

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 4

set_socketMethod · 0.95
del_channelMethod · 0.95
setblockingMethod · 0.45
getpeernameMethod · 0.45

Tested by

no test coverage detected