Skip to content

Commit

Permalink
0.7.1
Browse files Browse the repository at this point in the history
Да.
  • Loading branch information
danila-schelkov committed Oct 11, 2020
1 parent a498525 commit 0084c58
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .idea/3d-converter.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 3d_converter.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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
Author-email: [email protected]
License: GPLv3
Description: ## `Python 3D Models Converter`

**Version**: 0.6.8
**Version**: 0.7.1

### Thanks a lot for motivating [AMIRMISTIK]!

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## `Python 3D Models Converter`

**Version**: 0.7.0
**Version**: 0.7.1

### Thanks a lot for motivating [AMIRMISTIK]!

Expand Down
2 changes: 1 addition & 1 deletion models_converter/chunks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
38 changes: 19 additions & 19 deletions models_converter/utils/reader.py
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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)
Expand All @@ -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:
Expand All @@ -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
56 changes: 0 additions & 56 deletions models_converter/utils/reader.pyi

This file was deleted.

34 changes: 17 additions & 17 deletions models_converter/utils/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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
53 changes: 0 additions & 53 deletions models_converter/utils/writer.pyi

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='3d-converter',
version='0.7.0',
version='0.7.1',
author='Vorono4ka',
author_email='[email protected]',
description='Python 3D Models Converter',
Expand Down

0 comments on commit 0084c58

Please sign in to comment.