original_docstring: Load previosly-exported data into this object
docstring: Load previosly-exported data into this object
docstring_tokens: Load previosly - exported data into this object
code: def load_dict(self, data):
          """Load previosly-exported data into this object"""
          for hw_addr, hw_data in data.items():
              if hw_data.get('is_bridge'):
                  self.bridges.add(hw_addr)
              ip_addrs = hw_data.get('ip')
              if ip_addrs:
                  if hw_addr not in self.ip_for_hw:
                      self.ip_for_hw[hw_addr] = set()
                  for ip_addr in ip_addrs:
                      if ip_addr in self.known_ip_addresses:
                          continue
                      new_ip_addr = canonical_ip_address(ip_addr)
                      if new_ip_addr != ip_addr:
                          logger.warning("Tried loading a non-canonical IP address %r -> %r",
                                         ip_addr, new_ip_addr)
                          self.known_ip_addresses.add(ip_addr)
                          ip_addr = new_ip_addr
                          if ip_addr in self.known_ip_addresses:
                              return
                      self.ip_for_hw[hw_addr].add(ip_addr)
                      self.known_ip_addresses.add(ip_addr)
              names = hw_data.get('names')
              if names:
                  if hw_addr not in self.names_for_hw:
                      self.names_for_hw[hw_addr] = set()
                  self.names_for_hw[hw_addr].update(names)
code_tokens: def load_dict ( self , data ) : for hw_addr , hw_data in data . items ( ) : if hw_data . get ( 'is_bridge' ) : self . bridges . add ( hw_addr ) ip_addrs = hw_data . get ( 'ip' ) if ip_addrs : if hw_addr not in self . ip_for_hw : self . ip_for_hw [ hw_addr ] = set ( ) for ip_addr in ip_addrs : if ip_addr in self . known_ip_addresses : continue new_ip_addr = canonical_ip_address ( ip_addr ) if new_ip_addr != ip_addr : logger . warning ( "Tried loading a non-canonical IP address %r -> %r" , ip_addr , new_ip_addr ) self . known_ip_addresses . add ( ip_addr ) ip_addr = new_ip_addr if ip_addr in self . known_ip_addresses : return self . ip_for_hw [ hw_addr ] . add ( ip_addr ) self . known_ip_addresses . add ( ip_addr ) names = hw_data . get ( 'names' ) if names : if hw_addr not in self . names_for_hw : self . names_for_hw [ hw_addr ] = set ( ) self . names_for_hw [ hw_addr ] . update ( names )
short_docstring: Load previosly-exported data into this object
short_docstring_tokens: Load previosly - exported data into this object
comment: """Load previosly-exported data into this object"""