This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import click | |
| from tool import __version__ | |
| @click.group() | |
| @click.version_option( | |
| __version__, "-V", "--version", message="%(prog)s, version %(version)s" | |
| ) | |
| @click.pass_context |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A module including custom decorators. | |
| """ | |
| from . import __version__ | |
| def add_version(f): | |
| """ | |
| Add the version of the tool to the help heading. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import click | |
| from tool import __version__ | |
| from tool.custom_decorators import add_version | |
| @click.group() | |
| @click.version_option( | |
| __version__, "-V", "--version", message="%(prog)s, version %(version)s" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.7.2-alpine | |
| RUN pip install --upgrade pip | |
| RUN adduser -D worker | |
| USER worker | |
| WORKDIR /home/worker | |
| COPY --chown=worker:worker requirements.txt requirements.txt | |
| RUN pip install --user -r requirements.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.7.2-alpine | |
| RUN pip install --upgrade pip | |
| RUN adduser -D worker | |
| USER worker | |
| WORKDIR /home/worker | |
| RUN pip install --user pipenv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import resource | |
| import sys | |
| import time | |
| from sniffing import FunctionSniffingClass | |
| def list_sort(arr): | |
| return arr.sort() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| from boxx import timeit | |
| def list_sort(arr): | |
| return arr.sort() | |
| def sorted_builtin(arr): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from time import time | |
| class Timer(object): | |
| def __init__(self, description): | |
| self.description = description | |
| def __enter__(self): | |
| self.start = time() | |
| def __exit__(self, type, value, traceback): | |
| self.end = time() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from contextlib import contextmanager | |
| from time import time | |
| @contextmanager | |
| def timing(description: str) -> None: | |
| start = time() | |
| yield | |
| ellapsed_time = time() - start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test(): | |
| """Stupid test function""" | |
| L = [i for i in range(100)] | |
| if __name__ == '__main__': | |
| import timeit | |
| print(timeit.timeit("test()", setup="from __main__ import test")) |