Skip to content

Commit

Permalink
Merge pull request #2233 from sopel-irc/target-slots
Browse files Browse the repository at this point in the history
tools.target: use slots for Channel and User types
  • Loading branch information
dgw authored Jan 8, 2022
2 parents 787baa6 + 3ca95e5 commit 1195e78
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sopel/tools/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class User:
:param str user: the user's local username ("user" in `[email protected]`)
:param str host: the user's hostname ("host.name" in `[email protected]`)
"""
__slots__ = (
'nick', 'user', 'host', 'channels', 'account', 'away',
)

def __init__(self, nick, user, host):
assert isinstance(nick, Identifier)
self.nick = nick
Expand Down Expand Up @@ -59,6 +63,10 @@ class Channel:
:param name: the channel name
:type name: :class:`~.tools.Identifier`
"""
__slots__ = (
'name', 'users', 'privileges', 'topic', 'modes', 'last_who', 'join_time',
)

def __init__(self, name):
assert isinstance(name, Identifier)
self.name = name
Expand Down

0 comments on commit 1195e78

Please sign in to comment.