Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a8f5583
set_shutting_down moved from CLI
dparamonov-reef Feb 28, 2019
14489b8
rst files renamed according to package name
dparamonov-reef Feb 28, 2019
663760f
Added docs for b2sdk.transferer
dparamonov-reef Feb 28, 2019
2e370ea
Unneeded file removed
dparamonov-reef Feb 28, 2019
d76520b
Table of contents updated
dparamonov-reef Feb 28, 2019
26ecabb
Docstrings fixed in order to eliminate warnings during docs build
dparamonov-reef Feb 28, 2019
bffcad1
Docstrings for b2sdk.api module updated
dparamonov-reef Mar 1, 2019
89167bb
Correctly set types in docstrings
dparamonov-reef Mar 1, 2019
aa1d920
Docstrings for b2sdk.b2hhtp module updated
dparamonov-reef Mar 1, 2019
8ac16fd
Docstrings for b2sdk.bounded_queue_executor were updated
dparamonov-reef Mar 1, 2019
ae455c5
Docstrings for objects in b2sdk.bucket module added
dparamonov-reef Mar 2, 2019
65bd9c8
Formatting fixed
dparamonov-reef Mar 2, 2019
31d67aa
Docstrings added for objects from b2sdk.progress module
dparamonov-reef Mar 2, 2019
55d5d90
Docstrings added for objects in b2sdk.sync.action module
dparamonov-reef Mar 2, 2019
c8d3a8b
Docstrings added for objects in b2sdk.sync.exception module
dparamonov-reef Mar 2, 2019
f60c82a
Docstrings added for objects in b2sdk.sync.file module
dparamonov-reef Mar 2, 2019
6f03ac1
Docstrings added for objects in b2sdk.sync.folder_parser module
dparamonov-reef Mar 2, 2019
be569e9
Typos fixed
dparamonov-reef Mar 2, 2019
9c42cb1
Docstrings for reporter objects updated
dparamonov-reef Mar 2, 2019
a493949
Docstrings added for objects in module b2sdk.sync.folder
dparamonov-reef Mar 2, 2019
7f2db66
Docstrings added for objects in policy_manager module
dparamonov-reef Mar 4, 2019
32cd955
Docstrings adde for objects in b2sdk.sync.policy module
dparamonov-reef Mar 4, 2019
fca7a66
Docstrings added for objects in b2sdk.sync.report module
dparamonov-reef Mar 4, 2019
c79216e
Docstrings added for objects in b2sdk.sync.scan_policies module
dparamonov-reef Mar 4, 2019
f35009e
Docstrings updated, strings -> objects
dparamonov-reef Mar 4, 2019
ed6ccc7
flie and folder objects' types updated in docstrings
dparamonov-reef Mar 4, 2019
aabd754
Docstrings added for objects in b2sdk.sync.sync module
dparamonov-reef Mar 4, 2019
ad765ce
Module content entries removed from ToC as uneeded
dparamonov-reef Mar 4, 2019
e965775
Rename B2_Command_Line_Tool to B2 Python SDK
dparamonov-reef Mar 4, 2019
b82ff7e
Sphinx theme changed to sphinx_rtd_theme
dparamonov-reef Mar 5, 2019
d2e7a6e
Docstrings added for objects in module b2sdk.account_info.abstract
dparamonov-reef Mar 5, 2019
b434ce4
Docstrings added for objects in b2sdk.account_info.exception module
dparamonov-reef Mar 5, 2019
dd1e124
Docstrings added for objects in b2sdk.account_info.sqlite_account_info
dparamonov-reef Mar 5, 2019
2d58439
Docstrings added for objects in b2sdk.account_info.upload_url_pool
dparamonov-reef Mar 5, 2019
a175b77
docstring fixed
dparamonov-reef Mar 5, 2019
4b9d2a1
Docstrings added for objects in b2sdk.account_info.in_memory
dparamonov-reef Mar 5, 2019
41e5a0f
indentation fixed in docstrings
dparamonov-reef Mar 5, 2019
628464d
Docs structure updated
dparamonov-reef Mar 5, 2019
cbddaae
Docstrings added for objects in b2sdk.utils module
dparamonov-reef Mar 5, 2019
ad7664c
Fixed quoting in docstring
dparamonov-reef Mar 5, 2019
8104a77
docstring added to url_for_api function
dparamonov-reef Mar 5, 2019
91958f9
Exclude set_auth_data_with_schema_0_for_test from a set of documented…
dparamonov-reef Mar 9, 2019
c8ffc66
Remove functions to gracefully stop threads
dparamonov-reef Mar 9, 2019
2d3d1d4
Fix formatting
dparamonov-reef Mar 9, 2019
3d9ed39
Merge branch 'keyboard-interrupt' into sphinx-docs
dparamonov-reef Mar 9, 2019
d787c89
Fix formatting issues
dparamonov-reef Mar 9, 2019
09d37aa
Delete parse_args module and related unit tests
dparamonov-reef Mar 9, 2019
66f2a4a
Remove repr_dict_deterministically function
dparamonov-reef Mar 9, 2019
d7f9ed7
Remove trailing whitespaces from docstrings
dparamonov-reef Mar 10, 2019
5fe94b6
Remove extra spaces in docstrings
dparamonov-reef Mar 11, 2019
db77fd8
Add installation guide docs template
dparamonov-reef Mar 13, 2019
81dedf5
Add tutorial docs template
dparamonov-reef Mar 13, 2019
70ee755
Update table of contents
dparamonov-reef Mar 13, 2019
83d8b15
Add overview section to the docs
dparamonov-reef Mar 13, 2019
188e1c5
Add installation instructions
dparamonov-reef Mar 13, 2019
0b30b6b
Remove extra spaces in docstrings
dparamonov-reef Mar 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 120 additions & 8 deletions b2sdk/account_info/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class AbstractAccountInfo(object):

