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 8
8
9
9
### Changed
10
10
11
+ - Bumped minimum ` PyCifRW ` version to ` 4.4.3 ` .
12
+
11
13
### Deprecated
12
14
13
15
### Removed
14
16
15
17
### Fixed
16
18
19
+ - Handling of paths on Windows when using the ` P_cif ` parser.
17
20
18
21
## Version 3.0.1 – 2019-06-27
19
22
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def getversioncfg():
91
91
zip_safe = False ,
92
92
install_requires = [
93
93
'six' ,
94
- 'pycifrw>=4.2 ' ,
94
+ 'pycifrw>=4.4.3 ' ,
95
95
],
96
96
author = 'Simon J.L. Billinge group' ,
97
97
author_email = '[email protected] ' ,
Original file line number Diff line number Diff line change @@ -281,8 +281,7 @@ def parseFile(self, filename):
281
281
"""
282
282
self .ciffile = None
283
283
self .filename = filename
284
- fileurl = _quoteLocalPath (filename )
285
- rv = self ._parseCifDataSource (fileurl )
284
+ rv = self ._parseCifDataSource (filename )
286
285
# all good here
287
286
return rv
288
287
@@ -705,35 +704,6 @@ def getSymOp(s):
705
704
rv = SymOp (R , t )
706
705
return rv
707
706
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
-
737
707
def getParser (eps = None ):
738
708
"""Return new parser object for CIF structure format.
739
709
Original file line number Diff line number Diff line change 22
22
23
23
from diffpy .structure .tests .testutils import datafile
24
24
from diffpy .structure .parsers .p_cif import P_cif , leading_float , getSymOp
25
- from diffpy .structure .parsers .p_cif import _quoteLocalPath
26
25
from diffpy .structure .parsers import getParser
27
26
from diffpy .structure import Structure
28
27
from diffpy .structure import StructureFormatError
@@ -61,18 +60,6 @@ def test_getSymOp(self):
61
60
self .assertEqual (str (op1_std ), str (op1 ))
62
61
return
63
62
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
-
76
63
# End of class TestRoutines
77
64
78
65
# ----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments