semvec/pypi-packages huggingface dataset:
classic-messaging-kombu 0.0.3
Provides implementation for publisher and consumer with Kombu library
Requires Python: >=3.7

# Classic Messaging Kombu

This package provides implementation of interfaces in classic-messaging and 
base for consumers and messages handling.

Usage with publishing:

```python
from classic.components import component
from classic.messaging import Message, Publisher
from classic.messaging_kombu import BrokerScheme, KombuPublisher
from kombu import Exchange, Queue, Connection


@component
class SomeService:
    publisher: Publisher

    def do_some_work(self):
        message = Message('some', 'Some very useful info')
        self.publisher.publish(message)


broker_scheme = BrokerScheme(
    Queue('queue1', Exchange('some')),
)
        
connection = Connection('amqp://localhost:5672/')
publisher = KombuPublisher(
    connection=connection,
    scheme=broker_scheme
)

service = SomeService(publisher=publisher)

service.do_some_work()

```
Message have 2 arguments - target and body. Target is a str with destination. 
In simple case it is an exchange name, in complex case - entry in mapping.

Body can be any serializable object.


Customization of target:
```python
from classic.messaging import Message
from classic.messaging_kombu import BrokerScheme, KombuPublisher
from kombu import Exchange, Queue, Connection


targets = {
    'FIRST': {
        'exchange': 'exchange1',
    },
    'SECOND': {
        'exchange': 'exchange2',
        'timeout': 10,
    }
}

broker_scheme = BrokerScheme(
    Queue('queue1', Exchange('exchange1')),
    Queue('queue2', Exchange('exchange2')),
)
        
connection = Connection('amqp://localhost:5672/')
publisher = KombuPublisher(
    connection=connection,
    scheme=broker_scheme,
    messages_params=targets,
)

publisher = KombuPublisher(
    connection=connection,
    scheme=broker_scheme
)

publisher.publish(
    Message('FIRST', 'Hello'),  # Will be published to exchange1 and queue1
    Message('SECOND', 'By'),  # Will be published to exchange2, queue2 and timeout=10
)
```

Usage with consuming:
```python
from classic.messaging_kombu import BrokerScheme, KombuConsumer, MessageHandler
from kombu import Exchange, Queue, Connection


class SomeSerice:
    def handle_message(self, message):
        print(message)

        
class CustomHandler(MessageHandler):
    
    def handle(self, message, body):
        print(body)
        
        message.ack()


broker_scheme = BrokerScheme(
    Queue('queue1', Exchange('exchange1')),
    Queue('queue2', Exchange('exchange2')),
)

connection = Connection('amqp://localhost:5672/')

consumer = KombuConsumer(
    connection=connection,
    scheme=broker_scheme,
)

service = SomeSerice()
handler = CustomHandler()

consumer.register_function(service.handle_message, 'queue1')
consumer.register_handler(handler, 'queue2')

```
classic-messaging 0.0.2
Provides abstract classes for messages publication in async queues
Requires Python: >=3.7

# Classic Messaging

This package provides abstract classes for message queues.

Usage:

```python
from classic.components import component
from classic.messaging import Message, Publisher


@component
class SomeService:
    publisher: Publisher

    def do_some_work(self):
        message = Message('target', 'Some very useful info')
        self.publisher.publish(message)
```

Publisher have inner buffer. Messages can be planned for publishing, and 
will be published later

Usage with deferred publishing:
```python
from classic.components import component
from classic.messaging import Message, Publisher


@component
class SomeService:
    publisher: Publisher

    def create_message(self):
        message = Message('target', 'Some very useful info')
        self.publisher.plan(message)

    def do_some_work(self):
        try:
            self.create_message()
        except Exception:
            self.publisher.reset()
            raise 
        else:
            self.publisher.flush()
```


Usage with join_points:
```python
from classic.components import component
from classic.messaging import Message, Publisher
from classic.aspects import join_poin


@component
class SomeService:
    publisher: Publisher
    
    @join_poin
    def do_some_work(self):
        message = Message('target', 'Some very useful info')
        self.publisher.plan(message)

        
class RealPublisher(Publisher):
    
    def publish(self, message):
        print(message)


publisher = RealPublisher()

SomeService.do_some_work.join(publisher)
```
gdrivewrapper 0.0.17
A wrapper around Google Drive SDK
Requires Python: >=3

