docstr: Implement marshalling from nested fields. pydantic isn't a core dependency
  so we're implementing this by hand instead.
docstr_tok: ["Implement","marshalling","from","nested","fields",".","pydantic","is","n't","a","core","dependency","so","we","'re","implementing","this","by","hand","instead","."]
code: def from_fields(cls, **fields) -> Optional["NodeAvailabilitySummary"]:
      """Implement marshalling from nested fields. pydantic isn't a core dependency
      so we're implementing this by hand instead."""
      parsed = {}
  
      node_availabilites_dict = fields.get("node_availabilities", {})
  
      for (
          node_type,
          node_availability_record_dict,
      ) in node_availabilites_dict.items():
          unavailable_information_dict = (
              node_availability_record_dict.pop(
                  "unavailable_node_information", None
              )
          )
          unavaiable_information = None
          if unavailable_information_dict is not None:
              unavaiable_information = UnavailableNodeInformation(
                  **unavailable_information_dict
              )
  
          parsed[node_type] = NodeAvailabilityRecord(
              unavailable_node_information=unavaiable_information,
              **node_availability_record_dict,
          )
  
      return NodeAvailabilitySummary(node_availabilities=parsed)
  
file_path: ray/python/ray/autoscaler/_private/node_provider_availability_tracker.py
imports: import threading
  import time
  from dataclasses import dataclass
  from typing import Callable, Dict, Optional, Tuple
  from ray.autoscaler._private.constants import AUTOSCALER_NODE_AVAILABILITY_MAX_STALENESS_S
  from ray.autoscaler.node_launch_exception import NodeLaunchException
label_desc: Use image node_id 1 for calling the NodeAvailabilitySummary obj's underlying member method code with example usage: obj.from_fields(cls) and returns: NodeAvailabilitySummary