Does this Page have space for the given
number of bytes?
165546
protected boolean hasSpaceFor(int bytes) {
        // Do we have enough lvs spare?
        // (Each LV holds up to 255 bytes, and we're
        //  not allowed more than 255 of them)
        int reqLVs = (int)Math.ceil(bytes / 255.0);

        if(numLVs + reqLVs > 255) {
            return false;
        }
        return true;
    }
12301
def __changed_bytes(self, other):
        
        if self._page_size != other._page_size:
            raise SimMemoryError("SimPagedMemory page sizes differ. This is asking for disaster.")

        our_pages = set(self._pages.keys())
        their_pages = set(other._pages.keys())
        their_additions = their_pages - our_pages
        our_additions = our_pages - their_pages
        common_pages = our_pages & their_pages

        candidates = set()
        for p in their_additions:
            candidates.update(other._pages[p].keys())
        for p in our_additions:
            candidates.update(self._pages[p].keys())

        for p in common_pages:
            our_page = self._pages[p]
            their_page = other._pages[p]

            if our_page is their_page:
                continue

            our_keys = set(our_page.keys())
            their_keys = set(their_page.keys())
            changes = (our_keys - their_keys) | (their_keys - our_keys) | {
                i for i in (our_keys & their_keys) if our_page.load_mo(self.state, i) is not their_page.load_mo(self.state, i)
            }
            candidates.update(changes)

        #both_changed = our_changes & their_changes
        #ours_changed_only = our_changes - both_changed
        #theirs_changed_only = their_changes - both_changed
        #both_deleted = their_deletions & our_deletions
        #ours_deleted_only = our_deletions - both_deleted
        #theirs_deleted_only = their_deletions - both_deleted

        differences = set()
        for c in candidates:
            if c not in self and c in other:
                differences.add(c)
            elif c in self and c not in other:
                differences.add(c)
            else:
                if type(self[c]) is not SimMemoryObject:
                    self[c] = SimMemoryObject(self.state.solver.BVV(ord(self[c]), self.byte_width), c, byte_width=self.byte_width)
                if type(other[c]) is not SimMemoryObject:
                    other[c] = SimMemoryObject(self.state.solver.BVV(ord(other[c]), self.byte_width), c, byte_width=self.byte_width)
                if c in self and self[c] != other[c]:
                    # Try to see if the bytes are equal
                    self_byte = self[c].bytes_at(c, 1)
                    other_byte = other[c].bytes_at(c, 1)
                    if self_byte is not other_byte:
                        #l.debug("%s: offset %x, two different bytes %s %s from %s %s", self.id, c,
                        #        self_byte, other_byte,
                        #        self[c].object.model, other[c].object.model)
                        differences.add(c)
                else:
                    # this means the byte is in neither memory
                    pass

        return differences
1283744
def memory_usage(self, string=False):
        
        if string:
            n = getsizeof(self)
            return ' '.join((str(s) for s in convert_bytes(n)))
        return self.info()['size']
538305
def content_size_exceeded_max(self, content_bytes):
        '''
        
        '''
        content_size = sys.getsizeof(content_bytes)
        if content_size > self.item_size_max():
            return (True, content_size)

        return (False, content_size)
211042
def _get_limit_and_offset(page, page_size):
    
    if page < 1:
        raise ValueError('page must be >= 1')
    limit = page_size
    offset = (page - 1) * page_size
    return limit, offset
918015
private static String getSpaces(int n) {

        // avoid negative NegativeArraySizeException in case uri is missing
        n = Math.max(n, 0);
        StringBuffer result = new StringBuffer(n);
        for (; n > 0; n--) {
            result.append(' ');
        }
        return result.toString();
    }
74463
def check_content_size(url, headers, max_content_bytes):
    
    if not max_content_bytes:
        return
    if 'content-length' in headers:
        size = int(headers['content-length'])
        if size > max_content_bytes:
            msg = 'URL content of %s with %d bytes exceeds %d bytes.' % (url, size, max_content_bytes)
            raise IOError(msg)
716104
def space(self):
        
        schema = SpaceSchema()
        resp = self.service.get(self.base+'space/')
        return self.service.decode(schema, resp)
351429
def _pad(string, size):
    
    strlen = len(string)
    if strlen == size:
        return string
    if strlen < size:
        return _padding[0:size-strlen] + string
    return string[-size:]
479235
private byte[] getContentBytesForPage(int pageNum) throws IOException {
        RandomAccessFileOrArray f = reader.getSafeFile();
        byte[] contentBytes = reader.getPageContent(pageNum, f);
        f.close();
        return contentBytes;
    }
352311
function isSpace(c)
{
	return (c === 0x20) ||
	    (c >= 0x0009 && c <= 0x000d) ||
	    (c === 0x00a0) ||
	    (c === 0x1680) ||
	    (c === 0x180e) ||
	    (c >= 0x2000 && c <= 0x200a) ||
	    (c === 0x2028) ||
	    (c === 0x2029) ||
	    (c === 0x202f) ||
	    (c === 0x205f) ||
	    (c === 0x3000) ||
	    (c === 0xfeff);
}
527585
def clean_pages_from_space(confluence, space_key, limit=500):
    
    flag = True
    while flag:
        values = confluence.get_all_pages_from_space_trash(space=space_key, start=0, limit=limit)
        if len(values) == 0:
            flag = False
            print("For space {} trash is empty".format(space_key))
        else:
            print("Found in space {} pages as trashed {}".format(space_key, len(values)))
            for value in values:
                print("Removing page with title: " + value['title'])
                confluence.remove_page_from_trash(value['id'])
1288709
def request_bytesize(self):
        """"""
        return sum(len(str(e)) for elts in self._in_deque for e in elts)
821341
@Override
    public int smallByteSize() {
        int bound = byteSize();
        ByteBuffer buf = ByteBuffer.allocate(bound);
        asSmallBytes(buf);
        return buf.position();
    }
1181085
def get_space(self):
        # type: () -> Optional[Text]
        """"""
        if self._full is None:
            return None

        if self._full.find('.') > 0:
            return self._full.rsplit(".", 1)[0]
        else:
            return ""
563131
def havespace(self, scriptname, scriptsize):
        
        code, data = self.__send_command(
            "HAVESPACE", [scriptname.encode("utf-8"), scriptsize])
        if code == "OK":
            return True
        return False
702397
function pad(text, width) {
  var space = (width - text.length) + 5;
  return text + Array(space).join(" ");
}