|
10 | 10 |
|
11 | 11 | self = sys.modules[__name__].__dict__
|
12 | 12 |
|
13 |
| -try: |
14 |
| - unicode = unicode |
15 |
| -except NameError: |
16 |
| - unicode = str |
17 |
| - |
18 | 13 | FORMAT_DATE = "%Y-%m-%d"
|
19 | 14 | FORMAT_DATETIME = "%Y-%m-%d %H:%M:%S"
|
20 | 15 | FORMAT_TIME = "%H:%M:%S"
|
@@ -103,7 +98,7 @@ def valid_type(dtype):
|
103 | 98 | if dtype is None:
|
104 | 99 | return True
|
105 | 100 |
|
106 |
| - if not isinstance(dtype, str) and not isinstance(dtype, unicode): |
| 101 | + if not isinstance(dtype, str): |
107 | 102 | return False
|
108 | 103 |
|
109 | 104 | dtype = dtype.lower()
|
@@ -152,14 +147,13 @@ def set(value, dtype=None):
|
152 | 147 | """
|
153 | 148 | if not dtype:
|
154 | 149 | return str_set(value)
|
| 150 | + |
155 | 151 | if dtype.endswith("-tuple"):
|
156 | 152 | return tuple_set(value)
|
157 |
| - if sys.version_info > (3, 0): |
158 |
| - if isinstance(value, str): |
159 |
| - return str_set(value) |
160 |
| - else: |
161 |
| - if isinstance(value, (str, unicode)): |
162 |
| - return str_set(value) |
| 153 | + |
| 154 | + if isinstance(value, str): |
| 155 | + return str_set(value) |
| 156 | + |
163 | 157 | return self.get(dtype + "_set", str_set)(value)
|
164 | 158 |
|
165 | 159 |
|
@@ -206,9 +200,6 @@ def str_get(string):
|
206 | 200 | if string in [None, "", [], {}]:
|
207 | 201 | return default_values("string")
|
208 | 202 |
|
209 |
| - if sys.version_info < (3, 0): |
210 |
| - return unicode(string) |
211 |
| - |
212 | 203 | return str(string)
|
213 | 204 |
|
214 | 205 |
|
@@ -296,7 +287,7 @@ def boolean_get(string):
|
296 | 287 | if string in [None, "", [], {}]:
|
297 | 288 | return default_values("boolean")
|
298 | 289 |
|
299 |
| - if isinstance(string, (unicode, str)): |
| 290 | + if isinstance(string, str): |
300 | 291 | string = string.lower()
|
301 | 292 |
|
302 | 293 | truth = ["true", "1", True, "t"] # be kind, spec only accepts True / False
|
|
0 commit comments