Skip to content

Commit 7049eb3

Browse files
mwwodamhagmajer
andauthored
Remove or deprecate insensitive language (#609)
Co-authored-by: Marcin Hagmajer <[email protected]>
1 parent b0d0384 commit 7049eb3

23 files changed

+619
-35
lines changed

HISTORY.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Release History
44
---------------
55

6+
Next release
7+
++++++++
8+
9+
**New Features and Enhancements:**
10+
11+
- Sensitive language replacement (`#609 <https://github.com/box/box-python-sdk/pull/609>`_)
12+
613
2.12.1 (2021-06-16)
714
++++++++
815

@@ -85,7 +92,7 @@ Release History
8592
2.4.0 (2019-05-16)
8693
++++++++++++++++++
8794

88-
- Added ability to set metadata on a `file <https://github.com/box/box-python-sdk/blob/master/docs/usage/files.md#set-metadata>`_ or a `folder <https://github.com/box/box-python-sdk/blob/master/docs/usage/folders.md#set-metadata>`_
95+
- Added ability to set metadata on a `file <https://github.com/box/box-python-sdk/blob/main/docs/usage/files.md#set-metadata>`_ or a `folder <https://github.com/box/box-python-sdk/blob/main/docs/usage/folders.md#set-metadata>`_
8996

9097
2.3.2 (2019-03-29)
9198
++++++++++++++++++
@@ -100,8 +107,8 @@ Release History
100107
2.3.0 (2019-03-28)
101108
++++++++++++++++++
102109

103-
- Added the ability to set `file description upon upload <https://github.com/box/box-python-sdk/blob/master/docs/usage/files.md#upload-a-file>`_
104-
- Added support for `basic authenticated proxy and unauthenticated proxy <https://github.com/box/box-python-sdk/blob/master/docs/usage/configuration.md#proxy>`_
110+
- Added the ability to set `file description upon upload <https://github.com/box/box-python-sdk/blob/main/docs/usage/files.md#upload-a-file>`_
111+
- Added support for `basic authenticated proxy and unauthenticated proxy <https://github.com/box/box-python-sdk/blob/main/docs/usage/configuration.md#proxy>`_
105112

106113
2.2.2 (2019-03-14)
107114
++++++++++++++++++
@@ -116,18 +123,18 @@ Release History
116123
2.2.0 (2019-02-14)
117124
++++++++++++++++++
118125

119-
- Added abilty for user to `retrieve an avatar <https://github.com/box/box-python-sdk/blob/master/docs/usage/user.md#get-the-avatar-for-a-user>`_
126+
- Added abilty for user to `retrieve an avatar <https://github.com/box/box-python-sdk/blob/main/docs/usage/user.md#get-the-avatar-for-a-user>`_
120127
for a user.
121128
- Changed retry strategy to use exponential backoff with randomized jitter.
122129

123130
2.1.0 (2019-02-07)
124131
++++++++++++++++++
125132

126-
- Added ability for user to `chunk upload files <https://github.com/box/box-python-sdk/blob/master/docs/usage/files.md#chunked-upload>`_
133+
- Added ability for user to `chunk upload files <https://github.com/box/box-python-sdk/blob/main/docs/usage/files.md#chunked-upload>`_
127134
and resume uploads for interrupted uploads.
128-
- Added ability to `verify webhook message <https://github.com/box/box-python-sdk/blob/master/docs/usage/webhook.md#validate-webhook-message>`_.
129-
- Added ability for user to add metadata classification to `files <https://github.com/box/box-python-sdk/blob/master/docs/usage/files.md#set-a-classification>`_
130-
and `folders <https://github.com/box/box-python-sdk/blob/master/docs/usage/folders.md#set-a-classification>`_.
135+
- Added ability to `verify webhook message <https://github.com/box/box-python-sdk/blob/main/docs/usage/webhook.md#validate-webhook-message>`_.
136+
- Added ability for user to add metadata classification to `files <https://github.com/box/box-python-sdk/blob/main/docs/usage/files.md#set-a-classification>`_
137+
and `folders <https://github.com/box/box-python-sdk/blob/main/docs/usage/folders.md#set-a-classification>`_.
131138
- Bugfix where calling ``.response_object()`` method on an API object could throw.
132139

133140
2.0.0

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Box Python SDK
44
.. image:: http://opensource.box.com/badges/active.svg
55
:target: http://opensource.box.com/badges
66

7-
.. image:: https://travis-ci.org/box/box-python-sdk.png?branch=master
7+
.. image:: https://travis-ci.org/box/box-python-sdk.png?branch=main
88
:target: https://travis-ci.org/box/box-python-sdk
99

1010
.. image:: https://readthedocs.org/projects/box-python-sdk/badge/?version=latest
@@ -17,8 +17,8 @@ Box Python SDK
1717
.. image:: https://img.shields.io/pypi/dm/boxsdk.svg
1818
:target: https://pypi.python.org/pypi/boxsdk
1919

20-
.. image:: https://coveralls.io/repos/github/box/box-python-sdk/badge.svg?branch=master
21-
:target: https://coveralls.io/github/box/box-python-sdk?branch=master
20+
.. image:: https://coveralls.io/repos/github/box/box-python-sdk/badge.svg?branch=main
21+
:target: https://coveralls.io/github/box/box-python-sdk?branch=main
2222

2323

2424
.. contents::
@@ -38,7 +38,7 @@ The current version of the SDK is v2.x — if you're looking for the code or doc
3838
the 2.x branch; you should consider upgrading from 1.5.x at your earliest convenience. See the changelog_ for a list
3939
of breaking changes and added features between the major versions.
4040

41-
.. _changelog: https://github.com/box/box-python-sdk/blob/master/HISTORY.rst#200
41+
.. _changelog: https://github.com/box/box-python-sdk/blob/main/HISTORY.rst#200
4242

4343

4444
Getting Started
@@ -270,7 +270,7 @@ Usage Documentation
270270
Full documentation of the available functionality with example code is available in the `SDK documentation pages`_, and
271271
there is also method-level documentation available on ReadTheDocs_.
272272

273-
.. _SDK documentation pages: https://github.com/box/box-python-sdk/blob/master/docs/usage
273+
.. _SDK documentation pages: https://github.com/box/box-python-sdk/blob/main/docs/usage
274274
.. _ReadTheDocs: https://box-python-sdk.readthedocs.io/en/stable/index.html
275275

276276
Making API Calls Manually
@@ -383,7 +383,7 @@ and ``Translator`` to see how the SDK performs dynamic lookups to determine retu
383383
Contributing
384384
------------
385385

386-
See `CONTRIBUTING.rst <https://github.com/box/box-python-sdk/blob/master/CONTRIBUTING.rst>`_.
386+
See `CONTRIBUTING.rst <https://github.com/box/box-python-sdk/blob/main/CONTRIBUTING.rst>`_.
387387

388388

389389
Developer Setup

boxsdk/client/client.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
from ..object.search import Search
1111
from ..object.events import Events
1212
from ..object.collaboration_whitelist import CollaborationWhitelist
13+
from ..object.collaboration_allowlist import CollaborationAllowlist
1314
from ..object.trash import Trash
1415
from ..pagination.limit_offset_based_object_collection import LimitOffsetBasedObjectCollection
1516
from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
1617
from ..util.shared_link import get_shared_link_header
18+
from ..util.deprecation_decorator import deprecated
1719

1820

1921
class Client(Cloneable):
@@ -227,6 +229,7 @@ def collaboration(self, collab_id):
227229
"""
228230
return self.translator.get('collaboration')(session=self._session, object_id=collab_id)
229231

232+
@deprecated('Use collaboration_allowlist instead')
230233
def collaboration_whitelist(self):
231234
"""
232235
Initilializes a :class:`CollaborationWhitelist` object.
@@ -238,6 +241,7 @@ def collaboration_whitelist(self):
238241
"""
239242
return CollaborationWhitelist(self._session)
240243

244+
@deprecated('Use collaboration_allowlist_entry instead')
241245
def collaboration_whitelist_entry(self, entry_id):
242246
"""
243247
Initialize a :class:`CollaborationWhitelistEntry` object, whose box id is entry_id.
@@ -253,6 +257,7 @@ def collaboration_whitelist_entry(self, entry_id):
253257
"""
254258
return self.translator.get('collaboration_whitelist_entry')(session=self._session, object_id=entry_id)
255259

260+
@deprecated('Use collaboration_allowlist_exempt_target instead')
256261
def collaboration_whitelist_exempt_target(self, exemption_id):
257262
"""
258263
Initialize a :class:`CollaborationWhitelistExemptTarget` object, whose box id is target_id.
@@ -271,6 +276,50 @@ def collaboration_whitelist_exempt_target(self, exemption_id):
271276
object_id=exemption_id
272277
)
273278

