Skip to content

Commit

Permalink
Fix type issues in exception_utils.py (#1972)
Browse files Browse the repository at this point in the history
* Fix type issues in exception_utils.py

* fix yaml
  • Loading branch information
jackgerrits authored Mar 13, 2024
1 parent 508d266 commit 24418bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ jobs:
- uses: actions/setup-python@v4
- run: pip install ".[jupyter-executor]" mypy
# As more modules are type check clean, add them here
- run: mypy --install-types --non-interactive autogen/logger
- run: |
mypy --install-types --non-interactive \
autogen/logger \
autogen/exception_utils.py
13 changes: 8 additions & 5 deletions autogen/exception_utils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
from typing import Any


class AgentNameConflict(Exception):
def __init__(self, msg="Found multiple agents with the same name.", *args, **kwargs):
def __init__(self, msg: str = "Found multiple agents with the same name.", *args: Any, **kwargs: Any):
super().__init__(msg, *args, **kwargs)


class NoEligibleSpeaker(Exception):
"""Exception raised for early termination of a GroupChat."""

def __init__(self, message="No eligible speakers."):
def __init__(self, message: str = "No eligible speakers."):
self.message = message
super().__init__(self.message)


class SenderRequired(Exception):
"""Exception raised when the sender is required but not provided."""

def __init__(self, message="Sender is required but not provided."):
def __init__(self, message: str = "Sender is required but not provided."):
self.message = message
super().__init__(self.message)

Expand All @@ -23,7 +26,7 @@ class InvalidCarryOverType(Exception):
"""Exception raised when the carryover type is invalid."""

def __init__(
self, message="Carryover should be a string or a list of strings. Not adding carryover to the message."
self, message: str = "Carryover should be a string or a list of strings. Not adding carryover to the message."
):
self.message = message
super().__init__(self.message)
Expand All @@ -32,6 +35,6 @@ def __init__(
class UndefinedNextAgent(Exception):
"""Exception raised when the provided next agents list does not overlap with agents in the group."""

def __init__(self, message="The provided agents list does not overlap with agents in the group."):
def __init__(self, message: str = "The provided agents list does not overlap with agents in the group."):
self.message = message
super().__init__(self.message)

0 comments on commit 24418bd

Please sign in to comment.