user_is_admin. Internal helper function. This docstring was added automatically to improve maintainability. Args: username: Parameter. Returns: Varies.
(username: Optional[str])
| 3631 | |
| 3632 | Route handler or application helper. |
| 3633 | |
| 3634 | This docstring was expanded to make future maintenance easier. |
| 3635 | |
| 3636 | Args: |
| 3637 | file_storage: Parameter. |
| 3638 | dest_path: Parameter. |
| 3639 | bufsize: Parameter. |
| 3640 | |
| 3641 | Returns: |
| 3642 | Varies. |
| 3643 | """ |
| 3644 | # Fast chunked saving for large uploads. |
| 3645 | # Bigger buffer + buffered writer improves throughput on many devices. |
| 3646 | try: |
| 3647 | file_storage.stream.seek(0) |
| 3648 | except Exception: |
| 3649 | pass |
| 3650 | os.makedirs(os.path.dirname(dest_path), exist_ok=True) |
| 3651 | with open(dest_path, "wb", buffering=bufsize) as out: |
| 3652 | shutil.copyfileobj(file_storage.stream, out, length=bufsize) |
| 3653 | |
| 3654 | def human_size(n: int) -> str: |
| 3655 | """human_size. |
| 3656 | |
| 3657 | Internal helper function. |
| 3658 | |
| 3659 | This docstring was added automatically to improve maintainability. |
| 3660 | |
| 3661 | Args: |
| 3662 | n: Parameter. |
| 3663 |
no test coverage detected