Drop <3.7 support and add type hints (#59)

- Drop support for Python <3.7
- Bump the pre-commit version used in CI
- Add type hinting and docstrings
- Add mypy to pre-commit config
- Fix typing issues
- Update colors module
  - Update colors module to use uppercase hex codes
  - Add `__lt__` to allow sorting colors by name
- Fix `build_examples.py` to work with color Enum
- Update example badges in `README.md`
- Fix typing issues in server
- Update travis links in `README.md`
- Fix PyPi deployment bug (#60)
This commit is contained in:
Jon Grace-Cox
2022-08-08 23:19:50 -04:00
committed by GitHub
parent f16867114a
commit 8a434d95b5
36 changed files with 430 additions and 313 deletions

View File

@@ -3,21 +3,20 @@ import anybadge
if __name__ == "__main__":
print(
"""| Color Name | Hex Code | Example |
| ---------- | -------- | ------- |"""
"""
| Color Name | Hex | Example |
| ------------- | ------- | ------- |"""
)
for color, hex in sorted(anybadge.COLORS.items()):
for color in sorted(anybadge.colors.Color):
file = "examples/color_" + color + ".svg"
file = "examples/color_" + color.name.lower() + ".svg"
url = "https://cdn.rawgit.com/jongracecox/anybadge/master/" + file
anybadge.Badge(label="Color", value=color, default_color=color).write_badge(
file, overwrite=True
)
anybadge.Badge(
label="Color", value=color.name.lower(), default_color=color.value
).write_badge(file, overwrite=True)
print(
"| {color} | {hex} | ![]({url}) |".format(
color=color, hex=hex.upper(), url=url
)
f"| {color.name.lower():<13} | {color.value.upper():<7} | ![]({f'{url})':<84}|"
)