Skip to content

Commit cc0db13

Browse files
Use ternary operator to not add additional lines without accompanying test
Co-authored-by: Raphael Guzman <[email protected]>
1 parent c61947d commit cc0db13

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

datajoint/s3.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,23 @@ class Folder:
1717
"""
1818
A Folder instance manipulates a flat folder of objects within an S3-compatible object store
1919
"""
20-
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False, proxy_server=None, **_):
21-
if proxy_server:
22-
# from https://docs.min.io/docs/python-client-api-reference
23-
http_client = urllib3.ProxyManager(
24-
proxy_server,
25-
timeout=urllib3.Timeout.DEFAULT_TIMEOUT,
26-
cert_reqs="CERT_REQUIRED",
27-
retries=urllib3.Retry(
28-
total=5,
29-
backoff_factor=0.2,
30-
status_forcelist=[500, 502, 503, 504],
31-
)
32-
)
33-
else:
34-
http_client = None
35-
20+
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False,
21+
proxy_server=None, **_):
22+
# from https://docs.min.io/docs/python-client-api-reference
3623
self.client = minio.Minio(
3724
endpoint,
3825
access_key=access_key,
3926
secret_key=secret_key,
4027
secure=secure,
41-
http_client=http_client,
28+
http_client= (
29+
urllib3.ProxyManager(proxy_server,
30+
timeout=urllib3.Timeout.DEFAULT_TIMEOUT,
31+
cert_reqs="CERT_REQUIRED",
32+
retries=urllib3.Retry(total=5,
33+
backoff_factor=0.2,
34+
status_forcelist=[500, 502, 503,
35+
504]))
36+
if proxy_server else None),
4237
)
4338
self.bucket = bucket
4439
if not self.client.bucket_exists(bucket):

0 commit comments

Comments
 (0)