Update pre-commit tools versions
Change-Id: Ifeb7c1a52b403d89d6e44e425ae935d6a6f43d77
This commit is contained in:
parent
2326ce5e7b
commit
cd8ff324cf
@ -4,7 +4,7 @@ default_language_version:
|
|||||||
python: python3
|
python: python3
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.6.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
@ -22,7 +22,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: doc8
|
- id: doc8
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.5.5
|
rev: v0.6.7
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: ['--fix', '--unsafe-fixes']
|
args: ['--fix', '--unsafe-fixes']
|
||||||
@ -34,7 +34,7 @@ repos:
|
|||||||
# args: ['-l', '79']
|
# args: ['-l', '79']
|
||||||
# exclude: '^codegenerator/templates/.*$'
|
# exclude: '^codegenerator/templates/.*$'
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.4.1
|
rev: v1.11.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
language: python
|
language: python
|
||||||
|
@ -42,7 +42,9 @@ class AnsibleGenerator(BaseGenerator):
|
|||||||
|
|
||||||
self._render(test_template, context, test_dest.parent, test_dest.name)
|
self._render(test_template, context, test_dest.parent, test_dest.name)
|
||||||
|
|
||||||
def generate(self, res, target_dir, args=None):
|
def generate(
|
||||||
|
self, res, target_dir, _openapi_spec=None, operation_id=None, args=None
|
||||||
|
):
|
||||||
"""Generate code for the Ansible"""
|
"""Generate code for the Ansible"""
|
||||||
logging.debug(f"Generating Ansible code in {target_dir}")
|
logging.debug(f"Generating Ansible code in {target_dir}")
|
||||||
ansible_path = ["plugins", "modules"]
|
ansible_path = ["plugins", "modules"]
|
||||||
|
@ -24,12 +24,13 @@ from openstack import resource
|
|||||||
from sphinx import pycode
|
from sphinx import pycode
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from codegenerator.ansible import AnsibleGenerator
|
# from codegenerator.ansible import AnsibleGenerator
|
||||||
from codegenerator import common
|
from codegenerator import common
|
||||||
from codegenerator.jsonschema import JsonSchemaGenerator
|
from codegenerator.jsonschema import JsonSchemaGenerator
|
||||||
from codegenerator.metadata import MetadataGenerator
|
from codegenerator.metadata import MetadataGenerator
|
||||||
from codegenerator.openapi_spec import OpenApiSchemaGenerator
|
from codegenerator.openapi_spec import OpenApiSchemaGenerator
|
||||||
from codegenerator.osc import OSCGenerator
|
|
||||||
|
# from codegenerator.osc import OSCGenerator
|
||||||
from codegenerator.rust_cli import RustCliGenerator
|
from codegenerator.rust_cli import RustCliGenerator
|
||||||
from codegenerator.rust_sdk import RustSdkGenerator
|
from codegenerator.rust_sdk import RustSdkGenerator
|
||||||
from codegenerator.types import Metadata
|
from codegenerator.types import Metadata
|
||||||
@ -193,8 +194,8 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
generators = {
|
generators = {
|
||||||
"osc": OSCGenerator(),
|
# "osc": OSCGenerator(),
|
||||||
"ansible": AnsibleGenerator(),
|
# "ansible": AnsibleGenerator(),
|
||||||
"rust-sdk": RustSdkGenerator(),
|
"rust-sdk": RustSdkGenerator(),
|
||||||
"rust-cli": RustCliGenerator(),
|
"rust-cli": RustCliGenerator(),
|
||||||
"openapi-spec": OpenApiSchemaGenerator(),
|
"openapi-spec": OpenApiSchemaGenerator(),
|
||||||
|
@ -153,7 +153,7 @@ class KeystoneGenerator(OpenStackServerSourceBase):
|
|||||||
if route.rule.startswith("/static"):
|
if route.rule.startswith("/static"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._process_route(route, openapi_spec)
|
self._process_route_keystone(route, openapi_spec)
|
||||||
|
|
||||||
self._sanitize_param_ver_info(openapi_spec, self.min_api_version)
|
self._sanitize_param_ver_info(openapi_spec, self.min_api_version)
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class KeystoneGenerator(OpenStackServerSourceBase):
|
|||||||
|
|
||||||
return impl_path
|
return impl_path
|
||||||
|
|
||||||
def _process_route(self, route, openapi_spec):
|
def _process_route_keystone(self, route, openapi_spec):
|
||||||
args = route.arguments
|
args = route.arguments
|
||||||
# ep = route.endpoint
|
# ep = route.endpoint
|
||||||
view = self.app.view_functions[route.endpoint]
|
view = self.app.view_functions[route.endpoint]
|
||||||
@ -345,7 +345,7 @@ class KeystoneGenerator(OpenStackServerSourceBase):
|
|||||||
operation_spec.tags.extend(operation_tags)
|
operation_spec.tags.extend(operation_tags)
|
||||||
operation_spec.tags = list(set(operation_spec.tags))
|
operation_spec.tags = list(set(operation_spec.tags))
|
||||||
|
|
||||||
self.process_operation(
|
self.process_operation_keystone(
|
||||||
func,
|
func,
|
||||||
path,
|
path,
|
||||||
openapi_spec,
|
openapi_spec,
|
||||||
@ -356,7 +356,7 @@ class KeystoneGenerator(OpenStackServerSourceBase):
|
|||||||
|
|
||||||
return operation_spec
|
return operation_spec
|
||||||
|
|
||||||
def process_operation(
|
def process_operation_keystone(
|
||||||
self,
|
self,
|
||||||
func,
|
func,
|
||||||
path,
|
path,
|
||||||
|
@ -423,7 +423,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
# Tenant and Project quota is the same
|
# Tenant and Project quota is the same
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._process_route(route, openapi_spec, processed_routes)
|
self._process_route_neutron(route, openapi_spec, processed_routes)
|
||||||
|
|
||||||
def _process_base_resource_routes(self, openapi_spec, processed_routes):
|
def _process_base_resource_routes(self, openapi_spec, processed_routes):
|
||||||
"""Process base resources exposed through Pecan"""
|
"""Process base resources exposed through Pecan"""
|
||||||
@ -438,7 +438,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
("ports", "port"),
|
("ports", "port"),
|
||||||
]:
|
]:
|
||||||
for method, action in [("GET", "index"), ("POST", "create")]:
|
for method, action in [("GET", "index"), ("POST", "create")]:
|
||||||
self._process_route(
|
self._process_route_neutron(
|
||||||
Route(
|
Route(
|
||||||
coll,
|
coll,
|
||||||
f"/{coll}",
|
f"/{coll}",
|
||||||
@ -461,7 +461,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
("DELETE", "delete"),
|
("DELETE", "delete"),
|
||||||
("PUT", "update"),
|
("PUT", "update"),
|
||||||
]:
|
]:
|
||||||
self._process_route(
|
self._process_route_neutron(
|
||||||
Route(
|
Route(
|
||||||
coll,
|
coll,
|
||||||
f"/{coll}/{{{res}_id}}",
|
f"/{coll}/{{{res}_id}}",
|
||||||
@ -474,7 +474,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
processed_routes,
|
processed_routes,
|
||||||
controller=mgr.get_controller_for_resource(coll),
|
controller=mgr.get_controller_for_resource(coll),
|
||||||
)
|
)
|
||||||
self._process_route(
|
self._process_route_neutron(
|
||||||
Route(
|
Route(
|
||||||
"port_allowed_address_pair",
|
"port_allowed_address_pair",
|
||||||
"/ports/{port_id}/add_allowed_address_pairs",
|
"/ports/{port_id}/add_allowed_address_pairs",
|
||||||
@ -488,7 +488,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
controller=mgr.get_controller_for_resource("ports"),
|
controller=mgr.get_controller_for_resource("ports"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def _process_route(
|
def _process_route_neutron(
|
||||||
self,
|
self,
|
||||||
route,
|
route,
|
||||||
openapi_spec,
|
openapi_spec,
|
||||||
@ -628,7 +628,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
if tag not in [x["name"] for x in openapi_spec.tags]:
|
if tag not in [x["name"] for x in openapi_spec.tags]:
|
||||||
openapi_spec.tags.append({"name": tag})
|
openapi_spec.tags.append({"name": tag})
|
||||||
|
|
||||||
self.process_operation(
|
self.process_operation_neutron(
|
||||||
func,
|
func,
|
||||||
openapi_spec,
|
openapi_spec,
|
||||||
operation_spec,
|
operation_spec,
|
||||||
@ -639,7 +639,7 @@ class NeutronGenerator(OpenStackServerSourceBase):
|
|||||||
method=method,
|
method=method,
|
||||||
)
|
)
|
||||||
|
|
||||||
def process_operation(
|
def process_operation_neutron(
|
||||||
self,
|
self,
|
||||||
func,
|
func,
|
||||||
openapi_spec,
|
openapi_spec,
|
||||||
|
@ -40,7 +40,9 @@ class OSCGenerator(BaseGenerator):
|
|||||||
|
|
||||||
self._render(test_template, context, test_dest.parent, test_dest.name)
|
self._render(test_template, context, test_dest.parent, test_dest.name)
|
||||||
|
|
||||||
def generate(self, res, target_dir, args=None):
|
def generate(
|
||||||
|
self, res, target_dir, _openapi_spec=None, operation_id=None, args=None
|
||||||
|
):
|
||||||
"""Generate code for the OpenStackClient"""
|
"""Generate code for the OpenStackClient"""
|
||||||
logging.debug(f"Generating OpenStackClient code in {target_dir}")
|
logging.debug(f"Generating OpenStackClient code in {target_dir}")
|
||||||
osc_path = res.mod_name.split(".")[1:]
|
osc_path = res.mod_name.split(".")[1:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user