Rename __json__() to asdict()

This commit is contained in:
grossmj
2021-04-17 23:34:28 +09:30
parent 44074ff7c9
commit cefab8d362
89 changed files with 286 additions and 282 deletions

View File

@ -65,7 +65,7 @@ async def create_atm_switch(project_id: UUID, node_data: schemas.ATMSwitchCreate
node_type="atm_switch",
mappings=node_data.get("mappings"),
)
return node.__json__()
return node.asdict()
@router.get("/{node_id}", response_model=schemas.ATMSwitch)
@ -74,7 +74,7 @@ def get_atm_switch(node: ATMSwitch = Depends(dep_node)):
Return an ATM switch node.
"""
return node.__json__()
return node.asdict()
@router.post("/{node_id}/duplicate", response_model=schemas.ATMSwitch, status_code=status.HTTP_201_CREATED)
@ -84,7 +84,7 @@ async def duplicate_atm_switch(destination_node_id: UUID = Body(..., embed=True)
"""
new_node = await Dynamips.instance().duplicate_node(node.id, str(destination_node_id))
return new_node.__json__()
return new_node.asdict()
@router.put("/{node_id}", response_model=schemas.ATMSwitch)
@ -99,7 +99,7 @@ async def update_atm_switch(node_data: schemas.ATMSwitchUpdate, node: ATMSwitch
if "mappings" in node_data:
node.mappings = node_data["mappings"]
node.updated()
return node.__json__()
return node.asdict()
@router.delete("/{node_id}", status_code=status.HTTP_204_NO_CONTENT)
@ -156,7 +156,7 @@ async def create_nio(
nio = await Dynamips.instance().create_nio(node, jsonable_encoder(nio_data, exclude_unset=True))
await node.add_nio(nio, port_number)
return nio.__json__()
return nio.asdict()
@router.delete("/{node_id}/adapters/{adapter_number}/ports/{port_number}/nio", status_code=status.HTTP_204_NO_CONTENT)