diff options
author | Miroslav Šedivý <[email protected]> | 2022-12-02 22:04:23 +0100 |
---|---|---|
committer | Miroslav Šedivý <[email protected]> | 2022-12-02 22:04:23 +0100 |
commit | 325cc917d5ad14b130b156d23b7adca46499dc24 (patch) | |
tree | 247b41199512db9693d00baf7522602805e31c3f /mastodon/lists.py | |
parent | c796cf39b01e38fe381fb4743988da991b072183 (diff) | |
download | mastodon.py-325cc917d5ad14b130b156d23b7adca46499dc24.tar.gz |
refactor: use f-strings
Diffstat (limited to 'mastodon/lists.py')
-rw-r--r-- | mastodon/lists.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mastodon/lists.py b/mastodon/lists.py index 0882133..57ced46 100644 --- a/mastodon/lists.py +++ b/mastodon/lists.py | |||
@@ -26,7 +26,7 @@ class Mastodon(Internals): | |||
26 | Returns a :ref:`list dict <list dict>`. | 26 | Returns a :ref:`list dict <list dict>`. |
27 | """ | 27 | """ |
28 | id = self.__unpack_id(id) | 28 | id = self.__unpack_id(id) |
29 | return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) | 29 | return self.__api_request('GET', f'/api/v1/lists/{id}') |
30 | 30 | ||
31 | @api_version("2.1.0", "2.6.0", _DICT_VERSION_ACCOUNT) | 31 | @api_version("2.1.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
32 | def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None): | 32 | def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None): |
@@ -47,7 +47,7 @@ class Mastodon(Internals): | |||
47 | since_id = self.__unpack_id(since_id, dateconv=True) | 47 | since_id = self.__unpack_id(since_id, dateconv=True) |
48 | 48 | ||
49 | params = self.__generate_params(locals(), ['id']) | 49 | params = self.__generate_params(locals(), ['id']) |
50 | return self.__api_request('GET', '/api/v1/lists/{0}/accounts'.format(id)) | 50 | return self.__api_request('GET', f'/api/v1/lists/{id}/accounts') |
51 | 51 | ||
52 | ### | 52 | ### |
53 | # Writing data: Lists | 53 | # Writing data: Lists |
@@ -71,7 +71,7 @@ class Mastodon(Internals): | |||
71 | """ | 71 | """ |
72 | id = self.__unpack_id(id) | 72 | id = self.__unpack_id(id) |
73 | params = self.__generate_params(locals(), ['id']) | 73 | params = self.__generate_params(locals(), ['id']) |
74 | return self.__api_request('PUT', '/api/v1/lists/{0}'.format(id), params) | 74 | return self.__api_request('PUT', f'/api/v1/lists/{id}', params) |
75 | 75 | ||
76 | @api_version("2.1.0", "2.1.0", "2.1.0") | 76 | @api_version("2.1.0", "2.1.0", "2.1.0") |
77 | def list_delete(self, id): | 77 | def list_delete(self, id): |
@@ -79,7 +79,7 @@ class Mastodon(Internals): | |||
79 | Delete a list. | 79 | Delete a list. |
80 | """ | 80 | """ |
81 | id = self.__unpack_id(id) | 81 | id = self.__unpack_id(id) |
82 | self.__api_request('DELETE', '/api/v1/lists/{0}'.format(id)) | 82 | self.__api_request('DELETE', f'/api/v1/lists/{id}') |
83 | 83 | ||
84 | @api_version("2.1.0", "2.1.0", "2.1.0") | 84 | @api_version("2.1.0", "2.1.0", "2.1.0") |
85 | def list_accounts_add(self, id, account_ids): | 85 | def list_accounts_add(self, id, account_ids): |
@@ -93,8 +93,7 @@ class Mastodon(Internals): | |||
93 | account_ids = list(map(lambda x: self.__unpack_id(x), account_ids)) | 93 | account_ids = list(map(lambda x: self.__unpack_id(x), account_ids)) |
94 | 94 | ||
95 | params = self.__generate_params(locals(), ['id']) | 95 | params = self.__generate_params(locals(), ['id']) |
96 | self.__api_request( | 96 | self.__api_request('POST', f'/api/v1/lists/{id}/accounts', params) |
97 | 'POST', '/api/v1/lists/{0}/accounts'.format(id), params) | ||
98 | 97 | ||
99 | @api_version("2.1.0", "2.1.0", "2.1.0") | 98 | @api_version("2.1.0", "2.1.0", "2.1.0") |
100 | def list_accounts_delete(self, id, account_ids): | 99 | def list_accounts_delete(self, id, account_ids): |
@@ -108,5 +107,4 @@ class Mastodon(Internals): | |||
108 | account_ids = list(map(lambda x: self.__unpack_id(x), account_ids)) | 107 | account_ids = list(map(lambda x: self.__unpack_id(x), account_ids)) |
109 | 108 | ||
110 | params = self.__generate_params(locals(), ['id']) | 109 | params = self.__generate_params(locals(), ['id']) |
111 | self.__api_request( | 110 | self.__api_request('DELETE', f'/api/v1/lists/{id}/accounts', params) \ No newline at end of file |
112 | 'DELETE', '/api/v1/lists/{0}/accounts'.format(id), params) \ No newline at end of file | ||