Fix more lint issues in demos/ directory.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/afa09ef9 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/afa09ef9 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/afa09ef9 Branch: refs/heads/trunk Commit: afa09ef99b29d7dfbace3a5316520a38ec1312f0 Parents: a6c3345 Author: Tomaz Muraus <to...@tomaz.me> Authored: Sat Jun 25 12:10:01 2016 +0200 Committer: Tomaz Muraus <to...@tomaz.me> Committed: Sat Jun 25 12:10:01 2016 +0200 ---------------------------------------------------------------------- demos/example_aliyun_ecs.py | 3 ++- demos/example_aliyun_oss.py | 10 ++++++---- demos/example_aliyun_slb.py | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/afa09ef9/demos/example_aliyun_ecs.py ---------------------------------------------------------------------- diff --git a/demos/example_aliyun_ecs.py b/demos/example_aliyun_ecs.py index c7de072..9b6c283 100644 --- a/demos/example_aliyun_ecs.py +++ b/demos/example_aliyun_ecs.py @@ -72,9 +72,10 @@ if len(nodes) == 0: auth = NodeAuthPassword('P@$$w0rd') + ex_internet_charge_type = ecs.internet_charge_types.BY_TRAFFIC node = ecs.create_node(image=image, size=small, name='test', ex_security_group_id=sg, - ex_internet_charge_type=ecs.internet_charge_types.BY_TRAFFIC, + ex_internet_charge_type=ex_internet_charge_type, ex_internet_max_bandwidth_out=1, ex_data_disk=data_disk, auth=auth) http://git-wip-us.apache.org/repos/asf/libcloud/blob/afa09ef9/demos/example_aliyun_oss.py ---------------------------------------------------------------------- diff --git a/demos/example_aliyun_oss.py b/demos/example_aliyun_oss.py index 6bda227..5055d15 100644 --- a/demos/example_aliyun_oss.py +++ b/demos/example_aliyun_oss.py @@ -59,6 +59,7 @@ if len(uploads) > 0: oss.ex_abort_all_multipart_uploads(c1) print('Abort them all') + def data_iter(limit): i = 0 while True: @@ -68,7 +69,7 @@ def data_iter(limit): break print('Starting to upload 1MB using multipart api') -one_mb = 1024*1024 +one_mb = 1024 * 1024 obj = oss.upload_object_via_stream(data_iter(one_mb), c1, upload_object_name) print('Finish uploading') @@ -77,6 +78,7 @@ print('Delete object %s' % obj) oss.delete_object(obj) # Create container -#c2 = oss.create_container(container_name='20160117') -#c2 = oss.create_container(container_name='20160117', ex_location='oss-cn-beijing') -#c2_got = oss.get_container('20160117') +# c2 = oss.create_container(container_name='20160117') +# c2 = oss.create_container(container_name='20160117', +# ex_location='oss-cn-beijing') +# c2_got = oss.get_container('20160117') http://git-wip-us.apache.org/repos/asf/libcloud/blob/afa09ef9/demos/example_aliyun_slb.py ---------------------------------------------------------------------- diff --git a/demos/example_aliyun_slb.py b/demos/example_aliyun_slb.py index 0b41839..24ed034 100644 --- a/demos/example_aliyun_slb.py +++ b/demos/example_aliyun_slb.py @@ -47,7 +47,8 @@ else: 'HealthCheck': 'off'} nodes = ecs.list_nodes() print('Found %d nodes' % len(nodes)) - members = [Member(node.id, node.public_ips[0], 80, extra={'Weight': 50*(i+1)}) + members = [Member(node.id, node.public_ips[0], 80, + extra={'Weight': 50 * (i + 1)}) for i, node in enumerate(nodes)] new_b = slb.create_balancer('test-balancer', 80, 'http', Algorithm.WEIGHTED_ROUND_ROBIN, members,