chore: configured flake8 & formatted code
ci/woodpecker/push/lint Pipeline was successful Details

dev
Jef Roosens 2022-07-31 13:38:48 +02:00
parent a84eecc687
commit 58d3cff531
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 34 additions and 18 deletions

View File

@ -6,35 +6,45 @@ class VieterTargets:
params = {"offset": offset, "limit": limit, "repo": repo} params = {"offset": offset, "limit": limit, "repo": repo}
return await self._vieter._get("/targets", params=params) return await self._vieter._get("/targets", params=params)
async def info(self, target_id: int) -> dict: async def info(self, target_id: int) -> dict:
return await self._vieter._get(f"/targets/{target_id}") return await self._vieter._get(f"/targets/{target_id}")
async def create(self, url: str, branch: str, repo: str, schedule: str = None, arch: [str] = None): async def create(
self, url: str, branch: str, repo: str, schedule: str = None, arch: [str] = None
):
params = { params = {
'url': url, "url": url,
'branch': branch, "branch": branch,
'repo': repo, "repo": repo,
'schedule': schedule, "schedule": schedule,
} }
if arch is not None: if arch is not None:
params['arch'] = arch.join(',') params["arch"] = arch.join(",")
await self._vieter._post('/targets', params=params) await self._vieter._post("/targets", params=params)
async def create(self, target_id: int, url: str = None, branch: str = None, repo: str = None, schedule: str = None, arch: [str] = None): async def edit(
self,
target_id: int,
url: str = None,
branch: str = None,
repo: str = None,
schedule: str = None,
arch: [str] = None,
):
params = { params = {
'url': url, "url": url,
'branch': branch, "branch": branch,
'repo': repo, "repo": repo,
'schedule': schedule, "schedule": schedule,
} }
if arch is not None: if arch is not None:
params['arch'] = arch.join(',') params["arch"] = arch.join(",")
await self._vieter._patch(f'/targets/{target_id}', params=params) await self._vieter._patch(f"/targets/{target_id}", params=params)
async def delete(self, target_id: int): async def delete(self, target_id: int):
await self._vieter._delete(f'/targets/{target_id}') await self._vieter._delete(f"/targets/{target_id}")

View File

@ -4,7 +4,7 @@ from .targets import VieterTargets
from .logs import VieterBuildLogs from .logs import VieterBuildLogs
API_PREFIX = '/api/v1' API_PREFIX = "/api/v1"
class VieterApiException(Exception): class VieterApiException(Exception):
@ -35,7 +35,9 @@ class Vieter:
if params is not None: if params is not None:
params = {k: v for k, v in params.items() if v is not None} params = {k: v for k, v in params.items() if v is not None}
async with self._client.request(method, f"{API_PREFIX}{path}", params=params) as res: async with self._client.request(
method, f"{API_PREFIX}{path}", params=params
) as res:
if res.status == 404: if res.status == 404:
return VieterApiException("Error 404") return VieterApiException("Error 404")

View File

@ -12,3 +12,7 @@ lint =
develop = develop =
%(lint)s %(lint)s
jedi jedi
[flake8]
max-line-length = 88
extend-ignore = E203