Compare commits

...

2 Commits

Author SHA1 Message Date
4c5d2b08fd Ruff
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 24s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 23s
2025-04-13 23:40:10 +02:00
94ecf8d526 feat: introduce AiderArgs dataclass for better argument handling 2025-04-13 23:40:05 +02:00
2 changed files with 18 additions and 8 deletions

View File

@ -7,12 +7,19 @@ It assumes that the default branch (default "main") exists and that you have a v
import argparse import argparse
import logging import logging
import time import time
from dataclasses import dataclass
from . import handle_issues, secrets from . import handle_issues, secrets
from .gitea_client import GiteaClient from .gitea_client import GiteaClient
from .seen_issues_db import SeenIssuesDB from .seen_issues_db import SeenIssuesDB
logger = logging.getLogger(__name__)
@dataclass
class AiderArgs:
gitea_url: str
owner: str
repo: str
base_branch: str
def parse_args(): def parse_args():
@ -63,12 +70,13 @@ def main():
while True: while True:
logger.info('Checking for new issues...') logger.info('Checking for new issues...')
for repo in repositories: for repo in repositories:
args_copy = argparse.Namespace() aider_args = AiderArgs(
args_copy.gitea_url = args.gitea_url gitea_url=args.gitea_url,
args_copy.owner = args.owner owner=args.owner,
args_copy.repo = repo repo=repo,
args_copy.base_branch = args.base_branch base_branch=args.base_branch,
handle_issues(args_copy, client, seen_issues_db) )
handle_issues(aider_args, client, seen_issues_db)
if not args.daemon: if not args.daemon:
break break
logger.info('Sleeping for %d seconds...', args.interval) logger.info('Sleeping for %d seconds...', args.interval)

View File

@ -109,7 +109,9 @@ class GiteaClient:
return issues return issues
def iter_user_repositories( def iter_user_repositories(
self, owner: str, only_those_with_issues: bool = False, self,
owner: str,
only_those_with_issues: bool = False,
) -> Iterator[str]: ) -> Iterator[str]:
""" """
Get a list of repositories for a given user. Get a list of repositories for a given user.