@@ -52,7 +52,7 @@ def add_header(filepath, header, YEAR, AUTHORS):
52
52
output .append (inpt [0 ] + '\n ' )
53
53
inpt = inpt [1 :]
54
54
regex = re .compile (r'Copyright \(C\).*\n' )
55
- repl = r'Copyright (C) ' + YEAR + ' ' + AUTHORS + '\n '
55
+ repl = r'Copyright (C) ' + YEAR + ' ' + AUTHORS + '\n '
56
56
output .extend ([re .sub (regex , repl , x ) for x in inpt ])
57
57
else :
58
58
print (('Adding header in {}' .format (filepath )))
@@ -82,7 +82,7 @@ def prepare_header(stub, YEAR, AUTHORS):
82
82
with open (stub , 'r' ) as l :
83
83
header = l .read ()
84
84
# Insert correct YEAR and AUTHORS in stub
85
- rep = {'YEAR' : YEAR , 'AUTHORS' : AUTHORS }
85
+ rep = {'YEAR' : YEAR , 'AUTHORS' : AUTHORS }
86
86
rep = dict ((re .escape (k ), v ) for k , v in rep .items ())
87
87
pattern = re .compile ("|" .join (list (rep .keys ())))
88
88
header = pattern .sub (lambda m : rep [re .escape (m .group (0 ))], header )
@@ -105,24 +105,25 @@ def file_license(attributes):
105
105
# Remove licensefile= from strings
106
106
lic = [re .sub (r'licensefile\=' , '' , x ) for x in gitattributes if 'licensefile' in x ]
107
107
# Create list of blacklisted files
108
- blacklist = [fname for key , value in list (dict (list (zip (fil , lic ))).items ())
109
- if value == '!licensefile'
110
- for fname in glob .glob (key )]
108
+ blacklist = [
109
+ fname for key , value in list (dict (list (zip (fil , lic ))).items ())
110
+ if value == '!licensefile' for fname in glob .glob (key )
111
+ ]
111
112
# Now create a dictionary with the files to be considered for
112
113
# license header manipulation
113
- file_license = {key : value
114
- for k , value in list ( dict ( list ( zip ( fil , lic ))). items ())
115
- for key in glob .glob (k )
116
- if key not in blacklist }
114
+ file_license = {
115
+ key : value
116
+ for k , value in list ( dict ( list ( zip ( fil , lic ))). items ()) for key in glob .glob (k ) if key not in blacklist
117
+ }
117
118
return file_license
118
119
119
120
120
121
def license_maintainer ():
121
122
"""
122
123
Maintain license header in source files
123
124
"""
124
- YEAR = str (date .today ().year )
125
- AUTHORS = 'Roberto Di Remigio, Luca Frediani and collaborators .'
125
+ YEAR = str (date .today ().year )
126
+ AUTHORS = 'Roberto Di Remigio, Luca Frediani and contributors .'
126
127
127
128
script_dir = os .path .dirname (os .path .abspath (__file__ ))
128
129
project_root_dir = os .path .abspath (os .path .join (script_dir , os .pardir ))
0 commit comments