Skip to content

Commit fcb6bec

Browse files
committed
fpga: fixed a new pylint complain about unspecified-encoding
1 parent 2d1f063 commit fcb6bec

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

fpga/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def set_top(self, toplevel):
237237
toplevel = os.path.join(self._absdir, toplevel)
238238
toplevel = os.path.normpath(toplevel)
239239
if os.path.exists(toplevel):
240-
with open(toplevel, 'r') as file:
240+
with open(toplevel, 'r', encoding='utf-8') as file:
241241
hdl = file.read()
242242
# Removing comments, newlines and carriage-returns
243243
hdl = re.sub(r'--.*[$\n]|\/\/.*[$\n]', '', hdl)

fpga/tool/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def _configure(self):
112112
filename = '.pyfpga.yml'
113113
self.configs = {}
114114
if os.path.exists(filename):
115-
with open(filename, 'r') as file:
115+
with open(filename, 'r', encoding='utf-8') as file:
116116
data = safe_load(file)
117117
if self._TOOL in data:
118118
self.configs = data[self._TOOL]
@@ -184,7 +184,7 @@ def _create_gen_script(self, tasks):
184184
params.append(f'{{ {param[0]} {param[1]} }}')
185185
# Script creation
186186
template = os.path.join(os.path.dirname(__file__), 'template.tcl')
187-
with open(template, 'r') as file:
187+
with open(template, 'r', encoding='utf-8') as file:
188188
tcl = file.read()
189189
tcl = tcl.replace('#TOOL#', self._TOOL)
190190
tcl = tcl.replace('#PRESYNTH#', "True" if self.presynth else "False")
@@ -204,7 +204,7 @@ def _create_gen_script(self, tasks):
204204
tcl = tcl.replace('#POSTSYN_CMDS#', '\n'.join(self.cmds['postsyn']))
205205
tcl = tcl.replace('#POSTIMP_CMDS#', '\n'.join(self.cmds['postimp']))
206206
tcl = tcl.replace('#POSTBIT_CMDS#', '\n'.join(self.cmds['postbit']))
207-
with open(f'{self._TOOL}.tcl', 'w') as file:
207+
with open(f'{self._TOOL}.tcl', 'w', encoding='utf-8') as file:
208208
file.write(tcl)
209209

210210
def generate(self, to_task, from_task, capture):

fpga/tool/ise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def transfer(self, devtype, position, part, width, capture):
164164
temp = temp.replace('#POSITION#', str(position))
165165
temp = temp.replace('#NAME#', part)
166166
temp = temp.replace('#WIDTH#', str(width))
167-
with open('ise-prog.impact', 'w') as file:
167+
with open('ise-prog.impact', 'w', encoding='utf-8') as file:
168168
file.write(temp)
169169
return run(self._TRF_COMMAND, capture)
170170

fpga/tool/openflow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def _create_gen_script(self, tasks):
128128
params.append(f'chparam -set {param[0]} {param[1]} {self.top}')
129129
# Script creation
130130
template = os.path.join(os.path.dirname(__file__), 'template.sh')
131-
with open(template, 'r') as file:
131+
with open(template, 'r', encoding='utf-8') as file:
132132
text = file.read()
133133
text = text.format(
134134
backend=self.backend,
@@ -161,7 +161,7 @@ def _create_gen_script(self, tasks):
161161
tool_nextpnr_ecp5=self.tools['nextpnr-ecp5'],
162162
tool_ecppack=self.tools['ecppack']
163163
)
164-
with open(f'{self._TOOL}.sh', 'w') as file:
164+
with open(f'{self._TOOL}.sh', 'w', encoding='utf-8') as file:
165165
file.write(text)
166166

167167
def generate(self, to_task, from_task, capture):
@@ -173,7 +173,7 @@ def generate(self, to_task, from_task, capture):
173173
def transfer(self, devtype, position, part, width, capture):
174174
super().transfer(devtype, position, part, width, capture)
175175
template = os.path.join(os.path.dirname(__file__), 'openprog.sh')
176-
with open(template, 'r') as file:
176+
with open(template, 'r', encoding='utf-8') as file:
177177
text = file.read()
178178
text = text.format(
179179
family=self.part['family'],
@@ -185,7 +185,7 @@ def transfer(self, devtype, position, part, width, capture):
185185
tool_iceprog=self.tools['iceprog'],
186186
tool_openocd=self.tools['openocd']
187187
)
188-
with open('openprog.sh', 'w') as file:
188+
with open('openprog.sh', 'w', encoding='utf-8') as file:
189189
file.write(text)
190190
return run(self._TRF_COMMAND, capture)
191191

fpga/tool/vivado.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ def transfer(self, devtype, position, part, width, capture):
9292
temp = _TEMPLATES[devtype]
9393
if devtype != 'detect':
9494
temp = temp.replace('#BITSTREAM#', self.bitstream)
95-
with open('vivado-prog.tcl', 'w') as file:
95+
with open('vivado-prog.tcl', 'w', encoding='utf-8') as file:
9696
file.write(temp)
9797
return run(self._TRF_COMMAND, capture)

0 commit comments

Comments
 (0)