Browse Source

📝 Remove *, from functions where it's not needed #1234 (#1239)

* Fix for - [FEATURE] Remove *, where it's not needed #1234

* 🔥 Remove unnecessary arg *,

* 🎨 Update docs format highlight lines

Co-authored-by: Sebastián Ramírez <[email protected]>
pull/1569/head
Pankaj Giri 5 years ago
committed by GitHub
parent
commit
7e2518350a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/en/docs/tutorial/schema-extra-example.md
  2. 2
      docs_src/body_fields/tutorial001.py
  3. 2
      docs_src/body_multiple_params/tutorial002.py
  4. 2
      docs_src/body_multiple_params/tutorial003.py
  5. 2
      docs_src/body_multiple_params/tutorial005.py
  6. 2
      docs_src/body_nested_models/tutorial001.py
  7. 2
      docs_src/body_nested_models/tutorial002.py
  8. 2
      docs_src/body_nested_models/tutorial003.py
  9. 2
      docs_src/body_nested_models/tutorial004.py
  10. 2
      docs_src/body_nested_models/tutorial005.py
  11. 2
      docs_src/body_nested_models/tutorial006.py
  12. 2
      docs_src/body_nested_models/tutorial007.py
  13. 2
      docs_src/body_nested_models/tutorial008.py
  14. 2
      docs_src/cookie_params/tutorial001.py
  15. 2
      docs_src/extra_models/tutorial001.py
  16. 2
      docs_src/extra_models/tutorial002.py
  17. 2
      docs_src/header_params/tutorial001.py
  18. 2
      docs_src/header_params/tutorial002.py
  19. 2
      docs_src/path_operation_advanced_configuration/tutorial004.py
  20. 2
      docs_src/path_operation_configuration/tutorial001.py
  21. 2
      docs_src/path_operation_configuration/tutorial002.py
  22. 2
      docs_src/path_operation_configuration/tutorial003.py
  23. 2
      docs_src/path_operation_configuration/tutorial004.py
  24. 2
      docs_src/path_operation_configuration/tutorial005.py
  25. 2
      docs_src/request_forms/tutorial001.py
  26. 2
      docs_src/response_model/tutorial002.py
  27. 2
      docs_src/response_model/tutorial003.py
  28. 2
      docs_src/schema_extra_example/tutorial001.py
  29. 2
      docs_src/schema_extra_example/tutorial002.py
  30. 3
      docs_src/schema_extra_example/tutorial003.py
  31. 2
      docs_src/security/tutorial004.py
  32. 2
      docs_src/security/tutorial005.py

2
docs/en/docs/tutorial/schema-extra-example.md

