from ..constants import FORMAT_CHECKS
from ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES
from ..postprocessor import KnowledgePostProcessor


class FormatChecks(KnowledgePostProcessor):
    _registry_keys = [FORMAT_CHECKS]

    def process(self, kp):
        headers = kp.headers
        for field, typ, input in HEADER_REQUIRED_FIELD_TYPES:
            assert field in headers, "Required field `{}` missing from headers.".format(
                field)
            assert isinstance(headers[field], typ), "Value for field `{}` is of type {}, and needs to be of type {}.".format(
                field, type(headers[field]), typ)
        for field, typ, input in HEADER_OPTIONAL_FIELD_TYPES:
            if field in headers:
                assert isinstance(headers[field], typ), "Value for field `{}` is of type {}, and needs to be of type {}.".format(
                    field, type(headers[field]), typ)

@@ -396,16 +396,34 @@
 headers,
+ %5C%0A               
  %22Requir
@@ -433,16 +433,21 @@
 field %60%7B
+field
 %7D%60 missi
@@ -467,39 +467,8 @@
 rs.%22
-.format(%0A                field)
 %0A   
@@ -508,32 +508,51 @@
 s%5Bfield%5D, typ), 
+%5C%0A                f
 %22Value for field
@@ -546,32 +546,37 @@
 lue for field %60%7B
+field
 %7D%60 is of type %7B%7D
@@ -577,48 +577,13 @@
 ype 
-%7B%7D, and needs to be of type %7B%7D.%22.format(
+%22 + %5C
 %0A   
@@ -588,38 +588,34 @@
                f
-ield, 
+%22%7B
 type(headers%5Bfie
@@ -618,22 +618,50 @@
 %5Bfield%5D)
+%7D
 , 
-typ)
+and needs to be of type %7Btyp%7D.%22
 %0A       
@@ -804,16 +804,39 @@
 , typ), 
+%5C%0A                    f
 %22Value f
@@ -846,16 +846,21 @@
 field %60%7B
+field
 %7D%60 is of
@@ -869,48 +869,13 @@
 ype 
-%7B%7D, and needs to be of type %7B%7D.%22.format(
+%22 + %5C
 %0A   
@@ -892,22 +892,18 @@
        f
-ield, 
+%22%7B
 type(hea
@@ -914,15 +914,43 @@
 %5Bfield%5D)
+%7D
 , 
-typ)
+and needs to be of type %7Btyp%7D.%22
 %0A

Fix lint issues related to long lines