module documentation

Utility functions.

Function cached_get_repo Return a GitHub repository object, cached for 1 day.
Function form_from_initial Create a form instance with the defined initial data.
Type Variable T Undocumented
Variable logger Undocumented
@ttl_cache(maxsize=100, ttl=timedelta(days=1).total_seconds())
def cached_get_repo(repo_id: str) -> Repository:

Return a GitHub repository object, cached for 1 day.

def form_from_initial(cls: type[T], **kwargs: Any) -> T:

Create a form instance with the defined initial data.

Form fields are typically defined with initial values. And Django's forms allow extracting this initial values from an instance of a form. So, what this helper function does is inspect all fields of a form, extract the initial values, and then creates a new form instance with these initial values.

Any additional keyword arguments are directly passed to the form constructor.

T =

Undocumented

Value
TypeVar('FormT',
        bound=Form)
logger =

Undocumented