<commit_before>CHANGES
*******

0.9 (unreleased)
================

Total rewrite of Reg! This includes a range of changes that can break
code. The primary motivations for this rewrite:

* unify predicate system with class-based lookup system.

* extract dispatch information from specific arguments instead of all
  arguments.

Some specific changes:

* Replaced ``@reg.generic`` decorator with ``@reg.dispatch()``
  decorator. This decorator can be configured with predicates that
  extract information from the arguments.

* In particular, rewrite this::

    @reg.generic
    def foo(obj):
       pass

  to this::

    @reg.dispatch('obj')
    def foo(obj):
       pass

  And this::

    @reg.generic
    def bar(a, b):
        pass

  To this::

    @reg.dispatch('a', 'b')
    def bar(a, b):
        pass

  This is to get dispatch on the classes of these instance
  arguments. You can also use ``match_class`` to have direct dispatch
  on class arguments (useful for replicating classmethods), and
  ``match_key`` to have dispatch on the (immutable) value of the
  argument. You supply functions to these match functions that extract
  the exact information to dispatch on from the argument.

* pep443 support is gone. Reg is focused on its own dispatch system.

* Compose functionality is gone -- it turns out Morepath doesn't use
  lookup composition to support App inheritance. The cached lookup
  functionality has moved into ``registry.py`` and now also supports
  caching of predicate-based lookups.

* Dependency on the future module is gone in favor of a small amount
  of compatibility code.

0.8 (2014-08-28)
================

- Added a ``@reg.classgeneric``. This is like ``@reg.generic``, but
  the first argument is treated as a class, not as an instance. This
  makes it possible to replace ``@classmethod`` with a generic
  function too.

- Fix documentation on running documentation tests. For some reason
  this did not work properly anymore without running sphinxpython
  explicitly.

- Optimization: improve performance of generic function calls by
  employing ``lookup_mapply`` instead of general ``mapply``, as we
  only care about passing in the lookup argument when it's defined,
  and any other arguments should work as before. Also added a
  ``perf.py`` which is a simple generic function timing script.

0.7 (2014-06-17)
================

- Python 2.6 compatibility. (<NAME>)

- Class maps (and thus generic function lookup) now works with old
  style classes as well.

- Marked as production/stable now in ``setup.py``.

0.6 (2014-04-08)
================

- Removed unused code from mapply.py.

- Typo fix in API docs.

0.5 (2014-01-21)
================

- Make ``reg.ANY`` public. Used for predicates that match any value.

0.4 (2014-01-14)
================

- arginfo has been totally rewritten and is now part of the public API of reg.

0.3 (2014-01-06)
================

- Experimental Python 3.3 support thanks to the future module.

0.2 (2013-12-19)
================

- If a generic function implementation defines a ``lookup`` argument
  that argument will be the lookup used to call it.

- Added ``reg.mapply()``. This allows you to call things with more
  keyword arguments than it accepts, ignoring those extra keyword
  args.

- A function that returns ``None`` is not assumed to fail, so no fallback
  to the original generic function is triggered anymore.

- An optional ``precalc`` facility is made available on ``Matcher`` to
  avoid some recalculation.

- Implement a specific ``PredicateMatcher`` that matches a value on
  predicate.

0.1 (2013-10-28)
================

- Initial public release.
<commit_msg>A few more notes for the changes.<commit_after>CHANGES
*******

0.9 (unreleased)
================

Total rewrite of Reg! This includes a range of changes that can break
code. The primary motivations for this rewrite:

* unify predicate system with class-based lookup system.

* extract dispatch information from specific arguments instead of all
  arguments.

Some specific changes:

* Replaced ``@reg.generic`` decorator with ``@reg.dispatch()``
  decorator. This decorator can be configured with predicates that
  extract information from the arguments. Rewrite this::

    @reg.generic
    def foo(obj):
       pass

  to this::

    @reg.dispatch('obj')
    def foo(obj):
       pass

  And this::

    @reg.generic
    def bar(a, b):
        pass

  To this::

    @reg.dispatch('a', 'b')
    def bar(a, b):
        pass

  This is to get dispatch on the classes of these instance
  arguments. You can also use ``match_class`` to have direct dispatch
  on class arguments (useful for replicating classmethods), and
  ``match_key`` to have dispatch on the (immutable) value of the
  argument. You supply functions to these match functions that extract
  the exact information to dispatch on from the argument.

* The ``register_function`` API replaces the ``register`` API to
  register a function. Replace this::

    r.register(foo, (SomeClass,), dispatched_to)

  with::

    r.register_function(foo, dispatched_to, obj=SomeClass)

  You now use keyword parameters to indicate exactly those arguments
  specified by ``reg.dispatch()`` are actually predicate
  arguments. You don't need to worry about the order of predicates
  anymore when you register a function for it.

* The new ``classgeneric`` functionality is part of the predicate
  system now; you can use ``reg.match_class`` instead. Replace

    @reg.classgeneric
    def foo(cls):
       pass

  with::

    @reg.dispatch(reg.match_class('cls', lambda cls: cls))
    def foo(cls):
        pass

  You can do this with any argument now, not just the first one.

* pep443 support is gone. Reg is focused on its own dispatch system.

* Compose functionality is gone -- it turns out Morepath doesn't use
  lookup composition to support App inheritance. The cached lookup
  functionality has moved into ``registry.py`` and now also supports
  caching of predicate-based lookups.

* Dependency on the future module is gone in favor of a small amount
  of compatibility code.

0.8 (2014-08-28)
================

- Added a ``@reg.classgeneric``. This is like ``@reg.generic``, but
  the first argument is treated as a class, not as an instance. This
  makes it possible to replace ``@classmethod`` with a generic
  function too.

- Fix documentation on running documentation tests. For some reason
  this did not work properly anymore without running sphinxpython
  explicitly.

- Optimization: improve performance of generic function calls by
  employing ``lookup_mapply`` instead of general ``mapply``, as we
  only care about passing in the lookup argument when it's defined,
  and any other arguments should work as before. Also added a
  ``perf.py`` which is a simple generic function timing script.

0.7 (2014-06-17)
================

- Python 2.6 compatibility. (<NAME>)

- Class maps (and thus generic function lookup) now works with old
  style classes as well.

- Marked as production/stable now in ``setup.py``.

0.6 (2014-04-08)
================

- Removed unused code from mapply.py.

- Typo fix in API docs.

0.5 (2014-01-21)
================

- Make ``reg.ANY`` public. Used for predicates that match any value.

0.4 (2014-01-14)
================

- arginfo has been totally rewritten and is now part of the public API of reg.

0.3 (2014-01-06)
================

- Experimental Python 3.3 support thanks to the future module.

0.2 (2013-12-19)
================

- If a generic function implementation defines a ``lookup`` argument
  that argument will be the lookup used to call it.

- Added ``reg.mapply()``. This allows you to call things with more
  keyword arguments than it accepts, ignoring those extra keyword
  args.

- A function that returns ``None`` is not assumed to fail, so no fallback
  to the original generic function is triggered anymore.

- An optional ``precalc`` facility is made available on ``Matcher`` to
  avoid some recalculation.

- Implement a specific ``PredicateMatcher`` that matches a value on
  predicate.

0.1 (2013-10-28)
================

- Initial public release.

{'fraction_non_alphanumeric': 0.1130637827209045, 'fraction_numerical': 0.021875384048175003, 'mean_word_length': 3.666284403669725, '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}}
{'dir': 'git-commits-cleaned', 'id': '1813492', 'n_tokens_mistral': 2341, 'n_tokens_neox': 2194, 'n_words': 1057}