Skip to content

Commit bd4c27f

Browse files
committed
remove url parsing through _quoteLocalPath
1 parent aa6db8b commit bd4c27f

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/diffpy/structure/parsers/p_cif.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ def parseFile(self, filename):
281281
"""
282282
self.ciffile = None
283283
self.filename = filename
284-
fileurl = _quoteLocalPath(filename)
285-
rv = self._parseCifDataSource(fileurl)
284+
rv = self._parseCifDataSource(filename)
286285
# all good here
287286
return rv
288287

@@ -731,8 +730,6 @@ def _quoteLocalPath(filename):
731730
if cnvflag:
732731
from six.moves.urllib.request import pathname2url
733732
rv = pathname2url(filename)
734-
if rv.startswith("///"):
735-
rv = "file:" + rv
736733
return rv
737734

738735

src/diffpy/structure/tests/testp_cif.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def test__quoteLocalPath(self):
6666
"check _quoteLocalPath()"
6767
from six.moves.urllib.request import pathname2url as p2u
6868
self.assertEqual('/a/b/c.cif', _quoteLocalPath('/a/b/c.cif'))
69-
self.assertEqual('file:' + p2u('c:\\a.cif'), _quoteLocalPath('c:\\a.cif'))
70-
self.assertEqual('file:' + p2u('c:/a.cif'), _quoteLocalPath('c:/a.cif'))
69+
self.assertEqual(p2u('c:\\a.cif'), _quoteLocalPath('c:\\a.cif'))
70+
self.assertEqual(p2u('c:/a.cif'), _quoteLocalPath('c:/a.cif'))
7171
self.assertEqual('/x:y/c.cif', _quoteLocalPath('/x:y/c.cif'))
7272
self.assertEqual('http::cif.org/a.cif',
7373
_quoteLocalPath('http::cif.org/a.cif'))

0 commit comments

Comments
 (0)