本文整理匯總了Python中api.PackageInfo.description方法的典型用法代碼示例。如果您正苦於以下問題:Python PackageInfo.description方法的具體用法?Python PackageInfo.description怎麽用?Python PackageInfo.description使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類api.PackageInfo
的用法示例。
在下文中一共展示了PackageInfo.description方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: search
# 需要導入模塊: from api import PackageInfo [as 別名]
# 或者: from api.PackageInfo import description [as 別名]
def search(self, query):
out_s = subprocess.check_output(['apt-cache', 'search', query])
r = []
for l in out_s.split('\n'):
s = filter(None, l.split(' '))
if len(s) == 0:
continue
p = PackageInfo()
p.name = s[0]
p.state = 'i' if p.name in self.all_dict else 'r'
p.description = ' '.join(s[2:])
r.append(p)
return r
示例2: _parse_dpkg
# 需要導入模塊: from api import PackageInfo [as 別名]
# 或者: from api.PackageInfo import description [as 別名]
def _parse_dpkg(self, d):
r = []
for l in d.split('\n'):
s = filter(None, l.split(' '))
if len(s) == 0:
continue
p = PackageInfo()
if s[0][0] == 'i':
p.state = 'i'
else:
continue
p.name = s[1]
p.version = s[2]
p.description = ' '.join(s[3:])
r.append(p)
return r
示例3: _parse_all_installed
# 需要導入模塊: from api import PackageInfo [as 別名]
# 或者: from api.PackageInfo import description [as 別名]
def _parse_all_installed(self, d):
r = []
lines = d.splitlines()
infos = ['\n'.join(lines[i:i+2]) for i in range(0, len(lines), 2)]
for info in infos:
s = info.split('\n')
if len(s) == 0:
continue
package = s[0].split(' ')
p = PackageInfo()
p.state = 'i'
p.name = package[0]
p.version = package[1]
s[1].lstrip().rstrip()
p.description = ' '.join(s[1])
r.append(p)
return r