File tree Expand file tree Collapse file tree 2 files changed +48
-14
lines changed
Expand file tree Collapse file tree 2 files changed +48
-14
lines changed Original file line number Diff line number Diff line change 1+ from os import *
2+ import sys
3+
4+ files = []
5+ dirs = [sys .argv [1 ]]
6+ def listAll (mypath ):
7+ for (dirpath , dirnames , filenames ) in walk (mypath ):
8+ files .extend ([mypath + f for f in filenames if not f .startswith ('.' )])
9+ dirs .extend ([mypath + '/' + f for f in dirnames ])
10+ break
11+
12+ for a in dirs :
13+ listAll (a )
14+
15+ print len (files )
Original file line number Diff line number Diff line change 11import sys
2+ from os import walk
23from spellCheck import *
34
4- val = ''
5- lineNo = 0
6- print ("\n \n =============================================================\n " )
7- print (sys .argv [1 ])
8- print ("\n --------------------------------------------------------------\n " )
9- for line in open (sys .argv [1 ], 'r' ):
10- lineNo += 1
11- lines = re .findall ('[a-z]+' , line .lower ())
12- for word in lines :
13- a = correct (word .lower ())
14- if a != word .lower ():
15- val = 'Line: ' + str (lineNo ) + ' => ' + word + ' != ' + a + '\n '
16- print val
17- print ("\n \n --------------------------------------------------------------\n \n " )
5+ def printDetails (filePath ):
6+ print filePath
7+ val = ''
8+ lineNo = 0
9+ val = "\n \n =============================================================\n "
10+ val += filePath
11+ val += "\n --------------------------------------------------------------\n "
12+ for line in open (filePath , 'r' ):
13+ lineNo += 1
14+ lines = re .findall ('[a-z]+' , line .lower ())
15+ for word in lines :
16+ a = correct (word .lower ())
17+ if a != word .lower ():
18+ wordChange = 'Line: ' + str (lineNo )+ ' => ' + word + ' != ' + a + '\n '
19+ val += wordChange
20+ print wordChange
21+ val += "\n \n ----------------------------------------------------------\n \n "
22+ file_op = open (filePath + ".gds.txt" , "w" )
23+ file_op .write (val )
24+ file_op .close ()
25+
26+ files = []
27+ dirs = [sys .argv [1 ]]
28+
29+ def listAll (path ):
30+ for (dirpath , dirnames , filenames ) in walk (path ):
31+ files .extend ([path + '/' + f for f in filenames if not f .startswith ('.' )])
32+ dirs .extend ([path + '/' + f for f in dirnames ])
33+ break
34+
35+ for a in dirs : listAll (a )
36+ for fl in files : printDetails (fl )
You can’t perform that action at this time.
0 commit comments