Skip to content

Commit

Permalink
Merge pull request #2134 from Exirel/irc-utils-myinfo-namedtuple
Browse files Browse the repository at this point in the history
irc: MyInfo namedtuple with proper type hint
  • Loading branch information
dgw authored Aug 2, 2021
2 parents dd198fe + 6b63eb2 commit e607f08
Showing 1 changed file with 5 additions and 7 deletions.
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

0 comments on commit e607f08

Please sign in to comment.