@classmethod
def all_capabilities(cls):
"""
Return a list of all possible capabilities

:rtype: list
"""
return cls.ALL_CAPABILITIES

@abstractmethod
Expand All @@ -58,64 +63,112 @@ def clear(self):
def refresh_entire_bucket_name_cache(self, name_id_iterable):
"""
Removes all previous name-to-id mappings and stores new ones.

:param name_id_iterable: a list of tuples of the form (name, id)
:type name_id_iterable: list
"""

@abstractmethod
def remove_bucket_name(self, bucket_name):
"""
Removes one entry from the bucket name cache.

:param bucket_name: a bucket name
:type bucket_name: str
"""

@abstractmethod
def save_bucket(self, bucket):
"""
Remembers the ID for a bucket name.

:param bucket: a Bucket object
:type bucket: b2sdk.bucket.Bucket
"""

@abstractmethod
def get_bucket_id_or_none_from_bucket_name(self, bucket_name):
"""
Looks up the bucket ID for a given bucket name.

:param bucket_name: a bucket name
:type bucket_name: str
:return bucket ID or None:
:rtype: str, None
"""

@abstractmethod
def clear_bucket_upload_data(self, bucket_id):
"""
Removes all upload URLs for the given bucket.

:param bucket_id: a bucket ID
:type bucket_id: str
"""

@abstractmethod
def get_account_id(self):
""" returns account_id or raises MissingAccountData exception """
"""
Returns account_id or raises MissingAccountData exception

:rtype: str
"""

@abstractmethod
def get_account_id_or_app_key_id(self):
""" returns the account id or key id used to authenticate """
"""
Returns the account id or key id used to authenticate

:rtype: str
"""

@abstractmethod
def get_account_auth_token(self):
""" returns account_auth_token or raises MissingAccountData exception """
"""
Returns account_auth_token or raises MissingAccountData exception

:rtype: str
"""

@abstractmethod
def get_api_url(self):
""" returns api_url or raises MissingAccountData exception """
"""
Returns api_url or raises MissingAccountData exception

:rtype: str
"""

@abstractmethod
def get_application_key(self):
""" returns application_key or raises MissingAccountData exception """
"""
Returns application_key or raises MissingAccountData exception

:rtype: str
"""

@abstractmethod
def get_download_url(self):
""" returns download_url or raises MissingAccountData exception """
"""
Returns download_url or raises MissingAccountData exception

:rtype: str
"""

@abstractmethod
def get_realm(self):
""" returns realm or raises MissingAccountData exception """
"""
Returns realm or raises MissingAccountData exception

:rtype: str
"""

