aoptk.literature.utils
Classes
Asynchronous request limiter to control the rate of API calls. |
Functions
|
Check if the given publication ID is a EuropePMC ID. |
|
Convert every image in a list to the specified format. |
|
Convert an image to PNG format. |
Check if the image is already in the target format. |
|
|
Remove the 'PMC' prefix from ID. |
Module Contents
- class aoptk.literature.utils.AsyncRequestLimiter(requests_per_second: int)[source]
Asynchronous request limiter to control the rate of API calls.
- aoptk.literature.utils.is_europepmc_id(publication_id: aoptk.literature.id.ID) bool[source]
Check if the given publication ID is a EuropePMC ID.
- aoptk.literature.utils.convert_image_format(images_to_convert_path: list[pathlib.Path], target_format: str = 'png') list[pathlib.Path][source]
Convert every image in a list to the specified format.
- Parameters:
images_to_convert_path – The images to convert.
target_format – The desired image format (e.g., ‘png’, ‘jpg’).
- aoptk.literature.utils.convert_to_png(inpath: pathlib.Path, outpath: pathlib.Path) None[source]
Convert an image to PNG format.
- Parameters:
inpath – The path of the input image.
outpath – The path where the converted image will be saved.
- aoptk.literature.utils._image_in_this_format_already_exists(target_format: str, image_path: pathlib.Path) bool[source]
Check if the image is already in the target format.
- Parameters:
target_format – The desired image format (e.g., ‘png’, ‘jpg’).
image_path – The path of the image to check.
- aoptk.literature.utils.remove_pmc_prefix(ids: list[aoptk.literature.id.ID]) list[aoptk.literature.id.ID][source]
Remove the ‘PMC’ prefix from ID.