示例#1
0
 def from_pyobject(cls, func, tag: str = TYPE_TAG, protected=None):
     if not isinstance(tag, str):
         raise TypeError('The tag must be a string.')
     scaps = make_extptr(func, conversion._str_to_charsxp(cls.TYPE_TAG),
                         protected)
     res = cls(scaps)
     if tag != cls.TYPE_TAG:
         res.TYPE_TAG = tag
     return res
示例#2
0
def _as_charsxp_cdata(x: typing.Union[CharSexp, str]):
    if isinstance(x, CharSexp):
        return x.__sexp__._cdata
    else:
        return conversion._str_to_charsxp(x)
示例#3
0
 def get_attrib(self, name: str) -> 'Sexp':
     res = openrlib.rlib.Rf_getAttrib(self.__sexp__._cdata,
                                      conversion._str_to_charsxp(name))
     return res