From 58d3cff53188e2cbef646784d7ebd6aca5a0acd5 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Sun, 31 Jul 2022 13:38:48 +0200 Subject: [PATCH] chore: configured flake8 & formatted code --- aiovieter/targets.py | 42 ++++++++++++++++++++++++++---------------- aiovieter/vieter.py | 6 ++++-- setup.cfg | 4 ++++ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/aiovieter/targets.py b/aiovieter/targets.py index 7e4ba86..657d7ce 100644 --- a/aiovieter/targets.py +++ b/aiovieter/targets.py @@ -6,35 +6,45 @@ class VieterTargets: params = {"offset": offset, "limit": limit, "repo": repo} return await self._vieter._get("/targets", params=params) - + async def info(self, target_id: int) -> dict: 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 = { - 'url': url, - 'branch': branch, - 'repo': repo, - 'schedule': schedule, + "url": url, + "branch": branch, + "repo": repo, + "schedule": schedule, } 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 = { - 'url': url, - 'branch': branch, - 'repo': repo, - 'schedule': schedule, + "url": url, + "branch": branch, + "repo": repo, + "schedule": schedule, } 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): - await self._vieter._delete(f'/targets/{target_id}') + await self._vieter._delete(f"/targets/{target_id}") diff --git a/aiovieter/vieter.py b/aiovieter/vieter.py index aa89750..f6eb9c2 100644 --- a/aiovieter/vieter.py +++ b/aiovieter/vieter.py @@ -4,7 +4,7 @@ from .targets import VieterTargets from .logs import VieterBuildLogs -API_PREFIX = '/api/v1' +API_PREFIX = "/api/v1" class VieterApiException(Exception): @@ -35,7 +35,9 @@ class Vieter: if params 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: return VieterApiException("Error 404") diff --git a/setup.cfg b/setup.cfg index e73cad8..dbe8579 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,3 +12,7 @@ lint = develop = %(lint)s jedi + +[flake8] +max-line-length = 88 +extend-ignore = E203