astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- asdf v »
- Developer API »
- calculate_padding

# calculate_padding

asdf.util.calculate_padding(content_size, pad_blocks, block_size)

  Calculates the amount of extra space to add to a block given the user’s request for the amount of extra space. Care is given so that the total of size of the block with padding is evenly divisible by block size.

  Parameters:
    content_size int

      The size of the actual content

    pad_blocks float or bool

      If `False`, add no padding (always return 0). If `True`, add a default amount of padding of 10% If a float, it is a factor to multiple content_size by to get the new total size.

    block_size int

      The filesystem block size to use.

  Returns:
    nbytes int

      The number of extra bytes to add for padding.