Exemple #1
0
    def toStr(self, **unused):  # PYCHOK expected
        '''Return this reference frame as a text string.

           @return: This L{RefFrame}'s attributes (C{str}).
        '''
        e = self.ellipsoid
        t = (Fmt.EQUAL(_name_,
                       repr(self.name)), Fmt.EQUAL(_epoch_, self.epoch),
             Fmt.PAREN(Fmt.EQUAL(_ellipsoid_, classname(e)),
                       Fmt.EQUAL(_name_, repr(e.name))))
        return _COMMASPACE_.join(t)
Exemple #2
0
 def _instr(self, prec, *attrs, **kwds):
     '''(INTERNAL) Format, used by C{Conic}, C{Ellipsoid}, C{Transform}.
     '''
     t = Fmt.EQUAL(_name_, repr(self.name)),
     if attrs:
         t += pairs(((a, getattr(self, a)) for a in attrs),
                    prec=prec,
                    ints=True)
     if kwds:
         t += pairs(kwds, prec=prec)
     return _COMMASPACE_.join(t)
Exemple #3
0
def _qURL(url, timeout=2, **params):
    '''(INTERNAL) Build B{C{url}} query, get and verify response.
    '''
    if params:  # build url query, don't map(quote, params)!
        p = '&'.join(Fmt.EQUAL(p, v) for p, v in params.items() if v)
        if p:
            url = NN(url, '?', p)
    u = urlopen(url, timeout=timeout)  # secs

    s = u.getcode()
    if s != 200:  # http.HTTPStatus.OK or http.client.OK
        raise IOError('code %d: %s' % (s, u.geturl()))

    r = u.read()
    u.close()
    # urlcleanup()
    return ub2str(r).strip()
Exemple #4
0
 def _dot_attr(name, value):
     return Fmt.DOT(Fmt.EQUAL(name, value))