Skip to content

Commit

Permalink
fix for python3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
metacollin committed Aug 14, 2024
1 parent 364bfec commit da3e189
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gerber/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def read(filename):
CncFile object representing the file, either GerberFile, ExcellonFile,
or IPCNetlist. Returns None if file is not of the proper type.
"""
with open(filename, 'rU') as f:
with open(filename, 'r', newline=None) as f:
data = f.read()
return loads(data, filename)

Expand Down
6 changes: 3 additions & 3 deletions gerber/excellon.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def read(filename):
"""
# File object should use settings from source file by default.
with open(filename, 'rU') as f:
with open(filename, 'r', newline=None) as f:
data = f.read()
settings = FileSettings(**detect_excellon_format(data))
return ExcellonParser(settings).parse(filename)
Expand Down Expand Up @@ -426,7 +426,7 @@ def hole_count(self):
return len(self.hits)

def parse(self, filename):
with open(filename, 'rU') as f:
with open(filename, 'r', newline=None) as f:
data = f.read()
return self.parse_raw(data, filename)

Expand Down Expand Up @@ -819,7 +819,7 @@ def detect_excellon_format(data=None, filename=None):
if data is None and filename is None:
raise ValueError('Either data or filename arguments must be provided')
if data is None:
with open(filename, 'rU') as f:
with open(filename, 'r', newline=None) as f:
data = f.read()

# Check for obvious clues:
Expand Down
2 changes: 1 addition & 1 deletion gerber/ipc356.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def settings(self):
return FileSettings(units=self.units, angle_units=self.angle_units)

def parse(self, filename):
with open(filename, 'rU') as f:
with open(filename, 'r', newline=None) as f:
data = f.read()
return self.parse_raw(data, filename)

Expand Down

0 comments on commit da3e189

Please sign in to comment.