
'''simple docstring'''







def       snake_case_	(       __SCREAMING_SNAKE_CASE      :				str = "mytext.txt"   ,   __SCREAMING_SNAKE_CASE      :				bool = False							):



						"""simple docstring"""





						import socket

						lowercase_			:  Any									= 12312  # Reserve a port for your service.
						lowercase_			:  Optional[int]									= socket.socket()  # Create a socket object
						lowercase_			:  List[str]									= socket.gethostname()  # Get local machine name
						sock.bind((host, port)							)  # Bind to the port
						sock.listen(5							)  # Now wait for client connection.

						print('''Server listening....'''							)

						while True:
												lowercase_		,				lowercase_			:  Any									= sock.accept()  # Establish connection with client.
												print(F'''Got connection from {addr}'''							)
												lowercase_			:  Union[str, Any]									= conn.recv(1024							)
												print(F'''Server received: {data = }'''							)

												with open(_A   ,   '''rb'''							) as in_file:
																		lowercase_			:  int									= in_file.read(1024							)
																		while data:
																								conn.send(_A							)
																								print(F'''Sent {data!r}'''							)
																								lowercase_			:  Dict									= in_file.read(1024							)

												print('''Done sending'''							)
												conn.close()
												if testing:  # Allow the test to complete
																		break

						sock.shutdown(1							)
						sock.close()


if __name__ == "__main__":
					send_file()





'''simple docstring'''







from __future__ import annotations

from queue import Queue






class 				lowerCAmelCase__     :






					def __init__(     self	):


											"""simple docstring"""





											lowercase_			:  dict[int, list[int]]									= {}






					def 			_snake_case					(     self	):


											"""simple docstring"""





											for i in self.vertices:
																	print(__SCREAMING_SNAKE_CASE       ,							''' : '''       ,							''' -> '''.join([str(__SCREAMING_SNAKE_CASE	) for j in self.vertices[i]]	)	)






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											if from_vertex in self.vertices:
																	self.vertices[from_vertex].append(__SCREAMING_SNAKE_CASE	)
											else:
																	lowercase_			:  Optional[Any]									= [to_vertex]






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  List[Any]									= set()

											# create a first in first out queue to store all the vertices for BFS
											lowercase_			:  Queue									= Queue()

											# mark the source node as visited and enqueue it
											visited.add(__SCREAMING_SNAKE_CASE	)
											queue.put(__SCREAMING_SNAKE_CASE	)

											while not queue.empty():
																	lowercase_			:  List[Any]									= queue.get()

																	# loop through all adjacent vertex and enqueue it if not yet visited
																	for adjacent_vertex in self.vertices[vertex]:
																							if adjacent_vertex not in visited:
																													queue.put(__SCREAMING_SNAKE_CASE	)
																													visited.add(__SCREAMING_SNAKE_CASE	)
											return visited


if __name__ == "__main__":
							from doctest import testmod

							testmod(verbose=True)

							_lowercase				:						Optional[int]												= Graph()
							g.add_edge(0, 1)
							g.add_edge(0, 2)
							g.add_edge(1, 2)
							g.add_edge(2, 0)
							g.add_edge(2, 3)
							g.add_edge(3, 3)

							g.print_graph()
							# 0  :  1 -> 2
							# 1  :  2
							# 2  :  0 -> 3
							# 3  :  3

							assert sorted(g.bfs(2)) == [0, 1, 2, 3]



