MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

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

Source from the content-addressed store, hash-verified

224 ignore_log_types = frozenset({'warning'})
225
226 def __init__(self, sock=None, map=None):
227 if map is None:
228 self._map = socket_map
229 else:
230 self._map = map
231
232 self._fileno = None
233
234 if sock:
235 # Set to nonblocking just to make sure for cases where we
236 # get a socket from a blocking source.
237 sock.setblocking(False)
238 self.set_socket(sock, map)
239 self.connected = True
240 # The constructor no longer requires that the socket
241 # passed be connected.
242 try:
243 self.addr = sock.getpeername()
244 except OSError as err:
245 if err.errno in (ENOTCONN, EINVAL):
246 # To handle the case where we got an unconnected
247 # socket.
248 self.connected = False
249 else:
250 # The socket is broken in some unknown way, alert
251 # the user and remove it from the map (to prevent
252 # polling of broken sockets).
253 self.del_channel(map)
254 raise
255 else:
256 self.socket = None
257
258 def __repr__(self):
259 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