Skip to content

Commit 52463ca

Browse files
author
GauravDS
committed
for swift code passing it is ready
1 parent 9676005 commit 52463ca

File tree

2 files changed

+48
-14
lines changed

2 files changed

+48
-14
lines changed

python/SpellFix/ListAll.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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)

python/SpellFix/fNr.py

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
import sys
2+
from os import walk
23
from 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)

0 commit comments

Comments
 (0)