semvec/pypi-packages huggingface dataset:
discordbook 0.2.4
A Discord.py module to facilitate easier viewing for large amounts of content.
Requires Python: >=3.5

# DiscordBook

A Discord module for bot developers wanting a lightweight and customizable package for a book-like info display.

Example of a well-formatted book display:

![](assets/discordbookexample1.png)

### Terminology:
* ***Book*** - abstracted structure to use
* ***Line*** - particular item inside the book - in the above example, "Abyssal Buckler" would be a line
* ***Chapter*** - group of lines - in the example, "A" would be a chapter
* ***Page*** - combination of chapter headers and lines that can be displayed on the embed


### Options
Currently, 2 types of books are supported - a default book with the following default parameters:
```python
Book(chapters = [], title = "\a", description = '\a', color = 1, image = None, per_page = 10)
```

### Example usage of Book:
```python
from discordbook import Book

# Creating the content for the book
lines1 = ["test line 1", "test line 2", "test line 3"]
chapter1 = Chapter("Test Chapter 1", lines1)

lines2 = ["test line 1", "test line 2", "test line 3"]
chapter2 = Chapter("Test Chapter 2", lines2)

lines3 = ["test line 1", "test line 2", "test line 3"]
chapter3 = Chapter("Test Chapter 3", lines3)

lines4 = ["test line 1", "test line 2", "test line 3"]
chapter4 = Chapter("Test Chapter 4", lines4)

lines5 = ["test line 1", "test line 2", "test line 3"]
chapter5 = Chapter("Test Chapter 5", lines5)

# Initializing the object itself
item_book = Book([chapter1, chapter2, chapter3, chapter4, chapter5], "Test Book", "Test book Desc")

# A blocking method that will send and constantly update the book display
await item_book.open_book(client, message.channel, message.author)
```

![](assets/discordbookexample3.png)


And an alphabetically ordered book with the following default parameters:
```python
AlphabeticalBook(content = [], title = "\a", description = '\a', color = 1, per_page = 10, ignore_caps = True)
```

### Example usage of Alphabetical Book:
```python
from discordbook import AlphabeticalBook

# Creating the content for the book
lines1 = ["Test", "test", "Abc", "bc", "D", "Zee"]

# Initializing the object itself
a_book = AlphabeticalBook(lines1, "Test Book", "test desc", ignore_caps = False)

# A blocking method that will send and constantly update the book display
await a_book.open_book(client, message.channel)
```

#### Result
![](assets/discordbookexample2.png)



### Caveats
- Books are static once generated
- Opening a book should be the last call in your function, since it will prevent the rest of your code from running
- Creating a book with empty lines will result in errors

### TODO:
- [ ] Develop ordering of chapters based of less than function?
- [ ] Bookmark feature to come back to this page after?
- [ ] Give more fine-grained control with non-blocking books
- [ ] Better error checking on small/empty books
- [ ] Set browsing speed, better options for settings
- [ ] Better documentation


Open to pull requests or issues!
colorizelatextables 1.1
Utility script to transform csv files or pandas dataframes to colorized LaTex tables

## ColorizeLaTexTables: small script to get color coded latex tables from csv files or pandas DataFrames
![colorized table](images/bigtable.png)
Create latex tables that are colored based on rank.
# Installation
Install via pip:
```
pip install colorizelatextables
```
# Dependencies
Only necessary dependency is pandas, seaborn is recommended for color palettes:
```
pip install pandas
pip install seaborn
```
# Usage:
You can either use the script or use the module
## Script
```
colorize_table.py examples/BigTable.csv bigtable.tex
```
You can also use seaborn palette names if you have seaborn
```
colorize_table.py --palette "GnBu_r" examples/BigTable.csv bigtable.tex
```
### Options:
```
usage: colorize_table.py [-h] [-a] [--precision PRECISION] [-n NRANKS]
                         [--colors COLORS] [--palette PALETTE] [-f]
                         [--seperator SEPERATOR] [--columnwise]
                         inputpath [outputpath]

positional arguments:
  inputpath             the path to the .csv table
  outputpath            the path where you want the.tex file

optional arguments:
  -h, --help            show this help message and exit
  -a, --ascending       highlight from smallest to largest, default is
                        descending
  --precision PRECISION
                        decimal precision,default is 3
  -n NRANKS, --nranks NRANKS
                        number of ranks to highlight
  --colors COLORS       rgb_codes as list of float triples. if you have
                        seaborn it is recommended to use the --palette option
  --palette PALETTE     seaborn color palette name
  -f, --full            creates a complete .tex document, rather than only the
                        tabular statement
  --seperator SEPERATOR
                        seperator of csv, comma is default
  --columnwise          calculate columnwise rank rather than rowwise rank

```
## Module
```python
from colorizelatextables import to_colorized_latex
table_string, defined_colors = to_colorized_latex(df, sns.color_palette("GnBu_d",n_colors=3))
```
You can also provide additional keyword arguments that are passed to pandas [to_latex()](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_latex.html) function, e.g.
```python
table_string, defined_colors = to_colorized_latex(df, sns.color_palette("GnBu_d",n_colors=3), column_format="|c|c|c|c|c|c|c|c|c|")
```