Skip to content

Commit e2a10fe

Browse files
committed
feat(Usage Reports): fix lint issues
Signed-off-by: manu.k.m <[email protected]>
1 parent 1618394 commit e2a10fe

File tree

3 files changed

+129
-60
lines changed

3 files changed

+129
-60
lines changed

ibm_platform_services/usage_reports_v4.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ def new_instance(
5555
parameters and external configuration.
5656
"""
5757
authenticator = get_authenticator_from_environment(service_name)
58-
service = cls(
59-
authenticator
60-
)
58+
service = cls(authenticator)
6159
service.configure_service(service_name)
6260
return service
6361

@@ -255,7 +253,9 @@ def get_resource_group_usage(
255253
path_param_keys = ['account_id', 'resource_group_id', 'billingmonth']
256254
path_param_values = self.encode_path_vars(account_id, resource_group_id, billingmonth)
257255
path_param_dict = dict(zip(path_param_keys, path_param_values))
258-
url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/usage/{billingmonth}'.format(**path_param_dict)
256+
url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/usage/{billingmonth}'.format(
257+
**path_param_dict
258+
)
259259
request = self.prepare_request(
260260
method='GET',
261261
url=url,
@@ -445,7 +445,9 @@ def get_resource_usage_resource_group(
445445
path_param_keys = ['account_id', 'resource_group_id', 'billingmonth']
446446
path_param_values = self.encode_path_vars(account_id, resource_group_id, billingmonth)
447447
path_param_dict = dict(zip(path_param_keys, path_param_values))
448-
url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/resource_instances/usage/{billingmonth}'.format(**path_param_dict)
448+
url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/resource_instances/usage/{billingmonth}'.format(
449+
**path_param_dict
450+
)
449451
request = self.prepare_request(
450452
method='GET',
451453
url=url,
@@ -539,7 +541,11 @@ def get_resource_usage_org(
539541
path_param_keys = ['account_id', 'organization_id', 'billingmonth']
540542
path_param_values = self.encode_path_vars(account_id, organization_id, billingmonth)
541543
path_param_dict = dict(zip(path_param_keys, path_param_values))
542-
url = '/v4/accounts/{account_id}/organizations/{organization_id}/resource_instances/usage/{billingmonth}'.format(**path_param_dict)
544+
url = (
545+
'/v4/accounts/{account_id}/organizations/{organization_id}/resource_instances/usage/{billingmonth}'.format(
546+
**path_param_dict
547+
)
548+
)
543549
request = self.prepare_request(
544550
method='GET',
545551
url=url,
@@ -3066,7 +3072,6 @@ class StateEnum(str, Enum):
30663072
ENABLED = 'enabled'
30673073
DISABLED = 'disabled'
30683074

3069-
30703075
class AccountTypeEnum(str, Enum):
30713076
"""
30723077
Type of account. Possible values [enterprise, account].
@@ -3075,15 +3080,13 @@ class AccountTypeEnum(str, Enum):
30753080
ACCOUNT = 'account'
30763081
ENTERPRISE = 'enterprise'
30773082

3078-
30793083
class IntervalEnum(str, Enum):
30803084
"""
30813085
Frequency of taking the snapshot of the billing reports.
30823086
"""
30833087

30843088
DAILY = 'daily'
30853089

3086-
30873090
class VersioningEnum(str, Enum):
30883091
"""
30893092
A new version of report is created or the existing report version is overwritten
@@ -3093,7 +3096,6 @@ class VersioningEnum(str, Enum):
30933096
NEW = 'new'
30943097
OVERWRITE = 'overwrite'
30953098

3096-
30973099
class ReportTypesEnum(str, Enum):
30983100
"""
30993101
report_types.
@@ -3104,7 +3106,6 @@ class ReportTypesEnum(str, Enum):
31043106
ACCOUNT_RESOURCE_INSTANCE_USAGE = 'account_resource_instance_usage'
31053107

31063108

3107-
31083109
class SnapshotList:
31093110
"""
31103111
List of billing reports snapshots.
@@ -3447,7 +3448,9 @@ def from_dict(cls, _dict: Dict) -> 'SnapshotListSnapshotsItem':
34473448
if 'created_on' in _dict:
34483449
args['created_on'] = _dict.get('created_on')
34493450
if 'report_types' in _dict:
3450-
args['report_types'] = [SnapshotListSnapshotsItemReportTypesItem.from_dict(v) for v in _dict.get('report_types')]
3451+
args['report_types'] = [
3452+
SnapshotListSnapshotsItemReportTypesItem.from_dict(v) for v in _dict.get('report_types')
3453+
]
34513454
if 'files' in _dict:
34523455
args['files'] = [SnapshotListSnapshotsItemFilesItem.from_dict(v) for v in _dict.get('files')]
34533456
if 'processed_at' in _dict:
@@ -3537,7 +3540,6 @@ class AccountTypeEnum(str, Enum):
35373540
ACCOUNT = 'account'
35383541
ENTERPRISE = 'enterprise'
35393542

3540-
35413543
class StateEnum(str, Enum):
35423544
"""
35433545
Status of the billing snapshot configuration. Possible values are [enabled,
@@ -3548,7 +3550,6 @@ class StateEnum(str, Enum):
35483550
DISABLED = 'disabled'
35493551

35503552

3551-
35523553
class SnapshotListSnapshotsItemBillingPeriod:
35533554
"""
35543555
Period of billing in snapshot.
@@ -3711,7 +3712,6 @@ class ReportTypesEnum(str, Enum):
37113712
ACCOUNT_RESOURCE_INSTANCE_USAGE = 'account_resource_instance_usage'
37123713

37133714

3714-
37153715
class SnapshotListSnapshotsItemReportTypesItem:
37163716
"""
37173717
SnapshotListSnapshotsItemReportTypesItem.
@@ -3792,7 +3792,6 @@ class TypeEnum(str, Enum):
37923792
ACCOUNT_RESOURCE_INSTANCE_USAGE = 'account_resource_instance_usage'
37933793

37943794

3795-
37963795
class SnapshotConfig:
37973796
"""
37983797
Billing reports snapshot configuration.
@@ -4004,7 +4003,6 @@ class StateEnum(str, Enum):
40044003
ENABLED = 'enabled'
40054004
DISABLED = 'disabled'
40064005

4007-
40084006
class AccountTypeEnum(str, Enum):
40094007
"""
40104008
Type of account. Possible values are [enterprise, account].
@@ -4013,15 +4011,13 @@ class AccountTypeEnum(str, Enum):
40134011
ACCOUNT = 'account'
40144012
ENTERPRISE = 'enterprise'
40154013

4016-
40174014
class IntervalEnum(str, Enum):
40184015
"""
40194016
Frequency of taking the snapshot of the billing reports.
40204017
"""
40214018

40224019
DAILY = 'daily'
40234020

4024-
40254021
class VersioningEnum(str, Enum):
40264022
"""
40274023
A new version of report is created or the existing report version is overwritten
@@ -4031,7 +4027,6 @@ class VersioningEnum(str, Enum):
40314027
NEW = 'new'
40324028
OVERWRITE = 'overwrite'
40334029

4034-
40354030
class ReportTypesEnum(str, Enum):
40364031
"""
40374032
report_types.
@@ -4042,7 +4037,6 @@ class ReportTypesEnum(str, Enum):
40424037
ACCOUNT_RESOURCE_INSTANCE_USAGE = 'account_resource_instance_usage'
40434038

40444039

4045-
40464040
class Subscription:
40474041
"""
40484042
Subscription.
@@ -4515,6 +4509,7 @@ def __ne__(self, other: 'SupportSummary') -> bool:
45154509
"""Return `true` when self and other are not equal, false otherwise."""
45164510
return not self == other
45174511

4512+
45184513
##############################################################################
45194514
# Pagers
45204515
##############################################################################

test/integration/test_usage_reports_v4.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def setup_class(cls):
3636
if os.path.exists(config_file):
3737
os.environ['IBM_CREDENTIALS_FILE'] = config_file
3838

39-
cls.usage_reports_service = UsageReportsV4.new_instance(
40-
)
39+
cls.usage_reports_service = UsageReportsV4.new_instance()
4140
assert cls.usage_reports_service is not None
4241

4342
cls.config = read_external_sources(UsageReportsV4.DEFAULT_SERVICE_NAME)
@@ -156,7 +155,9 @@ def test_get_resource_usage_account_with_pager(self):
156155
assert all_items is not None
157156

158157
assert len(all_results) == len(all_items)
159-
print(f'\nget_resource_usage_account() returned a total of {len(all_results)} items(s) using GetResourceUsageAccountPager.')
158+
print(
159+
f'\nget_resource_usage_account() returned a total of {len(all_results)} items(s) using GetResourceUsageAccountPager.'
160+
)
160161

161162
@needscredentials
162163
def test_get_resource_usage_resource_group(self):
@@ -222,7 +223,9 @@ def test_get_resource_usage_resource_group_with_pager(self):
222223
assert all_items is not None
223224

224225
assert len(all_results) == len(all_items)
225-
print(f'\nget_resource_usage_resource_group() returned a total of {len(all_results)} items(s) using GetResourceUsageResourceGroupPager.')
226+
print(
227+
f'\nget_resource_usage_resource_group() returned a total of {len(all_results)} items(s) using GetResourceUsageResourceGroupPager.'
228+
)
226229

227230
@needscredentials
228231
def test_get_resource_usage_org(self):
@@ -288,7 +291,9 @@ def test_get_resource_usage_org_with_pager(self):
288291
assert all_items is not None
289292

290293
assert len(all_results) == len(all_items)
291-
print(f'\nget_resource_usage_org() returned a total of {len(all_results)} items(s) using GetResourceUsageOrgPager.')
294+
print(
295+
f'\nget_resource_usage_org() returned a total of {len(all_results)} items(s) using GetResourceUsageOrgPager.'
296+
)
292297

293298
@needscredentials
294299
def test_get_org_usage(self):

0 commit comments

Comments
 (0)