pylav.utils package#

Subpackages#

Submodules#

pylav.utils.aiohttp_postgres_cache module#

class pylav.utils.aiohttp_postgres_cache.PostgresCacheBackend(**kwargs)[source]#

Bases: CacheBackend

Wrapper for higher-level cache operations. In most cases, the only thing you need to specify here is which storage class(es) to use

class pylav.utils.aiohttp_postgres_cache.PostgresStorage(**kwargs)[source]#

Bases: BaseCache

interface for lower-level backend storage operations

async bulk_delete(keys)[source]#

Delete multiple items from the cache

async clear()[source]#

Delete all items from the cache

async contains(key)[source]#

Check if a key is stored in the cache

async delete(key)[source]#

Delete an item from the cache

async keys()[source]#

Get all keys stored in the cache

async read(key)[source]#

Read an item from the cache

async size()[source]#

Get the number of items in the cache

values()[source]#

Get all values stored in the cache

async write(key, item)[source]#

Write an item to the cache

pylav.utils.aiohttp_postgres_cache.postgres_template()[source]#

pylav.utils.localtracks module#

class pylav.utils.localtracks.LocalTrackCache(client, root)[source]#

Bases: object

A cache for local tracks.

async file_watcher()[source]#

A file watcher for the local track cache.

property hexdigest_to_query#

The hexdigest to query cache.

async initialize()[source]#

Initialize the local track cache.

property is_ready#

Whether the local track cache is ready.

property path_to_query#

The path to query cache.

property path_to_track#

The path to track cache.

property root_folder#

The root folder of the local track cache.

async shutdown()[source]#

Shutdown the local track cache.

async update()[source]#

Update the local track cache.

async wipe_cache()[source]#

Wipe the local track cache.

pylav.utils.location module#

async pylav.utils.location.closest(data, compare_to, *, region_pool=None)[source]#

Get the closest region to the given coordinates

pylav.utils.location.distance(lat1, lon1, lat2, lon2)[source]#

Calculate the distance between two coordinates on the earth

async pylav.utils.location.get_closest_discord_region(host=None)[source]#

Get the closest discord region to the given host

async pylav.utils.location.get_closest_region_name_and_coordinate(lat, lon, region_pool=None)[source]#

Get the closest region name and coordinate to the given coordinates

async pylav.utils.location.get_coordinates(ip=None)[source]#

Get the coordinates of the given ip address

pylav.utils.validators module#

pylav.utils.validators.is_url(uri)[source]#

Check if the given uri is a url.

Module contents#