<commit_before># -*- coding: utf-8 -*-
# Copyright (c) 2010 <NAME>. This program is open-source software,
# and may be redistributed under the terms of the MIT license. See the
# LICENSE file in this distribution for details.

"""
This module implements dependency injection. See
http://martinfowler.com/articles/injection.html for an explanation of
dependency injection.

Here is a tutorial that explains how to use this module.

First, import the injection module so that you can use the injection
functionality:
  >>> from nak import inject

Then, create a class whose instances have to be injected a "feature"
identified by the string 'IService' (but could be any hashable type: a
class for example):
  >>> class Client(object):
  ...     service = inject.Attr('IService')  # inject a feature as an attribute
  ...     def use_service(self):
  ...         self.service.do_something()  # use the injected feature
  ...

Then, create a class (or a callable) that implements the "feature":
  >>> class Service(object):
  ...     def do_something(self):<commit_msg>Fixed a wrong import in the docstring<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2010 <NAME>. This program is open-source software,
# and may be redistributed under the terms of the MIT license. See the
# LICENSE file in this distribution for details.

"""
This module implements dependency injection. See
http://martinfowler.com/articles/injection.html for an explanation of
dependency injection.

Here is a tutorial that explains how to use this module.

First, import the injection module so that you can use the injection
functionality:
  >>> from yaak import inject

Then, create a class whose instances have to be injected a "feature"
identified by the string 'IService' (but could be any hashable type: a
class for example):
  >>> class Client(object):
  ...     service = inject.Attr('IService')  # inject a feature as an attribute
  ...     def use_service(self):
  ...         self.service.do_something()  # use the injected feature
  ...

Then, create a class (or a callable) that implements the "feature":
  >>> class Service(object):
  ...     def do_something(self):
{'fraction_non_alphanumeric': 0.09466357308584687, 'fraction_numerical': 0.004640371229698376, 'mean_word_length': 3.6767895878524945, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 23, '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}}
{'dir': 'git-commits-cleaned', 'id': '568322', 'n_tokens_mistral': 580, 'n_tokens_neox': 557, 'n_words': 269}