Skip to content

Commit 7017919

Browse files
authored
Fix type issues in exception_utils.py (microsoft#1972)
* Fix type issues in exception_utils.py * fix yaml
1 parent 09b7185 commit 7017919

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/type-check.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ jobs:
1919
- uses: actions/setup-python@v4
2020
- run: pip install ".[jupyter-executor]" mypy
2121
# As more modules are type check clean, add them here
22-
- run: mypy --install-types --non-interactive autogen/logger
22+
- run: |
23+
mypy --install-types --non-interactive \
24+
autogen/logger \
25+
autogen/exception_utils.py

autogen/exception_utils.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1+
from typing import Any
2+
3+
14
class AgentNameConflict(Exception):
2-
def __init__(self, msg="Found multiple agents with the same name.", *args, **kwargs):
5+
def __init__(self, msg: str = "Found multiple agents with the same name.", *args: Any, **kwargs: Any):
36
super().__init__(msg, *args, **kwargs)
47

58

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

9-
def __init__(self, message="No eligible speakers."):
12+
def __init__(self, message: str = "No eligible speakers."):
1013
self.message = message
1114
super().__init__(self.message)
1215

1316

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

17-
def __init__(self, message="Sender is required but not provided."):
20+
def __init__(self, message: str = "Sender is required but not provided."):
1821
self.message = message
1922
super().__init__(self.message)
2023

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

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

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

0 commit comments

Comments
 (0)