<jupyter_start><jupyter_text>import datetimeclass ConstructorInjection:    def __init__(self, time_provider):        self.time_provider = time_provider            def get_current_time(self):        return self.time_provider()<jupyter_code>class ParameterInjection:
    def __init__(self):
        pass
    
    def get_current_time(self, time_provider):
        return time_provider()

class SetterInjection:
    def __init__(self):
        pass
    
    def set_time_provider(self, time_provider):
        self.time_provider = time_provider
        
    def get_current_time(self):
        return self.time_provider()
    
def production_code_time_provider():
    ct = datetime.datetime.now()
    return f"{ct.hour}:{ct.minute}"
    

def midnight_time_provider():
    return "00:01"
ci1 = ConstructorInjection(midnight_time_provider)
ci1.get_current_time()
ci2 = ParameterInjection()
ci2.get_current_time(production_code_time_provider)
si = SetterInjection()
si.get_current_time()
si.set_time_provider(midnight_time_provider)
si.get_current_time()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08897126969416126, 'fraction_numerical': 0.0074142724745134385, 'mean_word_length': 4.242718446601942, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '619756', 'license': 'MIT', 'n_tokens_mistral': 345, 'n_tokens_neox': 341, 'n_words': 56, 'path': 'design-patterns/dependency-injection.ipynb', 'repo_name': 'AlaminMahamud/awesome-python', 'size': '1079'}