Commit c25bfcb5 authored by Michael Fladischer's avatar Michael Fladischer

Update upstream source from tag 'upstream/8.5.0'

Update to upstream version '8.5.0'
with Debian dir 3b2433ef8f1eee4980388c5abb1211d1fbfc0eb4
parents 56543680 b50124a7
Metadata-Version: 1.1
Name: dropbox
Version: 8.4.1
Version: 8.5.0
Summary: Official Dropbox API Client
Home-page: http://www.dropbox.com/developers
Author: Dropbox
......@@ -9,7 +9,7 @@ License: MIT License
Description: Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.4.1
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.5.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
......
Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.4.1
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.5.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
......
Metadata-Version: 1.1
Name: dropbox
Version: 8.4.1
Version: 8.5.0
Summary: Official Dropbox API Client
Home-page: http://www.dropbox.com/developers
Author: Dropbox
......@@ -9,7 +9,7 @@ License: MIT License
Description: Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.4.1
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.5.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
......
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
try:
......
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
try:
......
This diff is collapsed.
......@@ -681,6 +681,91 @@ class DropboxTeamBase(object):
)
return r
def team_member_space_limits_excluded_users_add(self,
users=None):
"""
Add users to member space limits excluded users list.
:param Nullable users: List of users to be added/removed.
:rtype: :class:`dropbox.team.ExcludedUsersUpdateResult`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.team.ExcludedUsersUpdateError`
"""
arg = team.ExcludedUsersUpdateArg(users)
r = self.request(
team.member_space_limits_excluded_users_add,
'team',
arg,
None,
)
return r
def team_member_space_limits_excluded_users_list(self,
limit=1000):
"""
List member space limits excluded users.
:param long limit: Number of results to return per call.
:rtype: :class:`dropbox.team.ExcludedUsersListResult`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.team.ExcludedUsersListError`
"""
arg = team.ExcludedUsersListArg(limit)
r = self.request(
team.member_space_limits_excluded_users_list,
'team',
arg,
None,
)
return r
def team_member_space_limits_excluded_users_list_continue(self,
cursor):
"""
Continue listing member space limits excluded users.
:param str cursor: Indicates from what point to get the next set of
users.
:rtype: :class:`dropbox.team.ExcludedUsersListResult`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.team.ExcludedUsersListContinueError`
"""
arg = team.ExcludedUsersListContinueArg(cursor)
r = self.request(
team.member_space_limits_excluded_users_list_continue,
'team',
arg,
None,
)
return r
def team_member_space_limits_excluded_users_remove(self,
users=None):
"""
Remove users from member space limits excluded users list.
:param Nullable users: List of users to be added/removed.
:rtype: :class:`dropbox.team.ExcludedUsersUpdateResult`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.team.ExcludedUsersUpdateError`
"""
arg = team.ExcludedUsersUpdateArg(users)
r = self.request(
team.member_space_limits_excluded_users_remove,
'team',
arg,
None,
)
return r
def team_member_space_limits_get_custom_quota(self,
users):
"""
......@@ -728,7 +813,7 @@ class DropboxTeamBase(object):
def team_member_space_limits_set_custom_quota(self,
users_and_quotas):
"""
Set users custom quota. Custom quota has to be at least 25GB. A maximum
Set users custom quota. Custom quota has to be at least 15GB. A maximum
of 1000 members can be specified in a single call.
:param list users_and_quotas: List of users and their custom quotas.
......@@ -736,7 +821,7 @@ class DropboxTeamBase(object):
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.team.CustomQuotaError`
:class:`dropbox.team.SetCustomQuotaError`
"""
arg = team.SetCustomQuotaArg(users_and_quotas)
r = self.request(
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ __all__ = [
# This should always be 0.0.0 in master. Only update this after tagging
# before release.
__version__ = '8.4.1'
__version__ = '8.5.0'
import contextlib
import json
......
This diff is collapsed.
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
......
This diff is collapsed.
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
......
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
......@@ -3572,7 +3573,7 @@ class FolderAction(bb.Union):
:ivar unshare: Stop sharing this folder.
:ivar leave_a_copy: Keep a copy of the contents upon leaving or being kicked
from the folder.
:ivar share_link: This action is deprecated. Use create_link instead.
:ivar share_link: Use create_link instead.
:ivar create_link: Create a shared link for folder.
"""
......@@ -10542,6 +10543,8 @@ class RemoveFolderMemberError(bb.Union):
:ivar team_folder: This action cannot be performed on a team shared folder.
:ivar no_permission: The current user does not have permission to perform
this action.
:ivar too_many_files: This shared folder has too many files for leaving a
copy. You can still remove this user without leaving a copy.
"""
_catch_all = 'other'
......@@ -10554,6 +10557,8 @@ class RemoveFolderMemberError(bb.Union):
# Attribute is overwritten below the class definition
no_permission = None
# Attribute is overwritten below the class definition
too_many_files = None
# Attribute is overwritten below the class definition
other = None
@classmethod
......@@ -10626,6 +10631,14 @@ class RemoveFolderMemberError(bb.Union):
"""
return self._tag == 'no_permission'
def is_too_many_files(self):
"""
Check if the union tag is ``too_many_files``.
:rtype: bool
"""
return self._tag == 'too_many_files'
def is_other(self):
"""
Check if the union tag is ``other``.
......@@ -17086,6 +17099,7 @@ RemoveFolderMemberError._folder_owner_validator = bv.Void()
RemoveFolderMemberError._group_access_validator = bv.Void()
RemoveFolderMemberError._team_folder_validator = bv.Void()
RemoveFolderMemberError._no_permission_validator = bv.Void()
RemoveFolderMemberError._too_many_files_validator = bv.Void()
RemoveFolderMemberError._other_validator = bv.Void()
RemoveFolderMemberError._tagmap = {
'access_error': RemoveFolderMemberError._access_error_validator,
......@@ -17094,6 +17108,7 @@ RemoveFolderMemberError._tagmap = {
'group_access': RemoveFolderMemberError._group_access_validator,
'team_folder': RemoveFolderMemberError._team_folder_validator,
'no_permission': RemoveFolderMemberError._no_permission_validator,
'too_many_files': RemoveFolderMemberError._too_many_files_validator,
'other': RemoveFolderMemberError._other_validator,
}
......@@ -17101,6 +17116,7 @@ RemoveFolderMemberError.folder_owner = RemoveFolderMemberError('folder_owner')
RemoveFolderMemberError.group_access = RemoveFolderMemberError('group_access')
RemoveFolderMemberError.team_folder = RemoveFolderMemberError('team_folder')
RemoveFolderMemberError.no_permission = RemoveFolderMemberError('no_permission')
RemoveFolderMemberError.too_many_files = RemoveFolderMemberError('too_many_files')
RemoveFolderMemberError.other = RemoveFolderMemberError('other')
RemoveMemberJobStatus._complete_validator = MemberAccessLevelResult_validator
......
......@@ -25,11 +25,15 @@ class Union(object):
# union is composed of only symbols.
__slots__ = ['_tag', '_value']
_tagmap = {} # type: typing.Dict[typing.Text, bv.Validator]
_permissioned_tagmaps = set() # type: typing.Set[typing.Text]
def __init__(self, tag, value=None):
# type: (typing.Text, typing.Optional[typing.Any]) -> None
assert tag in self._tagmap, 'Invalid tag %r.' % tag
validator = self._tagmap[tag]
validator = None
tagmap_names = ['_{}_tagmap'.format(map_name) for map_name in self._permissioned_tagmaps]
for tagmap_name in ['_tagmap'] + tagmap_names:
if tag in getattr(self, tagmap_name):
validator = getattr(self, tagmap_name)[tag]
assert validator is not None, 'Invalid tag %r.' % tag
if isinstance(validator, bv.Void):
assert value is None, 'Void type union member must have None value.'
elif isinstance(validator, (bv.Struct, bv.Union)):
......@@ -54,6 +58,31 @@ class Union(object):
def __hash__(self):
return hash((self._tag, self._value))
@classmethod
def _is_tag_present(cls, tag, caller_permissions):
assert tag, 'tag value should not be None'
if tag in cls._tagmap:
return True
for extra_permission in caller_permissions.permissions:
tagmap_name = '_{}_tagmap'.format(extra_permission)
if hasattr(cls, tagmap_name) and tag in getattr(cls, tagmap_name):
return True
return False
@classmethod
def _get_val_data_type(cls, tag, caller_permissions):
assert tag, 'tag value should not be None'
for extra_permission in caller_permissions.permissions:
tagmap_name = '_{}_tagmap'.format(extra_permission)
if hasattr(cls, tagmap_name) and tag in getattr(cls, tagmap_name):
return getattr(cls, tagmap_name)[tag]
return cls._tagmap[tag]
class Route(object):
def __init__(self, name, deprecated, arg_type, result_type, error_type, attrs):
......
This diff is collapsed.
......@@ -14,6 +14,7 @@ from __future__ import absolute_import, unicode_literals
from abc import ABCMeta, abstractmethod
import datetime
import hashlib
import math
import numbers
import re
......@@ -455,6 +456,16 @@ class Struct(Composite):
self.validate_fields_only(val)
return val
def validate_with_permissions(self, val, caller_permissions):
"""
For a val to pass validation, val must be of the correct type and have
all required permissioned fields present. Should only be called
for callers with extra permissions.
"""
self.validate(val)
self.validate_fields_only_with_permissions(val, caller_permissions)
return val
def validate_fields_only(self, val):
"""
To pass field validation, no required field should be missing.
......@@ -465,11 +476,27 @@ class Struct(Composite):
FIXME(kelkabany): Since the definition object does not maintain a list
of which fields are required, all fields are scanned.
"""
for field_name, _ in self.definition._all_fields_:
for field_name in self.definition._all_field_names_:
if not hasattr(val, field_name):
raise ValidationError("missing required field '%s'" %
field_name)
def validate_fields_only_with_permissions(self, val, caller_permissions):
"""
To pass field validation, no required field should be missing.
This method assumes that the contents of each field have already been
validated on assignment, so it's merely a presence check.
Should only be called for callers with extra permissions.
"""
self.validate_fields_only(val)
# check if type has been patched
for extra_permission in caller_permissions.permissions:
all_field_names = '_all_{}_field_names_'.format(extra_permission)
for field_name in getattr(self.definition, all_field_names, set()):
if not hasattr(val, field_name):
raise ValidationError("missing required field '%s'" % field_name)
def validate_type_only(self, val):
"""
Use this when you only want to validate that the type of an object
......@@ -590,3 +617,54 @@ class Nullable(Validator):
def get_default(self):
return None
class Redactor(object):
def __init__(self, regex):
"""
Args:
regex: What parts of the field to redact.
"""
self.regex = regex
@abstractmethod
def apply(self, val):
"""Redacts information from annotated field.
Returns: A redacted version of the string provided.
"""
pass
def _get_matches(self, val):
if not self.regex:
return None
try:
return re.search(self.regex, val)
except TypeError:
return None
class HashRedactor(Redactor):
def apply(self, val):
matches = self._get_matches(val)
val_to_hash = str(val) if isinstance(val, int) or isinstance(val, float) else val
try:
# add string literal to ensure unicode
hashed = hashlib.md5(val_to_hash.encode('utf-8')).hexdigest() + ''
except [AttributeError, ValueError]:
hashed = None
if matches:
blotted = '***'.join(matches.groups())
if hashed:
return '{} ({})'.format(hashed, blotted)
return blotted
return hashed
class BlotRedactor(Redactor):
def apply(self, val):
matches = self._get_matches(val)
if matches:
return '***'.join(matches.groups())
return '********'
This diff is collapsed.
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
try:
......
This diff is collapsed.
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
try:
......@@ -69,6 +70,43 @@ class EmmState(bb.Union):
EmmState_validator = bv.Union(EmmState)
class GroupCreation(bb.Union):
"""
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar admins_and_members: Team admins and members can create groups.
:ivar admins_only: Only team admins can create groups.
"""
_catch_all = None
# Attribute is overwritten below the class definition
admins_and_members = None
# Attribute is overwritten below the class definition
admins_only = None
def is_admins_and_members(self):
"""
Check if the union tag is ``admins_and_members``.
:rtype: bool
"""
return self._tag == 'admins_and_members'
def is_admins_only(self):
"""
Check if the union tag is ``admins_only``.
:rtype: bool
"""
return self._tag == 'admins_only'
def __repr__(self):
return 'GroupCreation(%r, %r)' % (self._tag, self._value)
GroupCreation_validator = bv.Union(GroupCreation)
class OfficeAddInPolicy(bb.Union):
"""
This class acts as a tagged union. Only one of the ``is_*`` methods will
......@@ -498,6 +536,54 @@ class SharedLinkCreatePolicy(bb.Union):
SharedLinkCreatePolicy_validator = bv.Union(SharedLinkCreatePolicy)
class SmartSyncPolicy(bb.Union):
"""
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar local: The specified content will be synced as local files by default.
:ivar on_demand: The specified content will be synced as on-demand files by
default.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
local = None
# Attribute is overwritten below the class definition
on_demand = None
# Attribute is overwritten below the class definition
other = None
def is_local(self):
"""
Check if the union tag is ``local``.
:rtype: bool
"""
return self._tag == 'local'
def is_on_demand(self):
"""
Check if the union tag is ``on_demand``.
:rtype: bool
"""
return self._tag == 'on_demand'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def __repr__(self):
return 'SmartSyncPolicy(%r, %r)' % (self._tag, self._value)
SmartSyncPolicy_validator = bv.Union(SmartSyncPolicy)
class SsoPolicy(bb.Union):
"""
This class acts as a tagged union. Only one of the ``is_*`` methods will
......@@ -865,6 +951,16 @@ EmmState.optional = EmmState('optional')
EmmState.required = EmmState('required')
EmmState.other = EmmState('other')
GroupCreation._admins_and_members_validator = bv.Void()
GroupCreation._admins_only_validator = bv.Void()
GroupCreation._tagmap = {
'admins_and_members': GroupCreation._admins_and_members_validator,
'admins_only': GroupCreation._admins_only_validator,
}
GroupCreation.admins_and_members = GroupCreation('admins_and_members')
GroupCreation.admins_only = GroupCreation('admins_only')
OfficeAddInPolicy._disabled_validator = bv.Void()
OfficeAddInPolicy._enabled_validator = bv.Void()
OfficeAddInPolicy._other_validator = bv.Void()
......@@ -978,6 +1074,19 @@ SharedLinkCreatePolicy.default_team_only = SharedLinkCreatePolicy('default_team_
SharedLinkCreatePolicy.team_only = SharedLinkCreatePolicy('team_only')
SharedLinkCreatePolicy.other = SharedLinkCreatePolicy('other')
SmartSyncPolicy._local_validator = bv.Void()
SmartSyncPolicy._on_demand_validator = bv.Void()
SmartSyncPolicy._other_validator = bv.Void()
SmartSyncPolicy._tagmap = {
'local': SmartSyncPolicy._local_validator,
'on_demand': SmartSyncPolicy._on_demand_validator,
'other': SmartSyncPolicy._other_validator,
}
SmartSyncPolicy.local = SmartSyncPolicy('local')
SmartSyncPolicy.on_demand = SmartSyncPolicy('on_demand')
SmartSyncPolicy.other = SmartSyncPolicy('other')
SsoPolicy._disabled_validator = bv.Void()
SsoPolicy._optional_validator = bv.Void()
SsoPolicy._required_validator = bv.Void()
......
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
......@@ -17,10 +18,12 @@ except (SystemError, ValueError):
try:
from . import (
common,
team_policies,
users_common,
)
except (SystemError, ValueError):
import common
import team_policies
import users_common
......@@ -372,6 +375,7 @@ class FullAccount(Account):
current account is personal, then ``team`` will always be None, but
``is_paired`` will indicate if a work account is linked.
:ivar account_type: What type of account this user has.
:ivar root_info: The root info for this account.
"""
__slots__ = [
......@@ -389,6 +393,8 @@ class FullAccount(Account):
'_is_paired_present',
'_account_type_value',
'_account_type_present',
'_root_info_value',
'_root_info_present',
]
_has_required_fields = True
......@@ -403,6 +409,7 @@ class FullAccount(Account):
referral_link=None,
is_paired=None,
account_type=None,
root_info=None,
profile_photo_url=None,
country=None,
team=None,
......@@ -427,6 +434,8 @@ class FullAccount(Account):
self._is_paired_present = False
self._account_type_value = None
self._account_type_present = False
self._root_info_value = None
self._root_info_present = False
if country is not None:
self.country = country
if locale is not None:
......@@ -441,6 +450,8 @@ class FullAccount(Account):
self.is_paired = is_paired
if account_type is not None:
self.account_type = account_type
if root_info is not None:
self.root_info = root_info
@property
def country(self):
......@@ -617,8 +628,31 @@ class FullAccount(Account):
self._account_type_value = None
self._account_type_present = False
@property
def root_info(self):
"""
The root info for this account.
:rtype: common.RootInfo_validator
"""
if self._root_info_present:
return self._root_info_value
else:
raise AttributeError("missing required field 'root_info'")
@root_info.setter
def root_info(self, val):
self._root_info_validator.validate_type_only(val)
self._root_info_value = val
self._root_info_present = True
@root_info.deleter
def root_info(self):
self._root_info_value = None
self._root_info_present = False
def __repr__(self):
return 'FullAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, disabled={!r}, locale={!r}, referral_link={!r}, is_paired={!r}, account_type={!r}, profile_photo_url={!r}, country={!r}, team={!r}, team_member_id={!r})'.format(
return 'FullAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, disabled={!r}, locale={!r}, referral_link={!r}, is_paired={!r}, account_type={!r}, root_info={!r}, profile_photo_url={!r}, country={!r}, team={!r}, team_member_id={!r})'.format(
self._account_id_value,
self._name_value,
self._email_value,
......@@ -628,6 +662,7 @@ class FullAccount(Account):
self._referral_link_value,
self._is_paired_value,
self._account_type_value,
self._root_info_value,
self._profile_photo_url_value,
self._country_value,
self._team_value,
......@@ -1539,6 +1574,7 @@ FullAccount._team_validator = bv.Nullable(FullTeam_validator)
FullAccount._team_member_id_validator = bv.Nullable(bv.String())
FullAccount._is_paired_validator = bv.Boolean()
FullAccount._account_type_validator = users_common.AccountType_validator
FullAccount._root_info_validator = common.RootInfo_validator
FullAccount._all_field_names_ = Account._all_field_names_.union(set([
'country',
'locale',
......@@ -1547,6 +1583,7 @@ FullAccount._all_field_names_ = Account._all_field_names_.union(set([
'team_member_id',
'is_paired',
'account_type',
'root_info',
]))
FullAccount._all_fields_ = Account._all_fields_ + [
('country', FullAccount._country_validator),
......@@ -1556,6 +1593,7 @@ FullAccount._all_fields_ = Account._all_fields_ + [
('team_member_id', FullAccount._team_member_id_validator),
('is_paired', FullAccount._is_paired_validator),
('account_type', FullAccount._account_type_validator),
('root_info', FullAccount._root_info_validator),
]
Team._id_validator = bv.String()
......
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment