File tree Expand file tree Collapse file tree 4 files changed +5
-45
lines changed
Expand file tree Collapse file tree 4 files changed +5
-45
lines changed Original file line number Diff line number Diff line change 88
99### Changed
1010
11+ - Bumped minimum ` PyCifRW ` version to ` 4.4.3 ` .
12+
1113### Deprecated
1214
1315### Removed
1416
1517### Fixed
1618
19+ - Handling of paths on Windows when using the ` P_cif ` parser.
1720
1821## Version 3.0.1 – 2019-06-27
1922
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def getversioncfg():
9191 zip_safe = False ,
9292 install_requires = [
9393 'six' ,
94- 'pycifrw>=4.2 ' ,
94+ 'pycifrw>=4.4.3 ' ,
9595 ],
9696 author = 'Simon J.L. Billinge group' ,
9797 author_email = 'sb2896@columbia.edu' ,
Original file line number Diff line number Diff 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
@@ -705,35 +704,6 @@ def getSymOp(s):
705704 rv = SymOp (R , t )
706705 return rv
707706
708-
709- def _quoteLocalPath (filename ):
710- """Quote local paths to file URL-s.
711-
712- CifFile reads files with urlopen, which fails for Windows paths or
713- for paths containing ":".
714-
715- Parameters
716- ----------
717- filename : str
718- The path to be corrected.
719-
720- Returns
721- -------
722- str
723- The fixed URL when it contains ":" or `filename`.
724- Return filename if it forms http or ftp URL.
725- """
726- rv = filename
727- cnvflag = False
728- if ':' in filename :
729- head = filename .split (':' , 1 )[0 ].lower ()
730- cnvflag = head .isalpha () and head not in ('http' , 'https' , 'ftp' )
731- if cnvflag :
732- from six .moves .urllib .request import pathname2url
733- rv = pathname2url (filename )
734- return rv
735-
736-
737707def getParser (eps = None ):
738708 """Return new parser object for CIF structure format.
739709
Original file line number Diff line number Diff line change 2222
2323from diffpy .structure .tests .testutils import datafile
2424from diffpy .structure .parsers .p_cif import P_cif , leading_float , getSymOp
25- from diffpy .structure .parsers .p_cif import _quoteLocalPath
2625from diffpy .structure .parsers import getParser
2726from diffpy .structure import Structure
2827from 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# ----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments