|
34 | 34 | from . import constants |
35 | 35 | from .. import command |
36 | 36 |
|
37 | | -try: |
38 | | - from tank_vendor import sgutils |
39 | | -except ImportError: |
40 | | - from tank_vendor import six as sgutils |
41 | | - |
42 | 37 | logger = sgtk.platform.get_logger(__name__) |
43 | 38 |
|
44 | 39 |
|
@@ -316,9 +311,8 @@ def _execute_action(self, data): |
316 | 311 | # message that wasn't on the first line of text before any newlines. |
317 | 312 | for line in stdout.split("\n") + stderr.split("\n"): |
318 | 313 | if line.startswith(tag): |
319 | | - filtered_output.append( |
320 | | - sgutils.ensure_str(base64.b64decode(line[tag_length:])) |
321 | | - ) |
| 314 | + decoded = base64.b64decode(line[tag_length:]).decode("utf-8") |
| 315 | + filtered_output.append(decoded) |
322 | 316 |
|
323 | 317 | filtered_output_string = "\n".join(filtered_output) |
324 | 318 |
|
@@ -632,8 +626,9 @@ def _get_actions(self, data): |
632 | 626 | if cached_data: |
633 | 627 | # The value will be bytes |
634 | 628 | # ensure_str doesn't accept a buffer as input |
635 | | - string_data = sgutils.ensure_str(cached_data[0]) |
636 | | - |
| 629 | + string_data = cached_data[0] |
| 630 | + if isinstance(string_data, bytes): |
| 631 | + string_data = string_data.decode("utf-8") |
637 | 632 | try: |
638 | 633 | decoded_data = sgtk.util.json.loads(string_data) |
639 | 634 | except Exception: |
@@ -1030,7 +1025,7 @@ def _write_commands_to_db(self, commands, config_data, contents_hash): |
1030 | 1025 |
|
1031 | 1026 | connection.commit() |
1032 | 1027 |
|
1033 | | - commands_blob = sqlite3.Binary(sgutils.ensure_binary(json.dumps(commands))) |
| 1028 | + commands_blob = sqlite3.Binary(json.dumps(commands).encode("utf-8")) |
1034 | 1029 |
|
1035 | 1030 | # Since we're likely to be updating out-of-date cached data more |
1036 | 1031 | # often than we're going to be inserting new rows into the cache, |
@@ -1265,10 +1260,10 @@ def _get_contents_hash(self, config_descriptor, entities): |
1265 | 1260 | logger.debug("Contents data to be used in hash generation: %s", json_data) |
1266 | 1261 |
|
1267 | 1262 | hash_data = hashlib.md5() |
1268 | | - hash_data.update(sgutils.ensure_binary(json_data)) |
| 1263 | + hash_data.update(json_data.encode("utf-8")) |
1269 | 1264 | # Base64 encode the digest, will is a binary string |
1270 | 1265 | # in Python 3. This ensures we can always encode it to a str. |
1271 | | - return sgutils.ensure_str(base64.b64encode(hash_data.digest())) |
| 1266 | + return base64.b64encode(hash_data.digest()).decode("utf-8") |
1272 | 1267 |
|
1273 | 1268 | def _get_entities_from_payload(self, data): |
1274 | 1269 | """ |
@@ -1541,7 +1536,7 @@ def _get_exception_message(self): |
1541 | 1536 | ) |
1542 | 1537 |
|
1543 | 1538 | if self._global_debug: |
1544 | | - message = sgutils.ensure_binary(html.escape(traceback.format_exc())) |
| 1539 | + message = html.escape(traceback.format_exc()).encode("utf-8") |
1545 | 1540 |
|
1546 | 1541 | return message |
1547 | 1542 |
|
@@ -2178,7 +2173,7 @@ def _legacy_sanitize_output(self, out): |
2178 | 2173 | line = re.sub(bold_match, "*", line) |
2179 | 2174 | sanitized.append(line) |
2180 | 2175 |
|
2181 | | - return sgutils.ensure_binary(html.escape("\n".join(sanitized))) |
| 2176 | + return html.escape("\n".join(sanitized)).encode("utf-8") |
2182 | 2177 |
|
2183 | 2178 | @sgtk.LogManager.log_timing |
2184 | 2179 | def _process_commands(self, commands, project, entities): |
|
0 commit comments