@@ -73,12 +73,7 @@ class DataClassification:
73
73
https://cyclonedx.org/docs/1.4/xml/#type_dataClassificationType
74
74
"""
75
75
76
- def __init__ (self , flow : DataFlow , classification : str ) -> None :
77
- if not flow and not classification :
78
- raise NoPropertiesProvidedException (
79
- 'One of `flow` or `classification` must be supplied - neither supplied'
80
- )
81
-
76
+ def __init__ (self , * , flow : DataFlow , classification : str ) -> None :
82
77
self .flow = flow
83
78
self .classification = classification
84
79
@@ -151,7 +146,7 @@ class AttachedText:
151
146
152
147
DEFAULT_CONTENT_TYPE = 'text/plain'
153
148
154
- def __init__ (self , content : str , content_type : str = DEFAULT_CONTENT_TYPE ,
149
+ def __init__ (self , * , content : str , content_type : str = DEFAULT_CONTENT_TYPE ,
155
150
encoding : Optional [Encoding ] = None ) -> None :
156
151
self .content_type = content_type
157
152
self .encoding = encoding
@@ -282,7 +277,7 @@ def from_composite_str(composite_hash: str) -> 'HashType':
282
277
283
278
raise UnknownHashTypeException (f"Unable to determine hash type from '{ composite_hash } '" )
284
279
285
- def __init__ (self , algorithm : HashAlgorithm , hash_value : str ) -> None :
280
+ def __init__ (self , * , algorithm : HashAlgorithm , hash_value : str ) -> None :
286
281
self ._alg = algorithm
287
282
self ._content = hash_value
288
283
@@ -329,17 +324,6 @@ class ExternalReferenceType(Enum):
329
324
VCS = 'vcs'
330
325
WEBSITE = 'website'
331
326
332
- # def __eq__(self, other: object) -> bool:
333
- # if isinstance(other, ExternalReferenceType):
334
- # return hash(other) == hash(self)
335
- # return False
336
- #
337
- # def __hash__(self) -> int:
338
- # return hash(self.value)
339
- #
340
- # def __repr__(self) -> str:
341
- # return f'<ExternalReferenceType name={self.name}, value={self.value}>'
342
-
343
327
344
328
class XsUri :
345
329
"""
@@ -382,7 +366,7 @@ class ExternalReference:
382
366
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_externalReference
383
367
"""
384
368
385
- def __init__ (self , reference_type : ExternalReferenceType , url : Union [str , XsUri ], comment : str = '' ,
369
+ def __init__ (self , * , reference_type : ExternalReferenceType , url : Union [str , XsUri ], comment : str = '' ,
386
370
hashes : Optional [List [HashType ]] = None ) -> None :
387
371
self ._type : ExternalReferenceType = reference_type
388
372
self ._url = str (url )
@@ -459,7 +443,7 @@ class License:
459
443
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_licenseType
460
444
"""
461
445
462
- def __init__ (self , spxd_license_id : Optional [str ] = None , license_name : Optional [str ] = None ,
446
+ def __init__ (self , * , spxd_license_id : Optional [str ] = None , license_name : Optional [str ] = None ,
463
447
license_text : Optional [AttachedText ] = None , license_url : Optional [XsUri ] = None ) -> None :
464
448
if not spxd_license_id and not license_name :
465
449
raise MutuallyExclusivePropertiesException ('Either `spxd_license_id` or `license_name` MUST be supplied' )
@@ -554,7 +538,7 @@ class LicenseChoice:
554
538
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_licenseChoiceType
555
539
"""
556
540
557
- def __init__ (self , license : Optional [License ] = None , license_expression : Optional [str ] = None ) -> None :
541
+ def __init__ (self , * , license : Optional [License ] = None , license_expression : Optional [str ] = None ) -> None :
558
542
if not license and not license_expression :
559
543
raise NoPropertiesProvidedException (
560
544
'One of `license` or `license_expression` must be supplied - neither supplied'
@@ -623,7 +607,7 @@ class Property:
623
607
Specifies an individual property with a name and value.
624
608
"""
625
609
626
- def __init__ (self , name : str , value : str ) -> None :
610
+ def __init__ (self , * , name : str , value : str ) -> None :
627
611
self ._name = name
628
612
self ._value = value
629
613
@@ -668,7 +652,7 @@ class NoteText:
668
652
669
653
DEFAULT_CONTENT_TYPE : str = 'text/plain'
670
654
671
- def __init__ (self , content : str , content_type : Optional [str ] = None ,
655
+ def __init__ (self , * , content : str , content_type : Optional [str ] = None ,
672
656
content_encoding : Optional [Encoding ] = None ) -> None :
673
657
self .content = content
674
658
self .content_type = content_type or NoteText .DEFAULT_CONTENT_TYPE
@@ -741,7 +725,7 @@ class Note:
741
725
742
726
_LOCALE_TYPE_REGEX = re .compile (r'^[a-z]{2}(?:\-[A-Z]{2})?$' )
743
727
744
- def __init__ (self , text : NoteText , locale : Optional [str ] = None ) -> None :
728
+ def __init__ (self , * , text : NoteText , locale : Optional [str ] = None ) -> None :
745
729
self .text = text
746
730
self .locale = locale
747
731
@@ -806,7 +790,7 @@ class OrganizationalContact:
806
790
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_organizationalContact
807
791
"""
808
792
809
- def __init__ (self , name : Optional [str ] = None , phone : Optional [str ] = None , email : Optional [str ] = None ) -> None :
793
+ def __init__ (self , * , name : Optional [str ] = None , phone : Optional [str ] = None , email : Optional [str ] = None ) -> None :
810
794
if not name and not phone and not email :
811
795
raise NoPropertiesProvidedException (
812
796
'One of name, email or phone must be supplied for an OrganizationalContact - none supplied.'
@@ -866,7 +850,7 @@ class OrganizationalEntity:
866
850
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_organizationalEntity
867
851
"""
868
852
869
- def __init__ (self , name : Optional [str ] = None , urls : Optional [List [XsUri ]] = None ,
853
+ def __init__ (self , * , name : Optional [str ] = None , urls : Optional [List [XsUri ]] = None ,
870
854
contacts : Optional [List [OrganizationalContact ]] = None ) -> None :
871
855
if not name and not urls and not contacts :
872
856
raise NoPropertiesProvidedException (
@@ -932,7 +916,7 @@ class Tool:
932
916
See the CycloneDX Schema for toolType: https://cyclonedx.org/docs/1.3/#type_toolType
933
917
"""
934
918
935
- def __init__ (self , vendor : Optional [str ] = None , name : Optional [str ] = None , version : Optional [str ] = None ,
919
+ def __init__ (self , * , vendor : Optional [str ] = None , name : Optional [str ] = None , version : Optional [str ] = None ,
936
920
hashes : Optional [List [HashType ]] = None ,
937
921
external_references : Optional [List [ExternalReference ]] = None ) -> None :
938
922
self ._vendor = vendor
@@ -1037,7 +1021,7 @@ class IdentifiableAction:
1037
1021
See the CycloneDX specification: https://cyclonedx.org/docs/1.4/xml/#type_identifiableActionType
1038
1022
"""
1039
1023
1040
- def __init__ (self , timestamp : Optional [datetime ] = None , name : Optional [str ] = None ,
1024
+ def __init__ (self , * , timestamp : Optional [datetime ] = None , name : Optional [str ] = None ,
1041
1025
email : Optional [str ] = None ) -> None :
1042
1026
if not timestamp and not name and not email :
1043
1027
raise NoPropertiesProvidedException (
@@ -1110,7 +1094,7 @@ class Copyright:
1110
1094
See the CycloneDX specification: https://cyclonedx.org/docs/1.4/xml/#type_copyrightsType
1111
1095
"""
1112
1096
1113
- def __init__ (self , text : str ) -> None :
1097
+ def __init__ (self , * , text : str ) -> None :
1114
1098
self .text = text
1115
1099
1116
1100
@property
0 commit comments