@abstractmethod
def get_minimum_part_size(self):
"""
:return: returns the minimum number of bytes in a part of a large file
Return the minimum number of bytes in a part of a large file

:return: number of bytes
:rtype: int
"""

@abstractmethod
Expand All @@ -124,6 +177,8 @@ def get_allowed(self):
An 'allowed' dict, as returned by b2_authorize_account.
Never None; for account info that was saved before 'allowed' existed,
returns DEFAULT_ALLOWED.

:rtype: dict
"""

@limit_trace_arguments(only=['self', 'api_url', 'download_url', 'minimum_part_size', 'realm'])
Expand All @@ -149,6 +204,25 @@ def set_auth_data(
a bucketName field. For keys with bucket restrictions, the name of the bucket is looked
up and stored, too. The console_tool does everything by bucket name, so it's convenient
to have the restricted bucket name handy.

:param account_id: user account ID
:type account_id: str
:param auth_token: user authentication token
:type auth_token: str
:param api_url: an API URL
:type api_url: str
:param download_url: path download URL
:type download_url: str
:param minimum_part_size: minimum size of the file part
:type minimum_part_size: int
:param application_key: application key
:type application_key: str
:param realm: a realm to authiroze account in
:type realm: str
:param allowed: the structure to use for old account info that was saved without 'allowed'
:type allowed: dict
:param account_id_or_app_key_id: account ID or application key ID
:type account_id_or_app_key_id: str
"""
if allowed is None:
allowed = self.DEFAULT_ALLOWED
Expand All @@ -173,6 +247,10 @@ def allowed_is_valid(cls, allowed):

If the bucketId is for a bucket that no longer exists, or the
capabilities do not allow listBuckets, then we won't have a bucketName.

:param allowed: the structure to use for old account info that was saved without 'allowed'
:type allowed: dict
:rtype: bool
"""
return (
('bucketId' in allowed) and ('bucketName' in allowed) and
Expand Down Expand Up @@ -203,6 +281,10 @@ def take_bucket_upload_url(self, bucket_id):
Returns a pair (upload_url, upload_auth_token) that has been removed
from the pool for this bucket, or (None, None) if there are no more
left.

:param bucket_id: a bucket ID
:type bucket_id: str
:rtype: tuple
"""

@abstractmethod
Expand All @@ -211,17 +293,47 @@ def put_bucket_upload_url(self, bucket_id, upload_url, upload_auth_token):
"""
Add an (upload_url, upload_auth_token) pair to the pool available for
the bucket.

:param bucket_id: a bucket ID
:type bucket_id: str
:param upload_url: an upload URL
:type upload_url: str
:param upload_auth_token: an upload authentication token
:type upload_auth_token: str
:rtype: tuple
"""

@abstractmethod
@limit_trace_arguments(only=['self'])
def put_large_file_upload_url(self, file_id, upload_url, upload_auth_token):
"""
Put large file upload URL into a pool

:param file_id: a file ID
:type file_id: str
:param upload_url: an upload URL
:type upload_url: str
:param upload_auth_token: an upload authentication token
:type upload_auth_token: str
"""
pass

@abstractmethod
def take_large_file_upload_url(self, file_id):
"""
Take large file upload URL from a pool

:param file_id: a file ID
:type file_id: str
"""
pass

@abstractmethod
def clear_large_file_upload_urls(self, file_id):
"""
Clear a pool of URLs for a given file ID

:param file_id: a file ID
:type file_id: str
"""
pass
19 changes: 19 additions & 0 deletions b2sdk/account_info/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,22 @@

@six.add_metaclass(ABCMeta)
class AccountInfoError(B2Error):
"""
Base class for all account info errors
"""
pass


class CorruptAccountInfo(AccountInfoError):
"""
Raised when an account info file is corrupted
"""

def __init__(self, file_name):
"""
:param file_name: an account info file name
:type file_name: str
"""
super(CorruptAccountInfo, self).__init__()
self.file_name = file_name

Expand All @@ -32,7 +43,15 @@ def __str__(self):


class MissingAccountData(AccountInfoError):
"""
Raised when there is no account info data available
"""

def __init__(self, key):
"""
:param key: a key for getting account data
:type key: str
"""
super(MissingAccountData, self).__init__()
self.key = key

Expand Down
Loading