1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
# ----------------------------------------------------------------------
3
3
#
4
4
# Brad T. Aagaard, U.S. Geological Survey
@@ -90,7 +90,8 @@ def _verify_configuration(self):
90
90
"""Verify project configuration file exists."""
91
91
path_filename = os .path .join (self .config_dir , self ._config_filename ())
92
92
if not os .path .isfile (path_filename ):
93
- raise IOError ("Could not find configuration file '{}'." .format (path_filename ))
93
+ raise IOError (
94
+ "Could not find configuration file '{}'." .format (path_filename ))
94
95
self .config_filename = path_filename
95
96
return
96
97
@@ -119,7 +120,8 @@ def _prog_test(self):
119
120
def _prog_format (self , filename ):
120
121
suffix = "." + filename .split ("." )[- 1 ]
121
122
language = self .LANGUAGE [suffix ]
122
- options = ["-l" , language , "-c" , self .config_filename , "--no-backup" , filename ]
123
+ options = ["-l" , language , "-c" ,
124
+ self .config_filename , "--no-backup" , filename ]
123
125
return ["uncrustify" ] + options
124
126
125
127
@@ -133,7 +135,8 @@ def _prog_test(self):
133
135
return ["autopep8" , "--version" ]
134
136
135
137
def _prog_format (self , filename ):
136
- options = ["--global-config={}" .format (self .config_filename ), "--in-place" , filename ]
138
+ options = [
139
+ "--global-config={}" .format (self .config_filename ), "--in-place" , filename ]
137
140
return ["autopep8" ] + options
138
141
139
142
@@ -204,9 +207,10 @@ def _find_files(self, patterns):
204
207
:returns: Files matching pattern.
205
208
"""
206
209
files = []
207
- root , dirs , names = os .walk (os .getcwd ())
210
+ root , _ , names = os .walk (os .getcwd ())
208
211
for pattern in patterns :
209
- files += [os .path .join (root , filename ) for filename in fnmatch .filter (names , pattern )]
212
+ files += [os .path .join (root , filename )
213
+ for filename in fnmatch .filter (names , pattern )]
210
214
return files
211
215
212
216
def _parse_command_line (self ):
@@ -215,11 +219,16 @@ def _parse_command_line(self):
215
219
import argparse
216
220
217
221
parser = argparse .ArgumentParser ()
218
- parser .add_argument ("--cplusplus" , action = "store" , dest = "cplusplus" , default = None , help = "[None, 'all', FILE, PATTERN]" )
219
- parser .add_argument ("--python" , action = "store" , dest = "python" , default = None , help = "[None, 'all', FILE, PATTERN]" )
220
- parser .add_argument ("--config-dir" , action = "store" , dest = "config_dir" , default = "doc/developer" , help = "Directory containing config files for formatters." )
221
- parser .add_argument ("--quiet" , action = "store_false" , dest = "show_progress" , default = True )
222
- parser .add_argument ("--debug" , action = "store_true" , dest = "debug" , default = True )
222
+ parser .add_argument ("--cplusplus" , action = "store" , dest = "cplusplus" ,
223
+ default = None , help = "[None, 'all', FILE, PATTERN]" )
224
+ parser .add_argument ("--python" , action = "store" , dest = "python" ,
225
+ default = None , help = "[None, 'all', FILE, PATTERN]" )
226
+ parser .add_argument ("--config-dir" , action = "store" , dest = "config_dir" ,
227
+ default = "doc/developer" , help = "Directory containing config files for formatters." )
228
+ parser .add_argument ("--quiet" , action = "store_false" ,
229
+ dest = "show_progress" , default = True )
230
+ parser .add_argument ("--debug" , action = "store_true" ,
231
+ dest = "debug" , default = True )
223
232
return parser .parse_args ()
224
233
225
234
0 commit comments