Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created November 1, 2020 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinThoma/0938f1b9f37ad7bde4ed39ee3a177384 to your computer and use it in GitHub Desktop.
Save MartinThoma/0938f1b9f37ad7bde4ed39ee3a177384 to your computer and use it in GitHub Desktop.
from pathlib import Path
from typing import List, Mapping
from model import Person, PersonId
from pydantic import parse_file_as
def get_people(filepath: Path) -> Mapping[PersonId, Person]:
people = parse_file_as(List[Person], filepath)
return {person.id: person for person in people}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment