@@ -425,20 +425,13 @@ def dump(self, licenses_data_dir):
425
425
- the license data as YAML frontmatter
426
426
- the license text
427
427
"""
428
-
429
- def write (location , byte_string ):
430
- # we write as binary because rules and licenses texts and data are
431
- # UTF-8-encoded bytes
432
- with io .open (location , 'wb' ) as of :
433
- of .write (byte_string )
434
-
435
428
metadata = self .to_dict ()
436
- content = self .text . encode ( 'utf-8' )
429
+ content = self .text
437
430
rule_post = FrontmatterPost (content = content , handler = SaneYAMLHandler (), ** metadata )
438
- output_string = dumps_frontmatter (post = rule_post )
439
-
431
+ output = dumps_frontmatter (post = rule_post )
440
432
license_file = self .license_file (licenses_data_dir = licenses_data_dir )
441
- write (license_file , output_string .encode ('utf-8' ))
433
+ with open (license_file , 'w' ) as of :
434
+ of .write (output )
442
435
443
436
def load (self , license_file , check_consistency = True ):
444
437
"""
@@ -2078,19 +2071,14 @@ def dump(self, rules_data_dir):
2078
2071
if self .is_from_license or self .is_synthetic :
2079
2072
return
2080
2073
2081
- def write (location , byte_string ):
2082
- # we write as binary because rules and licenses texts and data are
2083
- # UTF-8-encoded bytes
2084
- with io .open (location , 'wb' ) as of :
2085
- of .write (byte_string )
2086
-
2087
2074
rule_file = self .rule_file (rules_data_dir = rules_data_dir )
2088
2075
2089
2076
metadata = self .to_dict ()
2090
- content = self .text . encode ( 'utf-8' )
2077
+ content = self .text
2091
2078
rule_post = FrontmatterPost (content = content , handler = SaneYAMLHandler (), ** metadata )
2092
- output_string = dumps_frontmatter (post = rule_post )
2093
- write (rule_file , output_string .encode ('utf-8' ))
2079
+ output = dumps_frontmatter (post = rule_post )
2080
+ with open (rule_file , 'w' ) as of :
2081
+ of .write (output )
2094
2082
2095
2083
def load (self , rule_file , with_checks = True ):
2096
2084
"""
0 commit comments