human
I am working on the file "BlogPosts/Decorator_mixing/decorator_mixing.ipynb".
The first task is:
Example of using both: Providing a process_time
I write a lot of data pipelines, and it can be useful to have a process be consistent about all the times it uses (e.g., to set a creation_time field for a record). A @cachedproperty is a nice way to ensure we always get the same time back!
Can you write Python code for it?
assistant
#Here is the Python code you requested.

from datetime import datetime
from typing import Iterator

class ProcessTimeProvider(ABC):
    """Abstract interface for providing times for data pipelines + other processes"""
    
    @cachedproperty
    @abstractmethod
    def process_time(self) -> datetime:
        pass
    
    
class LocalProcessTimeProvider(ProcessTimeProvider):
    
    @cachedproperty
    def process_time(self) -> datetime:
        return datetime.now()
    
    
class UTCProcessTimeProvider(ProcessTimeProvider):
    
    @cachedproperty
    def process_time(self) -> datetime:
        return datetime.utcnow()