






'''simple docstring'''

# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


A:      Optional[int]  				=				[
    "EAGER",
    "AOT_EAGER",
    "INDUCTOR",
    "NVFUSER",
    "AOT_NVFUSER",
    "AOT_CUDAGRAPHS",
    "OFI",
    "FX2TRT",
    "ONNXRT",
    "IPEX",
]






def 	_UpperCAmelCase    (  a		:	Union[str, Any]						,			a		:	List[str]=None						,			a		:	List[Any]=None						,			a		:	Optional[Any]=None							)			->			str:





						"""simple docstring"""
						lowercase_      :   Tuple        =			True
						while ask_again:
												lowercase_      :   Optional[Any]        =			input(a							)
												try:
																		if default is not None and len(a							) == 0:
																								return default
																		return convert_value(a							) if convert_value is not None else result
												except Exception:
																		if error_message is not None:
																								print(a							)






def 	_UpperCAmelCase    (  a		:	Dict						,			a		:	Union[str, Any]=[]						,			a		:	Optional[Any]=None						,			a		:	Any=0							)			->			Any:





						"""simple docstring"""
						lowercase_      :   Tuple        =			BulletMenu(a						,			a							)
						lowercase_      :   Dict        =			menu.run(default_choice=a							)
						return convert_value(a							) if convert_value is not None else result






def 	_UpperCAmelCase    (  a		:	Optional[int]							)			->			List[str]:





						"""simple docstring"""
						lowercase_      :   str        =			int(a							)
						return ComputeEnvironment(['LOCAL_MACHINE', 'AMAZON_SAGEMAKER'][value]							)






def 	_UpperCAmelCase    (  a		:	str							)			->			Optional[int]:





						"""simple docstring"""
						lowercase_      :   List[str]        =			int(a							)
						return DistributedType(['NO', 'MULTI_CPU', 'MULTI_XPU', 'MULTI_GPU', 'MULTI_NPU', 'TPU'][value]							)






def 	_UpperCAmelCase    (  a		:	List[str]							)			->			Any:





						"""simple docstring"""
						lowercase_      :   List[Any]        =			int(a							)
						return DynamoBackend(DYNAMO_BACKENDS[value]							).value






def 	_UpperCAmelCase    (  a		:	int							)			->			str:





						"""simple docstring"""
						lowercase_      :   Union[str, Any]        =			int(a							)
						return PrecisionType(['no', 'fp16', 'bf16', 'fp8'][value]							)






def 	_UpperCAmelCase    (  a		:	int							)			->			Dict:





						"""simple docstring"""
						lowercase_      :   Dict        =			int(a							)
						return SageMakerDistributedType(['NO', 'DATA_PARALLEL', 'MODEL_PARALLEL'][value]							)






def 	_UpperCAmelCase    (  a		:	str							)			->			str:





						"""simple docstring"""
						return {"yes": True, "no": False}[value.lower()]






class 							__magic_name__     (	argparse.RawDescriptionHelpFormatter				):







	"""simple docstring"""



	def        lowerCamelCase__		(							self  ,      _lowercase  ,      _lowercase  ,      _lowercase  ,      _lowercase       )						->  str:
							lowercase_      :   str        =			super()._format_usage(_lowercase  ,      _lowercase  ,      _lowercase  ,      _lowercase       )
							lowercase_      :   int        =			usage.replace('<command> [<args>] '  ,      ''       )
							return usage








'''simple docstring'''

from __future__ import annotations






def 	_UpperCAmelCase    (  a		:	int = 4							)			->			list[list[int]]:





						"""simple docstring"""
						lowercase_      :   Tuple        =			abs(a							) or 4
						return [[1 + x + y * row_size for x in range(a							)] for y in range(a							)]






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			list[list[int]]:





						"""simple docstring"""
						return reverse_row(transpose(a							)							)
						# OR.. transpose(reverse_column(matrix))






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			list[list[int]]:





						"""simple docstring"""
						return reverse_row(reverse_column(a							)							)
						# OR.. reverse_column(reverse_row(matrix))






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			list[list[int]]:





						"""simple docstring"""
						return reverse_column(transpose(a							)							)
						# OR.. transpose(reverse_row(matrix))






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			list[list[int]]:





						"""simple docstring"""
						lowercase_      :   Any        =			[list(a							) for x in zip(*a							)]
						return matrix






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			list[list[int]]:





						"""simple docstring"""
						lowercase_      :   List[str]        =			matrix[::-1]
						return matrix






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			list[list[int]]:





						"""simple docstring"""
						lowercase_      :   str        =			[x[::-1] for x in matrix]
						return matrix






def 	_UpperCAmelCase    (  a		:	list[list[int]]							)			->			None:





						"""simple docstring"""
						for i in matrix:
												print(*a							)


if __name__ == "__main__":
						A:      Dict  				=				make_matrix()
						print("\norigin:\n")
						print_matrix(matrix)
						print("\nrotate 90 counterclockwise:\n")
						print_matrix(rotate_aa(matrix))

						A:      List[Any]  				=				make_matrix()
						print("\norigin:\n")
						print_matrix(matrix)
						print("\nrotate 180:\n")
						print_matrix(rotate_aaa(matrix))

						A:      List[str]  				=				make_matrix()
						print("\norigin:\n")
						print_matrix(matrix)
						print("\nrotate 270 counterclockwise:\n")
						print_matrix(rotate_aaa(matrix))