279+
def collaboration_allowlist(self):
280+
"""
281+
Initilializes a :class:`CollaborationAllowlist` object.
282+
283+
:return:
284+
A :class:`CollaborationAllowlist` object.
285+
:rype:
286+
:class:`CollaborationAllowlist`.
287+
"""
288+
return CollaborationAllowlist(self._session)
289+
290+
def collaboration_allowlist_entry(self, entry_id):
291+
"""
292+
Initialize a :class:`CollaborationAllowlistEntry` object, whose box id is entry_id.
293+
294+
:param entry_id:
295+
The box id of the :class:`CollaborationAllowlistEntry` object.
296+
:type entry_id:
297+
`unicode`
298+
:return:
299+
A :class:`CollaborationAllowlistEntry` object with the given entry id.
300+
:rtype:
301+
:class:`CollaborationAllowlistEntry`
302+
"""
303+
return self.translator.get('collaboration_whitelist_entry')(session=self._session, object_id=entry_id)
304+
305+
def collaboration_allowlist_exempt_target(self, exemption_id):
306+
"""
307+
Initialize a :class:`CollaborationAllowlistExemptTarget` object, whose box id is target_id.
308+
309+
:param exemption_id:
310+
The box id of the :class:`CollaborationAllowlistExemptTarget` object.
311+
:type exemption_id:
312+
`unicode`
313+
:return:
314+
A :class:`CollaborationAllowlistExemptTarget` object with the given target id.
315+
:rtype:
316+
:class:`CollaborationAllowlistExemptTarget`
317+
"""
318+
return self.translator.get('collaboration_whitelist_exempt_target')(
319+
session=self._session,
320+
object_id=exemption_id
321+
)
322+
274323
def trash(self):
275324
"""
276325
Initialize a :class:`Trash` object.

boxsdk/object/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
'collaboration_whitelist',
1111
'collaboration_whitelist_entry',
1212
'collaboration_whitelist_exempt_target',
13+
'collaboration_allowlist',
14+
'collaboration_allowlist_entry',
15+
'collaboration_allowlist_exempt_target',
1316
'collection',
1417
'comment',
1518
'device_pinner',
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# coding: utf-8
2+
from __future__ import unicode_literals, absolute_import
3+
4+
import json
5+
6+
from .base_endpoint import BaseEndpoint
7+
from ..pagination.marker_based_object_collection import MarkerBasedObjectCollection
8+
from ..util.api_call_decorator import api_call
9+
from ..util.text_enum import TextEnum
10+
11+
12+
class AllowlistDirection(TextEnum):
13+
"""
14+
Used to determine the direction of the allowlist.
15+
"""
16+
INBOUND = 'inbound'
17+
OUTBOUNT = 'outbound'
18+
BOTH = 'both'
19+
20+
21+
class CollaborationAllowlist(BaseEndpoint):
22+
"""Represents the allowlist of email domains that users in an enterprise may collaborate with."""
23+
24+
@api_call
25+
def get_entries(self, limit=None, marker=None, fields=None):
26+
"""
27+
Get the entries in the collaboration allowlist using limit-offset paging.
28+
29+
:param limit:
30+
The maximum number of entries to return per page. If not specified, then will use the server-side default.
31+
:type limit:
32+
`int` or None
33+
:param marker:
34+
The paging marker to start paging from.
35+
:type marker:
36+
`unicode` or None
37+
:param fields:
38+
List of fields to request.
39+
:type fields:
40+
`Iterable` of `unicode`
41+
:returns:
42+
An iterator of the entries in the allowlist.
43+
:rtype:
44+
:class:`BoxObjectCollection`
45+
"""
46+
return MarkerBasedObjectCollection(
47+
session=self._session,
48+
url=self.get_url('collaboration_whitelist_entries'),
49+
limit=limit,
50+
marker=marker,
51+
fields=fields,
52+
return_full_pages=False,
53+
)
54+
55+
@api_call
56+
def add_domain(self, domain, direction):
57+
"""
58+
Add a new domain to the collaboration allowlist.
59+
60+
:param domain:
61+
The email domain to add to the allowlist.
62+
:type domain:
63+
`unicode`
64+
:param direction:
65+
The direction in which collaboration should be allowed: 'inbound', 'outbound', or 'both'.
66+
:type direction:
67+
`unicode`
68+
:returns:
69+
The created allowlist entry for the domain.
70+
:rtype:
71+
:class:`CollaborationAllowlistEntry`
72+
"""
73+
url = self.get_url('collaboration_whitelist_entries')
74+
data = {
75+
'domain': domain,
76+
'direction': direction
77+
}
78+
response = self._session.post(url, data=json.dumps(data)).json()
79+
return self.translator.translate(
80+
session=self._session,
81+
response_object=response,
82+
)
83+
84+
@api_call
85+
def get_exemptions(self, limit=None, marker=None, fields=None):
86+
"""
87+
Get the list of exempted users who are not subject to the collaboration allowlist rules.
88+
89+
:param limit:
90+
The maximum number of entries to return per page. If not specified, then will use the server-side default.
91+
:type limit:
92+
`int` or None
93+
:param marker:
94+
The paging marker to start paging from.
95+
:type marker:
96+
`unicode` or None
97+
:param fields:
98+
List of fields to request.
99+
:type fields:
100+
`Iterable` of `unicode`
101+
:returns:
102+
An iterator of the exemptions to the allowlist.
103+
:rtype:
104+
:class:`BoxObjectCollection`
105+
"""
106+
return MarkerBasedObjectCollection(
107+
session=self._session,
108+
url=self.get_url('collaboration_whitelist_exempt_targets'),
109+
limit=limit,
110+
marker=marker,
111+
fields=fields,
112+
return_full_pages=False,
113+
)
114+
115+
@api_call
116+
def add_exemption(self, user):
117+
"""
118+
Exempt a user from the collaboration allowlist.
119+
120+
:param user:
121+
The user to exempt from the allowlist.
122+
:type user:
123+
:class:`User`
124+
:returns:
125+
The created allowlist exemption.
126+
:rtype:
127+
:class:`CollaborationAllowlistExemptTarget`
128+
"""
129+
url = self.get_url('collaboration_whitelist_exempt_targets')
130+
data = {
131+
'user': {
132+
'id': user.object_id # pylint:disable=protected-access
133+
}
134+
}
135+
response = self._session.post(url, data=json.dumps(data)).json()
136+
return self.translator.translate(
137+
session=self._session,
138+
response_object=response,
139+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# coding: utf-8
2+
from __future__ import unicode_literals, absolute_import
3+
from .collaboration_whitelist_entry import CollaborationWhitelistEntry
4+
5+
6+
class CollaborationAllowlistEntry(CollaborationWhitelistEntry):
7+
"""Represents a allowlisted email domain for enterprise collaboration."""
8+
9+
_item_type = 'collaboration_whitelist_entry'
10+
11+
def get_url(self, *args):
12+
"""
13+
Gets the collaboration allowlist entries endpoint URL.
14+
15+
:return:
16+
The collaboration allowlist entries endpoint URL.
17+
:rtype:
18+
`unicode`
19+
"""
20+
return self._session.get_url('collaboration_whitelist_entries', self._object_id, *args)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# coding: utf-8
2+
from __future__ import unicode_literals, absolute_import
3+
from boxsdk.object.collaboration_whitelist_exempt_target import CollaborationWhitelistExemptTarget
4+
5+
6+
class CollaborationAllowlistExemptTarget(CollaborationWhitelistExemptTarget):
7+
"""Represents a user who is exempted from the collaboration allowlist."""
8+
9+
_item_type = 'collaboration_whitelist_exempt_target'

0 commit comments

Comments
 (0)