def _type_isinstance(self, w_inst, w_type): if not isinstance(w_type, W_TypeObject): raise oefmt(self.w_TypeError, "need type object") if is_annotation_constant(w_type): cls = self._get_interplevel_cls(w_type) if cls is not None: assert w_inst is not None if isinstance(w_inst, cls): return True return self.type(w_inst).issubtype(w_type)
def f(arg): if is_annotation_constant(arg): return 1 return 10
def newtext(self, s): assert isinstance(s, str) if is_annotation_constant(s): return self._newtext_memo(s) return W_BytesObject(s) # Python3 this is unicode