Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#471)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
pre-commit-ci[bot] and ogajduse authored Oct 25, 2023
1 parent 4c4d01b commit b5d2314
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 36 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
ci:
autofix_prs: false
repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
args:
- --application-directories=.:wrapanapi
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.10.0
hooks:
- id: black
args: [--safe, --quiet, --line-length, "100"]
require_serial: true
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
args:
- --max-line-length=100
- --ignore=W503,E203
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.2
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py3-plus, --py38-plus]
args: [--py3-plus, --py311-plus]
16 changes: 10 additions & 6 deletions wrapanapi/entities/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@ class VmMixin(EntityMixin, metaclass=ABCMeta):
Defines methods or properties a wrapanapi.systems.System that manages Vm's should have
"""

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

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

@abstractproperty
def can_suspend(self):
"""Return True if this system can suspend VM's/instances, False if not."""
"""
Return True if this system can suspend VM's/instances, False if not.
Implementations must define whether this system can suspend (True/False)
"""

@abstractproperty
def can_pause(self):
"""Return True if this system can pause VM's/instances, False if not."""
"""
Return True if this system can pause VM's/instances, False if not.
Implementations must define whether this system can pause (True/False)
"""

@abstractmethod
def get_vm(self, name, **kwargs):
Expand Down
8 changes: 2 additions & 6 deletions wrapanapi/systems/ec2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import base64
import os
import re
import typing

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

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

can_suspend = False
can_pause = False

def __init__(self, **kwargs):
super().__init__(**kwargs)
self._username = kwargs.get("username")
Expand Down Expand Up @@ -1811,7 +1807,7 @@ def cleanup_resources(self):
self.remove_all_unused_volumes()
self.remove_all_unused_ips()

def list_resources(self, query="", view="") -> typing.List[ResourceExplorerResource]:
def list_resources(self, query="", view="") -> list[ResourceExplorerResource]:
"""
Lists resources using AWS Resource Explorer (resource-explorer-2).
Expand Down
3 changes: 0 additions & 3 deletions wrapanapi/systems/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,6 @@ class GoogleCloudSystem(System, TemplateMixin, VmMixin):
"num_template": lambda self: len(self.list_templates()),
}

can_suspend = False
can_pause = False

default_scope = ["https://www.googleapis.com/auth/cloud-platform"]

def __init__(self, project=None, zone=None, file_type=None, **kwargs):
Expand Down
3 changes: 0 additions & 3 deletions wrapanapi/systems/msazure.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,6 @@ class AzureSystem(System, VmMixin, TemplateMixin):
"num_template": lambda self: len(list(self.list_compute_images())),
}

can_suspend = True
can_pause = False

def __init__(self, **kwargs):
super().__init__(**kwargs)
self.client_id = kwargs.get("username")
Expand Down
3 changes: 0 additions & 3 deletions wrapanapi/systems/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,6 @@ class OpenstackSystem(System, VmMixin, TemplateMixin):
"num_template": lambda self: len(self.list_templates()),
}

can_suspend = True
can_pause = True

def __init__(self, tenant, username, password, auth_url, **kwargs):
self.keystone_version = kwargs.get("keystone_version")
if not self.keystone_version:
Expand Down
2 changes: 0 additions & 2 deletions wrapanapi/systems/rhevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,6 @@ class RHEVMSystem(System, VmMixin, TemplateMixin):
"num_datastore": lambda self: len(self.list_datastore()),
}

can_suspend = True
can_pause = False
# Over-ride default steady_wait_time
steady_wait_time = 6 * 60

Expand Down
3 changes: 0 additions & 3 deletions wrapanapi/systems/scvmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,6 @@ class SCVMMSystem(System, VmMixin, TemplateMixin):
"num_template": lambda self: len(self.list_templates()),
}

can_suspend = True
can_pause = False

def __init__(self, **kwargs):
super().__init__(**kwargs)
self.host = kwargs["hostname"]
Expand Down
3 changes: 0 additions & 3 deletions wrapanapi/systems/virtualcenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,6 @@ class VMWareSystem(System, VmMixin, TemplateMixin):
"num_datastore": lambda self: len(self.list_datastore()),
}

can_suspend = True
can_pause = False

def __init__(self, hostname, username, password, **kwargs):
super().__init__(**kwargs)
self.hostname = hostname
Expand Down

0 comments on commit b5d2314

Please sign in to comment.