




import os

import requests

__SCREAMING_SNAKE_CASE			:      Dict      			="""https://www.amdoren.com/api/currency.php"""


# Currency and their description
__SCREAMING_SNAKE_CASE			:      List[str]      			="""
AED	United Arab Emirates Dirham
AFN	Afghan Afghani
ALL	Albanian Lek
AMD	Armenian Dram
ANG	Netherlands Antillean Guilder
AOA	Angolan Kwanza
ARS	Argentine Peso
AUD	Australian Dollar
AWG	Aruban Florin
AZN	Azerbaijani Manat
BAM	Bosnia & Herzegovina Convertible Mark
BBD	Barbadian Dollar
BDT	Bangladeshi Taka
BGN	Bulgarian Lev
BHD	Bahraini Dinar
BIF	Burundian Franc
BMD	Bermudian Dollar
BND	Brunei Dollar
BOB	Bolivian Boliviano
BRL	Brazilian Real
BSD	Bahamian Dollar
BTN	Bhutanese Ngultrum
BWP	Botswana Pula
BYN	Belarus Ruble
BZD	Belize Dollar
CAD	Canadian Dollar
CDF	Congolese Franc
CHF	Swiss Franc
CLP	Chilean Peso
CNY	Chinese Yuan
COP	Colombian Peso
CRC	Costa Rican Colon
CUC	Cuban Convertible Peso
CVE	Cape Verdean Escudo
CZK	Czech Republic Koruna
DJF	Djiboutian Franc
DKK	Danish Krone
DOP	Dominican Peso
DZD	Algerian Dinar
EGP	Egyptian Pound
ERN	Eritrean Nakfa
ETB	Ethiopian Birr
EUR	Euro
FJD	Fiji Dollar
GBP	British Pound Sterling
GEL	Georgian Lari
GHS	Ghanaian Cedi
GIP	Gibraltar Pound
GMD	Gambian Dalasi
GNF	Guinea Franc
GTQ	Guatemalan Quetzal
GYD	Guyanaese Dollar
HKD	Hong Kong Dollar
HNL	Honduran Lempira
HRK	Croatian Kuna
HTG	Haiti Gourde
HUF	Hungarian Forint
IDR	Indonesian Rupiah
ILS	Israeli Shekel
INR	Indian Rupee
IQD	Iraqi Dinar
IRR	Iranian Rial
ISK	Icelandic Krona
JMD	Jamaican Dollar
JOD	Jordanian Dinar
JPY	Japanese Yen
KES	Kenyan Shilling
KGS	Kyrgystani Som
KHR	Cambodian Riel
KMF	Comorian Franc
KPW	North Korean Won
KRW	South Korean Won
KWD	Kuwaiti Dinar
KYD	Cayman Islands Dollar
KZT	Kazakhstan Tenge
LAK	Laotian Kip
LBP	Lebanese Pound
LKR	Sri Lankan Rupee
LRD	Liberian Dollar
LSL	Lesotho Loti
LYD	Libyan Dinar
MAD	Moroccan Dirham
MDL	Moldovan Leu
MGA	Malagasy Ariary
MKD	Macedonian Denar
MMK	Myanma Kyat
MNT	Mongolian Tugrik
MOP	Macau Pataca
MRO	Mauritanian Ouguiya
MUR	Mauritian Rupee
MVR	Maldivian Rufiyaa
MWK	Malawi Kwacha
MXN	Mexican Peso
MYR	Malaysian Ringgit
MZN	Mozambican Metical
NAD	Namibian Dollar
NGN	Nigerian Naira
NIO	Nicaragua Cordoba
NOK	Norwegian Krone
NPR	Nepalese Rupee
NZD	New Zealand Dollar
OMR	Omani Rial
PAB	Panamanian Balboa
PEN	Peruvian Nuevo Sol
PGK	Papua New Guinean Kina
PHP	Philippine Peso
PKR	Pakistani Rupee
PLN	Polish Zloty
PYG	Paraguayan Guarani
QAR	Qatari Riyal
RON	Romanian Leu
RSD	Serbian Dinar
RUB	Russian Ruble
RWF	Rwanda Franc
SAR	Saudi Riyal
SBD	Solomon Islands Dollar
SCR	Seychellois Rupee
SDG	Sudanese Pound
SEK	Swedish Krona
SGD	Singapore Dollar
SHP	Saint Helena Pound
SLL	Sierra Leonean Leone
SOS	Somali Shilling
SRD	Surinamese Dollar
SSP	South Sudanese Pound
STD	Sao Tome and Principe Dobra
SYP	Syrian Pound
SZL	Swazi Lilangeni
THB	Thai Baht
TJS	Tajikistan Somoni
TMT	Turkmenistani Manat
TND	Tunisian Dinar
TOP	Tonga Paanga
TRY	Turkish Lira
TTD	Trinidad and Tobago Dollar
TWD	New Taiwan Dollar
TZS	Tanzanian Shilling
UAH	Ukrainian Hryvnia
UGX	Ugandan Shilling
USD	United States Dollar
UYU	Uruguayan Peso
UZS	Uzbekistan Som
VEF	Venezuelan Bolivar
VND	Vietnamese Dong
VUV	Vanuatu Vatu
WST	Samoan Tala
XAF	Central African CFA franc
XCD	East Caribbean Dollar
XOF	West African CFA franc
XPF	CFP Franc
YER	Yemeni Rial
ZAR	South African Rand
ZMW	Zambian Kwacha
"""

