Skip to content

Commit b5d2314

Browse files
[pre-commit.ci] pre-commit autoupdate (#471)
* [pre-commit.ci] pre-commit autoupdate updates: - https://github.com/asottile/reorder_python_importshttps://github.com/asottile/reorder-python-imports - [github.com/asottile/reorder-python-imports: v3.9.0 → v3.12.0](asottile/reorder-python-imports@v3.9.0...v3.12.0) - [github.com/psf/black: 23.3.0 → 23.10.0](psf/black@23.3.0...23.10.0) - [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](PyCQA/flake8@6.0.0...6.1.0) - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0) - [github.com/asottile/pyupgrade: v3.3.2 → v3.15.0](asottile/pyupgrade@v3.3.2...v3.15.0) * Bump 3.8 -> 3.11 for pyupgrade * Address F811: redefinition of unused 'can_pause' and 'can_suspend' * F401: Remove unused import - typing * Drop Python 3.8 support --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ondřej Gajdušek <ogajduse@redhat.com>
1 parent 4c4d01b commit b5d2314

File tree

9 files changed

+19
-36
lines changed

9 files changed

+19
-36
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
ci:
22
autofix_prs: false
33
repos:
4-
- repo: https://github.com/asottile/reorder_python_imports
5-
rev: v3.9.0
4+
- repo: https://github.com/asottile/reorder-python-imports
5+
rev: v3.12.0
66
hooks:
77
- id: reorder-python-imports
88
args:
99
- --application-directories=.:wrapanapi
1010
- repo: https://github.com/psf/black
11-
rev: 23.3.0
11+
rev: 23.10.0
1212
hooks:
1313
- id: black
1414
args: [--safe, --quiet, --line-length, "100"]
1515
require_serial: true
1616
- repo: https://github.com/PyCQA/flake8
17-
rev: 6.0.0
17+
rev: 6.1.0
1818
hooks:
1919
- id: flake8
2020
args:
2121
- --max-line-length=100
2222
- --ignore=W503,E203
2323
- repo: https://github.com/pre-commit/pre-commit-hooks
24-
rev: v4.4.0
24+
rev: v4.5.0
2525
hooks:
2626
- id: trailing-whitespace
2727
- id: end-of-file-fixer
2828
- id: debug-statements
2929
- repo: https://github.com/asottile/pyupgrade
30-
rev: v3.3.2
30+
rev: v3.15.0
3131
hooks:
3232
- id: pyupgrade
33-
args: [--py3-plus, --py38-plus]
33+
args: [--py3-plus, --py311-plus]

wrapanapi/entities/vm.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,6 @@ class VmMixin(EntityMixin, metaclass=ABCMeta):
460460
Defines methods or properties a wrapanapi.systems.System that manages Vm's should have
461461
"""
462462

463-
# Implementations must define whether this system can suspend (True/False)
464-
can_suspend = None
465-
# Implementations must define whether this system can pause (True/False)
466-
can_pause = None
467463
# Implementations may override the amount of sec to wait for a VM to reach steady state
468464
steady_wait_time = 180
469465

@@ -485,11 +481,19 @@ def __init__(self, *args, **kwargs):
485481

486482
@abstractproperty
487483
def can_suspend(self):
488-
"""Return True if this system can suspend VM's/instances, False if not."""
484+
"""
485+
Return True if this system can suspend VM's/instances, False if not.
486+
487+
Implementations must define whether this system can suspend (True/False)
488+
"""
489489

490490
@abstractproperty
491491
def can_pause(self):
492-
"""Return True if this system can pause VM's/instances, False if not."""
492+
"""
493+
Return True if this system can pause VM's/instances, False if not.
494+
495+
Implementations must define whether this system can pause (True/False)
496+
"""
493497

494498
@abstractmethod
495499
def get_vm(self, name, **kwargs):

wrapanapi/systems/ec2.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import base64
22
import os
33
import re
4-
import typing
54

65
import boto3
76
from boto3 import client as boto3client
@@ -508,7 +507,7 @@ def get_tag_value(self, key) -> str:
508507
return tags[0].get("Value")
509508
return None
510509

511-
def get_tags(self, regex="") -> typing.List[dict]:
510+
def get_tags(self, regex="") -> list[dict]:
512511
"""
513512
Returns a list of tags (a dict with keys 'Key' and 'Value').
514513
Tags are taken from the resource properties.
@@ -571,9 +570,6 @@ class EC2System(System, VmMixin, TemplateMixin, StackMixin, NetworkMixin):
571570
"num_template": lambda self: len(self.list_templates()),
572571
}
573572

574-
can_suspend = False
575-
can_pause = False
576-
577573
def __init__(self, **kwargs):
578574
super().__init__(**kwargs)
579575
self._username = kwargs.get("username")
@@ -1811,7 +1807,7 @@ def cleanup_resources(self):
18111807
self.remove_all_unused_volumes()
18121808
self.remove_all_unused_ips()
18131809

1814-
def list_resources(self, query="", view="") -> typing.List[ResourceExplorerResource]:
1810+
def list_resources(self, query="", view="") -> list[ResourceExplorerResource]:
18151811
"""
18161812
Lists resources using AWS Resource Explorer (resource-explorer-2).
18171813

wrapanapi/systems/google.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,6 @@ class GoogleCloudSystem(System, TemplateMixin, VmMixin):
441441
"num_template": lambda self: len(self.list_templates()),
442442
}
443443

444-
can_suspend = False
445-
can_pause = False
446-
447444
default_scope = ["https://www.googleapis.com/auth/cloud-platform"]
448445

449446
def __init__(self, project=None, zone=None, file_type=None, **kwargs):

wrapanapi/systems/msazure.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,6 @@ class AzureSystem(System, VmMixin, TemplateMixin):
494494
"num_template": lambda self: len(list(self.list_compute_images())),
495495
}
496496

497-
can_suspend = True
498-
can_pause = False
499-
500497
def __init__(self, **kwargs):
501498
super().__init__(**kwargs)
502499
self.client_id = kwargs.get("username")

wrapanapi/systems/openstack.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,6 @@ class OpenstackSystem(System, VmMixin, TemplateMixin):
603603
"num_template": lambda self: len(self.list_templates()),
604604
}
605605

606-
can_suspend = True
607-
can_pause = True
608-
609606
def __init__(self, tenant, username, password, auth_url, **kwargs):
610607
self.keystone_version = kwargs.get("keystone_version")
611608
if not self.keystone_version:

wrapanapi/systems/rhevm.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,6 @@ class RHEVMSystem(System, VmMixin, TemplateMixin):
788788
"num_datastore": lambda self: len(self.list_datastore()),
789789
}
790790

791-
can_suspend = True
792-
can_pause = False
793791
# Over-ride default steady_wait_time
794792
steady_wait_time = 6 * 60
795793

wrapanapi/systems/scvmm.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,6 @@ class SCVMMSystem(System, VmMixin, TemplateMixin):
534534
"num_template": lambda self: len(self.list_templates()),
535535
}
536536

537-
can_suspend = True
538-
can_pause = False
539-
540537
def __init__(self, **kwargs):
541538
super().__init__(**kwargs)
542539
self.host = kwargs["hostname"]

wrapanapi/systems/virtualcenter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,9 +923,6 @@ class VMWareSystem(System, VmMixin, TemplateMixin):
923923
"num_datastore": lambda self: len(self.list_datastore()),
924924
}
925925

926-
can_suspend = True
927-
can_pause = False
928-
929926
def __init__(self, hostname, username, password, **kwargs):
930927
super().__init__(**kwargs)
931928
self.hostname = hostname

0 commit comments

Comments
 (0)