resolver.py 522 B

123456789101112131415161718
  1. # Copyright (c) Meta Platforms, Inc. and affiliates.
  2. # All rights reserved.
  3. # This source code is licensed under the license found in the
  4. # LICENSE file in the root directory of this source tree.
  5. from typing import Iterable
  6. def resolve_videos(node_ids: Iterable[str], required: bool = False):
  7. """
  8. Resolve videos given node ids.
  9. """
  10. from data.store import get_videos
  11. all_videos = get_videos()
  12. return [
  13. all_videos[nid] if required else all_videos.get(nid, None) for nid in node_ids
  14. ]