Add type annotations to ironicclient/osc/v1/baremetal_create.py
Changes: Add type annotations following code conventions. Added file to the migrated files list. Change-Id: Ia1f2f00a44a7d88e43d1d4f638b763c46ef2e32d Signed-off-by: Karan Anand <anandkarancompsci@gmail.com>
This commit is contained in:
@@ -10,21 +10,26 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from osc_lib.command import command
|
||||
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient.osc import command
|
||||
from ironicclient.v1 import create_resources
|
||||
|
||||
|
||||
class CreateBaremetal(command.Command):
|
||||
"""Create resources from files"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".CreateBaremetal")
|
||||
log: logging.Logger = logging.getLogger(
|
||||
__name__ + ".CreateBaremetal")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateBaremetal, self).get_parser(prog_name)
|
||||
def get_parser( # type: ignore[override]
|
||||
self, prog_name: str,
|
||||
) -> argparse.ArgumentParser:
|
||||
parser: argparse.ArgumentParser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
"resource_files", metavar="<file>", nargs="+",
|
||||
@@ -32,6 +37,7 @@ class CreateBaremetal(command.Command):
|
||||
"resources to create. Can be specified multiple times."))
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
create_resources.create_resources(self.app.client_manager.baremetal,
|
||||
parsed_args.resource_files)
|
||||
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
||||
create_resources.create_resources(
|
||||
self.app.client_manager.baremetal,
|
||||
parsed_args.resource_files)
|
||||
|
||||
@@ -41,4 +41,5 @@ files = [
|
||||
"ironicclient/__init__.py",
|
||||
"ironicclient/osc/plugin.py",
|
||||
"ironicclient/osc/v1/baremetal_shard.py",
|
||||
"ironicclient/osc/v1/baremetal_create.py",
|
||||
]
|
||||
Reference in New Issue
Block a user