From 1bedd453a82e65f34ecaddfd726590452704cf44 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 1 Apr 2024 17:58:40 +0200 Subject: [PATCH] Added const module --- .github/workflows/lint.yml | 29 +++ .github/workflows/publish.yml | 0 .vscode/settings.json | 42 ++++ __init__.py | 0 creyPY/__init__.py | 0 creyPY/const/__init__.py | 2 + creyPY/const/i18n.py | 436 ++++++++++++++++++++++++++++++++++ creyPY/const/stripe.py | 153 ++++++++++++ requirements.build.txt | 25 ++ setup.py | 13 + 10 files changed, 700 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .vscode/settings.json create mode 100644 __init__.py create mode 100644 creyPY/__init__.py create mode 100644 creyPY/const/__init__.py create mode 100644 creyPY/const/i18n.py create mode 100644 creyPY/const/stripe.py create mode 100644 requirements.build.txt create mode 100644 setup.py diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..93a7993 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,29 @@ +name: Lint + +on: + push: + branches: + - dev + - master + paths-ignore: + - "**/.github/**" + - "**/.gitignore" + - "**/.vscode/**" + - "**/README.md" + - "**/CHANGELOG.md" + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable + with: + options: "-l 100 --exclude '/.venv/|/__init__.py'" + - uses: creyD/autoflake_action@master + with: + no_commit: True + options: --in-place --remove-all-unused-imports -r --exclude **/__init__.py,**/db/models.py, + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Adjusted files for isort & autopep diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..de8d7cb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,42 @@ +{ + "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python3", + "python.globalModuleInstallation": false, + "python.terminal.activateEnvironment": true, + "python.analysis.typeCheckingMode": "basic", + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "editor.defaultFormatter": "ms-python.black-formatter" + }, + "black-formatter.args": ["--line-length", "100"], + "isort.args": ["--profile", "black"], + // Editor General + "files.insertFinalNewline": true, + "editor.fontSize": 15, + "editor.formatOnSave": true, + "editor.rulers": [100], + "editor.minimap.enabled": true, + "files.exclude": { + "**/.git": true, + "**/.pytest_cache": true, + "**/.venv": true, + "**/.svn": true, + "**/.hg": true, + "**/db.sqlite3": true, + "**/.DS_Store": true, + "**/*.pyc": true, + "**/__pycache__/": true + }, + "search.exclude": { + "**/.git": true, + "**/.venv": true, + "**/tmp": true, + "htmlcov/*": true, + "docs/*": true, + ".venv/*": true + }, + "python.testing.pytestArgs": ["app"], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/creyPY/__init__.py b/creyPY/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/creyPY/const/__init__.py b/creyPY/const/__init__.py new file mode 100644 index 0000000..1dc7d36 --- /dev/null +++ b/creyPY/const/__init__.py @@ -0,0 +1,2 @@ +from .i18n import * # noqa +from .stripe import * # noqa diff --git a/creyPY/const/i18n.py b/creyPY/const/i18n.py new file mode 100644 index 0000000..04edae8 --- /dev/null +++ b/creyPY/const/i18n.py @@ -0,0 +1,436 @@ +import enum + + +class CountryEnum(str, enum.Enum): + AF = "Afghanistan" + AX = "land Islands" + AL = "Albania" + DZ = "Algeria" + AS = "American Samoa" + AD = "AndorrA" + AO = "Angola" + AI = "Anguilla" + AQ = "Antarctica" + AG = "Antigua and Barbuda" + AR = "Argentina" + AM = "Armenia" + AW = "Aruba" + AU = "Australia" + AT = "Austria" + AZ = "Azerbaijan" + BS = "Bahamas" + BH = "Bahrain" + BD = "Bangladesh" + BB = "Barbados" + BY = "Belarus" + BE = "Belgium" + BZ = "Belize" + BJ = "Benin" + BM = "Bermuda" + BT = "Bhutan" + BO = "Bolivia" + BA = "Bosnia and Herzegovina" + BW = "Botswana" + BV = "Bouvet Island" + BR = "Brazil" + IO = "British Indian Ocean Territory" + BN = "Brunei Darussalam" + BG = "Bulgaria" + BF = "Burkina Faso" + BI = "Burundi" + KH = "Cambodia" + CM = "Cameroon" + CA = "Canada" + CV = "Cape Verde" + KY = "Cayman Islands" + CF = "Central African Republic" + TD = "Chad" + CL = "Chile" + CN = "China" + CX = "Christmas Island" + CC = "Cocos (Keeling) Islands" + CO = "Colombia" + KM = "Comoros" + CG = "Congo" + CD = "Congo, The Democratic Republic of the" + CK = "Cook Islands" + CR = "Costa Rica" + CI = 'Cote D"Ivoire' + HR = "Croatia" + CU = "Cuba" + CY = "Cyprus" + CZ = "Czech Republic" + DK = "Denmark" + DJ = "Djibouti" + DM = "Dominica" + DO = "Dominican Republic" + EC = "Ecuador" + EG = "Egypt" + SV = "El Salvador" + GQ = "Equatorial Guinea" + ER = "Eritrea" + EE = "Estonia" + ET = "Ethiopia" + FK = "Falkland Islands (Malvinas)" + FO = "Faroe Islands" + FJ = "Fiji" + FI = "Finland" + FR = "France" + GF = "French Guiana" + PF = "French Polynesia" + TF = "French Southern Territories" + GA = "Gabon" + GM = "Gambia" + GE = "Georgia" + DE = "Germany" + GH = "Ghana" + GI = "Gibraltar" + GR = "Greece" + GL = "Greenland" + GD = "Grenada" + GP = "Guadeloupe" + GU = "Guam" + GT = "Guatemala" + GG = "Guernsey" + GN = "Guinea" + GW = "Guinea-Bissau" + GY = "Guyana" + HT = "Haiti" + HM = "Heard Island and Mcdonald Islands" + VA = "Holy See (Vatican City State)" + HN = "Honduras" + HK = "Hong Kong" + HU = "Hungary" + IS = "Iceland" + IN = "India" + ID = "Indonesia" + IR = "Iran, Islamic Republic Of" + IQ = "Iraq" + IE = "Ireland" + IM = "Isle of Man" + IL = "Israel" + IT = "Italy" + JM = "Jamaica" + JP = "Japan" + JE = "Jersey" + JO = "Jordan" + KZ = "Kazakhstan" + KE = "Kenya" + KI = "Kiribati" + KP = 'Korea, Democratic People"S Republic of' + KR = "Korea, Republic of" + KW = "Kuwait" + KG = "Kyrgyzstan" + LA = 'Lao People"S Democratic Republic' + LV = "Latvia" + LB = "Lebanon" + LS = "Lesotho" + LR = "Liberia" + LY = "Libyan Arab Jamahiriya" + LI = "Liechtenstein" + LT = "Lithuania" + LU = "Luxembourg" + MO = "Macao" + MK = "Macedonia, The Former Yugoslav Republic of" + MG = "Madagascar" + MW = "Malawi" + MY = "Malaysia" + MV = "Maldives" + ML = "Mali" + MT = "Malta" + MH = "Marshall Islands" + MQ = "Martinique" + MR = "Mauritania" + MU = "Mauritius" + YT = "Mayotte" + MX = "Mexico" + FM = "Micronesia, Federated States of" + MD = "Moldova, Republic of" + MC = "Monaco" + MN = "Mongolia" + ME = "Montenegro" + MS = "Montserrat" + MA = "Morocco" + MZ = "Mozambique" + MM = "Myanmar" + NA = "Namibia" + NR = "Nauru" + NP = "Nepal" + NL = "Netherlands" + AN = "Netherlands Antilles" + NC = "New Caledonia" + NZ = "New Zealand" + NI = "Nicaragua" + NE = "Niger" + NG = "Nigeria" + NU = "Niue" + NF = "Norfolk Island" + MP = "Northern Mariana Islands" + NO = "Norway" + OM = "Oman" + PK = "Pakistan" + PW = "Palau" + PS = "Palestinian Territory, Occupied" + PA = "Panama" + PG = "Papua New Guinea" + PY = "Paraguay" + PE = "Peru" + PH = "Philippines" + PN = "Pitcairn" + PL = "Poland" + PT = "Portugal" + PR = "Puerto Rico" + QA = "Qatar" + RE = "Reunion" + RO = "Romania" + RU = "Russian Federation" + RW = "RWANDA" + SH = "Saint Helena" + KN = "Saint Kitts and Nevis" + LC = "Saint Lucia" + PM = "Saint Pierre and Miquelon" + VC = "Saint Vincent and the Grenadines" + WS = "Samoa" + SM = "San Marino" + ST = "Sao Tome and Principe" + SA = "Saudi Arabia" + SN = "Senegal" + RS = "Serbia" + SC = "Seychelles" + SL = "Sierra Leone" + SG = "Singapore" + SK = "Slovakia" + SI = "Slovenia" + SB = "Solomon Islands" + SO = "Somalia" + ZA = "South Africa" + GS = "South Georgia and the South Sandwich Islands" + ES = "Spain" + LK = "Sri Lanka" + SD = "Sudan" + SR = "Suriname" + SJ = "Svalbard and Jan Mayen" + SZ = "Swaziland" + SE = "Sweden" + CH = "Switzerland" + SY = "Syrian Arab Republic" + TW = "Taiwan, Province of China" + TJ = "Tajikistan" + TZ = "Tanzania, United Republic of" + TH = "Thailand" + TL = "Timor-Leste" + TG = "Togo" + TK = "Tokelau" + TO = "Tonga" + TT = "Trinidad and Tobago" + TN = "Tunisia" + TR = "Turkey" + TM = "Turkmenistan" + TC = "Turks and Caicos Islands" + TV = "Tuvalu" + UG = "Uganda" + UA = "Ukraine" + AE = "United Arab Emirates" + GB = "United Kingdom" + US = "United States" + UM = "United States Minor Outlying Islands" + UY = "Uruguay" + UZ = "Uzbekistan" + VU = "Vanuatu" + VE = "Venezuela" + VN = "Viet Nam" + VG = "Virgin Islands, British" + VI = "Virgin Islands, U.S." + WF = "Wallis and Futuna" + EH = "Western Sahara" + YE = "Yemen" + ZM = "Zambia" + ZW = "Zimbabwe" + + +class LanguageEnum(str, enum.Enum): + AA = "Afar" + AB = "Abkhazian" + AF = "Afrikaans" + AK = "Akan" + AM = "Amharic" + AN = "Aragonese" + AR = "Arabic" + AS = "Assamese" + AV = "Avar" + AY = "Aymara" + AZ = "Azerbaijani" + BA = "Bashkir" + BE = "Belarusian" + BG = "Bulgarian" + BH = "Bihari" + BI = "Bislama" + BM = "Bambara" + BN = "Bengali" + BO = "Tibetan" + BR = "Breton" + BS = "Bosnian" + CA = "Catalan" + CE = "Chechen" + CH = "Chamorro" + CO = "Corsican" + CR = "Cree" + CS = "Czech" + CU = "Old Church Slavonic / Old Bulgarian" + CV = "Chuvash" + CY = "Welsh" + DA = "Danish" + DE = "Deutsch" + DV = "Divehi" + DZ = "Dzongkha" + EE = "Ewe" + EL = "Greek" + EN = "English" + EO = "Esperanto" + ES = "Spanish" + ET = "Estonian" + EU = "Basque" + FA = "Persian" + FF = "Peul" + FI = "Finnish" + FJ = "Fijian" + FO = "Faroese" + FR = "French" + FY = "West Frisian" + GA = "Irish" + GD = "Scottish Gaelic" + GL = "Galician" + GN = "Guarani" + GU = "Gujarati" + GV = "Manx" + HA = "Hausa" + HE = "Hebrew" + HI = "Hindi" + HO = "Hiri Motu" + HR = "Croatian" + HT = "Haitian" + HU = "Hungarian" + HY = "Armenian" + HZ = "Herero" + IA = "Interlingua" + ID = "Indonesian" + IE = "Interlingue" + IG = "Igbo" + II = "Sichuan Yi" + IK = "Inupiak" + IO = "Ido" + IS = "Icelandic" + IT = "Italian" + IU = "Inuktitut" + JA = "Japanese" + JV = "Javanese" + KA = "Georgian" + KG = "Kongo" + KI = "Kikuyu" + KJ = "Kuanyama" + KK = "Kazakh" + KL = "Greenlandic" + KM = "Cambodian" + KN = "Kannada" + KO = "Korean" + KR = "Kanuri" + KS = "Kashmiri" + KU = "Kurdish" + KV = "Komi" + KW = "Cornish" + KY = "Kirghiz" + LA = "Latin" + LB = "Luxembourgish" + LG = "Ganda" + LI = "Limburgian" + LN = "Lingala" + LO = "Laotian" + LT = "Lithuanian" + LU = "Luba-Katanga" + LV = "Latvian" + MG = "Malagasy" + MH = "Marshallese" + MI = "Maori" + MK = "Macedonian" + ML = "Malayalam" + MN = "Mongolian" + MO = "Moldovan" + MR = "Marathi" + MS = "Malay" + MT = "Maltese" + MY = "Burmese" + NA = "Nauruan" + NB = "Norwegian Bokmål" + ND = "North Ndebele" + NE = "Nepali" + NG = "Ndonga" + NL = "Dutch" + NN = "Norwegian Nynorsk" + NO = "Norwegian" + NR = "South Ndebele" + NV = "Navajo" + NY = "Chichewa" + OC = "Occitan" + OJ = "Ojibwa" + OM = "Oromo" + OR = "Oriya" + OS = "Ossetian / Ossetic" + PA = "Panjabi / Punjabi" + PI = "Pali" + PL = "Polish" + PS = "Pashto" + PT = "Portuguese" + QU = "Quechua" + RM = "Raeto Romance" + RN = "Kirundi" + RO = "Romanian" + RU = "Russian" + RW = "Rwandi" + SA = "Sanskrit" + SC = "Sardinian" + SD = "Sindhi" + SE = "Northern Sami" + SG = "Sango" + SH = "Serbo-Croatian" + SI = "Sinhalese" + SK = "Slovak" + SL = "Slovenian" + SM = "Samoan" + SN = "Shona" + SO = "Somalia" + SQ = "Albanian" + SR = "Serbian" + SS = "Swati" + ST = "Southern Sotho" + SU = "Sundanese" + SV = "Swedish" + SW = "Swahili" + TA = "Tamil" + TE = "Telugu" + TG = "Tajik" + TH = "Thai" + TI = "Tigrinya" + TK = "Turkmen" + TL = "Tagalog / Filipino" + TN = "Tswana" + TO = "Tonga" + TR = "Turkish" + TS = "Tsonga" + TT = "Tatar" + TW = "Twi" + TY = "Tahitian" + UG = "Uyghur" + UK = "Ukrainian" + UR = "Urdu" + UZ = "Uzbek" + VE = "Venda" + VI = "Vietnamese" + VO = "Volapük" + WA = "Walloon" + WO = "Wolof" + XH = "Xhosa" + YI = "Yiddish" + YO = "Yoruba" + ZA = "Zhuang" + ZH = "Chinese" + ZU = "Zulu" diff --git a/creyPY/const/stripe.py b/creyPY/const/stripe.py new file mode 100644 index 0000000..2e9f513 --- /dev/null +++ b/creyPY/const/stripe.py @@ -0,0 +1,153 @@ +import enum + + +# Supported currencies for Stripe https://stripe.com/docs/currencies?presentment-currency=DE +# Commented out are the Zero-decimal currencies, to avoid custom implementation +class CurrencyEnum(str, enum.Enum): + USD = "United States Dollar" + 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" + # BIF = "Burundian Franc" + BMD = "Bermudan Dollar" + BND = "Brunei Dollar" + BOB = "Bolivian Boliviano" + BRL = "Brazilian Real" + BSD = "Bahamian Dollar" + BWP = "Botswanan Pula" + BYN = "Belarusian 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 Colón" + CVE = "Cape Verdean Escudo" + CZK = "Czech Republic Koruna" + # DJF = "Djiboutian Franc" + DKK = "Danish Krone" + DOP = "Dominican Peso" + DZD = "Algerian Dinar" + EGP = "Egyptian Pound" + ETB = "Ethiopian Birr" + EUR = "Euro" + FJD = "Fijian Dollar" + FKP = "Falkland Islands Pound" + GBP = "British Pound Sterling" + GEL = "Georgian Lari" + GIP = "Gibraltar Pound" + GMD = "Gambian Dalasi" + # GNF = "Guinean Franc" + GTQ = "Guatemalan Quetzal" + GYD = "Guyanaese Dollar" + HKD = "Hong Kong Dollar" + HNL = "Honduran Lempira" + HTG = "Haitian Gourde" + HUF = "Hungarian Forint" + IDR = "Indonesian Rupiah" + ILS = "Israeli New Sheqel" + INR = "Indian Rupee" + ISK = "Icelandic Króna" + JMD = "Jamaican Dollar" + # JPY = "Japanese Yen" + KES = "Kenyan Shilling" + KGS = "Kyrgystani Som" + KHR = "Cambodian Riel" + # KMF = "Comorian Franc" + # KRW = "South Korean Won" + KYD = "Cayman Islands Dollar" + KZT = "Kazakhstani Tenge" + LAK = "Laotian Kip" + LBP = "Lebanese Pound" + LKR = "Sri Lankan Rupee" + LRD = "Liberian Dollar" + LSL = "Lesotho Loti" + MAD = "Moroccan Dirham" + MDL = "Moldovan Leu" + # MGA = "Malagasy Ariary" + MKD = "Macedonian Denar" + MMK = "Myanma Kyat" + MNT = "Mongolian Tugrik" + MOP = "Macanese Pataca" + MUR = "Mauritian Rupee" + MVR = "Maldivian Rufiyaa" + MWK = "Malawian Kwacha" + MXN = "Mexican Peso" + MYR = "Malaysian Ringgit" + MZN = "Mozambican Metical" + NAD = "Namibian Dollar" + NGN = "Nigerian Naira" + NIO = "Nicaraguan Córdoba" + NOK = "Norwegian Krone" + NPR = "Nepalese Rupee" + NZD = "New Zealand Dollar" + 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 Rial" + RON = "Romanian Leu" + RSD = "Serbian Dinar" + RUB = "Russian Ruble" + # RWF = "Rwandan Franc" + SAR = "Saudi Riyal" + SBD = "Solomon Islands Dollar" + SCR = "Seychellois Rupee" + SEK = "Swedish Krona" + SGD = "Singapore Dollar" + SHP = "Saint Helena Pound" + SLE = "Sierra Leonean Leone" + SOS = "Somali Shilling" + SRD = "Surinamese Dollar" + STD = "São Tomé and Príncipe Dobra" + SZL = "Swazi Lilangeni" + THB = "Thai Baht" + TJS = "Tajikistani Somoni" + TOP = "Tongan Pa`anga" + TRY = "Turkish Lira" + TTD = "Trinidad and Tobago Dollar" + TWD = "New Taiwan Dollar" + TZS = "Tanzanian Shilling" + UAH = "Ukrainian Hryvnia" + # UGX = "Ugandan Shilling" + UYU = "Uruguayan Peso" + UZS = "Uzbekistan Som" + # VND = "Vietnamese Dong" + # VUV = "Vanuatu Vatu" + WST = "Samoan Tala" + # XAF = "CFA Franc BEAC" + XCD = "East Caribbean Dollar" + # XOF = "CFA Franc BCEAO" + # XPF = "CFP Franc" + YER = "Yemeni Rial" + ZAR = "South African Rand" + ZMW = "Zambian Kwacha" + + +class StripeStatus(str, enum.Enum): + active = "active" + all = "all" + canceled = "canceled" + ended = "ended" + incomplete = "incomplete" + incomplete_expired = "incomplete_expired" + past_due = "past_due" + paused = "paused" + trialing = "trialing" + unpaid = "unpaid" diff --git a/requirements.build.txt b/requirements.build.txt new file mode 100644 index 0000000..4a58714 --- /dev/null +++ b/requirements.build.txt @@ -0,0 +1,25 @@ +certifi==2024.2.2 +charset-normalizer==3.3.2 +docutils==0.20.1 +idna==3.6 +importlib_metadata==7.1.0 +jaraco.classes==3.4.0 +jaraco.context==4.3.0 +jaraco.functools==4.0.0 +keyring==25.0.0 +markdown-it-py==3.0.0 +mdurl==0.1.2 +more-itertools==10.2.0 +nh3==0.2.17 +pkginfo==1.10.0 +Pygments==2.17.2 +readme_renderer==43.0 +requests==2.31.0 +requests-toolbelt==1.0.0 +rfc3986==2.0.0 +rich==13.7.1 +setuptools==69.2.0 +twine==5.0.0 +urllib3==2.2.1 +wheel==0.43.0 +zipp==3.18.1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d45131f --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +from setuptools import find_packages, setup + +setup( + name="creyPY", + version="0.0.5", + description="My collection of Python and FastAPI shortcuts etc.", + author="Conrad Großer", + author_email="conrad@noah.tech", + packages=find_packages(), + url="https://github.com/creyD/creyPY", + license="MIT", + python_requires=">=3.12", +)