lint 적용

This commit is contained in:
Lectom C Han
2024-12-10 15:46:13 +09:00
parent 950f10dce1
commit 55badbc44b
5 changed files with 60 additions and 14 deletions

View File

@@ -64,7 +64,7 @@ sudo usermod -aG docker $USER
``` ```
* WSL상에 설치는 VSCode로 WSL에 리모트 연결한 상태에서 Extension 설치로도 가능하다 * 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 -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 | \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \

46
pyproject.toml Normal file
View File

@@ -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"

View File

@@ -1,18 +1,19 @@
import uvicorn import time
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
from app import * from app import *
from fastapi import FastAPI, status
from pydantic import BaseModel
app = FastAPI() app = FastAPI()
class HealthCheck(BaseModel): class HealthCheck(BaseModel):
"""Response model to validate and return when performing a health check.""" """Response model to validate and return when performing a health check."""
global request_id global request_id
status: str = "OK" status: str = "OK"
timestamp: int = math.floor(time.time()) timestamp: int = int(time.time())
@app.get( @app.get(
"/health", "/health",
@@ -33,7 +34,7 @@ async def get_health() -> HealthCheck:
HealthCheck: Returns a JSON response with the health status HealthCheck: Returns a JSON response with the health status
""" """
global request_id global request_id
return HealthCheck(status="OK", timestamp=math.floor(time.time())) return HealthCheck(status="OK", timestamp=int(time.time()))
@app.get("/") @app.get("/")

View File

@@ -1,2 +0,0 @@
import numpy as np
import torch

View File

@@ -2,6 +2,7 @@ import torch
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
class dict_options: class dict_options:
opt = {} opt = {}
opt["device"] = device opt["device"] = device