From f472f4ac22405a0016c7b0bae1c38225533c0164 Mon Sep 17 00:00:00 2001 From: "Piotr F. Mieszkowski" Date: Tue, 19 Apr 2022 21:16:40 +0200 Subject: [PATCH] Use isinstance() instead of type() --- GnuPG/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GnuPG/__init__.py b/GnuPG/__init__.py index 81f3a37..d16e97d 100644 --- a/GnuPG/__init__.py +++ b/GnuPG/__init__.py @@ -74,7 +74,7 @@ def public_keys( keyhome ): # confirms a key has a given email address def confirm_key( content, email ): tmpkeyhome = '' - if type(content) == 'str': + if isinstance(content, str): content = bytes(content, sys.getdefaultencoding()) while True: @@ -104,7 +104,7 @@ def confirm_key( content, email ): # adds a key and ensures it has the given email address def add_key( keyhome, content ): - if type(content) == 'str': + if isinstance(content, str): content = bytes(content, sys.getdefaultencoding()) p = subprocess.Popen( build_command(keyhome, '--import', '--batch'), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) p.communicate(input=content)