cli2 4.1.0rc17__tar.gz → 4.1.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.1.3/MANIFEST.in +2 -0
- {cli2-4.1.0rc17/cli2.egg-info → cli2-4.1.3}/PKG-INFO +1 -1
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/cli.py +1 -1
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/client.py +9 -1
- {cli2-4.1.0rc17 → cli2-4.1.3/cli2.egg-info}/PKG-INFO +1 -1
- cli2-4.1.3/setup.py +90 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_cli.py +2 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_client.py +5 -1
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_command.py +2 -2
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_restful.py +3 -3
- cli2-4.1.0rc17/MANIFEST.in +0 -2
- cli2-4.1.0rc17/setup.py +0 -44
- {cli2-4.1.0rc17 → cli2-4.1.3}/README.rst +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/classifiers.txt +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/__init__.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/ansible/__init__.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/ansible/action.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/ansible/playbook.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/ansible/variables.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/asyncio.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/cli2.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/colors.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/configuration.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/decorators.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/display.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/__init__.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/client.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/conf.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/example.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/example_obj.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/nesting.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/obj.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/obj2.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/examples/test.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/lock.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/log.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/node.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/sphinx.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/table.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2/test.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2.egg-info/requires.txt +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/cli2.egg-info/top_level.txt +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/setup.cfg +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_ansible.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_ansible_variables.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_asyncio.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_configuration.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_decorators.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_display.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_entry_point.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_group.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_inject.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_lock.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_node.py +0 -0
- {cli2-4.1.0rc17 → cli2-4.1.3}/tests/test_table.py +0 -0
cli2-4.1.3/MANIFEST.in
ADDED
|
@@ -1129,7 +1129,7 @@ class Argument:
|
|
|
1129
1129
|
# priority to varkwargs for word= and **{}
|
|
1130
1130
|
last = self.cmd[[*self.cmd.keys()][-1]]
|
|
1131
1131
|
if last is not self and last.param.kind == self.param.VAR_KEYWORD:
|
|
1132
|
-
if re.match('^-?-?[
|
|
1132
|
+
if re.match('^-?-?[\\w]+=', arg):
|
|
1133
1133
|
return
|
|
1134
1134
|
elif arg.startswith('**{') and arg.endswith('}'):
|
|
1135
1135
|
return
|
|
@@ -1086,7 +1086,15 @@ class Handler:
|
|
|
1086
1086
|
# httpx session is rendered unusable after a TransportError
|
|
1087
1087
|
if isinstance(response, httpx.TransportError):
|
|
1088
1088
|
await asyncio.sleep(seconds)
|
|
1089
|
-
|
|
1089
|
+
kwargs = dict(error=repr(response))
|
|
1090
|
+
try:
|
|
1091
|
+
response.request
|
|
1092
|
+
except (RuntimeError, AttributeError):
|
|
1093
|
+
pass
|
|
1094
|
+
else:
|
|
1095
|
+
kwargs['method'] = response.request.method
|
|
1096
|
+
kwargs['url'] = str(response.request.url)
|
|
1097
|
+
log.warn('reconnect', **kwargs)
|
|
1090
1098
|
await client.client_reset()
|
|
1091
1099
|
return
|
|
1092
1100
|
|
cli2-4.1.3/setup.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
# We're not having that for the moment
|
|
4
|
+
# from setuptools.command.install import install
|
|
5
|
+
# from setuptools.command.develop import develop
|
|
6
|
+
# from pathlib import Path
|
|
7
|
+
# import os
|
|
8
|
+
# import shutil
|
|
9
|
+
# import sys
|
|
10
|
+
#
|
|
11
|
+
#
|
|
12
|
+
# class CollectionInstaller:
|
|
13
|
+
# @property
|
|
14
|
+
# def collection_target(self):
|
|
15
|
+
# target = Path(os.getenv('HOME'))
|
|
16
|
+
# target /= '.ansible/collections/ansible_collections/yourlabs/cli2'
|
|
17
|
+
# return target
|
|
18
|
+
#
|
|
19
|
+
#
|
|
20
|
+
# class Develop(CollectionInstaller, develop):
|
|
21
|
+
# def run(self):
|
|
22
|
+
# super().run()
|
|
23
|
+
#
|
|
24
|
+
# source = Path(self.egg_path) / 'cli2/ansible/collection'
|
|
25
|
+
# if self.collection_target.exists():
|
|
26
|
+
# if self.collection_target.is_symlink():
|
|
27
|
+
# if self.collection_target.resolve() == source:
|
|
28
|
+
# return
|
|
29
|
+
# elif self.collection_target.is_dir():
|
|
30
|
+
# shutil.rmtree(self.collection_target)
|
|
31
|
+
#
|
|
32
|
+
# self.collection_target.parent.mkdir(exist_ok=True, parents=True)
|
|
33
|
+
# self.collection_target.symlink_to(source)
|
|
34
|
+
#
|
|
35
|
+
#
|
|
36
|
+
# class Install(CollectionInstaller, install):
|
|
37
|
+
# def run(self):
|
|
38
|
+
# super().run()
|
|
39
|
+
#
|
|
40
|
+
# self.collection_target.parent.mkdir(exist_ok=True, parents=True)
|
|
41
|
+
# source = Path(self.install_lib) / 'cli2/ansible/collection'
|
|
42
|
+
# shutil.copytree(source, self.collection_target, dirs_exist_ok=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
setup(
|
|
46
|
+
name='cli2',
|
|
47
|
+
version='4.1.3',
|
|
48
|
+
setup_requires='setupmeta',
|
|
49
|
+
packages=['cli2'],
|
|
50
|
+
install_requires=[
|
|
51
|
+
'docstring_parser',
|
|
52
|
+
'pyyaml',
|
|
53
|
+
'pygments',
|
|
54
|
+
'structlog',
|
|
55
|
+
],
|
|
56
|
+
extras_require=dict(
|
|
57
|
+
client=[
|
|
58
|
+
'httpx',
|
|
59
|
+
'truststore',
|
|
60
|
+
],
|
|
61
|
+
test=[
|
|
62
|
+
'freezegun',
|
|
63
|
+
'pytest',
|
|
64
|
+
'pytest-cov',
|
|
65
|
+
'pytest-mock',
|
|
66
|
+
'pytest-asyncio',
|
|
67
|
+
'pytest-httpx',
|
|
68
|
+
],
|
|
69
|
+
),
|
|
70
|
+
author='James Pic',
|
|
71
|
+
author_email='jamespic@gmail.com',
|
|
72
|
+
url='https://yourlabs.io/oss/cli2',
|
|
73
|
+
include_package_data=True,
|
|
74
|
+
license='MIT',
|
|
75
|
+
keywords='cli',
|
|
76
|
+
python_requires='>=3.6',
|
|
77
|
+
entry_points={
|
|
78
|
+
'console_scripts': [
|
|
79
|
+
'cli2 = cli2.cli2:main.entry_point',
|
|
80
|
+
'cli2-example = cli2.examples.obj:cli.entry_point',
|
|
81
|
+
'cli2-example2 = cli2.examples.obj2:cli.entry_point',
|
|
82
|
+
'cli2-example-nesting = cli2.examples.nesting:cli.entry_point',
|
|
83
|
+
'cli2-example-client = cli2.examples.client:cli.entry_point',
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
# cmdclass={
|
|
87
|
+
# 'install': Install,
|
|
88
|
+
# 'develop': Develop,
|
|
89
|
+
# },
|
|
90
|
+
)
|
|
@@ -9,6 +9,8 @@ def test_call():
|
|
|
9
9
|
result = main('cli2.examples.test.example_function', 'x', 'y=z')
|
|
10
10
|
assert "args=('x',)" in result
|
|
11
11
|
assert "kwargs={'y': 'z'}" in result
|
|
12
|
+
result = main('cli2.examples.test.example_function', 'http://?x=bar')
|
|
13
|
+
assert "args=('http://?x=bar',)" in result
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
def test_doc_by_default(mocker):
|
|
@@ -299,10 +299,14 @@ async def test_handler(client_class):
|
|
|
299
299
|
await handler(client, response, 1, [], log)
|
|
300
300
|
|
|
301
301
|
assert not client.client_reset.await_count
|
|
302
|
-
|
|
302
|
+
exc = httpx.TransportError('foo')
|
|
303
|
+
exc.request = response.request
|
|
304
|
+
result = await handler(client, exc, 0, [], log)
|
|
303
305
|
log.warn.assert_called_once_with(
|
|
304
306
|
'reconnect',
|
|
305
307
|
error="TransportError('foo')",
|
|
308
|
+
method='POST',
|
|
309
|
+
url='/',
|
|
306
310
|
)
|
|
307
311
|
assert not result
|
|
308
312
|
assert client.client_reset.await_count == 1
|
|
@@ -108,12 +108,12 @@ def test_positional_only_looksahead():
|
|
|
108
108
|
return (one, two)
|
|
109
109
|
cmd = cli2.Command(foo)
|
|
110
110
|
|
|
111
|
-
cmd.parse('
|
|
111
|
+
cmd.parse('z=w', 'three=z', 'x', 'y')
|
|
112
112
|
assert cmd['one'].value == 'x'
|
|
113
113
|
assert cmd['two'].value == ['y']
|
|
114
114
|
assert cmd['three'].value == 'z'
|
|
115
115
|
# make sure it takes weird keywords too
|
|
116
|
-
assert cmd['kwargs'].value['
|
|
116
|
+
assert cmd['kwargs'].value['z'] == 'w'
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
def test_keyword_only():
|
|
@@ -40,7 +40,7 @@ async def test_create(httpx_mock):
|
|
|
40
40
|
capacity='5',
|
|
41
41
|
)
|
|
42
42
|
)
|
|
43
|
-
assert module.result['
|
|
43
|
+
assert module.result['data']['id'] == 1
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
@pytest.mark.asyncio
|
|
@@ -68,7 +68,7 @@ async def test_update(httpx_mock):
|
|
|
68
68
|
)
|
|
69
69
|
)
|
|
70
70
|
assert not module.result['changed']
|
|
71
|
-
assert module.result['
|
|
71
|
+
assert module.result['data']['id'] == 1
|
|
72
72
|
|
|
73
73
|
# testing for update
|
|
74
74
|
httpx_mock.add_response(
|
|
@@ -91,5 +91,5 @@ async def test_update(httpx_mock):
|
|
|
91
91
|
price='6',
|
|
92
92
|
)
|
|
93
93
|
)
|
|
94
|
-
assert module.result['
|
|
94
|
+
assert module.result['data']['id'] == 1
|
|
95
95
|
assert module.result['changed']
|
cli2-4.1.0rc17/MANIFEST.in
DELETED
cli2-4.1.0rc17/setup.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
setup(
|
|
5
|
-
name='cli2',
|
|
6
|
-
version='4.1.0rc17',
|
|
7
|
-
setup_requires='setupmeta',
|
|
8
|
-
install_requires=[
|
|
9
|
-
'docstring_parser',
|
|
10
|
-
'pyyaml',
|
|
11
|
-
'pygments',
|
|
12
|
-
'structlog',
|
|
13
|
-
],
|
|
14
|
-
extras_require=dict(
|
|
15
|
-
client=[
|
|
16
|
-
'httpx',
|
|
17
|
-
'truststore',
|
|
18
|
-
],
|
|
19
|
-
test=[
|
|
20
|
-
'freezegun',
|
|
21
|
-
'pytest',
|
|
22
|
-
'pytest-cov',
|
|
23
|
-
'pytest-mock',
|
|
24
|
-
'pytest-asyncio',
|
|
25
|
-
'pytest-httpx',
|
|
26
|
-
],
|
|
27
|
-
),
|
|
28
|
-
author='James Pic',
|
|
29
|
-
author_email='jamespic@gmail.com',
|
|
30
|
-
url='https://yourlabs.io/oss/cli2',
|
|
31
|
-
include_package_data=True,
|
|
32
|
-
license='MIT',
|
|
33
|
-
keywords='cli',
|
|
34
|
-
python_requires='>=3.6',
|
|
35
|
-
entry_points={
|
|
36
|
-
'console_scripts': [
|
|
37
|
-
'cli2 = cli2.cli2:main.entry_point',
|
|
38
|
-
'cli2-example = cli2.examples.obj:cli.entry_point',
|
|
39
|
-
'cli2-example2 = cli2.examples.obj2:cli.entry_point',
|
|
40
|
-
'cli2-example-nesting = cli2.examples.nesting:cli.entry_point',
|
|
41
|
-
'cli2-example-client = cli2.examples.client:cli.entry_point',
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
)
|
|
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
|