Skip to content

Commit

Permalink
Fixed jank imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekokatt committed Sep 27, 2020
1 parent 0548d6b commit bb83e3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions hikari/impl/stateful_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import logging
import typing

import hikari.utilities.collections
from hikari import channels
from hikari import emojis
from hikari import errors
Expand Down Expand Up @@ -369,7 +368,7 @@ def set_emoji(self, emoji: emojis.KnownCustomEmoji, /) -> None:
guild_container = self._get_or_create_guild_record(emoji.guild_id)

if guild_container.emojis is None: # TODO: add test cases when it is not None?
guild_container.emojis = hikari.utilities.collections.SnowflakeSet()
guild_container.emojis = collections.SnowflakeSet()

guild_container.emojis.add(emoji.id)

Expand Down Expand Up @@ -564,7 +563,7 @@ def set_guild_channel(self, channel: channels.GuildChannel, /) -> None:
guild_record = self._get_or_create_guild_record(channel.guild_id)

if guild_record.channels is None:
guild_record.channels = hikari.utilities.collections.SnowflakeSet()
guild_record.channels = collections.SnowflakeSet()

guild_record.channels.add(channel.id)

Expand Down Expand Up @@ -1348,7 +1347,7 @@ def set_role(self, role: guilds.Role, /) -> None:
guild_record = self._get_or_create_guild_record(role.guild_id)

if guild_record.roles is None: # TODO: test when this is not None
guild_record.roles = hikari.utilities.collections.SnowflakeSet()
guild_record.roles = collections.SnowflakeSet()

guild_record.roles.add(role.id)

Expand Down
9 changes: 4 additions & 5 deletions tests/hikari/impl/test_stateful_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import mock
import pytest

import hikari.utilities.collections
from hikari import channels
from hikari import emojis
from hikari import guilds
Expand Down Expand Up @@ -406,7 +405,7 @@ def test_clear_emojis_for_guild(self, cache_impl):
mock_emoji_data_2 = mock.Mock(cache.KnownCustomEmojiData, user_id=snowflakes.Snowflake(123), ref_count=0)
mock_emoji_data_3 = mock.Mock(cache.KnownCustomEmojiData, user_id=None, ref_count=0)
mock_other_emoji_data = mock.Mock(cache.KnownCustomEmojiData)
emoji_ids = hikari.utilities.collections.SnowflakeSet()
emoji_ids = collections.SnowflakeSet()
emoji_ids.add_all(
[snowflakes.Snowflake(43123123), snowflakes.Snowflake(87643523), snowflakes.Snowflake(6873451)]
)
Expand Down Expand Up @@ -515,7 +514,7 @@ def test_delete_emoji(self, cache_impl):
)
mock_other_emoji_data = mock.Mock(cache.KnownCustomEmojiData)
mock_emoji = mock.Mock(emojis.KnownCustomEmoji)
emoji_ids = hikari.utilities.collections.SnowflakeSet()
emoji_ids = collections.SnowflakeSet()
emoji_ids.add_all([snowflakes.Snowflake(12354123), snowflakes.Snowflake(432123)])
cache_impl._emoji_entries = collections.FreezableDict(
{
Expand Down Expand Up @@ -543,7 +542,7 @@ def test_delete_emoji_without_user(self, cache_impl):
)
mock_other_emoji_data = mock.Mock(cache.KnownCustomEmojiData)
mock_emoji = mock.Mock(emojis.KnownCustomEmoji)
emoji_ids = hikari.utilities.collections.SnowflakeSet()
emoji_ids = collections.SnowflakeSet()
emoji_ids.add_all([snowflakes.Snowflake(12354123), snowflakes.Snowflake(432123)])
cache_impl._emoji_entries = collections.FreezableDict(
{
Expand Down Expand Up @@ -617,7 +616,7 @@ def test_get_emojis_view_for_guild(self, cache_impl):
mock_emoji_data_2 = mock.Mock(cache.KnownCustomEmojiData, user_id=None)
mock_emoji_1 = mock.Mock(emojis.KnownCustomEmoji)
mock_emoji_2 = mock.Mock(emojis.KnownCustomEmoji)
emoji_ids = hikari.utilities.collections.SnowflakeSet()
emoji_ids = collections.SnowflakeSet()
emoji_ids.add_all([snowflakes.Snowflake(65123), snowflakes.Snowflake(43156234)])
mock_wrapped_user = mock.Mock(cache.GenericRefWrapper[users.User])
cache_impl._emoji_entries = collections.FreezableDict(
Expand Down

0 comments on commit bb83e3e

Please sign in to comment.