Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-ASCII art filtered from random mode #110

Merged
merged 13 commits into from
Feb 13, 2020
13 changes: 9 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ Please consider the following :
4. If 1-line art is bipartite:
- Add as list (Example : ```"1-line art name": ["string1","string1"]```)
- Add 1-line art name to `RANDOM_FILTERED_ARTS` list
5. Add a test case to `test.py` (*Alphabetical order*)
6. Re-run `ArtList.ipynb`
5. If 1-line art is **Non-ASCII**:
- Add 1-line art name to `NON_ASCII_ARTS` list
- Add a test case to `test2.py` (*Alphabetical order*)
6. If 1-line art is **ASCII**:
- Add a test case to `test.py` (*Alphabetical order*)
- Add 1-line art name to `RANDOM_FILTERED_ARTS` list to remove it from random mode (*Optional*)
7. Re-run `ArtList.ipynb`
- Before this step you should re-install `art` package : ```python setup.py install```
7. Update 2 art counters in `README.md`
8. Update 2 art counters in `README.md`
- Badge section
- Overview section
8. Update `Reference` section in `README.md`
9. Update `Reference` section in `README.md`
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- `NON_ASCII_ARTS` list
- 20 new fonts
1. scammer
2. strikethrough
Expand All @@ -31,6 +32,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `setup.py` modified
- `coverage` dependency moved to `extras_require`
- Test system modified
- `random` mode modified
- `test` parameter removed from `font_list` function
- `mode` parameter added to `font_list` and `art_list` functions
### Removed
- `requirements.txt`
## [4.5] - 2020-01-29
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ art.art.artError: number should have int type
'✌(◕‿-)✌ '
```

* Note : Use `ART_NAMES` to access all arts name list (new in `Version 4.2`)
* Note1 : Use `ART_NAMES` to access all arts name list (new in `Version 4.2`)
* Note2 : Use `NON_ASCII_ARTS` to access all Non-ASCII arts name list (new in `Version 4.6`)

### ASCII text

Expand Down
2 changes: 1 addition & 1 deletion art/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
from .art import aprint, art, randart
from .art import tprint, tsave, text2art
from .art import get_font_dic, set_default, help_func, art_list, font_list
from .art_param import ART_VERSION, FONT_NAMES, NON_ASCII_FONTS, ART_NAMES, ART_COUNTER, FONT_COUNTER, DEFAULT_FONT
from .art_param import ART_VERSION, FONT_NAMES, NON_ASCII_FONTS, ART_NAMES, ART_COUNTER, FONT_COUNTER, DEFAULT_FONT, NON_ASCII_ARTS
__version__ = ART_VERSION
23 changes: 16 additions & 7 deletions art/art.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,41 @@ def line(char="*", number=30):
print(char * number)


def font_list(text="test", test=False):
def font_list(text="test", mode="all"):
"""
Print all fonts.

:param text : input text
:type text : str
:param test: test flag
:type test: bool
:param mode: fonts mode (all,ascii,non-ascii)
:type mode: str
:return: None
"""
fonts = set(FONT_MAP.keys())
if test:
fonts = set(FONT_NAMES)
if mode.lower() == "ascii":
fonts = fonts - set(NON_ASCII_FONTS)
if mode.lower() == "non-ascii":
fonts = set(NON_ASCII_FONTS)
for item in sorted(list(fonts)):
print(str(item) + " : ")
text_temp = text
tprint(text_temp, str(item))


def art_list():
def art_list(mode="all"):
"""
Print all 1-Line arts.

:param mode: fonts mode (all,ascii,non-ascii)
:type mode: str
:return: None
"""
for i in sorted(list(art_dic.keys())):
arts = set(ART_NAMES)
if mode.lower() == "ascii":
arts = arts - set(NON_ASCII_ARTS)
if mode.lower() == "non-ascii":
arts = set(NON_ASCII_ARTS)
for i in sorted(list(arts)):
print(i)
aprint(i)
line()
Expand Down
Loading