# gdrivewrapper

A wrapper around Google Drive SDK. Covers basic operations like uploading a file or creating a folder.

## Usage

#### Initiate the wrapper class

```python
from gdrivewrapper import GDriveWrapper

api_scope = "https://www.googleapis.com/auth/drive.file"
creds_path = "./drive_v3_creds.json"

gdw = GDriveWrapper(api_scope, creds_path)
```

#### Upload a local file

```python
from googleapiclient.http import MediaFileUpload

local_path = "/tmp/resources/hello.txt"
media = MediaFileUpload(local_path)
gdw.upload(media)
```

#### Upload a string

```python
from googleapiclient.http import MediaInMemoryUpload

my_bytearray = "my string :)".encode('utf-8')
media = MediaInMemoryUpload(my_bytearray)
gdw.upload(media)
```

#### Upload with a filename

```python
media = ...
gdw.upload(media, name="mytextfile.txt")
```

#### Upload with a thumbnail

```python
import base64

media = ...

with open("image_path.png") as fp:
    image_bytes = fp.read()

gdw.upload(media, thumbnail=image_bytes)
```

#### Upload to a folder

```python
response = gdw.create_folder("myfolder1")

media = ...
gdw.upload(media, folder_id=response["id"])
```

#### Add a comment to an existing file

```python
media = ...
response = gdw.upload(media)
gdw.create_comment(key=response["id"], comment="this file is great!")
```
approxmath 2.0.0
Fast approximate math functions: log, exp, sin, cos

Fast, Approximate Math Functions for NumPy
==========================================

``approxmath`` is a Python library of fast, approximate math functions
for operations on NumPy arrays. On average it is **4-5x faster than
NumPy** and has drop-in replacement functions for ``log``, ``exp``,
``cos``, and ``sin``.

The approximations were originally made by Jacques-Henri Jourdan and are
explained on `Cambium’s
blog <http://gallium.inria.fr/blog/fast-vectorizable-math-approx/>`__.

Performance & Accuracy
~~~~~~~~~~~~~~~~~~~~~~

.. figure:: benchmark.png
   :alt: approxmath vs NumPy performance

   approxmath vs NumPy performance

If your program doesn’t depend on the full precision of floating point
operations, the performance-accuracy trade-off will probably be worth
it, increasing FLOPS throughput 4-5x. However, in some instances
numerical instability will result: for example, ``approxmath.log(1.0)``
is nearly, but not exactly ``0.0``.

======== ================= ============
Function Relative Accuracy ops / second
======== ================= ============
exp      ``3e-9``          647 M/sec
log      ``5e-9``          896 M/sec
cos      ``2e-10``         470 M/sec
sin      ``2e-9``          463 M/sec
======== ================= ============

Benchmarks were run on a 2019 MacBook Pro (1.4 GHz Quad-Core Intel Core
i5), with Python 3.9.9 and NumPy 1.21.4.

Drop-in Replacement for NumPy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

   import approxmath.np as npa
   import numpy as np

   npa.sin(np.array([-np.pi/2, 0.0, np.pi/2]))
   # array([-1.,  0.,  1.])

   npa.log(np.array([1.0, np.e, np.e**2]))
   # array([4.53119942e-09, 1.00000000e+00, 2.00000000e+00])

   npa.cos(np.array([-2*np.pi/3, 0.0, 2*np.pi/3]))
   # array([-0.5,  1. , -0.5])

   npa.exp(np.array([-1., 0., 1.]))
   # array([0.36787944, 1.        , 2.71828183])

Drop-in Replacement for Aesara Tensor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

   import approxmath.aesara as att
   import aesara.tensor as tt

Functional equivalents:

========== =========== =================
Aesara     Approxmath  Relative Speed-Up
========== =========== =================
``tt.exp`` ``att.exp`` 15x
``tt.log`` ``att.log`` 15x
``tt.cos`` ``att.cos`` 13x
``tt.sin`` ``att.sin`` 13x
========== =========== =================

Installation
~~~~~~~~~~~~

.. code:: sh

   $ pip install approxmath

``approxmath`` is released under the MIT license.