本文整理汇总了Python中psr.sys.Io.str方法的典型用法代码示例。如果您正苦于以下问题:Python Io.str方法的具体用法?Python Io.str怎么用?Python Io.str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类psr.sys.Io
的用法示例。
在下文中一共展示了Io.str方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getIdsList
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def _getIdsList(ids):
idslist = None
if isinstance(ids,list):
if len(ids) > 0 and ids[0]!='' and ids[0]!=None:
li = len(ids)-1
if int(ids[0])+li == int(ids[li]):
idslist = Io.str(ids[0]+b':'+ids[li]) if isinstance(ids[0],bytes) else str(ids[0])+':'+str(ids[li])
else :
idslist = Io.str(b','.join(ids)) if isinstance(ids[0],bytes) else ','.join(ids)
elif isinstance(ids, int) and ids > 0:
idslist = Io.str(ids)
return idslist
示例2: _ids
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def _ids(self, box='INBOX', search='ALL', charset=None, byUid=False):
""""""
status, resp = self.cnx.select(box)
if status == self.KO :
self.createBox(box)
self.cnx.select(box)
status, resp = self.cnx.search(charset, '(%s)' % search)
return resplit(' ',Io.str(resp[self.K_HEAD]))
示例3: headerField
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def headerField(self, mid, field, byUid=False):
""""""
value = ''
field = field.upper()
query = '(UID BODY[HEADER' + ('])' if field=='*' or field=='ALL' else '.FIELDS (%s)])' % field)
status, resp = self.fetch(mid, query, byUid)
if status==self.OK and resp[0]!=None:
value = Io.str(resp[0][1][len(field)+2:-4])
return value
示例4: listBox
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def listBox(self, box='INBOX', pattern='*'):
""""""
status, resp = self.cnx.list(box,pattern)
l = []
for r in resp :
if r is not None :
name = Io.str(r).split(' "/" ')
l.append((name[0][1:-1].split(' '),name[1][1:-1]))
return l
示例5: initBoxNames
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def initBoxNames(self):
""""""
status, resp = self.cnx.xlist()
if status == self.OK :
bdef, bname, c = None, None, None
for c in resp :
bdef, bname = c[1:-1].split(b') "/" "')
if bdef == Io.bytes(self.NO_SELECT+' '+self.CHILDREN) :
self.BOXS['/'] = Io.str(bname)
elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.INBOX) :
self.BOXS[self.INBOX] = self.INBOX[1:].upper()
elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.DRAFTS) :
self.BOXS[self.DRAFTS] = Io.str(bname)
elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.TRASH) :
self.BOXS[self.TRASH] = Io.str(bname)
elif bdef == Io.bytes(self.NO_CHILDREN+' '+self.SENT) :
self.BOXS[self.SENT] = Io.str(bname)
else :
self.BOXS = { '/' : '/', self.INBOX : self.INBOX[1:].upper(), self.DRAFTS : self.DRAFTS[1:], self.TRASH : self.TRASH[1:], self.SENT : self.SENT[1:] }
示例6: buildIndex
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def buildIndex(self, fromPath):
"""Build mail for ImpraIndex
:Returns: 'email.message.Message'
"""
msg = MIMEText(Io.str(b2a_base64(Io.get_data(fromPath, True))), 'plain', 'utf-8')
msg['From'] = self.getHashName('system')+'@'+self.DOMAIN_NAME
msg['To'] = self.getHashName('all')+'@'+self.DOMAIN_NAME
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = Header(self.getHashName('index'),'utf-8')
return msg
示例7: status
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import str [as 别名]
def status(self, box='INBOX'):
""""""
status, resp = self.cnx.status(box, '(MESSAGES RECENT UIDNEXT UIDVALIDITY UNSEEN)')
if status == self.OK :
data = research(self.REG_SATUS, Io.str(resp[self.K_HEAD]))
l = resplit(' ',data.group(2))
dic = {'BOX' : box}
for i in range(len(l)):
if i%2 == 0 : dic[l[i]] = int(l[i+1])
else : dic = {}
return dic