File tree 2 files changed +21
-4
lines changed
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class Part(StrEnum):
36
36
APPLICATION = "a"
37
37
OPERATING_SYSTEM = "o"
38
38
HARDWARE_DEVICE = "h"
39
+ WILDCARD = "*" # wildcard for requesting "all" possible cpe parts
39
40
40
41
41
42
def is_uri_binding (cpe : str ) -> bool :
@@ -427,8 +428,8 @@ class CPEWellFormed:
427
428
"""
428
429
429
430
part : Part
430
- vendor : str
431
- product : str
431
+ vendor : Optional [ str ] = None
432
+ product : Optional [ str ] = None
432
433
version : Optional [str ] = None
433
434
update : Optional [str ] = None
434
435
edition : Optional [str ] = None
@@ -495,8 +496,8 @@ def __init__(
495
496
* ,
496
497
cpe_string : Optional [str ] = None ,
497
498
part : Part ,
498
- vendor : str ,
499
- product : str ,
499
+ vendor : Optional [ str ] = None ,
500
+ product : Optional [ str ] = None ,
500
501
version : Optional [str ] = None ,
501
502
update : Optional [str ] = None ,
502
503
edition : Optional [str ] = None ,
Original file line number Diff line number Diff line change @@ -456,6 +456,22 @@ def test_uri_unbind_examples(self):
456
456
self .assertIsNone (cpe .target_hw )
457
457
self .assertIsNone (cpe .other )
458
458
459
+ # example 7a
460
+ cpe = CPE .from_string ("cpe:2.3:*:Microsoft" )
461
+ self .assertFalse (cpe .is_uri_binding ())
462
+ self .assertTrue (cpe .is_formatted_string_binding ())
463
+ self .assertEqual (cpe .part , Part .WILDCARD )
464
+ self .assertEqual (cpe .vendor , "microsoft" )
465
+ self .assertIsNone (cpe .product )
466
+ self .assertIsNone (cpe .version )
467
+ self .assertIsNone (cpe .update )
468
+ self .assertIsNone (cpe .language )
469
+ self .assertIsNone (cpe .edition )
470
+ self .assertIsNone (cpe .sw_edition )
471
+ self .assertIsNone (cpe .target_sw )
472
+ self .assertIsNone (cpe .target_hw )
473
+ self .assertIsNone (cpe .other )
474
+
459
475
# example 8
460
476
with self .assertRaisesRegex (
461
477
CPEParsingError ,
You can’t perform that action at this time.
0 commit comments