


'''simple docstring'''






from __future__ import annotations

from numpy import array, cos, cross, floataa, radians, sin
from numpy.typing import NDArray







def 							UpperCamelCase_     (       A__   :  float				,       A__   :  float				,       A__   :  bool = False   ):
  '''simple docstring'''





  if radian_mode:
    return [magnitude * cos(A__   ), magnitude * sin(A__   )]
  return [magnitude * cos(radians(A__   )   ), magnitude * sin(radians(A__   )   )]







def 							UpperCamelCase_     (       A__   :  NDArray[floataa]				,       A__   :  NDArray[floataa]				,       A__   :  float = 10**-1   ):
  '''simple docstring'''





  lowerCAmelCase_     : NDArray[floataa]     =  cross(A__				,       A__   )
  lowerCAmelCase_     : float     =  sum(A__   )
  return abs(A__   ) < eps


if __name__ == "__main__":
  # Test to check if it works
  __A   :    Optional[Any]											= array(
      [
          polar_force(7_1_8.4, 180 - 30),
          polar_force(8_7_9.5_4, 45),
          polar_force(100, -90),
      ]
  )

  __A   :    NDArray[floataa]											= array([[0, 0], [0, 0], [0, 0]])

  assert in_static_equilibrium(forces, location)

  # Problem 1 in image_data/2D_problems.jpg
  __A   :    Any											= array(
      [
          polar_force(30 * 9.8_1, 15),
          polar_force(215, 180 - 45),
          polar_force(264, 90 - 30),
      ]
  )

  __A   :    Union[str, Any]											= array([[0, 0], [0, 0], [0, 0]])

  assert in_static_equilibrium(forces, location)

  # Problem in image_data/2D_problems_1.jpg
  __A   :    Union[str, Any]											= array([[0, -2000], [0, -1200], [0, 1_5600], [0, -1_2400]])

  __A   :    int											= array([[0, 0], [6, 0], [10, 0], [12, 0]])

  assert in_static_equilibrium(forces, location)

  import doctest

  doctest.testmod()







'''simple docstring'''






def 							UpperCamelCase_     (       A__   :  bytes   ):
  '''simple docstring'''





  return "".join([hex(A__   )[2:].zfill(2   ).upper() for byte in list(A__   )]   )







def 							UpperCamelCase_     (       A__   :  str   ):
  '''simple docstring'''





  if (len(A__   ) % 2) != 0:
    raise ValueError(
        """Base16 encoded data is invalid:
Data does not have an even number of hex digits."""   )
  # Check the character set - the standard base16 alphabet
  # is uppercase according to RFC3548 section 6
  if not set(A__   ) <= set("""0123456789ABCDEF"""   ):
    raise ValueError(
        """Base16 encoded data is invalid:
Data is not uppercase hex or it contains invalid characters."""   )
  # For every two hexadecimal digits (= a byte), turn it into an integer.
  # Then, string the result together into bytes, and return it.
  return bytes(int(data[i] + data[i + 1]				,       16   ) for i in range(0				,       len(A__   )				,       2   )   )


if __name__ == "__main__":
  import doctest

  doctest.testmod()



