Return any existing padding
356475
def padding
      last   = bytes.last
      subset = subset_padding

      if subset.all?{|e| e == last }
        self.class.new(subset)
      else
        self.class.new([])
      end
    end
1127347
def transform_padding(pad_width):
    
    num_pad_values = len(pad_width)
    onnx_pad_width = [0]*num_pad_values

    start_index = 0
    # num_pad_values will always be multiple of 2
    end_index = int(num_pad_values/2)
    for idx in range(0, num_pad_values):
        if idx % 2 == 0:
            onnx_pad_width[start_index] = pad_width[idx]
            start_index += 1
        else:
            onnx_pad_width[end_index] = pad_width[idx]
            end_index += 1

    return onnx_pad_width
584636
def paddingsize(self, namedstruct):
        '''
        
        '''
        if self.base is not None:
            return self.base.paddingsize(namedstruct)
        realsize = namedstruct._realsize()
        return (realsize + self.padding - 1) // self.padding * self.padding
1131158
function pad(str, width) {
  var len = Math.max(0, width - str.length);
  return str + Array(len + 1).join(' ');
}
136901
def __pad(strdata):
    
    if request.args.get('callback'):
        return "%s(%s);" % (request.args.get('callback'), strdata)
    else:
        return strdata
1225184
def pad(a, desiredlength):
    

    if len(a) >= desiredlength:
        return a

    islist = isinstance(a, list)
    a = np.array(a)
    diff = desiredlength - len(a)
    shape = list(a.shape)
    shape[0] = diff

    padded = np.concatenate([a, np.zeros(shape, dtype=a.dtype)])
    return padded.tolist() if islist else padded
809534
def pad(self, val):
        
        padding = len(int_to_bytes(self._prime))
        padded = int_to_bytes(val).rjust(padding, b'\x00')
        return padded
591669
def _set_padding(self, attr, value):
        """"""
        if not value:
            setattr(self, attr, "")
        else:
            value = str(value)
            if not value.isspace():
                raise ValueError("padding must be entirely whitespace")
            setattr(self, attr, value)
1296146
def _pad_default(x, padding:int, mode='reflection'):
    ""
    mode = _pad_mode_convert[mode]
    return F.pad(x[None], (padding,)*4, mode=mode)[0]
1103562
def pad_for_tpu(shapes_dict, hparams, max_length):
  """"""
  padded_shapes = {}

  def get_filler(specified_max_length):
    if not specified_max_length:
      return max_length
    return min(specified_max_length, max_length)

  inputs_none_filler = get_filler(hparams.max_input_seq_length)
  targets_none_filler = get_filler(hparams.max_target_seq_length)

  def pad_one_shape(shape, none_filler):
    return [
        (dim if dim is not None else none_filler) for dim in shape.as_list()
    ]

  for key, shape in six.iteritems(shapes_dict):
    if key == "inputs":
      padded_shapes[key] = pad_one_shape(shape, inputs_none_filler)
    elif key == "targets":
      padded_shapes[key] = pad_one_shape(shape, targets_none_filler)
    else:
      padded_shapes[key] = pad_one_shape(shape, max_length)
  return padded_shapes
1106271
def _pad(X):
    
    p_above = int(np.floor(np.log2(X.shape[1])))
    M = 2 ** (p_above + 1) - X.shape[1]
    X = np.hstack((np.zeros((X.shape[0], M)), X))

    return X, M
152313
function leftPad(value, length) {
  const total = !length ? 0 : length;

  let padded = value + '';

  while (padded.length < total) {
    padded = '0' + padded;
  }

  return padded;
}
265657
def pad(cls, data):
        
        if sys.version_info > (3, 0):
            try:
                data = data.encode("utf-8")
            except AttributeError:
                pass

            length = AES.block_size - (len(data) % AES.block_size)
            data += bytes([length]) * length
            return data
        else:
            return data + (AES.block_size - len(data) % AES.block_size) * chr(AES.block_size - len(data) % AES.block_size)
812697
def padFrameRange(frange, zfill):
        
        def _do_pad(match):
            """
            Substitutes padded for unpadded frames.
            """
            result = list(match.groups())
            result[1] = pad(result[1], zfill)
            if result[4]:
                result[4] = pad(result[4], zfill)
            return ''.join((i for i in result if i))
        return PAD_RE.sub(_do_pad, frange)
228870
def check_params(num_rows, num_cols, padding):
    """"""

    num_rows = check_int(num_rows, 'num_rows', min_value=1)
    num_cols = check_int(num_cols, 'num_cols', min_value=1)
    padding = check_int(padding, 'padding', min_value=0)

    return num_rows, num_cols, padding
654573
def pad_aes256(s):
    
    if len(s) % AES.block_size == 0:
        return s

    return Padding.appendPadding(s, blocksize=AES.block_size)
567997
def is_padded(self, namespace: str) -> bool:
        
        return self._index_to_token[namespace][0] == self._padding_token