第二个位置参数在哪里?

where is the second positional argument?

我不确定我是否完全理解这个错误是关于什么的...

Exception has occurred: TypeError
    __init__() takes exactly 1 positional argument (2 given)
 File "/home/react_app/fastapi/app/schemas.py", line 73, in <module>
    sch = SellSideCustomer(jsond)

这是我的代码:

from pydantic import BaseModel as _BaseModel, Field, create_model
from typing import Dict, List, Union, Tuple, Optional


class SellSideCreds(_BaseModel):
    user_name   :   str
    user_pass   :   str
    class Config:
        orm_mode = True


class SellSideCustomer(_BaseModel):
    creds   :   Dict[str, SellSideCreds]
    class Config:
        orm_mode = True


jsond = {"creds":
                {
                "user_name":"mrhowdy",
                "user_pass":"heythere"
                }
        }

sch = SellSideCustomer(jsond)
print(sch)

我知道函数上下文中的位置参数是什么,但不确定 jsond 是如何超过 1...这就是整个字典...

注: 我假设 __init__() 来自 pydantic,因为我这辈子从来没有写过这样的东西。我是新手。

__init__ 接受一个 positional 参数 (self);凭据必须作为关键字参数传递:

>>> SellSideCustomer(creds=jsond)
SellSideCustomer(creds={'creds': SellSideCreds(user_name='mrhowdy', user_pass='heythere')})