Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on May 3, 2021 at 08:36 AM

New Paste 1 (Python)

class Tracer(object):
    def __init__(self, obj):
        self._obj = obj

    def __getattr__(self, attr):
        if attr == '_obj':
            return super().__getattr__(attr)

        orig = getattr(self._obj, attr)
        if callable(orig):
            def wrapped(*args, **kwargs):
                print("Calling {}.{} with {}, {}".format(
                    repr(self._obj), attr, repr(args), repr(kwargs)))
                return orig(*args, **kwargs)
            return wrapped
        else:
            print("Getting {}.{} = {}".format(repr(self._obj), attr, repr(orig)))
            return orig

    def __setattr__(self, attr, value):
        if attr == '_obj':
            super().__setattr__(attr, value)
            return

        print("Setting {}.{} to {}".format(repr(self._obj), attr, repr(value)))
        setattr(self._obj, attr, value)