From 934cf599fdbfd5dec9c7ff5797137e1e695fe6da Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Mon, 6 Nov 2023 11:49:53 -0800 Subject: Add equality comparison for File objects --- src/wikiget/file.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/wikiget/file.py b/src/wikiget/file.py index 0f639d3..8de62ae 100644 --- a/src/wikiget/file.py +++ b/src/wikiget/file.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Wikiget. If not, see . +from typing import Any + from mwclient.image import Image from wikiget import DEFAULT_SITE @@ -43,3 +45,21 @@ class File: self.name = name self.dest = dest if dest else name self.site = site if site else DEFAULT_SITE + + def __eq__(self, other: Any) -> bool: + """ + Compares this File object with another for equality. + + :param other: another File to compare + :type other: File + :return: True if the Files are equal and False otherwise + :rtype: bool + """ + if not isinstance(other, File): + return NotImplemented + return ( + self.image == other.image + and self.name == other.name + and self.dest == other.dest + and self.site == other.site + ) -- cgit v1.2.3 From 14b3f3e4c48183776d3021fa596f30d2a3c1091f Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Tue, 7 Nov 2023 11:24:35 -0800 Subject: Emit a log message when authenticating with a private wiki --- src/wikiget/client.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/wikiget/client.py b/src/wikiget/client.py index 6551142..69051a7 100644 --- a/src/wikiget/client.py +++ b/src/wikiget/client.py @@ -34,6 +34,7 @@ def connect_to_site(site_name: str, args: Namespace) -> Site: try: site = Site(site_name, path=args.path, clients_useragent=wikiget.USER_AGENT) if args.username and args.password: + logger.info("Attempting to authenticate with credentials") site.login(args.username, args.password) except ConnectionError as e: # usually this means there is no such site, or there's no network connection, -- cgit v1.2.3