cli2 4.3.1__tar.gz → 4.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cli2-4.3.1/cli2.egg-info → cli2-4.3.3}/PKG-INFO +1 -1
- {cli2-4.3.1 → cli2-4.3.3}/cli2/client.py +8 -5
- {cli2-4.3.1 → cli2-4.3.3/cli2.egg-info}/PKG-INFO +1 -1
- {cli2-4.3.1 → cli2-4.3.3}/setup.py +1 -1
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_client.py +5 -2
- {cli2-4.3.1 → cli2-4.3.3}/MANIFEST.in +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/README.rst +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/classifiers.txt +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/__init__.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/ansible/__init__.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/ansible/action.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/ansible/playbook.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/ansible/variables.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/asyncio.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/cli.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/cli2.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/colors.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/configuration.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/decorators.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/display.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/__init__.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/client.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/conf.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/example.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/example_obj.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/nesting.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/obj.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/obj2.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/examples/test.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/lock.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/log.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/mask.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/node.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/sphinx.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/table.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2/test.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2.egg-info/requires.txt +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/cli2.egg-info/top_level.txt +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/setup.cfg +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_ansible.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_ansible_variables.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_asyncio.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_cli.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_command.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_configuration.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_decorators.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_display.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_entry_point.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_group.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_inject.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_lock.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_mask.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_node.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_restful.py +0 -0
- {cli2-4.3.1 → cli2-4.3.3}/tests/test_table.py +0 -0
|
@@ -155,6 +155,8 @@ class Paginator:
|
|
|
155
155
|
return
|
|
156
156
|
|
|
157
157
|
self.pagination_initialize(data)
|
|
158
|
+
if not self.per_page:
|
|
159
|
+
self.per_page = len(self.data_items(data))
|
|
158
160
|
self.initialized = True
|
|
159
161
|
|
|
160
162
|
def pagination_initialize(self, data):
|
|
@@ -248,10 +250,10 @@ class Paginator:
|
|
|
248
250
|
:param page_number: Page number to get the items from
|
|
249
251
|
"""
|
|
250
252
|
params = self.params.copy()
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
if page_number > 1:
|
|
254
|
+
try:
|
|
255
|
+
self.pagination_parameters(params, page_number)
|
|
256
|
+
except NotImplementedError:
|
|
255
257
|
raise
|
|
256
258
|
for expression in self.expressions:
|
|
257
259
|
if expression.parameterable:
|
|
@@ -1295,7 +1297,8 @@ class ClientCommand(Command):
|
|
|
1295
1297
|
|
|
1296
1298
|
async def post_call(self):
|
|
1297
1299
|
""" Call :py:meth:`Client.post_call`. """
|
|
1298
|
-
|
|
1300
|
+
if self.client:
|
|
1301
|
+
await self.client.post_call(self)
|
|
1299
1302
|
|
|
1300
1303
|
|
|
1301
1304
|
class Client(metaclass=ClientMetaclass):
|
|
@@ -514,12 +514,11 @@ async def test_pagination_patterns(httpx_mock, client_class):
|
|
|
514
514
|
self.total_items = data['total']
|
|
515
515
|
|
|
516
516
|
def pagination_parameters(self, params, page_number):
|
|
517
|
-
self.per_page = 1
|
|
518
517
|
params['offset'] = (page_number - 1) * self.per_page
|
|
519
518
|
params['limit'] = self.per_page
|
|
520
519
|
|
|
521
520
|
httpx_mock.add_response(
|
|
522
|
-
url='http://lol/off
|
|
521
|
+
url='http://lol/off',
|
|
523
522
|
json=dict(total=2, items=[dict(a=1)]),
|
|
524
523
|
)
|
|
525
524
|
|
|
@@ -1200,3 +1199,7 @@ def test_client_command(client_class, httpx_mock):
|
|
|
1200
1199
|
cmd = Client.cli['model']['get']
|
|
1201
1200
|
cmd()
|
|
1202
1201
|
assert not Client.post_call_called
|
|
1202
|
+
|
|
1203
|
+
cmd = Client.cli['request']
|
|
1204
|
+
cmd()
|
|
1205
|
+
assert not Client.post_call_called
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|