Skip to content
Snippets Groups Projects
Commit e7d2fe1a authored by Vincent Texier's avatar Vincent Texier
Browse files

[enh] #91 fix pylint alerts in key.ascii_armor module

parent 8b2344f2
No related branches found
No related tags found
1 merge request!65Pylint
import base64 import base64
import libnacl import libnacl
from re import compile import re
from typing import Optional, List, Dict, Any from typing import Optional, List, Dict, Any
from duniterpy.key import SigningKey, PublicKey, VerifyingKey from duniterpy.key import SigningKey, PublicKey, VerifyingKey
...@@ -28,7 +28,6 @@ class MissingPublickeyAndSigningKeyException(Exception): ...@@ -28,7 +28,6 @@ class MissingPublickeyAndSigningKeyException(Exception):
""" """
Raise when the message created is not encrypted and not signed... Raise when the message created is not encrypted and not signed...
""" """
pass
# Custom exceptions # Custom exceptions
...@@ -36,7 +35,6 @@ class ParserMissingSigningKeyException(Exception): ...@@ -36,7 +35,6 @@ class ParserMissingSigningKeyException(Exception):
""" """
Raise when the message is encrypted but no SigningKey instance is provided Raise when the message is encrypted but no SigningKey instance is provided
""" """
pass
# Custom exceptions # Custom exceptions
...@@ -44,7 +42,6 @@ class ParserMissingPublicKeysException(Exception): ...@@ -44,7 +42,6 @@ class ParserMissingPublicKeysException(Exception):
""" """
Raise when there is at least one signature but no public keys are provided Raise when there is at least one signature but no public keys are provided
""" """
pass
# Exception messages listed here # Exception messages listed here
...@@ -170,7 +167,7 @@ class AsciiArmor: ...@@ -170,7 +167,7 @@ class AsciiArmor:
:return: :return:
""" """
text = str() text = str()
regex_dash_escape_prefix = compile('^' + DASH_ESCAPE_PREFIX) regex_dash_escape_prefix = re.compile('^' + DASH_ESCAPE_PREFIX)
# if prefixed by a dash escape prefix... # if prefixed by a dash escape prefix...
if regex_dash_escape_prefix.match(dash_escaped_line): if regex_dash_escape_prefix.match(dash_escaped_line):
# remove dash '-' (0x2D) and space ' ' (0x20) prefix # remove dash '-' (0x2D) and space ' ' (0x20) prefix
...@@ -257,11 +254,11 @@ class AsciiArmor: ...@@ -257,11 +254,11 @@ class AsciiArmor:
:return: :return:
""" """
# regex patterns # regex patterns
regex_begin_message = compile(BEGIN_MESSAGE_HEADER) regex_begin_message = re.compile(BEGIN_MESSAGE_HEADER)
regex_end_message = compile(END_MESSAGE_HEADER) regex_end_message = re.compile(END_MESSAGE_HEADER)
regex_begin_signature = compile(BEGIN_SIGNATURE_HEADER) regex_begin_signature = re.compile(BEGIN_SIGNATURE_HEADER)
regex_end_signature = compile(END_SIGNATURE_HEADER) regex_end_signature = re.compile(END_SIGNATURE_HEADER)
regex_fields = compile("^(Version|Comment): (.+)$") regex_fields = re.compile("^(Version|Comment): (.+)$")
# trim message to get rid of empty lines # trim message to get rid of empty lines
ascii_armor_message = ascii_armor_message.strip(" \t\n\r") ascii_armor_message = ascii_armor_message.strip(" \t\n\r")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment