Skip to content

Commit

Permalink
minor fix in registration.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Archento committed Jan 14, 2025
1 parent dacae21 commit 007b31f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions python/src/uagents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,9 +1313,9 @@ async def _process_message_queue(self):
)

# sanity check
assert (
context.session == session
), "Context object should always have message session"
assert context.session == session, (
"Context object should always have message session"
)

# parse the received message
try:
Expand Down Expand Up @@ -1500,7 +1500,6 @@ def _update_agent(self, agent: Agent):
and agent._almanac_contract is not None
):
agent._registration_policy = LedgerBasedRegistrationPolicy(
agent._identity,
agent._ledger,
agent._wallet,
agent._almanac_contract,
Expand Down
10 changes: 4 additions & 6 deletions python/src/uagents/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ async def almanac_api_post(

class AgentRegistrationPolicy(ABC):
@abstractmethod
# pylint: disable=unnecessary-pass
async def register(
self,
agent_identifier: str,
Expand All @@ -152,7 +151,6 @@ async def register(

class BatchRegistrationPolicy(ABC):
@abstractmethod
# pylint: disable=unnecessary-pass
async def register(self):
pass

Expand Down Expand Up @@ -201,7 +199,7 @@ async def register(
self._logger.warning("Registration on Almanac API failed")


class BatchAlmanacApiRegistrationPolicy(AgentRegistrationPolicy):
class BatchAlmanacApiRegistrationPolicy(BatchRegistrationPolicy):
def __init__(
self, almanac_api: Optional[str] = None, logger: Optional[logging.Logger] = None
):
Expand Down Expand Up @@ -427,7 +425,7 @@ def __init__(

async def register(
self,
agent_address: str,
agent_identifier: str,
identity: Identity,
protocols: List[str],
endpoints: List[AgentEndpoint],
Expand All @@ -436,7 +434,7 @@ async def register(
# prefer the API registration policy as it is faster
try:
await self._api_policy.register(
agent_address, identity, protocols, endpoints, metadata
agent_identifier, identity, protocols, endpoints, metadata
)
except Exception as e:
self._logger.warning(
Expand All @@ -449,7 +447,7 @@ async def register(
# schedule the ledger registration
try:
await self._ledger_policy.register(
agent_address, identity, protocols, endpoints, metadata
agent_identifier, identity, protocols, endpoints, metadata
)
except InsufficientFundsError:
self._logger.warning(
Expand Down

0 comments on commit 007b31f

Please sign in to comment.