summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
Diffstat (limited to 'gerber')
-rw-r--r--gerber/common.py2
-rwxr-xr-xgerber/excellon.py6
-rw-r--r--gerber/ipc356.py2
-rw-r--r--gerber/rs274x.py2
-rw-r--r--gerber/tests/test_common.py4
-rw-r--r--gerber/tests/test_excellon.py6
6 files changed, 11 insertions, 11 deletions
diff --git a/gerber/common.py b/gerber/common.py
index 50ba728..1659e3b 100644
--- a/gerber/common.py
+++ b/gerber/common.py
@@ -34,7 +34,7 @@ def read(filename):
CncFile object representing the file, either GerberFile or
ExcellonFile. Returns None if file is not an Excellon or Gerber file.
"""
- with open(filename, 'r') as f:
+ with open(filename, 'rU') as f:
data = f.read()
fmt = detect_file_format(data)
if fmt == 'rs274x':
diff --git a/gerber/excellon.py b/gerber/excellon.py
index 101c6ea..708f50b 100755
--- a/gerber/excellon.py
+++ b/gerber/excellon.py
@@ -51,7 +51,7 @@ def read(filename):
"""
# File object should use settings from source file by default.
- with open(filename, 'r') as f:
+ with open(filename, 'rU') as f:
data = f.read()
settings = FileSettings(**detect_excellon_format(data))
return ExcellonParser(settings).parse(filename)
@@ -326,7 +326,7 @@ class ExcellonParser(object):
return len(self.hits)
def parse(self, filename):
- with open(filename, 'r') as f:
+ with open(filename, 'rU') as f:
data = f.read()
return self.parse_raw(data, filename)
@@ -557,7 +557,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, 'r') as f:
+ with open(filename, 'rU') as f:
data = f.read()
# Check for obvious clues:
diff --git a/gerber/ipc356.py b/gerber/ipc356.py
index e4d8027..b8a7ba3 100644
--- a/gerber/ipc356.py
+++ b/gerber/ipc356.py
@@ -144,7 +144,7 @@ class IPC_D_356_Parser(object):
return FileSettings(units=self.units, angle_units=self.angle_units)
def parse(self, filename):
- with open(filename, 'r') as f:
+ with open(filename, 'rU') as f:
oldline = ''
for line in f:
# Check for existing multiline data...
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 72d7e95..9fd63da 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -213,7 +213,7 @@ class GerberParser(object):
self.step_and_repeat = (1, 1, 0, 0)
def parse(self, filename):
- with open(filename, "r") as fp:
+ with open(filename, "rU") as fp:
data = fp.read()
return self.parse_raw(data, filename=None)
diff --git a/gerber/tests/test_common.py b/gerber/tests/test_common.py
index 0ba4b68..7c66c0f 100644
--- a/gerber/tests/test_common.py
+++ b/gerber/tests/test_common.py
@@ -25,9 +25,9 @@ def test_file_type_detection():
def test_load_from_string():
- with open(NCDRILL_FILE, 'r') as f:
+ with open(NCDRILL_FILE, 'rU') as f:
ncdrill = loads(f.read())
- with open(TOP_COPPER_FILE, 'r') as f:
+ with open(TOP_COPPER_FILE, 'rU') as f:
top_copper = loads(f.read())
assert_true(isinstance(ncdrill, ExcellonFile))
assert_true(isinstance(top_copper, GerberFile))
diff --git a/gerber/tests/test_excellon.py b/gerber/tests/test_excellon.py
index b821649..705adc3 100644
--- a/gerber/tests/test_excellon.py
+++ b/gerber/tests/test_excellon.py
@@ -16,7 +16,7 @@ NCDRILL_FILE = os.path.join(os.path.dirname(__file__),
def test_format_detection():
""" Test file type detection
"""
- with open(NCDRILL_FILE) as f:
+ with open(NCDRILL_FILE, "rU") as f:
data = f.read()
settings = detect_excellon_format(data)
assert_equal(settings['format'], (2, 4))
@@ -35,9 +35,9 @@ def test_read():
def test_write():
ncdrill = read(NCDRILL_FILE)
ncdrill.write('test.ncd')
- with open(NCDRILL_FILE) as src:
+ with open(NCDRILL_FILE, "rU") as src:
srclines = src.readlines()
- with open('test.ncd') as res:
+ with open('test.ncd', "rU") as res:
for idx, line in enumerate(res):
assert_equal(line.strip(), srclines[idx].strip())
os.remove('test.ncd')