module documentation
Utility functions.
Function | cached |
Return a GitHub repository object, cached for 1 day. |
Function | form |
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.
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.