small fixes for Py3

master
idziubenko 3 years ago
parent 15e94c1388
commit 0ff7ce47bc

6
.gitignore vendored

@ -0,0 +1,6 @@
revert_changes_to_vmachine
push_to_vmachine*
.vscode
*.pyc
*.pyo
*.bak

@ -129,7 +129,7 @@ class Import:
"""
self.ns = ns
self.location = location
self.filter = TnsFilter()
self._filter = TnsFilter()
def setfilter(self, filter):
"""
@ -137,7 +137,7 @@ class Import:
@param filter: A filter to set.
@type filter: L{TnsFilter}
"""
self.filter = filter
self._filter = filter
def apply(self, root):
"""
@ -147,7 +147,7 @@ class Import:
@param root: A schema root.
@type root: L{Element}
"""
if not self.filter.match(root, self.ns):
if not self._filter.match(root, self.ns):
return
if self.exists(root):
return

@ -21,7 +21,7 @@ import hashlib
import crypt
import string
from random import choice
from base64 import encodestring as _b64enc
from base64 import encodebytes as _b64enc
b64encode = lambda x: _b64enc(x).rstrip()
try:

@ -327,7 +327,7 @@ class ColorTerminalOutput(SaveAttrOutput):
"""
Создать ESC строку
"""
attrs = map(str, ['%s[' % self.escSymb] + attrs + ['m'])
attrs = list(map(str, ['%s[' % self.escSymb] + attrs + ['m']))
return "%s%s%s" % (attrs[0], ";".join(attrs[1:-1]), attrs[-1])
def outputText(self, s):

@ -13,10 +13,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
# from __future__ import absolute_import
from .output import BaseOutput, BasePositionOutput
from calculate.lib.utils.text import _uu8
from io import IOBase
class Print(object):
"""
@ -28,7 +28,7 @@ class Print(object):
self.output = output
self.position_controller = position_controller
self.buffer = []
if isinstance(printfunc, file):
if isinstance(printfunc, IOBase):
self.printfunc = printfunc.write
self.flush = printfunc.flush
else:

@ -811,8 +811,9 @@ def readLinesFile(filename, grab=False):
yield line.rstrip('\n')
except (OSError, IOError):
pass
finally:
raise StopIteration
# at least in python3, yield should give StopIteration automatically
# finally:
# raise StopIteration
def isEmptyFile(filename, grab=False):

Loading…
Cancel
Save