From 0fa833d49f931db19c95f28bb537d1cdf8cf73a2 Mon Sep 17 00:00:00 2001 From: nonepork <59335048+nonepork@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:16:12 +0800 Subject: [PATCH 1/6] Added mirror & reverse method --- README.md | 22 +++++ VividHues/__init__.py | 84 +++++++++++++++--- .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 9753 bytes VividHues/__pycache__/__init__.cpython-39.pyc | Bin 4119 -> 0 bytes 4 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 VividHues/__pycache__/__init__.cpython-312.pyc delete mode 100644 VividHues/__pycache__/__init__.cpython-39.pyc diff --git a/README.md b/README.md index 6122044..c9206c6 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,28 @@ Clr.delPrevLine(5) > ``` > ###### Paint your letters in a repeating pattern, by specifying an unlimited amount of Clr codes! +
+ + + +#### :todo: Clr.mirror() + +> ```python +> print( Clr.mirror(string) ) +> ``` +> ###### Upside down your string. + +
+ + + +#### :todo: Clr.reverse() + +> ```python +> print( Clr.reverse(string) ) +> ``` +> ###### Flip and upside down your string. +


diff --git a/VividHues/__init__.py b/VividHues/__init__.py index 22864f9..8f32928 100644 --- a/VividHues/__init__.py +++ b/VividHues/__init__.py @@ -51,7 +51,7 @@ class Clr: LIME = "\033[92m" YELLOW = "\033[93m" PINK = "\033[95m" - + UNDERLINE = "\033[4m" UL = UNDERLINE BOLD = "\033[01m" @@ -59,11 +59,49 @@ class Clr: RESET = "\033[0m" RS = RESET - + MIRROR_DICT = { + "a": "ɐ", + "b": "q", + "c": "ɔ", + "d": "p", + "e": "ǝ", + "f": "ɟ", + "g": "ƃ", + "h": "ɥ", + "i": "ᴉ", + "j": "ɾ", + "k": "ʞ", + "l": "l", + "m": "ɯ", + "n": "u", + "o": "o", + "p": "d", + "q": "b", + "r": "ɹ", + "s": "s", + "t": "ʇ", + "u": "n", + "v": "ʌ", + "w": "ʍ", + "x": "x", + "y": "ʎ", + "z": "z", + "0": "0", + "1": "Ɩ", + "2": "ᄅ", + "3": "Ɛ", + "4": "ㄣ", + "5": "ϛ", + "6": "9", + "7": "ㄥ", + "8": "8", + "9": "6", + } + @classmethod def random_color(cls) -> str: """ returns a random Clr code """ - + colors = [] # List of all the colors in the class Clr for key in Clr.__dict__.keys(): if key == "UNDERLINE": # Once we got to UNDERLINE, there is no more color @@ -77,14 +115,14 @@ def random_color(cls) -> str: @classmethod def random(cls, string_to_color: str) -> str: """ chooses a random Clr code """ - + return f'{Clr.random_color()}' + string_to_color + Clr.RS @classmethod def jazzy(cls, string_to_color: str) -> str: """ gives each letter a random color """ - + jazzy_str = "" for letter in string_to_color: @@ -96,7 +134,7 @@ def jazzy(cls, string_to_color: str) -> str: @classmethod def rainbow(cls, string_to_color: str) -> str: """ colors each letter in a rainbow pattern """ - + rainbow_colors = [Clr.RED, Clr.ORANGE, Clr.YELLOW, Clr.GREEN, Clr.LIME, Clr.CYAN, Clr.BLUE, Clr.PURPLE, Clr.PINK] rainbow_str = "" @@ -109,9 +147,10 @@ def rainbow(cls, string_to_color: str) -> str: colors_index += 1 if colors_index == 9: colors_index = 0 - + return rainbow_str + Clr.RS - + + @classmethod def pattern(cls, string_to_color: str, *chosen_clrs) -> str: """ allow custom definitions of Clr patterns """ @@ -122,7 +161,7 @@ def pattern(cls, string_to_color: str, *chosen_clrs) -> str: + f"Expected some Clr codes, but was povided {len(chosen_clrs)}!" + Clr.RS ) - + pattern_str = "" string_index = 0 colors_index = 0 @@ -133,10 +172,31 @@ def pattern(cls, string_to_color: str, *chosen_clrs) -> str: string_index += 1 if colors_index == len(chosen_clrs): colors_index = 0 - + return pattern_str + Clr.RS - + + @classmethod + def mirror(cls, string_to_color: str) -> str: + """ flip all letters upside down """ + + mirror_str = "" + + for letter in string_to_color: + mirror_str += Clr.MIRROR_DICT[letter] + + return mirror_str + + + @classmethod + def reverse(cls, string_to_color: str) -> str: + """ flip and reverse all letters upside down """ + + reverse_str = Clr.mirror(string_to_color)[::-1] + + return reverse_str + + def delPrevLine(repeat: int = 1) -> None: ''' erases the previous line in the CLI ''' @@ -148,7 +208,7 @@ def delPrevLine(repeat: int = 1) -> None: ) import sys - + CURSOR_UP_ONE = '\x1b[1A' ERASE_LINE = '\x1b[2K' for _ in range(int(repeat)): diff --git a/VividHues/__pycache__/__init__.cpython-312.pyc b/VividHues/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9d4989001cc755672553003661f15f878a89a16 GIT binary patch literal 9753 zcmc&(YiwIbcD}=x_!O!4%a*VFifKEN^{}4KLoeI164L!pQN)&B%~U5IL<2*TT%6v=6$gzDbWr+dxg=w`5& zf@eyghHE66d7l|mfdEwB5b`7}>m{f${q6;_Y?brnQG%NCdbH4a^iBB!q3#V73zgz!ncdZ>8Py(l z>`HcOIeirB=CC%0g-T`bFSJlk|!3WerQ z1Ou>+O_|BZo=8u*P8zTpYrj82S= z4ny1M(8zIBH!-XlkBkitj@%ViVabGVjt_LdFe-;<-nO(RC*z^-Z{wY4TJ(wueUKWrxs~@NUnjdF>X?R2+`cUux1jB)=NjeFj$tX z`|g!~ZfFDe2VIG!b5#J65_FET6r$gkRbFqu)_!$Q%80eP`rAD>dzK!1dbzH5skVOJ5C&ov1S&EOI|sB`SikY%7VR`g_=f&fYa3S?&RIc#pg5*X?Jjr z6?Ht9J)mPl9jj2&%FvosXzO^d{eJtsJsOAfI5@|i)p4MXU8reEAzHHwt?lpazQ6lk zHLIuWq}#zc#i;Y#<>z1=C+ZXnHEj&76$=MD-#dK&@V!orLk>AO$CcG7K^>P+b0CFi z%_TIqy=S^_TD-vODHrK-b*NJ-RPAMGtyb9A`0nnzyBDi9j=sggIU?$ux_s(2 z|MkGNK+>^o$u6cEP+JrldI^JTqR>YM$;Xu+ReosJm}H0?Ttm4veVNg^wg>hSY@^Q% z`(YEkd_=B-eHN<#f}TN&PK(?*i2r=IeItOq#bv4|v#!9Y~XoDJxD{NW%tA1W%a zze7`s7zl}@b8z;B8pPD?D+@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c4e0AU?#~pFsR1Z+{B$(}Xj63D){pZ9LV_ zY6Gk`@%1399VT#fzv6H`8p7)Q@ze+rOeHCu)!2Pw{E+~~sy^KSONT7Iv5(vtPYGBq zf((|L5JLE9C}lQoztf)*pjhmGgoP#o2tEx;xQsjR_)`KDi~dJgXcB;6aZ#dzOF;1p z=mQE(0uU@AAEg$jVm8*|OrXe&Qmc((G}hrLP~a#~XcBi^3sxGWBI|C0mr$nV$_8S=bg7nYn?EZ`WJdR!=`(w9i%lY{lh4}B$*qr$R znVVw1d46L)#NEu3GNw})y(>dNAc`R5w}R!jf@4Ln%n*CPQbd(Hm?5M>Sd literal 0 HcmV?d00001 diff --git a/VividHues/__pycache__/__init__.cpython-39.pyc b/VividHues/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 31f62a30fb5a6c439331340b9e9d47905ccceb3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4119 zcmd5<&2!tv6~_V#@KdrZe@L>O1h(VEOjF60oy2xKt!;@TYs^v_%1S1PS`5U6CCC&( zEkHTqP#sV0Lk_*Q(@T<8?x8b2^?&H}ufQ=q`PN%o_rv|Y1x3-84?ULBz6UJcF5bT1 z+uvJwLqmBDKjX^s>K~74+F$5q@MqxWCR$X35Sm~O%}F(Ln6K^WLVwB_`i1cg6I_^2 zxMK**;UeRhBI{Tp=VV0Q$%=xLo6|&53_a1r&|}@n3$~<{hM!|zt(s`hSYk;(Zp&t! zdIo=^xS2tVeg+ZaU61ibXgy{d`q!E;pbcma&7nbIxwbpczMY*pBUZ-M77MFKBqH4c`{+rtoECw|@gizI*iR|HJ?G4Y-!K zd%y1<{oejG*bc;)Z7&I_F&1Ysc%MbY0AGgXT%^?E{2wL-kJ|vHP>7a-)XPf%eBgZ+54{B^6C##tJJJ_Z#TV7 z|G@A(40l?=;CmN$7K1~x(WpVAH_vv~b+-W~JSJP^UA--(-;C{Ef9JRTclR$;Zd~lg zbh4Kc7fU7Ejzin4*Zn9$+60m9t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Cf27R12(v+wh6d^1V2vH1dA`M<`NLTh75n7u*39-;Fh#_VJa{ z1-CoeQ=vJ>o_B zK4?jQI|$nmjwVf?jvv%HQ<=9_rRaRzhs6T`5g^?5?QM#+Is>K)I*gHgAB(6`O}u=I zJRA8(q7Wj5a%!d+ZrIIP>C?>xL;S9|z*OnG)?((9$ zP%S(8a_!bq*`=zMF!y!X3c_zJVr>;Hi}prDn>jtwahC5xmsLA%gmsS4E*ltAVhXm> zTT~#^GkKDC-OW(68#tdQMc3VGdyVvoW8SXZnz<_#!JNZ;QkLoSiJ}+B{Or#By>iMo zL_qR9iDM9szFcwm?S;y$qu*X|%vyP=d`~e?Qm8k)DB8rKGDJ9Wbww3f1)gl9YYb5)hwk#qKA0;c%ve||Z1tWcj>4kC5%A(a#czL&@-{U)OB{`X9pBX3wklKo*C{~yujiHP5c NBlE`a_`qU}{{klb8Yut( From 356fe3b29df35f9b01b8d4994d969671e70755b5 Mon Sep 17 00:00:00 2001 From: nonepork <59335048+nonepork@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:20:28 +0800 Subject: [PATCH 2/6] Changed version --- VividHues/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VividHues/__init__.py b/VividHues/__init__.py index 8f32928..c99d0a1 100644 --- a/VividHues/__init__.py +++ b/VividHues/__init__.py @@ -36,7 +36,7 @@ def dunders() -> None: __homepage__ = "https://github.com/KennyOliver/VividHues" __package__ = "VividHues" __pypi__ = "https://pypi.org/project/VividHues/" -__version__ = "5.9.2" +__version__ = "5.10.2" class Clr: From 69bff8da44d3cb7e3361c295f09113eea84fa644 Mon Sep 17 00:00:00 2001 From: nonepork <59335048+nonepork@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:26:16 +0800 Subject: [PATCH 3/6] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c9206c6..655e9b5 100644 --- a/README.md +++ b/README.md @@ -285,9 +285,9 @@ Clr.delPrevLine(5)
- +![Mirror](https://github.com/nonepork/VividHues/assets/59335048/04119e77-cf52-4c3c-86d5-c9d5922bc28e) -#### :todo: Clr.mirror() +#### :mirror: Clr.mirror() > ```python > print( Clr.mirror(string) ) @@ -296,9 +296,9 @@ Clr.delPrevLine(5)
- +![Reverse](https://github.com/nonepork/VividHues/assets/59335048/a80c8f20-9e53-42a5-baed-fef1c6583913) -#### :todo: Clr.reverse() +#### 🔄 Clr.reverse() > ```python > print( Clr.reverse(string) ) From fa4c44d5e83b17fbb733fcd3658e9438b5ec5773 Mon Sep 17 00:00:00 2001 From: nonepork <59335048+nonepork@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:28:13 +0800 Subject: [PATCH 4/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 655e9b5..299e6d6 100644 --- a/README.md +++ b/README.md @@ -285,7 +285,7 @@ Clr.delPrevLine(5)
-![Mirror](https://github.com/nonepork/VividHues/assets/59335048/04119e77-cf52-4c3c-86d5-c9d5922bc28e) + #### :mirror: Clr.mirror() @@ -296,7 +296,7 @@ Clr.delPrevLine(5)
-![Reverse](https://github.com/nonepork/VividHues/assets/59335048/a80c8f20-9e53-42a5-baed-fef1c6583913) + #### 🔄 Clr.reverse() From 85ceec4b88d36324a87fd7dcac99be04a4e9e044 Mon Sep 17 00:00:00 2001 From: nonepork <59335048+nonepork@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:29:57 +0800 Subject: [PATCH 5/6] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 299e6d6..c8650de 100644 --- a/README.md +++ b/README.md @@ -285,10 +285,10 @@ Clr.delPrevLine(5)
- - #### :mirror: Clr.mirror() + + > ```python > print( Clr.mirror(string) ) > ``` @@ -296,10 +296,10 @@ Clr.delPrevLine(5)
- - #### 🔄 Clr.reverse() + + > ```python > print( Clr.reverse(string) ) > ``` From ddbccd2839f0e8411338ae6ccd5dfdcce721e62d Mon Sep 17 00:00:00 2001 From: nonepork <59335048+nonepork@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:40:37 +0800 Subject: [PATCH 6/6] Added fallback & capitalize flip letters --- VividHues/__init__.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/VividHues/__init__.py b/VividHues/__init__.py index c99d0a1..f314427 100644 --- a/VividHues/__init__.py +++ b/VividHues/__init__.py @@ -60,6 +60,32 @@ class Clr: RS = RESET MIRROR_DICT = { + "A": "Ɐ", + "B": "B", + "C": "C", + "D": "D", + "E": "E", + "F": "ᖶ", + "G": "ᘓ", + "H": "H", + "I": "I", + "J": "ᒉ", + "K": "K", + "L": "Γ", + "M": "W", + "N": "И", + "O": "O", + "P": "b", + "Q": "⥀", + "R": "ᖉ", + "S": "Ƨ", + "T": "ꓕ", + "U": "ꓵ", + "V": "Λ", + "W": "M", + "X": "X", + "Y": "⅄", + "Z": "Z", "a": "ɐ", "b": "q", "c": "ɔ", @@ -183,7 +209,10 @@ def mirror(cls, string_to_color: str) -> str: mirror_str = "" for letter in string_to_color: - mirror_str += Clr.MIRROR_DICT[letter] + try: + mirror_str += Clr.MIRROR_DICT[letter] + except KeyError: + mirror_str += letter return mirror_str