docstr: Parse authentication entries.
  
  Arguments:
    entries:        Dict of authentication entries.
    raise_on_error: If set to true, an invalid format will raise
                    InvalidConfigFileError
  Returns:
    Authentication registry.
docstr_tok: ["Parse","authentication","entries",".","Arguments",":","entries",":","Dict","of","authentication","entries",".","raise_on_error",":","If","set","to","true",",","an","invalid","format","will","raise","InvalidConfigFileError","Returns",":","Authentication","registry","."]
code: def parse_auth(
      cls,
      entries: Dict[str, Dict[str, Any]],
      raise_on_error: bool = False,
  ) -> Dict[str, Dict[str, Any]]:
      """Parse authentication entries.
  
      Arguments:
        entries:        Dict of authentication entries.
        raise_on_error: If set to true, an invalid format will raise
                        InvalidConfigFileError
      Returns:
        Authentication registry.
      """
      conf = {}
      for registry, entry in entries.items():
          if not isinstance(entry, dict):
              log.debug(f"Config entry for key {registry} is not auth config")  # type: ignore
              # We sometimes fall back to parsing the whole config as if it
              # was the auth config by itself, for legacy purposes. In that
              # case, we fail silently and return an empty conf if any of the
              # keys is not formatted properly.
              if raise_on_error:
                  raise InvalidConfigFileError(
                      f"Invalid configuration for registry {registry}"
                  )
              return {}
          if "identitytoken" in entry:
              log.debug(
                  f"Found an IdentityToken entry for registry {registry}"
              )
              conf[registry] = {"IdentityToken": entry["identitytoken"]}
              continue  # Other values are irrelevant if we have a token
  
          if "auth" not in entry:
              # Starting with engine v1.11 (API 1.23), an empty dictionary is
              # a valid value in the auth's config.
              # https://github.com/docker/compose/issues/3265
              log.debug(
                  f"Auth data for {registry} is absent. Client might be using a "
                  "credentials store instead."
              )
              conf[registry] = {}
              continue
  
          username, password = decode_auth(entry["auth"])
          log.debug(
              f"Found entry (registry={repr(registry)}, username={repr(username)})"
          )
  
          conf[registry] = {
              "username": username,
              "password": password,
              "email": entry.get("email"),
              "serveraddress": registry,
          }
      return conf
  
imports: import base64
  import json
  import logging
  import os
  import platform
  from typing import Any, Dict, Mapping, Optional, Tuple, Union
  import dockerpycreds
label_desc: Use image node_id 2 for calling the AuthConfig obj's underlying member method code with example usage: obj.parse_auth(cls, entries, raise_on_error) and returns: conf, dict