




'''simple docstring'''




def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      Tuple       ):
	'''simple docstring'''





	UpperCAmelCase__										=    [list(_UpperCAmelCase       ) for row in matrix]
	if matrix and isinstance(_UpperCAmelCase       ,						_UpperCAmelCase       ):
		if isinstance(matrix[0]       ,						_UpperCAmelCase       ):
			UpperCAmelCase__										=    0
			for row in matrix:
				if prev_len == 0:
					UpperCAmelCase__										=    len(_UpperCAmelCase       )
					UpperCAmelCase__										=    True
				else:
					UpperCAmelCase__										=    prev_len == len(_UpperCAmelCase       )
		else:
			UpperCAmelCase__										=    True
	else:
		UpperCAmelCase__										=    False

	return result

def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      Any       ):
	'''simple docstring'''





	if check_matrix(_UpperCAmelCase       ) and len(_UpperCAmelCase       ) > 0:
		UpperCAmelCase__										=    [list(_UpperCAmelCase       ) for row in a]
		UpperCAmelCase__										=    len(_UpperCAmelCase       )
		if isinstance(a[0]       ,						_UpperCAmelCase       ):
			UpperCAmelCase__										=    len(a[0]       )
		else:
			for dat in a:
				print(_UpperCAmelCase       )
			return

		# horizotal printing increasing
		for i in range(0       ,						_UpperCAmelCase       ):
			print(a[0][i]       )
		# vertical printing down
		for i in range(1       ,						_UpperCAmelCase       ):
			print(a[i][mat_col - 1]       )
		# horizotal printing decreasing
		if mat_row > 1:
			for i in range(mat_col - 2       ,						-1       ,						-1       ):
				print(a[mat_row - 1][i]       )
        # vertical printing up
		for i in range(mat_row - 2       ,						0       ,						-1       ):
			print(a[i][0]       )
		UpperCAmelCase__										=    [row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
		if len(_UpperCAmelCase       ) > 0:
			spiral_print_clockwise(_UpperCAmelCase       )
		else:
			return
	else:
		print("""Not a valid matrix"""       )
		return

def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      Any       ):
	'''simple docstring'''





	if matrix:
		return list(matrix.pop(0       )       ) + spiral_traversal(list(zip(*_UpperCAmelCase       )       )[::-1]       )
	else:
		return []


# driver code
if __name__ == "__main__":
				import doctest

				doctest.testmod()

				UpperCAmelCase_       				=      [[1, 2, 3, 4], [5, 6, 7, 8], [9, 1_0, 1_1, 1_2]]
				spiral_print_clockwise(a)






'''simple docstring'''




import os

from apache_beam.io.filesystems import FileSystems
from apache_beam.pipeline import Pipeline

from .logging import get_logger


UpperCAmelCase_       				=      2 << 2_0  # 2mb
UpperCAmelCase_       				=      get_logger(__name__)

class 						lowerCAmelCase_   ( lowerCamelCase_   ):







  '''simple docstring'''







  def 							SCREAMING_SNAKE_CASE__			(						self    :	Any ):






   """simple docstring"""






   UpperCAmelCase__										=    self._options.get_all_options().get("""runner""" )
   return runner in [None, "DirectRunner", "PortableRunner"]

def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      Any       ,						SCREAMING_SNAKE_CASE__			:      List[Any]       ,						SCREAMING_SNAKE_CASE__			:      Any=False       ):
 '''simple docstring'''





 UpperCAmelCase__										=    FileSystems
 if fs.exists(SCREAMING_SNAKE_CASE__       ):
  if force_upload:
   logger.info(F'''Remote path already exist: {remote_file_path}. Overwriting it as force_upload=True.'''       )
  else:
   logger.info(F'''Remote path already exist: {remote_file_path}. Skipping it as force_upload=False.'''       )
   return
 with fs.create(SCREAMING_SNAKE_CASE__       ) as remote_file:
  with open(SCREAMING_SNAKE_CASE__       ,						"""rb"""       ) as local_file:
   UpperCAmelCase__										=    local_file.read(SCREAMING_SNAKE_CASE__       )
   while chunk:
    remote_file.write(SCREAMING_SNAKE_CASE__       )
    UpperCAmelCase__										=    local_file.read(SCREAMING_SNAKE_CASE__       )







def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      Dict       ,						SCREAMING_SNAKE_CASE__			:      Any       ,						SCREAMING_SNAKE_CASE__			:      Dict=False       ):
 '''simple docstring'''





 UpperCAmelCase__										=    FileSystems
 if os.path.exists(SCREAMING_SNAKE_CASE__       ):
  if force_download:
   logger.info(F'''Local path already exist: {remote_file_path}. Overwriting it as force_upload=True.'''       )
  else:
   logger.info(F'''Local path already exist: {remote_file_path}. Skipping it as force_upload=False.'''       )
   return
 with fs.open(SCREAMING_SNAKE_CASE__       ) as remote_file:
  with open(SCREAMING_SNAKE_CASE__       ,						"""wb"""       ) as local_file:
   UpperCAmelCase__										=    remote_file.read(SCREAMING_SNAKE_CASE__       )
   while chunk:
    local_file.write(SCREAMING_SNAKE_CASE__       )
    UpperCAmelCase__										=    remote_file.read(SCREAMING_SNAKE_CASE__       )
