Advertisement
Guest User

Pydantic adapter

a guest
Aug 12th, 2023
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. from pydantic import *
  2.  
  3. class Foo(BaseModel):
  4.     decl: float
  5.     asc: float
  6.     name: str
  7.    
  8.     @classmethod
  9.     def from_nasa(cls, **args):
  10.         return cls(decl=args["declination"], asc=args["ascension"], name=args["name"])
  11.  
  12.     @classmethod
  13.     def from_uoft(cls, **args):
  14.         return cls(decl=args["dec"], asc=args["r-asc"], name=args["obj"])
  15.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement