From 0084c5887b3131dcf0ece2f0fa277fb16275556d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=A9=D0=B5=D0=BB?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=20=28Danila=20Schelkov=29?= <54549682+Vorono4ka@users.noreply.github.com> Date: Sun, 11 Oct 2020 17:19:04 +0400 Subject: [PATCH] 0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Да. --- .idea/3d-converter.iml | 2 +- .idea/misc.xml | 2 +- 3d_converter.egg-info/PKG-INFO | 4 +-- README.md | 2 +- models_converter/chunks/__init__.py | 2 +- models_converter/utils/reader.py | 38 ++++++++++---------- models_converter/utils/reader.pyi | 56 ----------------------------- models_converter/utils/writer.py | 34 +++++++++--------- models_converter/utils/writer.pyi | 53 --------------------------- setup.py | 2 +- 10 files changed, 43 insertions(+), 152 deletions(-) delete mode 100644 models_converter/utils/reader.pyi delete mode 100644 models_converter/utils/writer.pyi diff --git a/.idea/3d-converter.iml b/.idea/3d-converter.iml index 9b31378..8388dbc 100644 --- a/.idea/3d-converter.iml +++ b/.idea/3d-converter.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d1e22ec..d56657a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/3d_converter.egg-info/PKG-INFO b/3d_converter.egg-info/PKG-INFO index 3f68798..db3301c 100644 --- a/3d_converter.egg-info/PKG-INFO +++ b/3d_converter.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: 3d-converter -Version: 0.7.0 +Version: 0.7.1 Summary: Python 3D Models Converter Home-page: https://github.com/vorono4ka/3d-converter Author: Vorono4ka @@ -8,7 +8,7 @@ Author-email: crowo4ka@gmail.com License: GPLv3 Description: ## `Python 3D Models Converter` - **Version**: 0.6.8 + **Version**: 0.7.1 ### Thanks a lot for motivating [AMIRMISTIK]! diff --git a/README.md b/README.md index 163830a..8ecd8fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## `Python 3D Models Converter` -**Version**: 0.7.0 +**Version**: 0.7.1 ### Thanks a lot for motivating [AMIRMISTIK]! diff --git a/models_converter/chunks/__init__.py b/models_converter/chunks/__init__.py index e991cf4..65ffb15 100644 --- a/models_converter/chunks/__init__.py +++ b/models_converter/chunks/__init__.py @@ -401,7 +401,7 @@ def __init__(self, header=None): self.chunk_name = 'CAME' def parse(self, buffer: bytes): - super(Reader).__init__(buffer=buffer) + Reader.__init__(self, buffer=buffer) setattr(self, 'name', self.readString()) setattr(self, 'v1', self.readFloat()) diff --git a/models_converter/utils/reader.py b/models_converter/utils/reader.py index a131dd5..ddf0668 100644 --- a/models_converter/utils/reader.py +++ b/models_converter/utils/reader.py @@ -1,16 +1,16 @@ class Reader: - def __init__(self, buffer, endian='big'): + def __init__(self, buffer: bytes, endian: str = 'big'): self.buffer = buffer self.endian = endian self.i = 0 - def read(self, length=1): + def read(self, length: int = 1) -> bytes: result = self.buffer[self.i:self.i + length] self.i += length return result - def readUInteger(self, length=1): + def readUInteger(self, length: int = 1) -> int: result = 0 for x in range(length): byte = self.buffer[self.i] @@ -24,20 +24,20 @@ def readUInteger(self, length=1): return result - def readInteger(self, length=1): + def readInteger(self, length: int = 1) -> int: integer = self.readUInteger(length) result = integer if integer > 2 ** (length * 8) / 2: result -= 2 ** (length * 8) return result - def readUInt64(self): + def readUInt64(self) -> int: return self.readUInteger(8) - def readInt64(self): + def readInt64(self) -> int: return self.readInteger(8) - def readFloat(self): + def readFloat(self) -> float: as_int = self.readUInt32() binary = bin(as_int) binary = binary[2:].zfill(32) @@ -63,31 +63,31 @@ def readFloat(self): result = sign * 2 ** exponent * mantissa return result - def readUInt32(self): + def readUInt32(self) -> int: return self.readUInteger(4) - def readInt32(self): + def readInt32(self) -> int: return self.readInteger(4) - def readNUInt16(self): + def readNUInt16(self) -> float: return self.readUInt16() / 65535 - def readUInt16(self): + def readUInt16(self) -> int: return self.readUInteger(2) - def readNInt16(self): + def readNInt16(self) -> float: return self.readInt16() / 32512 - def readInt16(self): + def readInt16(self) -> int: return self.readInteger(2) - def readUInt8(self): + def readUInt8(self) -> int: return self.readUInteger() - def readInt8(self): + def readInt8(self) -> int: return self.readInteger() - def readBool(self): + def readBool(self) -> bool: if self.readUInt8() >= 1: return True else: @@ -108,12 +108,12 @@ def readBool(self): readUByte = readUInt8 readByte = readInt8 - def readChar(self, length=1): + def readChar(self, length: int = 1) -> str: return self.read(length).decode('utf-8') - def readString(self): + def readString(self) -> str: length = self.readUShort() return self.readChar(length) - def tell(self): + def tell(self) -> int: return self.i diff --git a/models_converter/utils/reader.pyi b/models_converter/utils/reader.pyi deleted file mode 100644 index 044dde3..0000000 --- a/models_converter/utils/reader.pyi +++ /dev/null @@ -1,56 +0,0 @@ -class Reader: - def __init__(self, buffer: bytes, endian: str = 'big'): - self.buffer = buffer - self.endian = endian - self.i = 0 - - def read(self, length: int = 1): ... - - def readUInteger(self, length: int = 1) -> int: ... - - def readInteger(self, length: int = 1) -> int: ... - - def readUInt64(self) -> int: ... - - def readInt64(self) -> int: ... - - def readFloat(self) -> float: ... - - def readUInt32(self) -> int: ... - - def readInt32(self) -> int: ... - - def readNUInt16(self) -> float: ... - - def readUInt16(self) -> int: ... - - def readNInt16(self) -> float: ... - - def readInt16(self) -> int: ... - - def readUInt8(self) -> int: ... - - def readInt8(self) -> int: ... - - def readBool(self) -> bool: ... - - readUInt = readUInteger - readInt = readInteger - - readULong = readUInt64 - readLong = readInt64 - - readNUShort = readNUInt16 - readNShort = readNInt16 - - readUShort = readUInt16 - readShort = readInt16 - - readUByte = readUInt8 - readByte = readInt8 - - def readChar(self, length: int = 1) -> str: ... - - def readString(self) -> str: ... - - def tell(self) -> int: ... diff --git a/models_converter/utils/writer.py b/models_converter/utils/writer.py index 11d1b2a..8af202f 100644 --- a/models_converter/utils/writer.py +++ b/models_converter/utils/writer.py @@ -3,22 +3,22 @@ def __init__(self, endian='big'): self.endian = endian self.buffer = b'' - def write(self, data): + def write(self, data: bytes) -> None: self.buffer += data - def writeUInteger(self, integer, length=1): + def writeUInteger(self, integer: int, length: int = 1) -> None: self.buffer += integer.to_bytes(length, self.endian, signed=False) - def writeInteger(self, integer, length=1): + def writeInteger(self, integer: int, length: int = 1) -> None: self.buffer += integer.to_bytes(length, self.endian, signed=True) - def writeUInt64(self, integer): + def writeUInt64(self, integer: int) -> None: self.writeUInteger(integer, 8) - def writeInt64(self, integer): + def writeInt64(self, integer: int) -> None: self.writeInteger(integer, 8) - def writeFloat(self, floating): + def writeFloat(self, floating: float) -> None: exponent = 0 sign = 1 @@ -64,31 +64,31 @@ def writeFloat(self, floating): self.writeUInt32(as_integer) - def writeUInt32(self, integer): + def writeUInt32(self, integer: int) -> None: self.writeUInteger(integer, 4) - def writeInt32(self, integer): + def writeInt32(self, integer: int) -> None: self.writeInteger(integer, 4) - def writeNUInt16(self, integer): + def writeNUInt16(self, integer: float) -> None: self.writeUInt16(round(integer * 65535)) - def writeUInt16(self, integer): + def writeUInt16(self, integer: int) -> None: self.writeUInteger(integer, 2) - def writeNInt16(self, integer): + def writeNInt16(self, integer: float) -> None: self.writeInt16(round(integer * 32512)) - def writeInt16(self, integer): + def writeInt16(self, integer: int) -> None: self.writeInteger(integer, 2) - def writeUInt8(self, integer): + def writeUInt8(self, integer: int) -> None: self.writeUInteger(integer) - def writeInt8(self, integer): + def writeInt8(self, integer: int) -> None: self.writeInteger(integer) - def writeBool(self, boolean: bool): + def writeBool(self, boolean: bool) -> None: if boolean: self.writeUInt8(1) else: @@ -109,11 +109,11 @@ def writeBool(self, boolean: bool): writeUByte = writeUInt8 writeByte = writeInt8 - def writeChar(self, string): + def writeChar(self, string: str) -> None: for char in list(string): self.buffer += char.encode('utf-8') - def writeString(self, string): + def writeString(self, string: str) -> None: encoded = string.encode('utf-8') self.writeUShort(len(encoded)) self.buffer += encoded diff --git a/models_converter/utils/writer.pyi b/models_converter/utils/writer.pyi deleted file mode 100644 index 4b0cf3f..0000000 --- a/models_converter/utils/writer.pyi +++ /dev/null @@ -1,53 +0,0 @@ -class Writer: - def __init__(self, endian: str = 'big'): - self.endian = endian - self.buffer = b'' - - def write(self, data: bytes) -> None: ... - - def writeUInteger(self, integer: int, length: int = 1) -> None: ... - - def writeInteger(self, integer: int, length: int = 1) -> None: ... - - def writeUInt64(self, integer: int) -> None: ... - - def writeInt64(self, integer: int) -> None: ... - - def writeFloat(self, floating: float) -> None: ... - - def writeUInt32(self, integer: int) -> None: ... - - def writeInt32(self, integer: int) -> None: ... - - def writeNUInt16(self, integer: int) -> None: ... - - def writeUInt16(self, integer: int) -> None: ... - - def writeNInt16(self, integer: int) -> None: ... - - def writeInt16(self, integer: int) -> None: ... - - def writeUInt8(self, integer: int) -> None: ... - - def writeInt8(self, integer: int) -> None: ... - - def writeBool(self, boolean: bool) -> None: ... - - writeUInt = writeUInteger - writeInt = writeInteger - - writeULong = writeUInt64 - writeLong = writeInt64 - - writeNUShort = writeNUInt16 - writeNShort = writeNInt16 - - writeUShort = writeUInt16 - writeShort = writeInt16 - - writeUByte = writeUInt8 - writeByte = writeInt8 - - def writeChar(self, string: str) -> None: ... - - def writeString(self, string: str) -> None: ... diff --git a/setup.py b/setup.py index 412a335..d937e64 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name='3d-converter', - version='0.7.0', + version='0.7.1', author='Vorono4ka', author_email='crowo4ka@gmail.com', description='Python 3D Models Converter',