semvec/pypi-packages huggingface dataset:
pyeventbus2 1.0.0
Lightweight event bus support sync and async, inspired by google guava event bus
License: MIT
Keywords: eventbus

# 同时支持的同步和异步消息通知的eventbus，灵感来自与google guava eventbus

用法：
1.定义接收消息类型：
```
class IntMessage(int):
    pass

class DictMessage(dict):
    pass
```
    
2.定义需要接收消息的Observer类，需继承subscriber.DefaultSubscriber，
并实现subscribe方法，subscribe方法的参数类型与自定义的消息类型保持一致
```
class CConcreteObserver(DefaultSubscriber):

    def subscribe(self, msg: msg.IntMessage):
        time.sleep(2)
        print(f"{self.__class__.__name__}#{inspect.stack()[0][3]}: msg:{msg}")
```      
 
3.根据消息类型，添加接收者
```
OBSERVER_REGISTRY = [
    {
        msg_type(msg.DictMessage()): [
            subscriber.AConcreteObserver()
        ]
    },
    {
        msg_type(msg.IntMessage()): [
            subscriber.BConcreteObserver(),
            subscriber.CConcreteObserver(),

        ]
    },
]
```

4.在需要的地方引入eventbus，根据自己的需求选择支持同步的方式（eventbus.EventBus）或异步的方式（eventbus.AsyncEventBus）
在消息接收处，调用notify接口发送消息给对应的所有观察者
```
sync_event_bus = eventbus.AsyncEventBus()
sync_event_bus.notify(msg.IntMessage(1211))
```
htmlhelpers 0.1.1
Simple package that helps with creating html strings.
License: MIT
Requires Python: >=3.7,<4.0
Keywords: HTML,String Formatting


htmlhelpers
===========

A simple module for building and formatting html strings in python.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a package which was inspired by the annoyance of writing html strings
when working with serving modules like flask.

.. code-block:: sh

   pip install htmlhelpers

Basic usage
^^^^^^^^^^^

First, lets make some strings with basic html elements.

.. code-block:: py

   from htmlhelpers import htmlstring as hs

Create an html element:

.. code-block:: py

   hs.p("We love volleyball!")
   # <p>We love volleyball!</p>

or one with attributes:

.. code-block:: py

   hs.p("We love volleyball!", attr_str='style="text-align:right"')
   # <p style="text-align:right">We love volleyball!</p>

Or build a hierarchy:

.. code-block:: py

   hs.html(hs.p("Still love volleyball!"))
   # <html><p>Still love volleyball!</p></html>

Build a list:

.. code-block:: py

   hs.ul("".join[hs.li("cats"), hs.li("dogs")])
   # <ul><li>cats</li><li>dogs</li></ul>

Although once a list like that begins to grow, things can start to look a little messy. For more complex html expressions, we will be using the notion on a ``tag_series`` and a ``tag_phrase``.

.. code-block:: py

   from htmlhelpers import htmlphrase as hp

Say we have a rappidly growing list. We can use a series to quickly create many of the same html elements in succession. We can use a ``tag_series``.

.. code-block:: py

   list_of_animals = ["cats", "dogs", "rabbits"]
   animals = hp.tag_series(hs.li, list_of_animals)
   hs.ul(animals)
   # <ul><li>cats</li><li>dogs</li><li>rabits</li></ul>

As the structure becomes deeper, we can further simplify our code with a ``tag_phrase``.

.. code-block:: py

   hp.tag_phrase([hs.html, hs.div, hs.ul], animals)
   # <html><div><ul><li>cats</li><li>dogs</li><li>rabits</li></ul></div></html>

Lastly, you can format the string in a much more human readable way, by setting the ``formatting=True`` in the ``tag_series`` function.

.. code-block:: py

   hp.tag_phrase([hs.html, hs.div, hs.ul], animals, formatting=True)
   """
   <html>
     <div>
       <ul>
         <li>cats</li>
         <li>dogs</li>
         <li>rabits</li>
       </ul>
     </div>
   </html>
   """

Optionally, you can pass one of these html phrase strings (any multilevel heirarchy) into the ``format_phrase`` function, found in ``htmlhelpers.htmlformat`` 

Hope this helps at least a little! :)