


'''simple docstring'''

from __future__ import annotations
class   __lowerCAmelCase						:





      '''simple docstring'''






      def __init__(self    :    Any   ,						UpperCamelCase    :    int = 0 ):

             '''simple docstring'''







             lowercase__      			= key



      def       UpperCamelCase__		(self    :    str   ,						UpperCamelCase    :    str   ,						UpperCamelCase    :    int ):

             '''simple docstring'''







             assert isinstance(UpperCamelCase   ,						UpperCamelCase ) and isinstance(UpperCamelCase   ,						UpperCamelCase )

             lowercase__      			= key or self.__key or 1

             # make sure key is an appropriate size
             key %= 255

             return [chr(ord(UpperCamelCase ) ^ key ) for ch in content]



      def       UpperCamelCase__		(self    :    List[Any]   ,						UpperCamelCase    :    str   ,						UpperCamelCase    :    int ):

             '''simple docstring'''







             assert isinstance(UpperCamelCase   ,						UpperCamelCase ) and isinstance(UpperCamelCase   ,						UpperCamelCase )

             lowercase__      			= key or self.__key or 1

             # make sure key is an appropriate size
             key %= 255

             return [chr(ord(UpperCamelCase ) ^ key ) for ch in content]



      def       UpperCamelCase__		(self    :    Optional[Any]   ,						UpperCamelCase    :    str   ,						UpperCamelCase    :    int = 0 ):

             '''simple docstring'''







             assert isinstance(UpperCamelCase   ,						UpperCamelCase ) and isinstance(UpperCamelCase   ,						UpperCamelCase )

             lowercase__      			= key or self.__key or 1

             # make sure key can be any size
             while key > 255:
                    key -= 255

             # This will be returned
             lowercase__      			= ''''''

             for ch in content:
                    ans += chr(ord(UpperCamelCase ) ^ key )

             return ans



      def       UpperCamelCase__		(self    :    Any   ,						UpperCamelCase    :    str   ,						UpperCamelCase    :    int = 0 ):

             '''simple docstring'''







             assert isinstance(UpperCamelCase   ,						UpperCamelCase ) and isinstance(UpperCamelCase   ,						UpperCamelCase )

             lowercase__      			= key or self.__key or 1

             # make sure key can be any size
             while key > 255:
                    key -= 255

             # This will be returned
             lowercase__      			= ''''''

             for ch in content:
                    ans += chr(ord(UpperCamelCase ) ^ key )

             return ans



      def       UpperCamelCase__		(self    :    str   ,						UpperCamelCase    :    str   ,						UpperCamelCase    :    int = 0 ):

             '''simple docstring'''







             assert isinstance(UpperCamelCase   ,						UpperCamelCase ) and isinstance(UpperCamelCase   ,						UpperCamelCase )

             try:
                    with open(UpperCamelCase ) as fin, open('''encrypt.out'''   ,						'''w+''' ) as fout:
                           # actual encrypt-process
                           for line in fin:
                                  fout.write(self.encrypt_string(UpperCamelCase   ,						UpperCamelCase ) )

             except OSError:
                    return False

             return True






      def       UpperCamelCase__		(self    :    Dict   ,						UpperCamelCase    :    str   ,						UpperCamelCase    :    int ):

             '''simple docstring'''







             assert isinstance(UpperCamelCase   ,						UpperCamelCase ) and isinstance(UpperCamelCase   ,						UpperCamelCase )

             try:
                    with open(UpperCamelCase ) as fin, open('''decrypt.out'''   ,						'''w+''' ) as fout:
                           # actual encrypt-process
                           for line in fin:
                                  fout.write(self.decrypt_string(UpperCamelCase   ,						UpperCamelCase ) )

             except OSError:
                    return False

             return True


# Tests
# crypt = XORCipher()
# key = 67

# # test encrypt
# print(crypt.encrypt("hallo welt",key))
# # test decrypt
# print(crypt.decrypt(crypt.encrypt("hallo welt",key), key))

# # test encrypt_string
# print(crypt.encrypt_string("hallo welt",key))

# # test decrypt_string
# print(crypt.decrypt_string(crypt.encrypt_string("hallo welt",key),key))

# if (crypt.encrypt_file("test.txt",key)):
#       print("encrypt successful")
# else:
#       print("encrypt unsuccessful")

# if (crypt.decrypt_file("encrypt.out",key)):
#       print("decrypt successful")
# else:
#       print("decrypt unsuccessful")










def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       float	,							lowercase	:       list[float]     ):


      '''simple docstring'''



      if discount_rate < 0:
            raise ValueError('Discount rate cannot be negative'     )
      if not cash_flows:
            raise ValueError('Cash flows list cannot be empty'     )
      lowerCamelCase_		     =    sum(
          cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(lowercase     )     )
      return round(lowercase	,							ndigits=2     )


if __name__ == "__main__":
 import doctest

 doctest.testmod()