def 	lowerCAmelCase_	(     lowerCamelCase:				str = "USD"   , lowerCamelCase:				str = "INR"   , lowerCamelCase:				float = 1.0   , lowerCamelCase:				str = ""  )    ->	str:


      '''simple docstring'''




      lowerCamelCase__					     = locals()
      # from is a reserved keyword
      lowerCamelCase__					     = params.pop('from_'  )
      lowerCamelCase__					     = requests.get(lowerCamelCase   , params=lowerCamelCase  ).json()
      return str(res['amount']  ) if res["error"] == 0 else res["error_message"]


if __name__ == "__main__":
      __SCREAMING_SNAKE_CASE			:      List[Any]      			=os.getenv("""CI""", """""")
      __SCREAMING_SNAKE_CASE			:      Optional[Any]      			=os.getenv("""AMDOREN_API_KEY""", """""")

      if not API_KEY and not TESTING:
            raise KeyError(
                """API key must be provided in the 'AMDOREN_API_KEY' environment variable."""
            )

      print(
          convert_currency(
              input("""Enter from currency: """).strip(),
              input("""Enter to currency: """).strip(),
              float(input("""Enter the amount: """).strip()),
              API_KEY,
          )
      )







import tempfile
import unittest

import numpy as np
import torch

from diffusers import DiffusionPipeline
from diffusers.models.attention_processor import Attention, AttnAddedKVProcessor





class   SCREAMING_SNAKE_CASE (       unittest.TestCase    ):





							"""simple docstring"""

							def 					__A       (     self:      Optional[Any]						,   __A:      bool = False      )			-> Union[str, Any]:
												_A									=       10

												if only_cross_attention:
																	_A									=       12
												else:
																	# when only cross attention is not set, the cross attention dim must be the same as the query dim
																	_A									=       query_dim

												return {
												    "query_dim": query_dim,
												    "cross_attention_dim": cross_attention_dim,
												    "heads": 2,
												    "dim_head": 4,
												    "added_kv_proj_dim": 6,
												    "norm_num_groups": 1,
												    "only_cross_attention": only_cross_attention,
												    "processor": AttnAddedKVProcessor(),
												}

							def 					__A       (     self:      List[Any]						,   __A:      str						,   __A:      Union[str, Any]      )			-> Union[str, Any]:
												_A									=       2

												_A									=       torch.rand(__A						,   __A						,   3						,   2      )
												_A									=       torch.rand(__A						,   4						,   __A      )
												_A									=       None

												return {
												    "hidden_states": hidden_states,
												    "encoder_hidden_states": encoder_hidden_states,
												    "attention_mask": attention_mask,
												}



							def 					__A       (     self:      Optional[int]      )			-> Any:
												# self and cross attention

												torch.manual_seed(0      )

												_A									=       self.get_constructor_arguments(only_cross_attention=__A      )
												_A									=       Attention(**__A      )

												self.assertTrue(attn.to_k is not None      )
												self.assertTrue(attn.to_v is not None      )

												_A									=       self.get_forward_arguments(
												    query_dim=constructor_args['''query_dim''']						,   added_kv_proj_dim=constructor_args['''added_kv_proj_dim''']      )

												_A									=       attn(**__A      )

												# only self attention

												torch.manual_seed(0      )

												_A									=       self.get_constructor_arguments(only_cross_attention=__A      )
												_A									=       Attention(**__A      )

												self.assertTrue(attn.to_k is None      )
												self.assertTrue(attn.to_v is None      )

												_A									=       self.get_forward_arguments(
												    query_dim=constructor_args['''query_dim''']						,   added_kv_proj_dim=constructor_args['''added_kv_proj_dim''']      )

												_A									=       attn(**__A      )

												self.assertTrue((only_cross_attn_out != self_and_cross_attn_out).all()      )





class   SCREAMING_SNAKE_CASE (       unittest.TestCase    ):





							"""simple docstring"""

							def 					__A       (     self:      Any      )			-> Dict:
												_A									=       DiffusionPipeline.from_pretrained('''hf-internal-testing/tiny-stable-diffusion-pipe'''						,   safety_checker=__A      )

												_A									=       pipe(
												    '''foo'''						,   num_inference_steps=2						,   generator=torch.Generator('''cpu'''      ).manual_seed(0      )						,   output_type='''np'''						,   ).images

												# the initial conversion succeeds
												_A									=       DiffusionPipeline.from_pretrained(
												    '''hf-internal-testing/tiny-stable-diffusion-pipe'''						,   device_map='''sequential'''						,   safety_checker=__A      )

												_A									=       pipe(
												    '''foo'''						,   num_inference_steps=2						,   generator=torch.Generator('''cpu'''      ).manual_seed(0      )						,   output_type='''np'''						,   ).images

												with tempfile.TemporaryDirectory() as tmpdir:
																	# save the converted model
																	pipe.save_pretrained(__A      )

																	# can also load the converted weights
																	_A									=       DiffusionPipeline.from_pretrained(__A						,   device_map='''sequential'''						,   safety_checker=__A      )

												_A									=       pipe(
												    '''foo'''						,   num_inference_steps=2						,   generator=torch.Generator('''cpu'''      ).manual_seed(0      )						,   output_type='''np'''						,   ).images

												self.assertTrue(np.allclose(__A						,   __A						,   atol=1e-5      )      )
												self.assertTrue(np.allclose(__A						,   __A						,   atol=1e-5      )      )



