UrlContainer¶
-
class
wwt_data_formats.abcs.
UrlContainer
[source]¶ Bases:
abc.ABC
A data object that may contain URLs. This ABC provides a generic interface for mutating those URLs.
This ABC helps establish a simple framework for walking a WWT folder structure and rewriting relative into absolute URLs.
Methods Summary
mutate_urls
(mutator)Visit all URLs inside this container and potentially mutate them.
Methods Documentation
-
abstract
mutate_urls
(mutator)[source]¶ Visit all URLs inside this container and potentially mutate them.
- Parameters
- mutatorcallable(str) -> str
A function taking a URL string and returning a URL string.
Notes
For each URL inside the container, the URL is updated with the mutator’s return value:
this.some_url = mutator(this.some_url)
If you just want to visit all of the URLs inside this container, you can write a mutator the returns its input unmodified.
Implementors should not call the mutator if the URL is an optional parameter that is
None
(or otherwise unset).
-
abstract