|
11 | 11 | import calendar |
12 | 12 | import requests |
13 | 13 | import time |
14 | | -import six |
15 | 14 | import warnings |
16 | | -from six.moves import urllib |
| 15 | +import urllib |
17 | 16 |
|
18 | 17 | import mohawk |
19 | 18 | import mohawk.bewit |
@@ -66,7 +65,7 @@ def __init__(self, options=None, session=None): |
66 | 65 | if credentials: |
67 | 66 | for x in ('accessToken', 'clientId', 'certificate'): |
68 | 67 | value = credentials.get(x) |
69 | | - if value and not isinstance(value, six.binary_type): |
| 68 | + if value and not isinstance(value, bytes): |
70 | 69 | try: |
71 | 70 | credentials[x] = credentials[x].encode('ascii') |
72 | 71 | except Exception: |
@@ -98,9 +97,9 @@ def makeHawkExt(self): |
98 | 97 | ext = {} |
99 | 98 | cert = c.get('certificate') |
100 | 99 | if cert: |
101 | | - if six.PY3 and isinstance(cert, six.binary_type): |
| 100 | + if isinstance(cert, bytes): |
102 | 101 | cert = cert.decode() |
103 | | - if isinstance(cert, six.string_types): |
| 102 | + if isinstance(cert, str): |
104 | 103 | cert = json.loads(cert) |
105 | 104 | ext['certificate'] = cert |
106 | 105 |
|
@@ -130,7 +129,7 @@ def _makeTopicExchange(self, entry, *args, **kwargs): |
130 | 129 | } |
131 | 130 |
|
132 | 131 | # If we are passed in a string, we can short-circuit this function |
133 | | - if isinstance(routingKeyPattern, six.string_types): |
| 132 | + if isinstance(routingKeyPattern, str): |
134 | 133 | log.debug('Passing through string for topic exchange key') |
135 | 134 | data['routingKeyPattern'] = routingKeyPattern |
136 | 135 | return data |
@@ -355,12 +354,12 @@ def _processArgs(self, entry, *_args, **_kwargs): |
355 | 354 | # These all need to be rendered down to a string, let's just check that |
356 | 355 | # they are up front and fail fast |
357 | 356 | for arg in args: |
358 | | - if not isinstance(arg, six.string_types) and not isinstance(arg, int): |
| 357 | + if not isinstance(arg, str) and not isinstance(arg, int): |
359 | 358 | raise exceptions.TaskclusterFailure( |
360 | 359 | 'Positional arg "%s" to %s is not a string or int' % (arg, entry['name'])) |
361 | 360 |
|
362 | | - for name, arg in six.iteritems(kwApiArgs): |
363 | | - if not isinstance(arg, six.string_types) and not isinstance(arg, int): |
| 361 | + for name, arg in kwApiArgs.items(): |
| 362 | + if not isinstance(arg, str) and not isinstance(arg, int): |
364 | 363 | raise exceptions.TaskclusterFailure( |
365 | 364 | 'KW arg "%s: %s" to %s is not a string or int' % (name, arg, entry['name'])) |
366 | 365 |
|
@@ -419,7 +418,7 @@ def _subArgsInRoute(self, entry, args): |
419 | 418 |
|
420 | 419 | route = entry['route'] |
421 | 420 |
|
422 | | - for arg, val in six.iteritems(args): |
| 421 | + for arg, val in args.items(): |
423 | 422 | toReplace = "<%s>" % arg |
424 | 423 | if toReplace not in route: |
425 | 424 | raise exceptions.TaskclusterFailure( |
@@ -650,7 +649,7 @@ def createTemporaryCredentials(clientId, accessToken, start, expiry, scopes, nam |
650 | 649 | """ |
651 | 650 |
|
652 | 651 | for scope in scopes: |
653 | | - if not isinstance(scope, six.string_types): |
| 652 | + if not isinstance(scope, str): |
654 | 653 | raise exceptions.TaskclusterFailure('Scope must be string') |
655 | 654 |
|
656 | 655 | # Credentials can only be valid for 31 days. I hope that |
@@ -687,7 +686,7 @@ def createTemporaryCredentials(clientId, accessToken, start, expiry, scopes, nam |
687 | 686 | ] + scopes) |
688 | 687 | sigStr = '\n'.join(sig).encode() |
689 | 688 |
|
690 | | - if isinstance(accessToken, six.text_type): |
| 689 | + if isinstance(accessToken, str): |
691 | 690 | accessToken = accessToken.encode() |
692 | 691 | sig = hmac.new(accessToken, sigStr, hashlib.sha256).digest() |
693 | 692 |
|
|
0 commit comments