semvec/pypi-packages huggingface dataset:
dictQ 1.0.0
Sophisticate Searching Algorithms
License: MIT
Requires Python: >=3.6
Keywords: sorting algorithms

# dictQ


[![PyPI version](https://badge.fury.io/py/dictQ.svg)](https://badge.fury.io/py/dictQ)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)


This library was created to simplify searching algorithms by visually displaying them in the form of a horizontal table, using colors to illustrate the searching steps, giving the ability to control the searching speed and manually switching between items, all this is especially for beginners in searching algorithms.


## Installation


You can install `dictQ` via pip:


```bash
pip install dictQ
```


## Usage 


### For linear search algorithm 


```python
from dictQ import searchVisualizer


x = [26, 45, 84, 84, 88, 94, 14, 92, 6, 81]
y = searchVisualizer(x, item=92)
y.linear_search()
```


#### Output


https://drive.google.com/file/d/1U_1TuI3hqXPwG5kOIXD_TbXuRc3vrPhm/view?usp=sharing


### For binary search algorithm 


```python
from dictQ import searchVisualizer


x = [6, 14, 26, 45, 81, 84, 84, 88, 92, 94]
y = searchVisualizer(x, item=92)
y.binary_search()
```


#### Output


https://drive.google.com/file/d/1GBij5QkGtfHRGDMKpp5vlN9z3l_qrEFz/view?usp=sharing


#### You can reduce the searching speed


```python
from dictQ import searchVisualizer


x = [6, 14, 26, 45, 81, 84, 84, 88, 92, 94]
y = searchVisualizer(x, item=92, speed=7)
```


#### You can control the searching steps by pressing Enter


```python
from dictQ import searchVisualizer


x = [6, 14, 26, 45, 81, 84, 84, 88, 92, 94]
y = searchVisualizer(x, item=92, control=True)
```


## License


This project is licensed under the MIT LICENSE - see the [LICENSE](https://opensource.org/licenses/MIT) for more details.
fastapi-discord 0.2.7
Discord OAuth FastAPI extension for APIs
License: MIT
Requires Python: >=3.5

[![PyPI version](https://badge.fury.io/py/fastapi-discord.svg)](https://badge.fury.io/py/fastapi-discord)
[![PyPI Downloads](https://img.shields.io/pypi/dm/fastapi-discord.svg)](https://pypi.org/project/fastapi-discord)

# FastAPI Discord (OAuth)
Support for "Login with Discord"/ Discord OAuth for FastAPI.
# Install
PIP Package `fastapi-discord`
# Example
You can find the Example in [examples/](https://github.com/Tert0/fastapi-discord/tree/master/examples)
```py
from typing import List

from fastapi import Depends, FastAPI
from fastapi.responses import JSONResponse
from fastapi_discord import DiscordOAuthClient, RateLimited, Unauthorized, User
from fastapi_discord.exceptions import ClientSessionNotInitialized
from fastapi_discord.models import GuildPreview

app = FastAPI()

discord = DiscordOAuthClient(
    "<client-id>", "<client-secret>", "<redirect-url>", ("identify", "guilds", "email")
)  # scopes


@app.on_event("startup")
async def on_startup():
    await discord.init()


@app.get("/login")
async def login():
    return {"url": discord.oauth_login_url}


@app.get("/callback")
async def callback(code: str):
    token, refresh_token = await discord.get_access_token(code)
    return {"access_token": token, "refresh_token": refresh_token}


@app.get(
    "/authenticated",
    dependencies=[Depends(discord.requires_authorization)],
    response_model=bool,
)
async def isAuthenticated(token: str = Depends(discord.get_token)):
    try:
        auth = await discord.isAuthenticated(token)
        return auth
    except Unauthorized:
        return False


@app.exception_handler(Unauthorized)
async def unauthorized_error_handler(_, __):
    return JSONResponse({"error": "Unauthorized"}, status_code=401)


@app.exception_handler(RateLimited)
async def rate_limit_error_handler(_, e: RateLimited):
    return JSONResponse(
        {"error": "RateLimited", "retry": e.retry_after, "message": e.message},
        status_code=429,
    )


@app.exception_handler(ClientSessionNotInitialized)
async def client_session_error_handler(_, e: ClientSessionNotInitialized):
    print(e)
    return JSONResponse({"error": "Internal Error"}, status_code=500)


@app.get("/user", dependencies=[Depends(discord.requires_authorization)], response_model=User)
async def get_user(user: User = Depends(discord.user)):
    return user


@app.get(
    "/guilds",
    dependencies=[Depends(discord.requires_authorization)],
    response_model=List[GuildPreview],
)
async def get_guilds(guilds: List = Depends(discord.guilds)):
    return guilds

```

# Inspired by
[Starlette-Discord](https://github.com/nwunderly/starlette-discord)

[Quart-Discord-OAuth](https://github.com/Tert0/Quart-Discord-OAuth/)

[Quart-Discord](https://github.com/jnawk/quart-discord)

Thanks to @jnawk and @nwunderly