
'''simple docstring'''


from typing import Any

class 						__lowercase					:

			def __init__(self      , A   ):
								lowerCamelCase_       :   Any  =		data
								lowerCamelCase_       :   Union[str, Any]  =		None

class 						__lowercase					:

			def __init__(self   ):
								lowerCamelCase_       :   Optional[int]  =		None

			def 							UpperCAmelCase__			(self   ):
								lowerCamelCase_       :   Union[str, Any]  =		self.head
								while temp is not None:
													print(temp.data      , end=''' '''   )
													lowerCamelCase_       :   Union[str, Any]  =		temp.next
								print()

			def 							UpperCAmelCase__			(self      , A   ):
								lowerCamelCase_       :   Dict  =		Node(__lowercase   )
								lowerCamelCase_       :   Optional[Any]  =		self.head
								lowerCamelCase_       :   Dict  =		new_node






			def 							UpperCAmelCase__			(self      , A      , A   ):
								if node_data_a == node_data_a:
													return
								else:
													lowerCamelCase_       :   Dict  =		self.head
													while node_a is not None and node_a.data != node_data_a:
																		lowerCamelCase_       :   Any  =		node_a.next

													lowerCamelCase_       :   Any  =		self.head
													while node_a is not None and node_a.data != node_data_a:
																		lowerCamelCase_       :   Optional[Any]  =		node_a.next

													if node_a is None or node_a is None:
																		return

													lowerCamelCase_       :   List[Any]  =		node_a.data, node_a.data


if __name__ == "__main__":
					__lowercase				: Optional[int]											=  LinkedList()
					for i in range(5, 0, -1):
										ll.push(i)

					ll.print_list()

					ll.swap_nodes(1, 4)
					print('''After swapping''')
					ll.print_list()









"""simple docstring"""





from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
							import accelerate



def 					lowerCAmelCase_      (   SCREAMING_SNAKE_CASE							:				str ):


							'''simple docstring'''







							if not is_accelerate_available():
														return method
							__lowerCamelCase   :   Dict       =version.parse(accelerate.__version__ ).base_version
							if version.parse(SCREAMING_SNAKE_CASE ) < version.parse('''0.17.0''' ):
														return method

							def wrapper(self							:				List[Any]     ,    *SCREAMING_SNAKE_CASE							:				Any     ,    **SCREAMING_SNAKE_CASE							:				List[str] ):
														if hasattr(self     ,    '''_hf_hook''' ) and hasattr(self._hf_hook     ,    '''pre_forward''' ):
																					self._hf_hook.pre_forward(self )
														return method(self     ,    *SCREAMING_SNAKE_CASE     ,    **SCREAMING_SNAKE_CASE )

							return wrapper




