semvec/pypi-packages huggingface dataset:
hookery 5.0.1
Trivial, primitive, naive, and optimistic hooks in Python 3.6+
License: MIT

*******
hookery
*******

Minimally invasive hooks with no metaclasses and no class decorators since ``v5.0.0``.

Status
======

* ``v3.10.1`` status is ``Beta``.
* ``v5.x`` status is ``Pre-Alpha``.

I use ``v3.10.1`` (https://pypi.org/project/hookery/3.10.1/) in production for work.

This document is for ``v5.x`` which is NOT production-ready yet.


Installation
============

.. code-block:: shell

    pip install hookery==3.10.1

Basic Usage
===========

.. code-block:: python

    from hookery import Hook, hooks

    class Profile:
        on_activated = Hook()

        @on_activated
        def log_activation(self):
            print(f"Activating {self}")

        def activate(self):
            hooks.trigger(self.on_activated)


    class WarehouseProfile(Profile):

        @Profile.on_activated
        def log_activation(self):
            print(f"Warehouse profile {self} is being activated")

        @Profile.on_activated
        def another_handler(self):
            print(f"This will also be printed")


The dummy example above demonstrates that:

* a hook registration requires no metaclasses, no base classes, no class decorators.
* you can register any number of handlers per hook inside the same class
* a handler called ``log_activation`` in child class does not override a handler with the same name
  in parent class.


.. code-block:: python

    >>> profile = WarehouseProfile()
    >>> profile.activate()
    Activating <__main__.WarehouseProfile object at 0x103ee66d8>
    Warehouse profile <__main__.WarehouseProfile object at 0x103ee66d8> is being activated
    This will also be printed


Limitations
===========

* For us, hooks and hook handlers are part of the class specification. This means that a class cannot have new hooks
  added or new hook handlers registered after the class has been created. If you wish to add functionality you either
  modify the class or extend it.
* ``@classmethod``'s and ``@staticmethod``'s cannot be registered as handlers because hooks apply to instances of
  a class, not the class itself.
* It is best to not decorate handlers with anything else.
changewords 1.0.3
Python tool to change or replace the text string in the files.
License: MIT
Keywords: change words

===================
changewords
===================

|pypi version| |build status|

Simply python tool to change or replace the text string in the files.
This tool pretty nice for programmers if somehow they want to replace/change their codes for many files,
eg: ``function``, ``class``, ``variable``, etc for recursive files or not.


Installation
============

Install from PyPI:

::

    $ pip install changewords


Usage
--------------

::

    usage: changewords.py [-h] [-p PATH] [-ft FILE_TYPE] [-fs FROM_STRING]
                          [-ts TO_STRING]

    Python tool to change or replace the strings in files.

    optional arguments:
      -h, --help            show this help message and exit
      -p PATH, --path PATH  the starting path or parent path name
                            by default is current path/folder.
      -ft FILE_TYPE, --file_type FILE_TYPE
                            file type you are looking for, eg: '.py', '.txt'
                            by default is '.py' (python files)
      -fs FROM_STRING, --from_string FROM_STRING
                            the string to change/replace
      -ts TO_STRING, --to_string TO_STRING
                            the string replacement


Example
--------------

::

    $ changewords -p=changewords_test -ft=.py -fs=helloworld -ts=mantabjiwa

    # or

    $ changewords --path=changewords_test --file_type=.py --from_string=helloworld --to_string=mantabjiwa



Running tests
--------------

To run the test use:

::

    $ python tests.py


.. |pypi version|
   image:: https://img.shields.io/pypi/v/changewords.svg
   :target: https://pypi.python.org/pypi/changewords

.. |build status| image:: https://travis-ci.org/agusmakmun/changewords.svg?branch=master
   :target: https://travis-ci.org/agusmakmun/changewords