Skip to content

Commit 7a256a5

Browse files
committed
Remove py2/3 support in ObjParser
1 parent 1451902 commit 7a256a5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

pywavefront/parser.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import gzip
3636
import logging
3737
import os
38-
import sys
3938

4039
from pywavefront.exceptions import PywavefrontException
4140

@@ -79,22 +78,15 @@ def create_line_generator(self):
7978
"""
8079

8180
if self.file_name.endswith(".gz"):
82-
if sys.version_info.major == 3:
83-
gz = gzip.open(self.file_name, mode='rt', encoding=self.encoding)
84-
else:
85-
gz = gzip.open(self.file_name, mode='rt')
81+
gz = gzip.open(self.file_name, mode='rt', encoding=self.encoding)
8682

8783
for line in gz.readlines():
8884
yield line
8985

9086
gz.close()
9187
else:
92-
if sys.version_info.major == 3:
93-
# Python 3 native `open` is much faster
94-
file = open(self.file_name, mode='r', encoding=self.encoding)
95-
else:
96-
# Python 2 needs the codecs package to deal with encoding
97-
file = codecs.open(self.file_name, mode='r', encoding=self.encoding)
88+
# Python 3 native `open` is much faster
89+
file = open(self.file_name, mode='r', encoding=self.encoding)
9890

9991
for line in file:
10092
yield line

0 commit comments

Comments
 (0)