@ -33,7 +33,7 @@ The same way you can pass extra info to `Field`, you can do the same with `Path`
For example, you can pass an `example` for a body request to `Body`:
```Python hl_lines="20 21 22 23 24 25"
```Python hl_lines="19 20 21 22 23 24"
{!../../../docs_src/schema_extra_example/tutorial003.py!}
```

2
docs_src/body_fields/tutorial001.py

@ -12,6 +12,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item = Body(..., embed=True)):
async def update_item(item_id: int, item: Item = Body(..., embed=True)):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_multiple_params/tutorial002.py

@ -17,6 +17,6 @@ class User(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item, user: User):
async def update_item(item_id: int, item: Item, user: User):
results = {"item_id": item_id, "item": item, "user": user}
return results

2
docs_src/body_multiple_params/tutorial003.py

@ -18,7 +18,7 @@ class User(BaseModel):
@app.put("/items/{item_id}")
async def update_item(
*, item_id: int, item: Item, user: User, importance: int = Body(...)
item_id: int, item: Item, user: User, importance: int = Body(...)
):
results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
return results

2
docs_src/body_multiple_params/tutorial005.py

@ -12,6 +12,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item = Body(..., embed=True)):
async def update_item(item_id: int, item: Item = Body(..., embed=True)):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial001.py

@ -13,6 +13,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial002.py

@ -15,6 +15,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial003.py

@ -15,6 +15,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial004.py

@ -21,6 +21,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial005.py

@ -21,6 +21,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial006.py

@ -21,6 +21,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/body_nested_models/tutorial007.py

@ -28,5 +28,5 @@ class Offer(BaseModel):
@app.post("/offers/")
async def create_offer(*, offer: Offer):
async def create_offer(offer: Offer):
return offer

2
docs_src/body_nested_models/tutorial008.py

@ -12,5 +12,5 @@ class Image(BaseModel):
@app.post("/images/multiple/")
async def create_multiple_images(*, images: List[Image]):
async def create_multiple_images(images: List[Image]):
return images

2
docs_src/cookie_params/tutorial001.py

@ -4,5 +4,5 @@ app = FastAPI()
@app.get("/items/")
async def read_items(*, ads_id: str = Cookie(None)):
async def read_items(ads_id: str = Cookie(None)):
return {"ads_id": ads_id}

2
docs_src/extra_models/tutorial001.py

@ -36,6 +36,6 @@ def fake_save_user(user_in: UserIn):
@app.post("/user/", response_model=UserOut)
async def create_user(*, user_in: UserIn):
async def create_user(user_in: UserIn):
user_saved = fake_save_user(user_in)
return user_saved

2
docs_src/extra_models/tutorial002.py

@ -34,6 +34,6 @@ def fake_save_user(user_in: UserIn):
@app.post("/user/", response_model=UserOut)
async def create_user(*, user_in: UserIn):
async def create_user(user_in: UserIn):
user_saved = fake_save_user(user_in)
return user_saved

2
docs_src/header_params/tutorial001.py

@ -4,5 +4,5 @@ app = FastAPI()
@app.get("/items/")
async def read_items(*, user_agent: str = Header(None)):
async def read_items(user_agent: str = Header(None)):
return {"User-Agent": user_agent}

2
docs_src/header_params/tutorial002.py

@ -4,5 +4,5 @@ app = FastAPI()
@app.get("/items/")
async def read_items(*, strange_header: str = Header(None, convert_underscores=False)):
async def read_items(strange_header: str = Header(None, convert_underscores=False)):
return {"strange_header": strange_header}

2
docs_src/path_operation_advanced_configuration/tutorial004.py

@ -15,7 +15,7 @@ class Item(BaseModel):
@app.post("/items/", response_model=Item, summary="Create an item")
async def create_item(*, item: Item):
async def create_item(item: Item):
"""
Create an item with all the information:

2
docs_src/path_operation_configuration/tutorial001.py

@ -15,5 +15,5 @@ class Item(BaseModel):
@app.post("/items/", response_model=Item, status_code=status.HTTP_201_CREATED)
async def create_item(*, item: Item):
async def create_item(item: Item):
return item

2
docs_src/path_operation_configuration/tutorial002.py

@ -15,7 +15,7 @@ class Item(BaseModel):
@app.post("/items/", response_model=Item, tags=["items"])
async def create_item(*, item: Item):
async def create_item(item: Item):
return item

2
docs_src/path_operation_configuration/tutorial003.py

@ -20,5 +20,5 @@ class Item(BaseModel):
summary="Create an item",
description="Create an item with all the information, name, description, price, tax and a set of unique tags",
)
async def create_item(*, item: Item):
async def create_item(item: Item):
return item

2
docs_src/path_operation_configuration/tutorial004.py

@ -15,7 +15,7 @@ class Item(BaseModel):
@app.post("/items/", response_model=Item, summary="Create an item")
async def create_item(*, item: Item):
async def create_item(item: Item):
"""
Create an item with all the information:

2
docs_src/path_operation_configuration/tutorial005.py

@ -20,7 +20,7 @@ class Item(BaseModel):
summary="Create an item",
response_description="The created item",
)
async def create_item(*, item: Item):
async def create_item(item: Item):
"""
Create an item with all the information:

2
docs_src/request_forms/tutorial001.py

@ -4,5 +4,5 @@ app = FastAPI()
@app.post("/login/")
async def login(*, username: str = Form(...), password: str = Form(...)):
async def login(username: str = Form(...), password: str = Form(...)):
return {"username": username}

2
docs_src/response_model/tutorial002.py

@ -13,5 +13,5 @@ class UserIn(BaseModel):
# Don't do this in production!
@app.post("/user/", response_model=UserIn)
async def create_user(*, user: UserIn):
async def create_user(user: UserIn):
return user

2
docs_src/response_model/tutorial003.py

@ -18,5 +18,5 @@ class UserOut(BaseModel):
@app.post("/user/", response_model=UserOut)
async def create_user(*, user: UserIn):
async def create_user(user: UserIn):
return user

2
docs_src/schema_extra_example/tutorial001.py

@ -22,6 +22,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/schema_extra_example/tutorial002.py

@ -12,6 +12,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(*, item_id: int, item: Item):
async def update_item(item_id: int, item: Item):
results = {"item_id": item_id, "item": item}
return results

3
docs_src/schema_extra_example/tutorial003.py

@ -13,7 +13,6 @@ class Item(BaseModel):
@app.put("/items/{item_id}")
async def update_item(
*,
item_id: int,
item: Item = Body(
...,
@ -23,7 +22,7 @@ async def update_item(
"price": 35.4,
"tax": 3.2,
},
)
),
):
results = {"item_id": item_id, "item": item}
return results

2
docs_src/security/tutorial004.py

@ -75,7 +75,7 @@ def authenticate_user(fake_db, username: str, password: str):
return user
def create_access_token(*, data: dict, expires_delta: timedelta = None):
def create_access_token(data: dict, expires_delta: timedelta = None):
to_encode = data.copy()
if expires_delta:
expire = datetime.utcnow() + expires_delta

2
docs_src/security/tutorial005.py

@ -91,7 +91,7 @@ def authenticate_user(fake_db, username: str, password: str):
return user
def create_access_token(*, data: dict, expires_delta: timedelta = None):
def create_access_token(data: dict, expires_delta: timedelta = None):
to_encode = data.copy()
if expires_delta:
expire = datetime.utcnow() + expires_delta

Loading…
Cancel
Save