Skip to content

Commit 240c499

Browse files
committed
linter appeasement
1 parent 219e0d4 commit 240c499

9 files changed

Lines changed: 32 additions & 38 deletions

File tree

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ max-statements=50
370370
# Minimum number of public methods for a class (see R0903).
371371
min-public-methods=2
372372

373-
max-positional-arguments=10
373+
max-positional-arguments=12
374374

375375

376376
[CLASSES]

libcloudforensics/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
# Since moving to poetry, ensure the version number tracked in pyproject.toml is
1818
# also updated
19-
__version__ = '20250331'
19+
__version__ = '20250721'

libcloudforensics/providers/aws/forensics.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def CreateVolumeCopy(zone: str,
124124
try:
125125
if volume_id:
126126
volume_to_copy = source_account.ebs.GetVolumeById(volume_id)
127-
elif instance_id:
127+
else:
128128
instance = source_account.ec2.GetInstanceById(instance_id)
129129
volume_to_copy = instance.GetBootVolume()
130130

@@ -200,8 +200,7 @@ def CreateVolumeCopy(zone: str,
200200

201201
return new_volume
202202

203-
# pylint: disable=too-many-arguments
204-
def StartAnalysisVm(
203+
def StartAnalysisVm( # pylint: disable=too-many-arguments,too-many-positional-arguments
205204
vm_name: str,
206205
default_availability_zone: str,
207206
boot_volume_size: int,

libcloudforensics/providers/aws/internal/ec2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@ def ListImages(
372372

373373
return images['Images']
374374

375-
# pylint: disable=too-many-arguments
376-
def GetOrCreateVm(
375+
def GetOrCreateVm( # pylint: disable=too-many-arguments,too-many-positional-arguments
377376
self,
378377
vm_name: str,
379378
boot_volume_size: int,

libcloudforensics/providers/azure/forensics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def CreateDiskCopy(
8585
try:
8686
if disk_name:
8787
disk_to_copy = src_account.compute.GetDisk(disk_name)
88-
elif instance_name:
88+
else:
8989
instance = src_account.compute.GetInstance(instance_name)
9090
disk_to_copy = instance.GetBootDisk()
9191
logger.info('Disk copy of {0:s} started...'.format(

libcloudforensics/providers/gcp/forensics.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def CreateDiskCopy(
7878
try:
7979
if disk_name:
8080
disk_to_copy = src_project.compute.GetDisk(disk_name)
81-
elif instance_name:
81+
else:
8282
instance = src_project.compute.GetInstance(instance_name)
8383
disk_to_copy = instance.GetBootDisk()
8484

@@ -713,19 +713,13 @@ def TriageInstance(project_id: str, instance_name: str) -> Dict[str, Any]:
713713

714714
cpu_usage = project.monitoring.GetCpuUsage(
715715
instance_ids=[instance_info['id']], aggregation_minutes=1)
716-
if cpu_usage:
717-
parsed_cpu = cpu_usage[0].get('cpu_usage', [])
716+
parsed_cpu = cpu_usage[0].get('cpu_usage', []) if cpu_usage else None
718717

719718

720719
gce_gpu_usage = project.monitoring.GetInstanceGPUUsage(
721-
instance_ids=[instance_info['id']])
722-
if gce_gpu_usage:
723-
parsed_gce_gpu = gce_gpu_usage
724-
720+
instance_ids=[instance_info['id']])
725721

726722
gke_gpu_usage = project.monitoring.GetNodeAccelUsage()
727-
if gke_gpu_usage:
728-
parsed_gke_gpu = gke_gpu_usage
729723

730724
instance_triage = {
731725
'instance_info': {
@@ -741,25 +735,25 @@ def TriageInstance(project_id: str, instance_name: str) -> Dict[str, Any]:
741735
'data_type': 'service_accounts',
742736
'values': instance_info['serviceAccounts']
743737
},
744-
{
745-
'data_type': 'firewalls',
746-
'values': instance.GetNormalisedFirewalls()
747-
}, {
748-
'data_type': 'cpu_usage', 'values': parsed_cpu
749-
}, {
750-
'data_type': 'gce_gpu_usage', 'values': parsed_gce_gpu
751-
}, {
752-
'data_type': 'gke_gpu_usage', 'values': parsed_gke_gpu
753-
}, {
754-
'data_type':
755-
'ssh_auth',
756-
'values':
757-
CheckInstanceSSHAuth(
758-
project_id, instance_info['name'])
759-
}, {
760-
'data_type': 'active_services',
761-
'values': parsed_services
762-
}]
738+
{
739+
'data_type': 'firewalls',
740+
'values': instance.GetNormalisedFirewalls()
741+
}, {
742+
'data_type': 'cpu_usage', 'values': parsed_cpu
743+
}, {
744+
'data_type': 'gce_gpu_usage', 'values': gce_gpu_usage
745+
}, {
746+
'data_type': 'gke_gpu_usage', 'values': gke_gpu_usage
747+
}, {
748+
'data_type':
749+
'ssh_auth',
750+
'values':
751+
CheckInstanceSSHAuth(
752+
project_id, instance_info['name'])
753+
}, {
754+
'data_type': 'active_services',
755+
'values': parsed_services
756+
}]
763757
}
764758

765759
return instance_triage

libcloudforensics/providers/gcp/internal/compute.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ def CreateInstanceFromRequest(
682682
return GoogleComputeInstance(
683683
project_id=self.project_id, zone=compute_zone, name=instance_name)
684684

685-
def CreateInstanceFromArguments( #pylint: disable=too-many-arguments
685+
def CreateInstanceFromArguments( # pylint: disable=too-many-arguments,too-many-positional-arguments
686686
self,
687687
instance_name: str,
688688
machine_type: str,
@@ -1288,6 +1288,7 @@ def ImportImageFromStorage(self,
12881288
'windows-8-x86-byol'
12891289
]
12901290

1291+
img_type = None
12911292
if not bootable:
12921293
img_type = '-data_disk'
12931294
elif not os_name:

libcloudforensics/providers/gcp/internal/monitoring.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def GetInstanceGPUUsage(
333333
for response in responses:
334334
time_series = response.get('timeSeries', [])
335335
for ts in time_series:
336+
gpu_name = 'None'
336337
if ts['metric'].get('labels', None):
337338
gpu_name = "{0:s} ({1:s})".format(
338339
ts['metric']['labels']['model'],

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "libcloudforensics"
3-
version = "20250331"
3+
version = "20250721"
44
description = "libcloudforensics is a set of tools to help acquire forensic evidence from Cloud platforms."
55
authors = ["cloud-forensics-utils development team <cloud-forensics-utils-dev@googlegroups.com>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)