extract a content string for part 'partname' from 'thread' of maximal
    length 'maxw'.
487840
def prepare_string(partname, thread, maxw):
    
    # map part names to function extracting content string and custom shortener
    prep = {
        'mailcount': (prepare_mailcount_string, None),
        'date': (prepare_date_string, None),
        'authors': (prepare_authors_string, shorten_author_string),
        'subject': (prepare_subject_string, None),
        'content': (prepare_content_string, None),
    }

    s = ' '  # fallback value
    if thread:
        # get extractor and shortener
        content, shortener = prep[partname]

        # get string
        s = content(thread)

    # sanitize
    s = s.replace('\n', ' ')
    s = s.replace('\r', '')

    # shorten if max width is requested
    if maxw:
        if len(s) > maxw and shortener:
            s = shortener(s, maxw)
        else:
            s = s[:maxw]
    return s
270120
def extract_length(self, lower_bound=None, upper_bound=None, new_path=None):
        """"""
        # Temporary path #
        if new_path is None: fraction = self.__class__(new_temp_path())
        elif isinstance(new_path, FASTA): fraction = new_path
        else:                fraction = self.__class__(new_path)
        # Generator #
        if lower_bound is None: lower_bound = 0
        if upper_bound is None: upper_bound = sys.maxint
        def fraction_iterator():
            for read in self:
                if lower_bound <= len(read) <= upper_bound:
                    yield read
        # Do it #
        fraction.write(fraction_iterator())
        fraction.close()
        return fraction
387574
def short_repr(item, max_length=15):
    """"""
    item = repr(item)
    if len(item) > max_length:
        item = '{}...{}'.format(item[:max_length - 3], item[-1])
    return item
895631
private String createString(String f)
    {
        return
            "maxThreadsPerBlock="+maxThreadsPerBlock+f+
            "maxThreadsDim="+Arrays.toString(maxThreadsDim)+f+
            "maxGridSize="+Arrays.toString(maxGridSize)+f+
            "sharedMemPerBlock="+sharedMemPerBlock+f+
            "totalConstantMemory="+totalConstantMemory+f+
            "regsPerBlock="+regsPerBlock+f+
            "SIMDWidth="+SIMDWidth+f+
            "memPitch="+memPitch+f+
            "regsPerBlock="+regsPerBlock+f+
            "clockRate="+clockRate+f+
            "textureAlign="+textureAlign;
    }
117128
def string_pieces(s, maxlen=1024):
    
    if not s:
        return
    i = 0
    while True:
        j = i + maxlen
        if j >= len(s):
            yield s[i:]
            return
        # Using "j - 1" keeps boundary characters with the left chunk
        while unicodedata.category(s[j - 1]) not in BOUNDARY_CATEGORIES:
            j -= 1
            if j == i:
                # No boundary available; oh well.
                j = i + maxlen
                break
        yield s[i:j]
        i = j
448301
def readpartial(maxlen, outbuf = "")
      data = @socket.readpartial(maxlen, outbuf)
      log :read, data
      data
    end
254669
def _get_part_reader(self, headers: 'CIMultiDictProxy[str]') -> Any:
        
        ctype = headers.get(CONTENT_TYPE, '')
        mimetype = parse_mimetype(ctype)

        if mimetype.type == 'multipart':
            if self.multipart_reader_cls is None:
                return type(self)(headers, self._content)
            return self.multipart_reader_cls(
                headers, self._content, _newline=self._newline
            )
        else:
            return self.part_reader_cls(
                self._boundary, headers, self._content, _newline=self._newline
            )
286893
def get_part_filenames(num_parts=None, start_num=0):
    """"""
    if num_parts is None:
        num_parts = get_num_part_files()
    return ['PART{0}.html'.format(i) for i in range(start_num+1, num_parts+1)]
377524
private String getString(int offset, int maxLength) {
        int index = offset;
        int lastIndex = index + maxLength;
        while (index < lastIndex && (buffer[index] != 0)) {
            index++;
        }
        return new String(buffer, offset, index - offset, StandardCharsets.ISO_8859_1);
    }
19312
def getfullnameof(mod, xtrapath=None):
    
    # Search sys.path first!
    epath = sys.path + winutils.get_system_path()
    if xtrapath is not None:
        if type(xtrapath) == type(''):
            epath.insert(0, xtrapath)
        else:
            epath = xtrapath + epath
    for p in epath:
        npth = os.path.join(p, mod)
        if os.path.exists(npth):
            return npth
        # second try: lower case filename
        for p in epath:
            npth = os.path.join(p, mod.lower())
            if os.path.exists(npth):
                return npth
    return ''
1324184
public String getSubstring(Part part) {
        int index=part.index;
        return msg.substring(index, index+part.length);
    }
357738
def getrawpart(self, msgid, stream=sys.stdout):
        
        for hdr, part in self._get(msgid):
            pl = part.get_payload(decode=True)
            if pl != None:
                print(pl, file=stream)
                break
534108
def getStringPartition(self):
        
        res = ''
        for s in self.partitions[self.index].getSlice():
            start = ''
            stop = ''
            if s.start is not None:
                start = int(s.start)
            if s.stop is not None:
                stop = int(s.stop)
            res += '{0}:{1},'.format(start, stop)
        return res
893979
public Part getPart(String partLabel)
  {
    if (m_parts!=null)
    {
        for (Object m_part : m_parts) {
            Part p = (Part) m_part;
            //if (p.getLabel().equals(partLabel)
            //	|| p.getLabel().equals(""+partLabel.charAt(0))) {
            if (p.getLabel().charAt(0) == partLabel.charAt(0)) {
                if (partLabel.length() > 1) {
                    p.setLabel(partLabel);
                }
                return p;
            }
        }
    	return null;
    }
    else
      return null;
  }
428091
public static String getOutputPart(ProcessOutput processOutput,String prefix)
    {
        //get output
        String output=processOutput.getOutputText();

        if(output!=null)
        {
            //set flag
            boolean validOutput=false;

            int index=output.indexOf(prefix);
            if(index!=-1)
            {
                //get index
                index=index+prefix.length();
    
                if(output.length()>index)
                {
                    //get output
                    output=output.substring(index);
                    
                    output=output.trim();
                    index=output.indexOf("\n");
                    if(index!=-1)
                    {
                        output=output.substring(0,index);
                        output=output.trim();
                    }

                    if(output.length()>0)
                    {
                        //set flag
                        validOutput=true;
                    }
                }
            }
            
            if(!validOutput)
            {
                output=null;
            }
        }
        
        return output;
    }
1321677
def _get_body_string(self):
        
        clen = self.content_length
        if clen > self.MEMFILE_MAX:
            raise HTTPError(413, 'Request entity too large')
        if clen < 0: clen = self.MEMFILE_MAX + 1
        data = self.body.read(clen)
        if len(data) > self.MEMFILE_MAX:  # Fail fast
            raise HTTPError(413, 'Request entity too large')
        return data
236580
public final String getFullString(final int len, String charsetName) {
        if (position + len > origin + limit) throw new IllegalArgumentException("limit excceed: "
                                                                                + (position + len - origin));

        try {
            String string = new String(buffer, position, len, charsetName);
            position += len;
            return string;
        } catch (UnsupportedEncodingException e) {
            throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
        }
    }