-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5df66da
commit 6bf0155
Showing
8 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ kafka/kafka1/ | |
kafka/zookeeper1/ | ||
web_data/imgur/images/ | ||
.env | ||
**/.venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.7-alpine | ||
FROM python:3.11-alpine | ||
ADD . /code | ||
WORKDIR /code | ||
RUN pip install flask | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
max_length = 0 | ||
|
||
def maxLengthPath(park,r,c): | ||
max_length = 0 | ||
visited=[[]] | ||
return maxLengthPathR(max_length,park,visited,r,c) | ||
|
||
def maxLengthPathR(max_length,park,visited,r,c): | ||
if r < 0 : | ||
return 0 | ||
if c < 0: | ||
return 0 | ||
if not park[r][c]: | ||
return 0 | ||
visited[r][c]= True | ||
if not visited[r][c+1]: | ||
m1=maxLengthPathR(max_length,park,visited,r,c+1) | ||
if m1>max_length: | ||
max_length = m1 | ||
return max_length | ||
|
||
print(maxLengthPath([[True,False,False]],0,0)) | ||
assert maxLengthPath([[False,False,False]],0,0) == 0 | ||
assert maxLengthPath([[True,False,False]],0,0) == 1 | ||
assert maxLengthPath([[True,True,False]],0,0) == 2 | ||
assert maxLengthPath([[True,True,False]],0,1) == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Pydantic | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Web Server and REST API | ||
|
||
## [FastAPI](https://fastapi.tiangolo.com/#installation) | ||
|
||
FastAPI is a web framework to build APIs. It needs the ASGI server like [uvicorn](https://www.uvicorn.org/). | ||
|
||
```sh | ||
uvicorn fastapi_main:app --reload | ||
``` | ||
|
||
* Some URLs | ||
|
||
```sh | ||
http://127.0.0.1:8000/docs | ||
http://127.0.0.1:8000/redoc | ||
``` | ||
|
||
* [See full tutorial](https://fastapi.tiangolo.com/tutorial/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:3.11-alpine | ||
ADD . /code | ||
WORKDIR /code | ||
RUN pip install -r requirements.txt | ||
|
||
EXPOSE 80 | ||
CMD ["uvicorn", "fastapi_main:app", "--host", "0.0.0.0", "--port", "80"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Union | ||
|
||
from fastapi import FastAPI | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.get("/") | ||
def read_root(): | ||
return {"Hello": "World"} | ||
|
||
|
||
@app.get("/items/{item_id}") | ||
def read_item(item_id: int, q: Union[str, None] = None): | ||
return {"item_id": item_id, "q": q} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
uvicorn[standard] | ||
fastapi | ||
pydantic |