Skip to content

Commit

Permalink
run pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro-Morales committed Jun 22, 2023
1 parent 33df39d commit bc85950
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/uagents/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ async def resolve(self, destination: str) -> Optional[str]:


class AlmanacResolver(Resolver):
async def resolve(self, address: str) -> Optional[str]:
result = query_record(address, "service")
async def resolve(self, destination: str) -> Optional[str]:
result = query_record(destination, "service")
if result is not None:
record = result.get("record") or {}
endpoint_list = (
Expand All @@ -68,14 +68,14 @@ async def resolve(self, address: str) -> Optional[str]:
if len(endpoint_list) > 0:
endpoints = [val.get("url") for val in endpoint_list]
weights = [val.get("weight") for val in endpoint_list]
return address, random.choices(endpoints, weights=weights)[0]
return destination, random.choices(endpoints, weights=weights)[0]

return None, None


class NameServiceResolver(Resolver):
async def resolve(self, name: str) -> Optional[str]:
return get_agent_address(name)
async def resolve(self, destination: str) -> Optional[str]:
return get_agent_address(destination)


class RulesBasedResolver(Resolver):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_agent_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from uagents import Agent
from uagents.setup import fund_agent_if_low
from uagents.resolver import get_agent_address
from uagents.config import (
REGISTRATION_FEE,
REGISTRATION_DENOM,
Expand Down Expand Up @@ -129,7 +130,7 @@ def test_registration(self):
)
self.assertEqual(is_owner, True, "Domain ownership failed")

query_address = agent.get_agent_address(agent.name)
query_address = get_agent_address(agent.name)

self.assertEqual(
query_address == agent.address, True, "Service contract registration failed"
Expand Down

0 comments on commit bc85950

Please sign in to comment.