Skip to content

Commit 1ad9b43

Browse files
committed
remove _quoteLocalPath fn and tests
1 parent 6002987 commit 1ad9b43

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

src/diffpy/structure/parsers/p_cif.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -704,35 +704,6 @@ def getSymOp(s):
704704
rv = SymOp(R, t)
705705
return rv
706706

707-
708-
def _quoteLocalPath(filename):
709-
"""Quote local paths to file URL-s.
710-
711-
CifFile reads files with urlopen, which fails for Windows paths or
712-
for paths containing ":".
713-
714-
Parameters
715-
----------
716-
filename : str
717-
The path to be corrected.
718-
719-
Returns
720-
-------
721-
str
722-
The fixed URL when it contains ":" or `filename`.
723-
Return filename if it forms http or ftp URL.
724-
"""
725-
rv = filename
726-
cnvflag = False
727-
if ':' in filename:
728-
head = filename.split(':', 1)[0].lower()
729-
cnvflag = head.isalpha() and head not in ('http', 'https', 'ftp')
730-
if cnvflag:
731-
from six.moves.urllib.request import pathname2url
732-
rv = pathname2url(filename)
733-
return rv
734-
735-
736707
def getParser(eps=None):
737708
"""Return new parser object for CIF structure format.
738709

src/diffpy/structure/tests/testp_cif.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
from diffpy.structure.tests.testutils import datafile
2424
from diffpy.structure.parsers.p_cif import P_cif, leading_float, getSymOp
25-
from diffpy.structure.parsers.p_cif import _quoteLocalPath
2625
from diffpy.structure.parsers import getParser
2726
from diffpy.structure import Structure
2827
from diffpy.structure import StructureFormatError
@@ -61,18 +60,6 @@ def test_getSymOp(self):
6160
self.assertEqual(str(op1_std), str(op1))
6261
return
6362

64-
65-
def test__quoteLocalPath(self):
66-
"check _quoteLocalPath()"
67-
from six.moves.urllib.request import pathname2url as p2u
68-
self.assertEqual('/a/b/c.cif', _quoteLocalPath('/a/b/c.cif'))
69-
self.assertEqual(p2u('c:\\a.cif'), _quoteLocalPath('c:\\a.cif'))
70-
self.assertEqual(p2u('c:/a.cif'), _quoteLocalPath('c:/a.cif'))
71-
self.assertEqual('/x:y/c.cif', _quoteLocalPath('/x:y/c.cif'))
72-
self.assertEqual('http::cif.org/a.cif',
73-
_quoteLocalPath('http::cif.org/a.cif'))
74-
return
75-
7663
# End of class TestRoutines
7764

7865
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)