Pack the start and end rules into an array of bytes.  Only pack
data which is not preserved by makeRulesCompatible.
501988
private byte[] packRules()
    {
        byte[] rules = new byte[6];
        rules[0] = (byte)startDay;
        rules[1] = (byte)startDayOfWeek;
        rules[2] = (byte)endDay;
        rules[3] = (byte)endDayOfWeek;

        // As of serial version 2, include time modes
        rules[4] = (byte)startTimeMode;
        rules[5] = (byte)endTimeMode;

        return rules;
    }
560176
def pack(self):
        """"""
        block = bytearray(self.size)
        self.pack_into(block)
        return block
766095
def _packto(self, stream):
        '''
        
        '''
        #self._logger.log(logging.DEBUG, 'packing %r', self)
        total_size = 0
        current = self
        while current is not None:
            total_size += current._parser.packto(current, stream)
            last = current
            current = getattr(current, '_sub', None)
        if hasattr(last, '_extra'):
            _extra = last._extra
            total_size += stream.write(_extra)
        return total_size
516305
def _pack_bits_into_byte(iterable):
    
    return (reduce(lambda x, y: (x << 1) + y, e)
            for e in zip_longest(*[iter(iterable)] * 8, fillvalue=0x0))
130518
public static byte[] readBytes(ByteBuffer buffer, int start, int end) {
		byte[] bs = new byte[end - start];
		System.arraycopy(buffer.array(), start, bs, 0, bs.length);
		return bs;
	}
509422
def Pack(self):
        """"""
        return struct.pack(self.format, self.command, self.arg0, self.arg1,
                           len(self.data), self.checksum, self.magic)
1034716
public void packSymbols(int first, int end) {
        int src;
        int dest;
        boolean touched;

        dest = first;
        for (src = first; src < end; src++) {
            touched = renameSymbol(src, dest);
            if (touched) {
                dest++;
            } else {
                // src not found; dest stays unused
            }
        }
    }
706516
def pack(mtype, request, rid=None):
    ''''''
    envelope = wire.Envelope() 
    if rid is not None:
        envelope.id = rid
    envelope.type = mtype
    envelope.message = request.SerializeToString()
    data = envelope.SerializeToString()
    data = encoder._VarintBytes(len(data)) + data
    return data
651812
def _packed_data(self):
    '''
    
    '''
    header = self.header()

    packed_data = np.frombuffer(self.data, dtype=np.int8)\
        .reshape((header['number_of_half_frames'], header['half_frame_bytes']))  # create array of half frames
    packed_data = packed_data[::-1, constants.header_offset:]  # slice out header and flip half frame order to reverse time ordering
    packed_data = packed_data.reshape((header['number_of_half_frames']*(header['half_frame_bytes']- constants.header_offset))) # compact into vector

    return packed_data
926732
def pack_into(self, buf, offset, write_payload):
    
    return self._get_framed(buf, offset, write_payload)
977469
function pack(items) {
		var data = arguments,
			idx = 0,
			buffer,
			bufferSize = 0;

		// Calculate buffer size
		items = items.split('');
		items.forEach(function(type) {
			if (type == 'v') {
				bufferSize += 2;
			} else if (type == 'V' || type == 'l') {
				bufferSize += 4;
			}
		});

		// Fill buffer
		buffer = new Buffer(bufferSize);
		items.forEach(function(type, index) {
			if (type == 'v') {
				buffer.writeUInt16LE(data[index + 1], idx);
				idx += 2;
			} else if (type == 'V') {
				buffer.writeUInt32LE(data[index + 1], idx);
				idx += 4;
			} else if (type == 'l') {
				buffer.writeInt32LE(data[index + 1], idx);
				idx += 4;
			}
		});

		return buffer;
	}
888917
public static byte[] getIncreasingByteArray(int start, int len) {
    byte[] ret = new byte[len];
    for (int k = 0; k < len; k++) {
      ret[k] = (byte) (k + start);
    }
    return ret;
  }
1323422
def getbyteslice(self, start, end):
        """"""
        c = self._rawarray[start:end]
        return c
793108
def _get_padded(data, start, end):
    
    if start < 0 and end > data.shape[0]:
        raise RuntimeError()
    if start < 0:
        start_zeros = np.zeros((-start, data.shape[1]),
                               dtype=data.dtype)
        return np.vstack((start_zeros, data[:end]))
    elif end > data.shape[0]:
        end_zeros = np.zeros((end - data.shape[0], data.shape[1]),
                             dtype=data.dtype)
        return np.vstack((data[start:], end_zeros))
    else:
        return data[start:end]
1316662
def pack(self, value=None):
        
        if value is None:
            output = self.header.pack()
            output += self.value.pack()
            return output

        elif isinstance(value, type(self)):
            return value.pack()
        else:
            msg = "{} is not an instance of {}".format(value,
                                                       type(self).__name__)
            raise PackException(msg)
1300848
def pack(self, value=None):
        """"""
        self._update_length()
        packet = super().pack()
        return self._complete_last_byte(packet)
630615
function slice (args, start, end) {
  var len = args.length;
  start = start > 0 ? start : 0;
  end = end >= 0 && end < len ? end : len;

  var n = end - start;
  if (n <= 0) return [];

  var ret = new Array(n);
  for (var i = 0; i < n; ++i) {
    ret[i] = args[i + start];
  }
  return ret;
}