@@ -80,9 +80,9 @@ def test_event_galaxy(self) -> None:
8080
8181 def test_attribute (self ) -> None :
8282 self .init_event ()
83- a : MISPAttribute = self .mispevent .add_attribute ('filename' , 'bar.exe' ) # type: ignore[assignment]
83+ a : MISPAttribute = self .mispevent .add_attribute ('filename' , 'bar.exe' )
8484 del a .uuid
85- a = self .mispevent .add_attribute_tag ('osint' , 'bar.exe' ) # type: ignore[assignment]
85+ a = self .mispevent .add_attribute_tag ('osint' , 'bar.exe' )
8686 attr_tags = self .mispevent .get_attribute_tag ('bar.exe' )
8787 self .assertEqual (self .mispevent .attributes [0 ].tags [0 ].name , 'osint' )
8888 self .assertEqual (attr_tags [0 ].name , 'osint' )
@@ -123,17 +123,17 @@ def test_to_dict_json_format(self) -> None:
123123
124124 def test_object_tag (self ) -> None :
125125 self .mispevent .add_object (name = 'file' , strict = True )
126- a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('filename' , value = '' ) # type: ignore[assignment]
126+ a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('filename' , value = '' )
127127 self .assertEqual (a , None )
128- a = self .mispevent .objects [0 ].add_attribute ('filename' , value = None ) # type: ignore[assignment]
128+ a = self .mispevent .objects [0 ].add_attribute ('filename' , value = None )
129129 self .assertEqual (a , None )
130- a = self .mispevent .objects [0 ].add_attribute ('filename' , value = 'bar' , Tag = [{'name' : 'blah' }]) # type: ignore[assignment]
130+ a = self .mispevent .objects [0 ].add_attribute ('filename' , value = 'bar' , Tag = [{'name' : 'blah' }])
131131 del a .uuid
132132 self .assertEqual (self .mispevent .objects [0 ].attributes [0 ].tags [0 ].name , 'blah' )
133133 self .assertTrue (self .mispevent .objects [0 ].has_attributes_by_relation (['filename' ]))
134134 self .assertEqual (len (self .mispevent .objects [0 ].get_attributes_by_relation ('filename' )), 1 )
135135 self .mispevent .add_object (name = 'url' , strict = True )
136- a = self .mispevent .objects [1 ].add_attribute ('url' , value = 'https://www.circl.lu' ) # type: ignore[assignment]
136+ a = self .mispevent .objects [1 ].add_attribute ('url' , value = 'https://www.circl.lu' )
137137 del a .uuid
138138 self .mispevent .objects [0 ].uuid = 'a'
139139 self .mispevent .objects [1 ].uuid = 'b'
@@ -175,7 +175,7 @@ def test_malware(self) -> None:
175175 with open ('tests/mispevent_testfiles/simple.json' , 'rb' ) as f :
176176 pseudofile = BytesIO (f .read ())
177177 self .init_event ()
178- a : MISPAttribute = self .mispevent .add_attribute ('malware-sample' , 'bar.exe' , data = pseudofile ) # type: ignore[assignment]
178+ a : MISPAttribute = self .mispevent .add_attribute ('malware-sample' , 'bar.exe' , data = pseudofile )
179179 del a .uuid
180180 attribute = self .mispevent .attributes [0 ]
181181 self .assertEqual (attribute .malware_binary , pseudofile )
@@ -217,7 +217,7 @@ def test_shadow_attributes(self) -> None:
217217 self .init_event ()
218218 p = self .mispevent .add_proposal (type = 'filename' , value = 'baz.jpg' )
219219 del p .uuid
220- a : MISPAttribute = self .mispevent .add_attribute ('filename' , 'bar.exe' ) # type: ignore[assignment]
220+ a : MISPAttribute = self .mispevent .add_attribute ('filename' , 'bar.exe' )
221221 del a .uuid
222222 p = self .mispevent .attributes [0 ].add_proposal (type = 'filename' , value = 'bar.pdf' )
223223 del p .uuid
@@ -227,13 +227,13 @@ def test_shadow_attributes(self) -> None:
227227
228228 def test_default_attributes (self ) -> None :
229229 self .mispevent .add_object (name = 'file' , strict = True )
230- a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('filename' , value = 'bar' , Tag = [{'name' : 'blah' }]) # type: ignore[assignment]
230+ a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('filename' , value = 'bar' , Tag = [{'name' : 'blah' }])
231231 del a .uuid
232- a = self .mispevent .objects [0 ].add_attribute ('pattern-in-file' , value = 'baz' ) # type: ignore[assignment]
232+ a = self .mispevent .objects [0 ].add_attribute ('pattern-in-file' , value = 'baz' )
233233 self .assertEqual (a .category , 'Artifacts dropped' )
234234 del a .uuid
235235 self .mispevent .add_object (name = 'file' , strict = False , default_attributes_parameters = self .mispevent .objects [0 ].attributes [0 ])
236- a = self .mispevent .objects [1 ].add_attribute ('filename' , value = 'baz' ) # type: ignore[assignment]
236+ a = self .mispevent .objects [1 ].add_attribute ('filename' , value = 'baz' )
237237 del a .uuid
238238 self .mispevent .objects [0 ].uuid = 'a'
239239 self .mispevent .objects [1 ].uuid = 'b'
@@ -245,13 +245,13 @@ def test_default_attributes(self) -> None:
245245 def test_obj_default_values (self ) -> None :
246246 self .init_event ()
247247 self .mispevent .add_object (name = 'whois' , strict = True )
248- a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('registrar' , value = 'registar.example.com' ) # type: ignore[assignment]
248+ a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('registrar' , value = 'registar.example.com' )
249249 del a .uuid
250- a = self .mispevent .objects [0 ].add_attribute ('domain' , value = 'domain.example.com' ) # type: ignore[assignment]
250+ a = self .mispevent .objects [0 ].add_attribute ('domain' , value = 'domain.example.com' )
251251 del a .uuid
252- a = self .mispevent .objects [0 ].add_attribute ('nameserver' , value = 'ns1.example.com' ) # type: ignore[assignment]
252+ a = self .mispevent .objects [0 ].add_attribute ('nameserver' , value = 'ns1.example.com' )
253253 del a .uuid
254- a = self .mispevent .objects [0 ].add_attribute ('nameserver' , value = 'ns2.example.com' , disable_correlation = False , to_ids = True , category = 'External analysis' ) # type: ignore[assignment]
254+ a = self .mispevent .objects [0 ].add_attribute ('nameserver' , value = 'ns2.example.com' , disable_correlation = False , to_ids = True , category = 'External analysis' )
255255 del a .uuid
256256 self .mispevent .objects [0 ].uuid = 'a'
257257 with open ('tests/mispevent_testfiles/def_param.json' ) as f :
@@ -353,16 +353,16 @@ def test_userdefined_object_custom_template(self) -> None:
353353 self .mispevent .to_json (sort_keys = True , indent = 2 )
354354 self .assertEqual (e .exception .message , '{\' member3\' } are required.' )
355355
356- a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('member3' , value = 'foo' ) # type: ignore[assignment]
356+ a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('member3' , value = 'foo' )
357357 del a .uuid
358358 with self .assertRaises (InvalidMISPObject ) as e :
359359 # Fail on requiredOneOf
360360 self .mispevent .to_json (sort_keys = True , indent = 2 )
361361 self .assertEqual (e .exception .message , 'At least one of the following attributes is required: member1, member2' )
362362
363- a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'bar' ) # type: ignore[assignment]
363+ a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'bar' )
364364 del a .uuid
365- a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'baz' ) # type: ignore[assignment]
365+ a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'baz' )
366366 del a .uuid
367367 with self .assertRaises (InvalidMISPObject ) as e :
368368 # member1 is not a multiple
@@ -384,16 +384,16 @@ def test_userdefined_object_custom_dir(self) -> None:
384384 self .mispevent .to_json (sort_keys = True , indent = 2 )
385385 self .assertEqual (e .exception .message , '{\' member3\' } are required.' )
386386
387- a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('member3' , value = 'foo' ) # type: ignore[assignment]
387+ a : MISPAttribute = self .mispevent .objects [0 ].add_attribute ('member3' , value = 'foo' )
388388 del a .uuid
389389 with self .assertRaises (InvalidMISPObject ) as e :
390390 # Fail on requiredOneOf
391391 self .mispevent .to_json (sort_keys = True , indent = 2 )
392392 self .assertEqual (e .exception .message , 'At least one of the following attributes is required: member1, member2' )
393393
394- a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'bar' ) # type: ignore[assignment]
394+ a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'bar' )
395395 del a .uuid
396- a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'baz' ) # type: ignore[assignment]
396+ a = self .mispevent .objects [0 ].add_attribute ('member1' , value = 'baz' )
397397 del a .uuid
398398 with self .assertRaises (InvalidMISPObject ) as e :
399399 # member1 is not a multiple
@@ -410,15 +410,15 @@ def test_userdefined_object_custom_dir(self) -> None:
410410 def test_first_last_seen (self ) -> None :
411411 me = MISPEvent ()
412412 me .info = 'Test First and Last Seen'
413- me .date = '2020.01.12' # type: ignore[assignment]
413+ me .date = '2020.01.12'
414414 self .assertEqual (me .date .day , 12 )
415415 me .add_attribute ('ip-dst' , '8.8.8.8' , first_seen = '06-21-1998' , last_seen = 1580213607.469571 )
416416 self .assertEqual (me .attributes [0 ].first_seen .year , 1998 )
417417 self .assertEqual (me .attributes [0 ].last_seen .year , 2020 )
418418 now = datetime .now ().astimezone ()
419419 me .attributes [0 ].last_seen = now
420420 today = date .today ()
421- me .attributes [0 ].first_seen = today # type: ignore[assignment]
421+ me .attributes [0 ].first_seen = today
422422 self .assertEqual (me .attributes [0 ].first_seen .year , today .year )
423423 self .assertEqual (me .attributes [0 ].last_seen , now )
424424
0 commit comments