2020import itertools
2121import numbers
2222
23- import six
24-
2523# Load pdffit2 and output modules to the current namespace.
2624# Note that "import diffpy.pdffit2.output as output" would
2725# crash with AttributeError when executed during imports of
@@ -213,7 +211,7 @@ def read_data(self, data, stype, qmax, qdamp):
213211
214212 Raises: IOError when the file cannot be read from disk
215213 """
216- pdffit2 .read_data (self ._handle , data , six . b ( stype ), qmax , qdamp )
214+ pdffit2 .read_data (self ._handle , data , stype . encode ( ), qmax , qdamp )
217215 self .data_files .append (data )
218216 return
219217
@@ -228,7 +226,7 @@ def read_data_string(self, data, stype, qmax, qdamp, name=""):
228226 qdamp -- instrumental Q-resolution factor
229227 name -- tag with which to label data
230228 """
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 )
232230 name = data
233231 self .data_files .append (name )
234232 return
@@ -249,7 +247,7 @@ def read_data_lists(self, stype, qmax, qdamp, r_data, Gr_data, dGr_data=None, na
249247
250248 Raises: ValueError when the data lists are of different length
251249 """
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 )
253251 self .data_files .append (name )
254252 return
255253
@@ -290,7 +288,7 @@ def alloc(self, stype, qmax, qdamp, rmin, rmax, bin):
290288 ValueError for bad input values
291289 pdffit.unassignedError when no structure has been loaded
292290 """
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 )
294292 return
295293
296294 def calc (self ):
@@ -495,7 +493,7 @@ def constrain(self, var, par, fcon=None):
495493 if fcon :
496494 fc = self .FCON [fcon ]
497495 pdffit2 .constrain_int (self ._handle , var_ref , varnc , par , fc )
498- elif isinstance (par , six . string_types ):
496+ elif isinstance (par , str ):
499497 pdffit2 .constrain_str (self ._handle , var_ref , varnc , par )
500498 else :
501499 pdffit2 .constrain_int (self ._handle , var_ref , varnc , par )
@@ -674,7 +672,7 @@ def fixpar(self, par):
674672
675673 Raises: pdffit.unassignedError when parameter has not been assigned
676674 """
677- if isinstance (par , six . string_types ) and par .upper () in self .selalias :
675+ if isinstance (par , str ) and par .upper () in self .selalias :
678676 par = self .selalias [par .upper ()]
679677 pdffit2 .fixpar (self ._handle , par )
680678 return
@@ -687,7 +685,7 @@ def freepar(self, par):
687685
688686 Raises: pdffit.unassignedError when parameter has not been assigned
689687 """
690- if isinstance (par , six . string_types ) and par .upper () in self .selalias :
688+ if isinstance (par , str ) and par .upper () in self .selalias :
691689 par = self .selalias [par .upper ()]
692690 pdffit2 .freepar (self ._handle , par )
693691 return
@@ -722,7 +720,7 @@ def psel(self, ip):
722720
723721 Raises: pdffit2.unassignedError if selected phase does not exist
724722 """
725- if isinstance (ip , six . string_types ) and ip .upper () in self .selalias :
723+ if isinstance (ip , str ) and ip .upper () in self .selalias :
726724 ip = self .selalias [ip .upper ()]
727725 pdffit2 .psel (self ._handle , ip )
728726 return
@@ -734,7 +732,7 @@ def pdesel(self, ip):
734732
735733 Raises: pdffit2.unassignedError if selected phase does not exist
736734 """
737- if isinstance (ip , six . string_types ) and ip .upper () in self .selalias :
735+ if isinstance (ip , str ) and ip .upper () in self .selalias :
738736 ip = self .selalias [ip .upper ()]
739737 pdffit2 .pdesel (self ._handle , ip )
740738 return
@@ -753,7 +751,7 @@ def selectAtomType(self, ip, ijchar, symbol, flag):
753751 pdffit2.unassignedError if selected phase does not exist
754752 ValueError for invalid value of ijchar
755753 """
756- pdffit2 .selectAtomType (self ._handle , ip , six . b ( ijchar ), symbol , flag )
754+ pdffit2 .selectAtomType (self ._handle , ip , ijchar . encode ( ), symbol , flag )
757755 return
758756
759757 def selectAtomIndex (self , ip , ijchar , aidx , flag ):
@@ -770,7 +768,7 @@ def selectAtomIndex(self, ip, ijchar, aidx, flag):
770768 pdffit2.unassignedError if selected phase does not exist
771769 ValueError if atom index or ijchar are invalid
772770 """
773- pdffit2 .selectAtomIndex (self ._handle , ip , six . b ( ijchar ), aidx , flag )
771+ pdffit2 .selectAtomIndex (self ._handle , ip , ijchar . encode ( ), aidx , flag )
774772 return
775773
776774 def selectAll (self , ip , ijchar ):
@@ -784,7 +782,7 @@ def selectAll(self, ip, ijchar):
784782 pdffit2.unassignedError if selected phase does not exist
785783 ValueError if ijchar is invalid
786784 """
787- pdffit2 .selectAll (self ._handle , ip , six . b ( ijchar ))
785+ pdffit2 .selectAll (self ._handle , ip , ijchar . encode ( ))
788786 return
789787
790788 def selectNone (self , ip , ijchar ):
@@ -798,7 +796,7 @@ def selectNone(self, ip, ijchar):
798796 pdffit2.unassignedError if selected phase does not exist
799797 ValueError if ijchar is invalid
800798 """
801- pdffit2 .selectNone (self ._handle , ip , six . b ( ijchar ))
799+ pdffit2 .selectNone (self ._handle , ip , ijchar . encode ( ))
802800 return
803801
804802 def bang (self , i , j , k ):
@@ -963,7 +961,7 @@ def get_scat_string(self, stype):
963961
964962 Returns: string with all scattering factors.
965963 """
966- return pdffit2 .get_scat_string (self ._handle , six . b ( stype ))
964+ return pdffit2 .get_scat_string (self ._handle , stype . encode ( ))
967965
968966 def get_scat (self , stype , element ):
969967 """get_scat(stype, element) --> Get active scattering factor for
@@ -979,7 +977,7 @@ def get_scat(self, stype, element):
979977 Raises:
980978 ValueError if element is not known.
981979 """
982- rv = pdffit2 .get_scat (self ._handle , six . b ( stype ), element )
980+ rv = pdffit2 .get_scat (self ._handle , stype . encode ( ), element )
983981 return rv
984982
985983 def set_scat (self , stype , element , value ):
@@ -999,7 +997,7 @@ def set_scat(self, stype, element, value):
999997
1000998 See also reset_scat, get_scat.
1001999 """
1002- pdffit2 .set_scat (self ._handle , six . b ( stype ), element , value )
1000+ pdffit2 .set_scat (self ._handle , stype . encode ( ), element , value )
10031001 return
10041002
10051003 def reset_scat (self , element ):
@@ -1074,7 +1072,7 @@ def lat(n):
10741072 6 <==> 'gamma'
10751073 """
10761074 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 ):
10781076 n = LatParams [n ]
10791077 return "lat(%i)" % n
10801078
0 commit comments