20
20
import itertools
21
21
import numbers
22
22
23
- import six
24
-
25
23
# Load pdffit2 and output modules to the current namespace.
26
24
# Note that "import diffpy.pdffit2.output as output" would
27
25
# crash with AttributeError when executed during imports of
@@ -213,7 +211,7 @@ def read_data(self, data, stype, qmax, qdamp):
213
211
214
212
Raises: IOError when the file cannot be read from disk
215
213
"""
216
- pdffit2 .read_data (self ._handle , data , six . b ( stype ), qmax , qdamp )
214
+ pdffit2 .read_data (self ._handle , data , stype . encode ( ), qmax , qdamp )
217
215
self .data_files .append (data )
218
216
return
219
217
@@ -228,7 +226,7 @@ def read_data_string(self, data, stype, qmax, qdamp, name=""):
228
226
qdamp -- instrumental Q-resolution factor
229
227
name -- tag with which to label data
230
228
"""
231
- pdffit2 .read_data_string (self ._handle , data , six . b ( stype ), qmax , qdamp , name )
229
+ pdffit2 .read_data_string (self ._handle , data , stype . encode ( ), qmax , qdamp , name )
232
230
name = data
233
231
self .data_files .append (name )
234
232
return
@@ -249,7 +247,7 @@ def read_data_lists(self, stype, qmax, qdamp, r_data, Gr_data, dGr_data=None, na
249
247
250
248
Raises: ValueError when the data lists are of different length
251
249
"""
252
- pdffit2 .read_data_arrays (self ._handle , six . b ( stype ), qmax , qdamp , r_data , Gr_data , dGr_data , name )
250
+ pdffit2 .read_data_arrays (self ._handle , stype . encode ( ), qmax , qdamp , r_data , Gr_data , dGr_data , name )
253
251
self .data_files .append (name )
254
252
return
255
253
@@ -290,7 +288,7 @@ def alloc(self, stype, qmax, qdamp, rmin, rmax, bin):
290
288
ValueError for bad input values
291
289
pdffit.unassignedError when no structure has been loaded
292
290
"""
293
- pdffit2 .alloc (self ._handle , six . b ( stype ), qmax , qdamp , rmin , rmax , bin )
291
+ pdffit2 .alloc (self ._handle , stype . encode ( ), qmax , qdamp , rmin , rmax , bin )
294
292
return
295
293
296
294
def calc (self ):
@@ -495,7 +493,7 @@ def constrain(self, var, par, fcon=None):
495
493
if fcon :
496
494
fc = self .FCON [fcon ]
497
495
pdffit2 .constrain_int (self ._handle , var_ref , varnc , par , fc )
498
- elif isinstance (par , six . string_types ):
496
+ elif isinstance (par , str ):
499
497
pdffit2 .constrain_str (self ._handle , var_ref , varnc , par )
500
498
else :
501
499
pdffit2 .constrain_int (self ._handle , var_ref , varnc , par )
@@ -674,7 +672,7 @@ def fixpar(self, par):
674
672
675
673
Raises: pdffit.unassignedError when parameter has not been assigned
676
674
"""
677
- if isinstance (par , six . string_types ) and par .upper () in self .selalias :
675
+ if isinstance (par , str ) and par .upper () in self .selalias :
678
676
par = self .selalias [par .upper ()]
679
677
pdffit2 .fixpar (self ._handle , par )
680
678
return
@@ -687,7 +685,7 @@ def freepar(self, par):
687
685
688
686
Raises: pdffit.unassignedError when parameter has not been assigned
689
687
"""
690
- if isinstance (par , six . string_types ) and par .upper () in self .selalias :
688
+ if isinstance (par , str ) and par .upper () in self .selalias :
691
689
par = self .selalias [par .upper ()]
692
690
pdffit2 .freepar (self ._handle , par )
693
691
return
@@ -722,7 +720,7 @@ def psel(self, ip):
722
720
723
721
Raises: pdffit2.unassignedError if selected phase does not exist
724
722
"""
725
- if isinstance (ip , six . string_types ) and ip .upper () in self .selalias :
723
+ if isinstance (ip , str ) and ip .upper () in self .selalias :
726
724
ip = self .selalias [ip .upper ()]
727
725
pdffit2 .psel (self ._handle , ip )
728
726
return
@@ -734,7 +732,7 @@ def pdesel(self, ip):
734
732
735
733
Raises: pdffit2.unassignedError if selected phase does not exist
736
734
"""
737
- if isinstance (ip , six . string_types ) and ip .upper () in self .selalias :
735
+ if isinstance (ip , str ) and ip .upper () in self .selalias :
738
736
ip = self .selalias [ip .upper ()]
739
737
pdffit2 .pdesel (self ._handle , ip )
740
738
return
@@ -753,7 +751,7 @@ def selectAtomType(self, ip, ijchar, symbol, flag):
753
751
pdffit2.unassignedError if selected phase does not exist
754
752
ValueError for invalid value of ijchar
755
753
"""
756
- pdffit2 .selectAtomType (self ._handle , ip , six . b ( ijchar ), symbol , flag )
754
+ pdffit2 .selectAtomType (self ._handle , ip , ijchar . encode ( ), symbol , flag )
757
755
return
758
756
759
757
def selectAtomIndex (self , ip , ijchar , aidx , flag ):
@@ -770,7 +768,7 @@ def selectAtomIndex(self, ip, ijchar, aidx, flag):
770
768
pdffit2.unassignedError if selected phase does not exist
771
769
ValueError if atom index or ijchar are invalid
772
770
"""
773
- pdffit2 .selectAtomIndex (self ._handle , ip , six . b ( ijchar ), aidx , flag )
771
+ pdffit2 .selectAtomIndex (self ._handle , ip , ijchar . encode ( ), aidx , flag )
774
772
return
775
773
776
774
def selectAll (self , ip , ijchar ):
@@ -784,7 +782,7 @@ def selectAll(self, ip, ijchar):
784
782
pdffit2.unassignedError if selected phase does not exist
785
783
ValueError if ijchar is invalid
786
784
"""
787
- pdffit2 .selectAll (self ._handle , ip , six . b ( ijchar ))
785
+ pdffit2 .selectAll (self ._handle , ip , ijchar . encode ( ))
788
786
return
789
787
790
788
def selectNone (self , ip , ijchar ):
@@ -798,7 +796,7 @@ def selectNone(self, ip, ijchar):
798
796
pdffit2.unassignedError if selected phase does not exist
799
797
ValueError if ijchar is invalid
800
798
"""
801
- pdffit2 .selectNone (self ._handle , ip , six . b ( ijchar ))
799
+ pdffit2 .selectNone (self ._handle , ip , ijchar . encode ( ))
802
800
return
803
801
804
802
def bang (self , i , j , k ):
@@ -963,7 +961,7 @@ def get_scat_string(self, stype):
963
961
964
962
Returns: string with all scattering factors.
965
963
"""
966
- return pdffit2 .get_scat_string (self ._handle , six . b ( stype ))
964
+ return pdffit2 .get_scat_string (self ._handle , stype . encode ( ))
967
965
968
966
def get_scat (self , stype , element ):
969
967
"""get_scat(stype, element) --> Get active scattering factor for
@@ -979,7 +977,7 @@ def get_scat(self, stype, element):
979
977
Raises:
980
978
ValueError if element is not known.
981
979
"""
982
- rv = pdffit2 .get_scat (self ._handle , six . b ( stype ), element )
980
+ rv = pdffit2 .get_scat (self ._handle , stype . encode ( ), element )
983
981
return rv
984
982
985
983
def set_scat (self , stype , element , value ):
@@ -999,7 +997,7 @@ def set_scat(self, stype, element, value):
999
997
1000
998
See also reset_scat, get_scat.
1001
999
"""
1002
- pdffit2 .set_scat (self ._handle , six . b ( stype ), element , value )
1000
+ pdffit2 .set_scat (self ._handle , stype . encode ( ), element , value )
1003
1001
return
1004
1002
1005
1003
def reset_scat (self , element ):
@@ -1074,7 +1072,7 @@ def lat(n):
1074
1072
6 <==> 'gamma'
1075
1073
"""
1076
1074
LatParams = {"a" : 1 , "b" : 2 , "c" : 3 , "alpha" : 4 , "beta" : 5 , "gamma" : 6 }
1077
- if isinstance (n , six . string_types ):
1075
+ if isinstance (n , str ):
1078
1076
n = LatParams [n ]
1079
1077
return "lat(%i)" % n
1080
1078
0 commit comments