Did I find the right examples for you? yes no

All Samples(15)  |  Call(10)  |  Derive(0)  |  Import(5)
    A word-wrap function that preserves existing line breaks
    and most spaces in the text. Expects that existing line
    breaks are posix newlines (
).
    

        def wrap(text, width):
    """
    A word-wrap function that preserves existing line breaks
    and most spaces in the text. Expects that existing line
    breaks are posix newlines (\n).
    """
    return reduce(lambda line, word, width=width: '%s%s%s' %
                  (line,
                   ' \n'[(len(line[line.rfind('\n')+1:])
                         + len(word.split('\n',1)[0]
                              ) >= width)],
                   word),
                  text.split(' ')
                 )
        


src/a/r/archgenxml-2.6/src/archgenxml/BaseGenerator.py   archgenxml(Download)
                authoremail.append("%s <unknown>" % author)
 
        authorline = utils.wrap(", ".join(authoremail), 77)
 
        return authors, emails, authorline

src/x/m/xmiparser-1.5/xmiparser/xmiparser.py   xmiparser(Download)
from utils import toBoolean
from utils import normalize
from utils import wrap as doWrap
from interfaces import IPackage
import zargoparser
        if wrap:
            log.debug("Wrapping the documenation.")
            doc = doWrap(doc, wrap)
        log.debug("Returning documenation '%r'.",
                  doc)

src/p/o/polaris-HEAD/ekf.py   polaris(Download)
import logging.config
from display import Display
from utils import safe_tangent, wrap, GRAVITY
import logging
import logging.config
    def linearized_model_output_matrix(self, phi, theta):
        """ Axhat, ayhat and azhat are used to compute the the expected accelerometer readings given the model (the flight dynamics of a fixed-wing aircraft). Once we have these we can look at the actual readings and adjust things accordingly. [ISEFMAV 2.26] """
        bxyz = matrix("0 0 0; 0 0 0; 0 0 0")
        self.psi = wrap(self.psi)
        bxyz[0,0] = cos(theta) * cos(self.psi)
    def magnetometer_readings_to_tilt_compensated_heading(self, bx, by, bz, phi, theta):
        self.variation = 4.528986*(pi/180)
        Xh = bx * cos(theta) + by * sin(phi) * sin(theta) + bz * cos(phi) * sin(theta)
        Yh = by * cos(phi) - bz * sin(phi)
        heading = wrap((atan2(-Yh, Xh) + self.variation))
    def estimate(self, Vair, theta, psi, GPS_Pn, GPS_Pe, dt):
        # CHECK UNITS
        #psi = wrap(psi)
        psi = wrap(TD.HEADING)
        theta = TD.PITCH

src/o/m/omniture-0.3.1/omniture/elements.py   omniture(Download)
        element.properties['search'] = {
            'type': type, 
            'keywords': utils.wrap(keywords), 
        }
        return element
 
    def select(self, keys):
        element = self.copy()
        element.properties['selected'] = utils.wrap(keys)

src/p/y/python-omniture-HEAD/omniture/elements.py   python-omniture(Download)
        element.properties['search'] = {
            'type': type, 
            'keywords': utils.wrap(keywords), 
        }
        return element
 
    def select(self, keys):
        element = self.copy()
        element.properties['selected'] = utils.wrap(keys)

src/p/o/polaris-HEAD/gps.py   polaris(Download)
from math import radians, sin, sqrt, atan2, cos, pi
from time import time
from utils import safe_tangent, wrap
from truthdata import TruthData
from geonavigation import heading

src/p/o/polaris-HEAD/fgo.py   polaris(Download)
from math import radians, sin, sqrt, atan2, cos, degrees
from utils import safe_tangent, wrap
from display import Display
from truthdata import TruthData