Skip to content

Instantly share code, notes, and snippets.

@terenty-rezman
terenty-rezman / decorate_class_own_methods.py
Created January 25, 2022 12:59
Python class decorate own methods
def for_all_own_methods(decorator: Callable):
"""
class decorator
apply decorator function to all class methods, excluding inherited ones
Args:
decorator ([Callable]): decorator function to apply to all own methods
"""
def decorate(cls):
import inspect
FROM ubuntu:20.04
RUN echo 1
RUN echo "#!/bin/bash" > test.sh && \
echo "echo x" >> test.sh && \
chmod +x test.sh && \
./test.sh