Skip to content

Commit 4b10297

Browse files
black format
1 parent 204fe7a commit 4b10297

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

shotgun_api3/shotgun.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
import base64
3333
import copy
34+
import io
35+
import http.cookiejar # used for attachment upload
3436
import datetime
3537
import json
3638
import logging
@@ -45,8 +47,6 @@
4547
import uuid # used for attachment upload
4648

4749
# Python 2/3 compatibility
48-
from .lib import six
49-
from .lib import sgsix
5050
from .lib import sgutils
5151
from io import BytesIO # used for attachment upload
5252

@@ -672,9 +672,15 @@ def __init__(
672672
# the lowercase version of the credentials.
673673
auth, self.config.server = self._split_url(base_url)
674674
if auth:
675+
<<<<<<< HEAD
675676
auth = base64.encodebytes(
676677
sgutils.ensure_binary(urllib.parse.unquote(auth))
677678
).decode("utf-8")
679+
=======
680+
auth = base64encode(urllib.parse.unquote(auth).encode("utf-8")).decode(
681+
"utf-8"
682+
)
683+
>>>>>>> f64d7ea (black format)
678684
self.config.authorization = "Basic " + auth.strip()
679685

680686
# foo:[email protected]:3456
@@ -2221,8 +2227,7 @@ def schema_field_update(
22212227
"type": entity_type,
22222228
"field_name": field_name,
22232229
"properties": [
2224-
{"property_name": k, "value": v}
2225-
for k, v in (properties or {}).items()
2230+
{"property_name": k, "value": v} for k, v in (properties or {}).items()
22262231
],
22272232
}
22282233
params = self._add_project_param(params, project_entity)
@@ -4556,7 +4561,9 @@ def encode(self, params, files, boundary=None, buffer=None):
45564561
key = key.decode("utf-8") if isinstance(key, bytes) else str(key)
45574562

45584563
buffer.write(("--%s\r\n" % boundary).encode("utf-8"))
4559-
buffer.write(('Content-Disposition: form-data; name="%s"' % key).encode("utf-8"))
4564+
buffer.write(
4565+
('Content-Disposition: form-data; name="%s"' % key).encode("utf-8")
4566+
)
45604567
buffer.write(("\r\n\r\n%s\r\n" % value).encode("utf-8"))
45614568
for key, fd in files:
45624569
# On Windows, it's possible that we were forced to open a file
@@ -4565,7 +4572,11 @@ def encode(self, params, files, boundary=None, buffer=None):
45654572
# If we don't, the mix of unicode and strings going into the
45664573
# buffer can cause UnicodeEncodeErrors to be raised.
45674574
filename = fd.name
4568-
filename = filename.decode("utf-8") if isinstance(filename, bytes) else str(filename)
4575+
filename = (
4576+
filename.decode("utf-8")
4577+
if isinstance(filename, bytes)
4578+
else str(filename)
4579+
)
45694580
filename = filename.split("/")[-1]
45704581
key = key.decode("utf-8") if isinstance(key, bytes) else str(key)
45714582
content_type = mimetypes.guess_type(filename)[0]

tests/test_api.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ def test_upload_download(self):
239239

240240
# test upload of non-ascii, unicode path
241241
u_path = os.path.abspath(
242-
os.path.expanduser(
243-
glob.glob(os.path.join(str(this_dir), "Noëlご.jpg"))[0]
244-
)
242+
os.path.expanduser(glob.glob(os.path.join(str(this_dir), "Noëlご.jpg"))[0])
245243
)
246244

247245
# If this is a problem, it'll raise with a UnicodeEncodeError. We
@@ -281,9 +279,7 @@ def test_upload_to_sg(self, mock_send_form):
281279
mock_send_form.return_value = "1\n:123\nasd"
282280
this_dir, _ = os.path.split(__file__)
283281
u_path = os.path.abspath(
284-
os.path.expanduser(
285-
glob.glob(os.path.join(str(this_dir), "Noëlご.jpg"))[0]
286-
)
282+
os.path.expanduser(glob.glob(os.path.join(str(this_dir), "Noëlご.jpg"))[0])
287283
)
288284
upload_id = self.sg.upload(
289285
"Version",

tests/test_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,7 @@ def test_encode_payload(self):
640640
self.assertTrue(isinstance(j, bytes))
641641

642642
def test_decode_response_ascii(self):
643-
self._assert_decode_resonse(
644-
True, str("my data \u00e0")
645-
)
643+
self._assert_decode_resonse(True, str("my data \u00e0"))
646644

647645
def test_decode_response_unicode(self):
648646
self._assert_decode_resonse(False, "my data \u00e0")

0 commit comments

Comments
 (0)