Skip to content

Commit

Permalink
E721 and arg-type corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyryn committed Jul 31, 2023
1 parent 504ae56 commit 9ab7c2f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions greenwiz/cogs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def testdrop(
if not 1 <= num <= 10:
raise InvalidInput("Num must be between 1 and 10.")

if type(member) == discord.Member:
if isinstance(member, discord.Member):
return await ctx.send(
f"Interpreted test command as: Send {num} random cryptomonKeys to discord user"
f" {member} asa DMed claimlink for reason {reason}."
Expand Down Expand Up @@ -102,7 +102,7 @@ async def testdrop(
@commands.check(nifty())
@commands.check(scope())
async def find_words(
self, ctx: commands.Context, min_length: int = 4, *, text: str
self, ctx: commands.Context(), min_length: int = 4, *, text: str
):

test_strings = text.split()
Expand Down
2 changes: 1 addition & 1 deletion greenwiz/cogs/upland_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def visitors(
response = await session.get(UPLAND_QUERY_URL + str(property_id))
json_res = await response.json()
print(json_res)
if not type(json_res) == list and json_res.get("code", 200) >= 400:
if not isinstance(json_res, list) and json_res.get("code", 200) >= 400:
raise UnableToCompleteRequestedAction(
f"I received an invalid response from the upland api: {json_res}"
)
Expand Down
2 changes: 1 addition & 1 deletion greenwiz/cogs/wax.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ async def drop(
if not 1 <= num <= 10:
raise InvalidInput("Num must be between 1 and 10.")

if type(member) == discord.Member:
if isinstance(member, discord.Member):
log(
f"Sending {num} random cryptomonKeys to discord user {member} as a DMed claimlink for reason {reason}",
"DBUG",
Expand Down
2 changes: 1 addition & 1 deletion greenwiz/utils/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def get_settings(self, num: int = 1000) -> dict[str, str]:
results = dict()
for key in keys:
id_ = str(key).split(":")[-1][:-1]
if await self.redis.type(key) == b"string":
if await self.redis.type(key) == b"string": # noqa: E721
value = await self.redis.get(key)
else:
value = await self.redis.hgetall(key)
Expand Down
5 changes: 4 additions & 1 deletion greenwiz/wax_chain/wax_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def format_wax_amount(amount):
def get_resp_code(response):
"""Wax nodes don't always follow HTTP standards let alone RESTful best practices."""
code = response.get("code", 0)
if code == 0 or not type(code) == int:
if code == 0 or not isinstance(code, int):
code = response.get("statusCode", 0)
try:
code = int(code)
Expand Down Expand Up @@ -1058,6 +1058,9 @@ async def send_link_start_to_finish(
if not isinstance(member, discord.abc.Snowflake):
raise AssertionError("Guild member' should always be a Member.")
while intro:
if not isinstance(introduced, discord.abc.Snowflake):
raise AssertionError("When post is classed as an intro and introduced role is defined,"
" introduced role should be addable.")
# To ensure it gets added if discord messes up initially
await member.add_roles(introduced)
if introduced in member.roles:
Expand Down

0 comments on commit 9ab7c2f

Please sign in to comment.