From bff84a01d21d7e13ff6e7676d55df4b885bdf664 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 4 Oct 2011 02:53:44 +0900 Subject: [PATCH] remove no use --- pymeshio/compatibility.py | 81 ----------------------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 pymeshio/compatibility.py diff --git a/pymeshio/compatibility.py b/pymeshio/compatibility.py deleted file mode 100644 index ab8da34..0000000 --- a/pymeshio/compatibility.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/python -# coding: utf-8 -""" -utitlities for pmd and vmd loading. - -- python2 and python3 compatibility. - -""" -import sys -import os.path - - -""" -utility functions for python2 and python3 compatibility. -""" -if sys.version_info[0]>=3: - xrange=range - -if sys.version_info[0]<3: - def truncate_zero(src): - """ - drop after 0x00 - """ - assert(type(src)==bytes) - pos = src.find(b"\x00") - if pos >= 0: - return src[:pos] - else: - return src -else: - def truncate_zero(src): - """ - drop after 0x00 - """ - assert(type(src)==bytes) - pos = src.find(b"\x00") - if pos >= 0: - return src[:pos].decode('cp932') - else: - return src.decode('cp932') - - -if sys.version_info[0]<3: - def to_str(src): - """ - str or unicode to str - """ - t=type(src) - if t==unicode: - return src.encode('cp932') - elif t==str: - return src - else: - raise "INVALID str: %s" % t - - def from_str(src): - """ - do nothing - """ - return src - -else: - def to_str(src): - """ - bytes or str to str - """ - t=type(src) - if t==str: - return src - elif t==bytes: - return src.decode('cp932') - else: - raise "INVALID str: %s" % t - - def from_str(src): - """ - str to bytes - """ - return src.encode('cp932') - - -- 2.11.0