Skip to content

Commit

Permalink
Adds code to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathadv committed Apr 12, 2019
1 parent ef197a8 commit 4e15b5b
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .gitignore
@@ -0,0 +1,107 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/


.idea/
11 changes: 11 additions & 0 deletions Pipfile
@@ -0,0 +1,11 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]

[requires]
python_version = "3.6"
Empty file.
32 changes: 32 additions & 0 deletions django_test_prettify/colorize.py
@@ -0,0 +1,32 @@
import inspect


RED = "\u001b[31m"
GREEN = "\u001b[32m"
YELLOW = "\u001b[33m"
BLUE = "\u001b[34m"
MAGENTA = "\u001b[35m"
WHITE = "\u001b[37m"
RESET = "\u001b[0m"


def colorize(color=WHITE):
def wrap(something):
if inspect.isclass(something):
_handle_class(something, color)
else:
_handle_function(something, color)

return something
return wrap


def _handle_class(_class, color):
for _, v in _class.__dict__.items():
_handle_function(v, color)


def _handle_function(_member, color):
if inspect.ismethod(_member) or inspect.isfunction(_member):
if _member.__doc__:
_member.__doc__ = f"{color}{_member.__doc__.strip()}{RESET}"

0 comments on commit 4e15b5b

Please sign in to comment.