Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irc: MyInfo namedtuple with proper type hint #2134

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions sopel/irc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
# Licensed under the Eiffel Forum License 2.
from __future__ import generator_stop

import collections
from typing import NamedTuple

from dns import rdtypes, resolver

from sopel.tools import deprecated


MYINFO_ARGS = ['client', 'servername', 'version']


def get_cnames(domain):
"""Determine the CNAMEs for a given domain.

Expand Down Expand Up @@ -104,13 +101,14 @@ def module(self):
return self.plugin


class MyInfo(collections.namedtuple('MyInfo', MYINFO_ARGS)):
class MyInfo(NamedTuple):
"""Store client, servername, and version from ``RPL_MYINFO`` events.

.. seealso::

https://modern.ircdocs.horse/#rplmyinfo-004

"""
# TODO: replace by a class using typing.NamedTuple (new in Python 3.5+)
# probably in Sopel 8.0 (due to drop most old Python versions)
client: str
servername: str
version: str