<commit_before>python-doublescript
===================

.. image:: https://travis-ci.org/fdintino/python-doublescript.svg?branch=master
    :target: https://travis-ci.org/fdintino/python-doublescript

python-doublescript is a package that allows runtime manipulation of the
evaluated value of “2 + 2” (generally to cause the result to equal “5”).
The name of the package and the specific focus on
`“2 + 2 = 5” <https://en.wikipedia.org/wiki/2_%2B_2_%3D_5>`_ comes from the
novel *1984* by George Orwell, but the motivation is to explore CPython
internals and how one would go about monkey-patching those internals at
runtime using ctypes.

Usage
-----

.. code-block:: python

    from doublescript import two_plus_two_equals

    with two_plus_two_equals(5):
        print(eval("2 + 2"))  # prints "5"

Or, if you’re feeling adventurous (currently only works on x86 architectures)::<commit_msg>Add a link to the europython talk and slides.<commit_after>python-doublescript
===================

.. image:: https://travis-ci.org/fdintino/python-doublescript.svg?branch=master
    :target: https://travis-ci.org/fdintino/python-doublescript

python-doublescript is a package that allows runtime manipulation of the
evaluated value of “2 + 2” (generally to cause the result to equal “5”).
The name of the package and the specific focus on
`“2 + 2 = 5” <https://en.wikipedia.org/wiki/2_%2B_2_%3D_5>`_ comes from the
novel *1984* by George Orwell, but the motivation is to explore CPython
internals and how one would go about monkey-patching those internals at
runtime using ctypes.

This package was the subject of a talk at
`EuroPython 2017`_: `2 + 2 = 5`_:
`Monkey-patching CPython with ctypes to conform to Party doctrine`__
(`slides`_). The video will be posted when it is made available.

.. _EuroPython 2017: https://ep2017.europython.eu/
.. _`2 + 2 = 5`: https://ep2017.europython.eu/conference/talks/2-2-5-monkey-patching-cpython-with-ctypes-to-conform-to-party-doctrine
.. _slides: https://www.slideshare.net/fdintino/2-2-5-monkeypatching-cpython-with-ctypes-to-conform-to-party-doctrine

__ `2 + 2 = 5`_

Usage
-----

.. code-block:: python

    from doublescript import two_plus_two_equals

    with two_plus_two_equals(5):
        print(eval("2 + 2"))  # prints "5"

Or, if you’re feeling adventurous (currently only works on x86 architectures)::
{'fraction_non_alphanumeric': 0.12531860662701785, 'fraction_numerical': 0.031011045029736617, 'mean_word_length': 4.198675496688741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 9, 'lorem ipsum': 0, 'www.': 1, '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': '5030811', 'n_tokens_mistral': 835, 'n_tokens_neox': 765, 'n_words': 243}