Skip to content

Commit

Permalink
lint: Fix linting in Credential class
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry-skydio committed Dec 22, 2023
1 parent 1d2a5f0 commit 768e88e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions revup/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,37 +807,37 @@ async def soft_reset(self, new_commit: GitCommitHash, env: Dict) -> None:
# TODO: only strictly needs to drop entries for HEAD
self.clear_cache()

async def credential(self, **kwargs: Dict[str, str]) -> str:
async def credential(self, **kwargs: str) -> str:
cred = Credential(self, description=kwargs)
await cred.fill()
return cred.password


class Credential():
class Credential:
git_ctx: Git
description: Dict[str, str]

def __init__(self, git: Git, description: Dict[str, str]):
self.git_ctx = git
self.description = description

def __getattr__(self, attr):
def __getattr__(self, attr: str) -> Any:
return self.description[attr]

async def _run(self, subcommand, input: Dict[str, str]) -> Dict[str, str]:
input_str = "\n".join(f"{k}={v}" for k, v in input.items())
async def _run(self, subcommand: str, args: Dict[str, str]) -> Dict[str, str]:
input_str = "\n".join(f"{k}={v}" for k, v in args.items())
stdout_str = await self.git_ctx.git_stdout("credential", subcommand, input_str=input_str)
stdout = {}
stdout_dict = {}
for line in stdout_str.splitlines():
if line == "":
break
k, v = line.split("=", 1)
stdout[k] = v
return stdout
stdout_dict[k] = v
return stdout_dict

async def fill(self):
async def fill(self) -> None:
self.description = await self._run("fill", self.description)

async def report(self, success: bool):
async def report(self, success: bool) -> None:
cmd = "approve" if success else "reject"
await self._run(cmd, self.description)

0 comments on commit 768e88e

Please sign in to comment.