

import socket







def 		_lowercase (     ):
      __lowerCAmelCase					:						List[str]					=					socket.socket(socket.AF_INET   ,	socket.SOCK_STREAM						)
      __lowerCAmelCase					:						List[str]					=					socket.gethostname()
      __lowerCAmelCase					:						Tuple					=					1_2_3_1_2

      sock.connect((host, port)						)
      sock.send(B'''Hello server!'''						)

      with open('''Received_file'''   ,	'''wb'''						) as out_file:
            print('''File opened'''						)
            print('''Receiving data...'''						)
            while True:
                  __lowerCAmelCase					:						str					=					sock.recv(1_0_2_4						)
                  if not data:
                        break
                  out_file.write(lowercase__						)

      print('''Successfully received the file'''						)
      sock.close()
      print('''Connection closed'''						)


if __name__ == "__main__":
 main()





from collections import deque

from .hash_table import HashTable







class   __lowercase      (_UpperCAmelCase ):
 def __init__(							self      ,							*A_      ,							**A_					)					->int:



       '''simple docstring'''





       super().__init__(*A_      ,							**A_					)
 def 	UpperCamelCase__  (							self      ,							A_      ,							A_					)					->Optional[int]:



       '''simple docstring'''





       __lowerCAmelCase					:						Dict					=					deque([]					) if self.values[key] is None else self.values[key]
       self.values[key].appendleft(A_					)
       __lowerCAmelCase					:						int					=					self.values[key]
 def 	UpperCamelCase__  (							self					)					->Tuple:



       '''simple docstring'''





       return (
           sum(self.charge_factor - len(A_					) for slot in self.values					)
           / self.size_table
           * self.charge_factor
       )





 def 	UpperCamelCase__  (							self      ,							A_      ,							A_=None					)					->str:



       '''simple docstring'''





       if not (
           len(self.values[key]					) == self.charge_factor and self.values.count(A_					) == 0
       ):
             return key
       return super()._collision_resolution(A_      ,							A_					)


