semvec/pypi-packages huggingface dataset:
pyutils_sh 1.6.0
Assortment of Python utilities for my personal projects
License: MIT
Keywords: python utilities survey exam gaze spss data research statistics

pyutils\_sh
===========

.. image:: https://img.shields.io/pypi/pyversions/pyutils_sh.svg
   :alt: PyPI - Python Version
   :target: https://pypi.org/project/pyutils_sh/

.. image:: https://img.shields.io/pypi/v/pyutils_sh.svg
   :alt: PyPI
   :target: https://pypi.org/project/pyutils_sh/

.. image:: https://img.shields.io/github/issues/sho-87/pyutils_sh.svg
   :alt: GitHub issues
   :target: https://github.com/sho-87/pyutils_sh/issues

.. image:: https://readthedocs.org/projects/pyutils_sh/badge/?version=latest
   :target: http://pyutils_sh.readthedocs.io

.. inclusion-marker-main-readme

Assortment of Python utilities for my personal projects

Requirements
------------

-  All code tested with Python 3.6 on Windows.
-  Minor adjustments may need to be made for Python 2.7 or other
   operating systems, but should mostly be OK.
-  Quickest way to get a working Python installation with all the useful
   dependencies is to install
   `Anaconda <https://www.continuum.io/downloads>`__

Documentation
-------------

You can find the documentation for this package
`here <http://pyutils-sh.readthedocs.io>`__
dbsession 0.6.7
The python postgreSQL ORM
License: MIT
Keywords: python,postgreSQL,ORM,psycopg2

# dbsession
The python postgreSQL ORM 

## introduction

DBSession gives simplicity, flexibility and order to the abstraction of database tables into python objects. Right now it's only supporting postgreSQL with psycopg2

## Usage

Assuming we have a table named `A` with the following estructure

```
 id | name  
----+-------
  1 | Paul  
  2 | George  
```

Create an archive `A.py` and create a class for the database abstraction `A` that inherits from `DatabaseObject`. The attribute `_TABLE_NAME` is the database table actual name

```py
from DBSession import DatabaseObject

TABLE_NAME = 'A'

class _A(DatabaseObject):

    _TABLE_NAME = TABLE_NAME

    def __init__(self, row):
        super().__init__(row)

wrapper = _A
```

Now implement every function associated with this table in the same file. Every function receives the params that goes in the query, and returns a tuple of four items:
- query (str): The actual query
- values (Tuple): The params to be replaced into the query
- wrapper (Object): The class that represent the table
- many (bool): Whether the query will return one or many instances

```py

def find_by_id(a_id):
    
    query = f"""
        SELECT *
        FROM {TABLE_NAME}
        WHERE id = %s
    """

    values = (a_id, )

    return query, values, wrapper, False

def get_all():

	query = f"""
        SELECT *
        FROM {TABLE_NAME}
    """

    values = ()

    return query, values, wrapper, True
```

Create a connection to the database using the `DBConnection` class. It receives the pool instance from psycopg2.

```py
connection_pool = psycopg2.pool.ThreadedConnectionPool(
    MINIMUM_CONNECTION,
    MAXIMUM_CONNECTION,
    user=POSTGRES_USER, 
    password=POSTGRES_PASSWORD, 
    host=POSTGRES_HOST, 
    port=POSTGRES_PORT, 
    database=POSTGRES_DB)


db_connection = DBConnection(connection_pool)
```

Finally, in the main code. To execute the query just create a `DBSession` instance, and call the `A` module functions by using de `query` function

```py
import A


db_session = db_connection.get_session()
a_1 = db_session.query(A.find_by_id, 1)
print(a_1)
# (1, 'Paul')

all_a = db_session.query(A.get_all)
print(all_a)
# [(1, 'Paul'), (2, 'George')]
```
simple-socks5 0.0.1
A simple SOCKS5 server implementation with AsyncIO
License: MIT
Requires Python: >=3.7
Keywords: socks,socks5,asyncio

# socks5

***socks5*** is a simple SOCKS5 implementation based on AsyncIO.

Currently only SOCKS5 without authentication and CONNECT command are supported.

## Requirement
Python >= 3.7

## Quick guide
```bash
git clone https://github.com/frankurcrazy/socks5
cd socks5 && python -m socks5.server -H 127.0.0.1 -P 8888
```

## License
MIT