File: account_info.py

package info (click to toggle)
python-b2sdk 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,020 kB
  • sloc: python: 30,902; sh: 13; makefile: 8
file content (78 lines) | stat: -rw-r--r-- 2,033 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
######################################################################
#
# File: b2sdk/v0/account_info.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import annotations

from b2sdk._internal import version_utils
from b2sdk import v1


class OldAccountInfoMethods:
    """this class contains proxy methods for deprecated signatures renamed for consistency in mid-2019"""

    def get_account_id_or_app_key_id(self):
        """
        Return the application key ID used to authenticate.

        :rtype: str

        .. deprecated:: 0.1.6
           Use :func:`get_application_key_id` instead.
        """
        return self.get_application_key_id()

    @version_utils.rename_argument(
        'account_id_or_app_key_id',
        'application_key_id',
        '0.1.5',
        None,
    )
    def set_auth_data(
        self,
        account_id,
        auth_token,
        api_url,
        download_url,
        minimum_part_size,
        application_key,
        realm,
        allowed=None,
        application_key_id=None,
        s3_api_url=None,
    ):
        # we need to enumerate all the parameters and cannot just "*args, **kwargs" because
        # the deprecation decorator doesn't feel safe with the kwargs approach
        return super().set_auth_data(
            account_id,
            auth_token,
            api_url,
            download_url,
            minimum_part_size,
            application_key,
            realm,
            allowed,
            application_key_id,
            s3_api_url=s3_api_url,
        )


class AbstractAccountInfo(OldAccountInfoMethods, v1.AbstractAccountInfo):
    pass


class InMemoryAccountInfo(OldAccountInfoMethods, v1.InMemoryAccountInfo):
    pass


class UrlPoolAccountInfo(OldAccountInfoMethods, v1.UrlPoolAccountInfo):
    pass


class SqliteAccountInfo(OldAccountInfoMethods, v1.SqliteAccountInfo):
    pass