diff options
author | Ben Sima <ben@bsima.me> | 2023-08-28 21:05:25 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-09-20 17:56:12 -0400 |
commit | 6e4a65579c3ade76feea0890072099f0d0caf416 (patch) | |
tree | 95671321c951134753323978854cece5f7d5435b /Biz/Dragons/main.py | |
parent | 13added53bbf996ec25a19b734326a6834918279 (diff) |
Prototype Mynion
This implements a prototype Mynion, my chatbot which will eventually
help me write code here. In fact he's already helping me, and works
pretty well over xmpp.
The prompt is currently not checked in because I'm experimenting with it
a lot, and it should probably be a runtime parameter anyways.
In the course of writing this I added some helper libraries to get me
going, configured black (didn't even know that was possible), and added
'outlines' and its dependencies even though I didn't end up using it.
I'll keep outlines around for now, but I'm not sure how useful it really
is because afaict its just pre-defining some stop conditions. But it
took a while to get it working so I'll just keep it in for now.
Diffstat (limited to 'Biz/Dragons/main.py')
-rwxr-xr-x | Biz/Dragons/main.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Biz/Dragons/main.py b/Biz/Dragons/main.py index 7ec80bb..7a94f99 100755 --- a/Biz/Dragons/main.py +++ b/Biz/Dragons/main.py @@ -20,7 +20,9 @@ def find_user(line: str) -> typing.Any: return re.findall(r"^[^<]*", line)[0].strip() -def authors_for(path: str, active_users: typing.List[str]) -> typing.Dict[str, str]: +def authors_for( + path: str, active_users: typing.List[str] +) -> typing.Dict[str, str]: """Return a dictionary of {author: commits} for given path. Usernames not in the 'active_users' list will be filtered out.""" raw = subprocess.check_output( @@ -71,7 +73,9 @@ def get_args() -> typing.Any: "Parse CLI arguments." cli = argparse.ArgumentParser(description=__doc__) cli.add_argument("test", action="store_true", help="run the test suite") - cli.add_argument("repo", default=".", help="the git repo to run on", metavar="REPO") + cli.add_argument( + "repo", default=".", help="the git repo to run on", metavar="REPO" + ) cli.add_argument( "-b", "--blackholes", @@ -138,7 +142,9 @@ class Repo: ) -> None: self.paths = [ p - for p in subprocess.check_output(["git", "ls-files", "--no-deleted"]) + for p in subprocess.check_output( + ["git", "ls-files", "--no-deleted"] + ) .decode("utf-8") .split() if not any(i in p for i in ignored_paths) @@ -147,7 +153,9 @@ class Repo: self.stats = {} for path in self.paths: self.stats[path] = authors_for(path, active_users) - self.blackholes = [path for path, authors in self.stats.items() if not authors] + self.blackholes = [ + path for path, authors in self.stats.items() if not authors + ] self.liabilities = { path: list(authors) for path, authors in self.stats.items() |