class_docstr: A dict-like proxy held by the Doc, to control access to span groups.
class_docstr_tok: ["A","dict-like","proxy","held","by","the","Doc",",","to","control","access","to","span","groups","."]
code: def from_bytes(self, bytes_data: bytes) -> "SpanGroups":
      # backwards-compatibility: bytes_data may be one of:
      # b'', a serialized empty list, a serialized list of SpanGroup bytes
      # or a serialized dict of SpanGroup bytes -> keys
      msg = (
          []
          if not bytes_data or bytes_data == self._EMPTY_BYTES
          else srsly.msgpack_loads(bytes_data)
      )
      self.clear()
      doc = self._ensure_doc()
      if isinstance(msg, list):
          # This is either the 1st version of `SpanGroups` serialization
          # or there were no SpanGroups serialized
          for value_bytes in msg:
              group = SpanGroup(doc).from_bytes(value_bytes)
              if group.name in self:
                  # Display a warning if `msg` contains `SpanGroup`s
                  # that have the same .name (attribute).
                  # Because, for `SpanGroups` serialized as lists,
                  # only 1 SpanGroup per .name is loaded. (See #10685)
                  warnings.warn(
                      Warnings.W120.format(
                          group_name=group.name,
                          group_values=self[group.name],
                      )
                  )
              self[group.name] = group
      else:
          for value_bytes, keys in msg.items():
              group = SpanGroup(doc).from_bytes(value_bytes)
              # Deserialize `SpanGroup`s as copies because it's possible for two
              # different `SpanGroup`s (pre-serialization) to have the same bytes
              # (since they can have the same `.name`).
              self[keys[0]] = group
              for key in keys[1:]:
                  self[key] = group.copy()
      return self
  
file_path: spacy/spacy/tokens/_dict_proxies.py
imports: import warnings
  import weakref
  from collections import UserDict
  from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Tuple, Union
  import srsly
  from ..errors import Errors, Warnings
  from .span_group import SpanGroup
label_desc: Use image node_id 7 for calling the SpanGroups obj's underlying member method code with example usage: obj.from_bytes(bytes_data) and returns: self