|
|
@ -1,13 +1,13 @@
|
|
|
|
#-*- coding: utf-8 -*-
|
|
|
|
#-*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
|
|
|
|
#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
@ -76,7 +76,7 @@ def prettyColumnStr(*cols):
|
|
|
|
partstr = cols[q][:cols[q+1]]
|
|
|
|
partstr = cols[q][:cols[q+1]]
|
|
|
|
# искать перевод строки с полученной части
|
|
|
|
# искать перевод строки с полученной части
|
|
|
|
brfind = wherenr.search(partstr)
|
|
|
|
brfind = wherenr.search(partstr)
|
|
|
|
# если перевод строки найден, то
|
|
|
|
# если перевод строки найден, то
|
|
|
|
if brfind != None:
|
|
|
|
if brfind != None:
|
|
|
|
# для текущего вывода в колонку
|
|
|
|
# для текущего вывода в колонку
|
|
|
|
# берем часть строки до перевода
|
|
|
|
# берем часть строки до перевода
|
|
|
@ -227,7 +227,7 @@ def columnWrite(*cols):
|
|
|
|
|
|
|
|
|
|
|
|
def justify(s,width):
|
|
|
|
def justify(s,width):
|
|
|
|
'''Выровнить текст по ширине
|
|
|
|
'''Выровнить текст по ширине
|
|
|
|
|
|
|
|
|
|
|
|
Параметры:
|
|
|
|
Параметры:
|
|
|
|
s выводимая строка
|
|
|
|
s выводимая строка
|
|
|
|
width ширина на которую надо выровнить строку
|
|
|
|
width ширина на которую надо выровнить строку
|
|
|
@ -265,7 +265,7 @@ def justify(s,width):
|
|
|
|
|
|
|
|
|
|
|
|
def runOsCommand(cmd, inStr=None, ret_first=None):
|
|
|
|
def runOsCommand(cmd, inStr=None, ret_first=None):
|
|
|
|
"""Выполняет внешнюю программу
|
|
|
|
"""Выполняет внешнюю программу
|
|
|
|
|
|
|
|
|
|
|
|
Параметры:
|
|
|
|
Параметры:
|
|
|
|
cmdStrProg внешняя программа
|
|
|
|
cmdStrProg внешняя программа
|
|
|
|
inStr данные передаваемые программе на страндартный вход.
|
|
|
|
inStr данные передаваемые программе на страндартный вход.
|
|
|
@ -279,6 +279,7 @@ def runOsCommand(cmd, inStr=None, ret_first=None):
|
|
|
|
fin.write(inStr)
|
|
|
|
fin.write(inStr)
|
|
|
|
fin.close()
|
|
|
|
fin.close()
|
|
|
|
res = fout.readlines()
|
|
|
|
res = fout.readlines()
|
|
|
|
|
|
|
|
fout.close()
|
|
|
|
if res:
|
|
|
|
if res:
|
|
|
|
if len(res) > 1:
|
|
|
|
if len(res) > 1:
|
|
|
|
if ret_first:
|
|
|
|
if ret_first:
|
|
|
@ -291,10 +292,10 @@ def runOsCommand(cmd, inStr=None, ret_first=None):
|
|
|
|
|
|
|
|
|
|
|
|
def genpassword(passlen=9):
|
|
|
|
def genpassword(passlen=9):
|
|
|
|
'''Вернуть случайный пассворд указанной длины
|
|
|
|
'''Вернуть случайный пассворд указанной длины
|
|
|
|
|
|
|
|
|
|
|
|
Параметры:
|
|
|
|
Параметры:
|
|
|
|
passlen длина пароля который нужно сгенерировать
|
|
|
|
passlen длина пароля который нужно сгенерировать
|
|
|
|
|
|
|
|
|
|
|
|
Возвращаемые параметры:
|
|
|
|
Возвращаемые параметры:
|
|
|
|
Сгенерированный пароль указанной длины
|
|
|
|
Сгенерированный пароль указанной длины
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|