Skip to content

Commit 42ce412

Browse files
nirmala-sharmanirmala.sharmasumanashrestha
authored
[Fix] If we give -o folderName/ as fourth argument then it is throwing error (#72)
* If we give -o folderName/ as fourth argument then it is throwing error * remove comment and ruff fixes --------- Co-authored-by: nirmala.sharma <[email protected]> Co-authored-by: sumanashrestha <[email protected]>
1 parent cda793a commit 42ce412

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

school_center.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def sort_key(c):
7575
school_long), float(c.get('lat')), float(c.get('long')))
7676
if school['scode'] == c['cscode']:
7777
continue
78-
if nearest_center == None or distance < nearest_distance:
78+
if nearest_center is None or distance < nearest_distance:
7979
nearest_center = c
8080
nearest_distance = distance
8181

@@ -99,13 +99,13 @@ def read_tsv(file_path: str) -> List[Dict[str, str]]:
9999
reader = csv.DictReader(file, delimiter='\t')
100100
for row in reader:
101101
data.append(dict(row))
102-
except FileNotFoundError as e:
102+
except FileNotFoundError:
103103
logger.error(f"File '{file_path}' not found.")
104104
sys.exit(1)
105-
except PermissionError as e:
105+
except PermissionError:
106106
logger.error(f"Permission denied while accessing file '{file_path}'.")
107107
sys.exit(1)
108-
except IOError as e:
108+
except IOError:
109109
logger.error(f"Error opening or reading file: {file_path}")
110110
sys.exit(1)
111111
except Exception as e:
@@ -131,13 +131,13 @@ def read_prefs(file_path: str) -> Dict[str, Dict[str, int]]:
131131
prefs[row['scode']][row['cscode']] = int(row['pref'])
132132
else:
133133
prefs[row['scode']] = {row['cscode']: int(row['pref'])}
134-
except FileNotFoundError as e:
134+
except FileNotFoundError:
135135
logger.error(f"File '{file_path}' not found.")
136136
sys.exit(1)
137-
except PermissionError as e:
137+
except PermissionError:
138138
logger.error(f"Permission denied while accessing file '{file_path}'.")
139139
sys.exit(1)
140-
except IOError as e:
140+
except IOError:
141141
logger.error(f"Error opening or reading file: {file_path}")
142142
sys.exit(1)
143143
except Exception as e:
@@ -206,8 +206,8 @@ def is_allocated(scode1: str, scode2: str) -> bool:
206206
help="Tab separated (TSV) file containing center details")
207207
parser.add_argument('prefs_tsv', default='prefs.tsv',
208208
help="Tab separated (TSV) file containing preference scores")
209-
parser.add_argument(
210-
'-o', '--output', default = DEFAULT_OUTPUT_FILENAME, help='Output file')
209+
parser.add_argument('-o', '--output', default = DEFAULT_OUTPUT_FILENAME,
210+
help='Output file')
211211
parser.add_argument('-s', '--seed', action='store', metavar='SEEDVALUE',
212212
default=None, type=float,
213213
help='Initialization seed for Random Number Generator')
@@ -237,7 +237,7 @@ def get_output_filename():
237237
if(basename):
238238
return basename
239239
else:
240-
return DEFAULT_OUTOUT_FILENAME
240+
return DEFAULT_OUTPUT_FILENAME
241241

242242

243243
output_dirname = get_output_dir()

0 commit comments

Comments
 (0)