Developer Notes

Here, we dive into ColorDetect’s inner definitions and working. Found a bug or feature request you would like to address? Take a look at the Contribution guidelines and feel free to submit a pull. The project source is hosted on Github

Module ColShare

Global methods non-object specific

Usage:

>>> from colordetect import col_share
# show a progress bar for a process
>>> col_share.progress_bar("<current_process_position>", "<total_process_length>", "<process_description>")
# sort a dictionary by value to required length or in specific order
>>> col_share.sort_order('<dictionary>', "<items_to_return>", "<order>")
colordetect.col_share.is_url(url: str) bool[source]

Check if the string parsed is a URL

Parameters

url: str

A string to be checked

colordetect.col_share.progress_bar()[source]

Parameters

position: int

Current position of process

total_length: int

Total length of process

post_text: str

Text to display along with progress bar

colordetect.col_share.sort_order(object_description: dict, key_count: int = 5, ascending: bool = True)[source]

sort_order

Sort items in a dictionary according to value

Parameters

object_description: dict

A dictionary whose values need sorting

key_count: int

The number of items to return from the sort

ascending: bool

The order to perform the dictionary sort. By default, set to True.

return:

A sorted dictionary with specific number