From 55badbc44b1071ab24607c7c915c176101305555 Mon Sep 17 00:00:00 2001 From: Lectom C Han Date: Tue, 10 Dec 2024 15:46:13 +0900 Subject: [PATCH] =?UTF-8?q?lint=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- pyproject.toml | 46 +++++++++++++++++++++++++++++++++++++++++++++ workspace/api.py | 19 ++++++++++--------- workspace/app.py | 2 -- workspace/option.py | 5 +++-- 5 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 pyproject.toml diff --git a/README.md b/README.md index 3593fed..c8d9c5d 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ sudo usermod -aG docker $USER ``` * WSL상에 설치는 VSCode로 WSL에 리모트 연결한 상태에서 Extension 설치로도 가능하다 -### GPU 이용하기 +### Nvidia GPU 이용하기 ``` $ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0e82701 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", +] + +line-length = 120 +indent-width = 4 + +[lint] +# 기본적으로 Pyflakes('F')와 pycodestyle('E') 코드의 하위 집합을 활성화합니다. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# 활성화된 모든 규칙에 대한 수정 허용. +fixable = ["ALL"] +unfixable = [] + +# 밑줄 접두사가 붙은 경우 사용하지 않는 변수를 허용합니다. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +quote-style = "double" +indent-style = "space" +skip-magic-trailing-comma = false +line-ending = "auto" +docstring-code-format = false +docstring-code-line-length = "dynamic" \ No newline at end of file diff --git a/workspace/api.py b/workspace/api.py index 81f00a4..91cdda9 100644 --- a/workspace/api.py +++ b/workspace/api.py @@ -1,18 +1,19 @@ -import uvicorn -import torch -import math, time -from fastapi import FastAPI, status, Path, Query, File, UploadFile, Form, Request -from pydantic import BaseModel -from fastapi.responses import HTMLResponse +import time + from app import * +from fastapi import FastAPI, status +from pydantic import BaseModel app = FastAPI() + class HealthCheck(BaseModel): """Response model to validate and return when performing a health check.""" + global request_id status: str = "OK" - timestamp: int = math.floor(time.time()) + timestamp: int = int(time.time()) + @app.get( "/health", @@ -33,9 +34,9 @@ async def get_health() -> HealthCheck: HealthCheck: Returns a JSON response with the health status """ global request_id - return HealthCheck(status="OK", timestamp=math.floor(time.time())) + return HealthCheck(status="OK", timestamp=int(time.time())) @app.get("/") def read_root(): - return {"hello":"world!"} \ No newline at end of file + return {"hello": "world!"} diff --git a/workspace/app.py b/workspace/app.py index f35d93a..e69de29 100644 --- a/workspace/app.py +++ b/workspace/app.py @@ -1,2 +0,0 @@ -import numpy as np -import torch diff --git a/workspace/option.py b/workspace/option.py index 6078c70..169e20a 100644 --- a/workspace/option.py +++ b/workspace/option.py @@ -2,10 +2,11 @@ import torch device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") + class dict_options: opt = {} - opt["device"] =device + opt["device"] = device opt["report_host"] = "http://localhost:7890" def call_default(self): - return self.opt \ No newline at end of file + return self.opt