cleanup based on flake8 output
This commit is contained in:
parent
b2928c8b1c
commit
01b3f9ca3a
1
.flake8
1
.flake8
@ -27,3 +27,4 @@ ignore =
|
|||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
# F401 import without use
|
# F401 import without use
|
||||||
*/__init__.py: F401,
|
*/__init__.py: F401,
|
||||||
|
__init__.py: F401,
|
||||||
|
@ -7,7 +7,6 @@ from fractions import Fraction
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
import math
|
import math
|
||||||
import struct
|
import struct
|
||||||
import io
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -1663,13 +1662,13 @@ def write_point_list(
|
|||||||
if implicit_closed:
|
if implicit_closed:
|
||||||
ManhattanDelta(points[-1][0] - points[0][0], points[-1][1] - points[0][1])
|
ManhattanDelta(points[-1][0] - points[0][0], points[-1][1] - points[0][1])
|
||||||
list_type = 2
|
list_type = 2
|
||||||
except:
|
except InvalidDataError:
|
||||||
try:
|
try:
|
||||||
deltas = [OctangularDelta(x, y) for x, y in points]
|
deltas = [OctangularDelta(x, y) for x, y in points]
|
||||||
if implicit_closed:
|
if implicit_closed:
|
||||||
OctangularDelta(points[-1][0] - points[0][0], points[-1][1] - points[0][1])
|
OctangularDelta(points[-1][0] - points[0][0], points[-1][1] - points[0][1])
|
||||||
list_type = 3
|
list_type = 3
|
||||||
except:
|
except InvalidDataError:
|
||||||
pass
|
pass
|
||||||
if list_type is not None:
|
if list_type is not None:
|
||||||
size = write_uint(stream, list_type)
|
size = write_uint(stream, list_type)
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
from numpy.testing import assert_equal
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -98,11 +92,15 @@ def test_file_1() -> None:
|
|||||||
assert geometry[1].height == 610
|
assert geometry[1].height == 610
|
||||||
assert geometry[1].width == 680
|
assert geometry[1].width == 680
|
||||||
|
|
||||||
assert_equal(geometry[2].point_list,
|
assert_equal(geometry[2].point_list, [
|
||||||
[[-30, -360], [480, -50], [180, 430], [-630, -20]])
|
[-30, -360],
|
||||||
|
[480, -50],
|
||||||
|
[180, 430],
|
||||||
|
[-630, -20],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[3].point_list,
|
assert_equal(geometry[3].point_list, [
|
||||||
[[-30, -400],
|
[-30, -400],
|
||||||
[450, 40],
|
[450, 40],
|
||||||
[70, -220],
|
[70, -220],
|
||||||
[10, 210],
|
[10, 210],
|
||||||
@ -123,23 +121,29 @@ def test_file_1() -> None:
|
|||||||
[210, 10],
|
[210, 10],
|
||||||
[40, 820],
|
[40, 820],
|
||||||
[-1340, 60],
|
[-1340, 60],
|
||||||
[30, -1370]])
|
[30, -1370],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[4].point_list,
|
assert_equal(geometry[4].point_list, [
|
||||||
[[40, -760], [490, -50], [110, 800], [-640, 10]])
|
[40, -760],
|
||||||
|
[490, -50],
|
||||||
|
[110, 800],
|
||||||
|
[-640, 10],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[5].point_list,
|
assert_equal(geometry[5].point_list, [
|
||||||
[[140, -380],
|
[140, -380],
|
||||||
[340, -10],
|
[340, -10],
|
||||||
[30, -100],
|
[30, -100],
|
||||||
[-320, 20],
|
[-320, 20],
|
||||||
[130, -460],
|
[130, -460],
|
||||||
[-480, -20],
|
[-480, -20],
|
||||||
[-210, 910],
|
[-210, 910],
|
||||||
[370, 40]])
|
[370, 40],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[6].point_list,
|
assert_equal(geometry[6].point_list, [
|
||||||
[[720, -20],
|
[720, -20],
|
||||||
[20, 20],
|
[20, 20],
|
||||||
[690, 0],
|
[690, 0],
|
||||||
[-10, 650],
|
[-10, 650],
|
||||||
@ -153,10 +157,11 @@ def test_file_1() -> None:
|
|||||||
[-90, -20],
|
[-90, -20],
|
||||||
[-60, 140],
|
[-60, 140],
|
||||||
[-1390, 50],
|
[-1390, 50],
|
||||||
[10, 30]])
|
[10, 30],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[7].point_list,
|
assert_equal(geometry[7].point_list, [
|
||||||
[[150, -830],
|
[150, -830],
|
||||||
[-1320, 40],
|
[-1320, 40],
|
||||||
[-70, 370],
|
[-70, 370],
|
||||||
[310, -30],
|
[310, -30],
|
||||||
@ -167,17 +172,25 @@ def test_file_1() -> None:
|
|||||||
[-20, 290],
|
[-20, 290],
|
||||||
[-1070, 20],
|
[-1070, 20],
|
||||||
[0, 230],
|
[0, 230],
|
||||||
[1380, -60]])
|
[1380, -60],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[8].point_list,
|
assert_equal(geometry[8].point_list, [
|
||||||
[[330, 0], [-10, 480], [620, -20], [-10, 330], [-930, 60], [0, -850]])
|
[330, 0],
|
||||||
|
[-10, 480],
|
||||||
|
[620, -20],
|
||||||
|
[-10, 330],
|
||||||
|
[-930, 60],
|
||||||
|
[0, -850],
|
||||||
|
])
|
||||||
|
|
||||||
assert_equal(geometry[9].point_list,
|
assert_equal(geometry[9].point_list, [
|
||||||
[[-140, -410],
|
[-140, -410],
|
||||||
[10, -140],
|
[10, -140],
|
||||||
[270, 0],
|
[270, 0],
|
||||||
[130, 1030],
|
[130, 1030],
|
||||||
[-500, 50],
|
[-500, 50],
|
||||||
[10, -330],
|
[10, -330],
|
||||||
[210, -10],
|
[210, -10],
|
||||||
[10, -190]])
|
[10, -190],
|
||||||
|
])
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
import pytest
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring
|
from ..basic import write_uint, write_bstring
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
from ..basic import InvalidRecordError, InvalidDataError
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +58,8 @@ def write_file_1(buf: BufferedIOBase) -> BufferedIOBase:
|
|||||||
+ [0b10] * 4
|
+ [0b10] * 4
|
||||||
+ [0b01] * 2
|
+ [0b01] * 2
|
||||||
+ [0b10] * 2
|
+ [0b10] * 2
|
||||||
+ [0b11, 0b10])
|
+ [0b11, 0b10]
|
||||||
|
)
|
||||||
|
|
||||||
for t, (x, x_en) in enumerate(zip(wh, wh_en)):
|
for t, (x, x_en) in enumerate(zip(wh, wh_en)):
|
||||||
write_uint(buf, 26) # CTRAPEZOID record
|
write_uint(buf, 26) # CTRAPEZOID record
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
|
|
||||||
from .utils import MAGIC_BYTES, FOOTER
|
from .utils import MAGIC_BYTES, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring
|
from ..basic import write_uint, write_bstring
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +55,6 @@ def test_file_1() -> None:
|
|||||||
assert layout.unit == 1000
|
assert layout.unit == 1000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write_file_2(buf: BufferedIOBase) -> BufferedIOBase:
|
def write_file_2(buf: BufferedIOBase) -> BufferedIOBase:
|
||||||
'''
|
'''
|
||||||
File contains no records.
|
File contains no records.
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
from typing import Sequence
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable, Sequence
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +154,8 @@ def write_text(buf: BufferedIOBase) -> BufferedIOBase:
|
|||||||
|
|
||||||
def name_test(layers: Sequence, is_textlayer: bool) -> None:
|
def name_test(layers: Sequence, is_textlayer: bool) -> None:
|
||||||
for ii, nn in enumerate(layers):
|
for ii, nn in enumerate(layers):
|
||||||
assert is_textlayer == nn.is_textlayer, f'Fail on layername {ii}'
|
msg = f'Fail on layername {ii}'
|
||||||
|
assert is_textlayer == nn.is_textlayer, msg
|
||||||
|
|
||||||
assert nn.nstring.string == ['AA', 'L5A', 'H5A', 'E5A', 'I56A',
|
assert nn.nstring.string == ['AA', 'L5A', 'H5A', 'E5A', 'I56A',
|
||||||
'E5L4', 'E5H4', 'E5E4', 'E5I47'][ii], msg
|
'E5L4', 'E5H4', 'E5E4', 'E5I47'][ii], msg
|
||||||
@ -172,7 +167,8 @@ def name_test(layers: Sequence, is_textlayer: bool) -> None:
|
|||||||
|
|
||||||
def name_test_text(layers: Sequence) -> None:
|
def name_test_text(layers: Sequence) -> None:
|
||||||
for ii, nn in enumerate(layers):
|
for ii, nn in enumerate(layers):
|
||||||
assert nn.is_textlayer, f'Fail on layername {ii}'
|
msg = f'Fail on layername {ii}'
|
||||||
|
assert nn.is_textlayer, msg
|
||||||
|
|
||||||
assert nn.nstring.string == ['TAA', 'TL5A', 'TH5A', 'TE5A', 'TI56A'][ii], msg
|
assert nn.nstring.string == ['TAA', 'TL5A', 'TH5A', 'TE5A', 'TI56A'][ii], msg
|
||||||
assert nn.layer_interval[0] == [None, None, 5, 5, 5][ii], msg
|
assert nn.layer_interval[0] == [None, None, 5, 5, 5][ii], msg
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
from numpy.testing import assert_equal
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte, PathExtensionScheme
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
from typing import Tuple
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
from numpy.testing import assert_equal
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte, write_float32, write_float64
|
||||||
from ..basic import InvalidRecordError, InvalidDataError, write_float32, write_float64
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -211,9 +205,9 @@ def test_file_1() -> None:
|
|||||||
assert pp.y == 0, msg
|
assert pp.y == 0, msg
|
||||||
|
|
||||||
if ii < 4 or ii == 5:
|
if ii < 4 or ii == 5:
|
||||||
assert pp.flip == False, msg
|
assert not bool(pp.flip), msg
|
||||||
else:
|
else:
|
||||||
assert pp.flip == True, msg
|
assert bool(pp.flip), msg
|
||||||
|
|
||||||
if ii < 5:
|
if ii < 5:
|
||||||
assert pp.angle == 0, msg
|
assert pp.angle == 0, msg
|
||||||
@ -502,9 +496,9 @@ def common_tests(layout: OasisLayout, variant: int) -> None:
|
|||||||
assert pp.y == 400 * (ii + 1), msg
|
assert pp.y == 400 * (ii + 1), msg
|
||||||
|
|
||||||
if ii in (4, 6):
|
if ii in (4, 6):
|
||||||
assert pp.flip == True, msg
|
assert bool(pp.flip), msg
|
||||||
else:
|
else:
|
||||||
assert pp.flip == False, msg
|
assert not bool(pp.flip), msg
|
||||||
|
|
||||||
if ii in (5, 6):
|
if ii in (5, 6):
|
||||||
assert pp.angle == 90, msg
|
assert pp.angle == 90, msg
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
import numpy
|
||||||
from numpy.testing import assert_equal
|
from numpy.testing import assert_equal
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -85,8 +80,11 @@ def common_tests(layout: OasisLayout) -> None:
|
|||||||
for ii in range(4):
|
for ii in range(4):
|
||||||
msg = f'Fail on poly {ii}'
|
msg = f'Fail on poly {ii}'
|
||||||
assert len(geometry[0].point_list) == 6, msg
|
assert len(geometry[0].point_list) == 6, msg
|
||||||
assert_equal(geometry[0].point_list, [[150, 0], [0, 50], [-50, 0], [0, 50],
|
assert_equal(
|
||||||
[-100, 0], [0, -100]], err_msg=msg)
|
geometry[0].point_list,
|
||||||
|
[[150, 0], [0, 50], [-50, 0], [0, 50], [-100, 0], [0, -100]],
|
||||||
|
err_msg=msg,
|
||||||
|
)
|
||||||
assert len(geometry[4].point_list) == 6
|
assert len(geometry[4].point_list) == 6
|
||||||
assert_equal(geometry[4].point_list, [[0, 150], [50, 0], [0, -50], [50, 0], [0, -100], [-100, 0]])
|
assert_equal(geometry[4].point_list, [[0, 150], [50, 0], [0, -50], [50, 0], [0, -100], [-100, 0]])
|
||||||
|
|
||||||
@ -97,8 +95,10 @@ def common_tests(layout: OasisLayout) -> None:
|
|||||||
assert len(geometry[7].point_list) == 9
|
assert len(geometry[7].point_list) == 9
|
||||||
assert_equal(geometry[7].point_list, [[25, 0], [50, 50], [0, 50], [-50, 50], [-50, 0], [-50, -50], [10, -75], [25, -25], [40, 0]])
|
assert_equal(geometry[7].point_list, [[25, 0], [50, 50], [0, 50], [-50, 50], [-50, 0], [-50, -50], [10, -75], [25, -25], [40, 0]])
|
||||||
assert len(geometry[8].point_list) == 9
|
assert len(geometry[8].point_list) == 9
|
||||||
assert_equal(geometry[8].point_list,
|
assert_equal(
|
||||||
numpy.cumsum([[25, 0], [50, 50], [0, 50], [-50, 50], [-50, 0], [-50, -50], [10, -75], [25, -25], [45, -575]], axis=0))
|
geometry[8].point_list,
|
||||||
|
numpy.cumsum([[25, 0], [50, 50], [0, 50], [-50, 50], [-50, 0], [-50, -50], [10, -75], [25, -25], [45, -575]], axis=0),
|
||||||
|
)
|
||||||
|
|
||||||
for ii in range(9, 12):
|
for ii in range(9, 12):
|
||||||
msg = f'Fail on poly {ii}'
|
msg = f'Fail on poly {ii}'
|
||||||
@ -425,7 +425,8 @@ def test_file_2() -> None:
|
|||||||
assert_equal(poly.point_list,
|
assert_equal(poly.point_list,
|
||||||
([[-1000, 0]]
|
([[-1000, 0]]
|
||||||
+ [[(-1) ** nn * 10, 20] for nn in range(8000)]
|
+ [[(-1) ** nn * 10, 20] for nn in range(8000)]
|
||||||
+ [[1000, 0], [0, -20 * 8000]]))
|
+ [[1000, 0], [0, -20 * 8000]]),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_file_3() -> None:
|
def test_file_3() -> None:
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
import pytest
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
from numpy.testing import assert_equal
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
from ..basic import InvalidDataError
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +50,6 @@ def write_file_common(buf: BufferedIOBase, variant: int) -> BufferedIOBase:
|
|||||||
write_uint(buf, 7) # PROPNAME record (implicit id 1)
|
write_uint(buf, 7) # PROPNAME record (implicit id 1)
|
||||||
write_bstring(buf, b'PROP1')
|
write_bstring(buf, b'PROP1')
|
||||||
|
|
||||||
|
|
||||||
write_uint(buf, 14) # CELL record (explicit)
|
write_uint(buf, 14) # CELL record (explicit)
|
||||||
write_bstring(buf, b'A') # Cell name
|
write_bstring(buf, b'A') # Cell name
|
||||||
|
|
||||||
@ -375,7 +370,7 @@ def write_file_3(buf: BufferedIOBase) -> BufferedIOBase:
|
|||||||
write_uint(buf, 7) # PROPNAME record (implicit id 0)
|
write_uint(buf, 7) # PROPNAME record (implicit id 0)
|
||||||
write_bstring(buf, b'S_GDS_PROPERTY')
|
write_bstring(buf, b'S_GDS_PROPERTY')
|
||||||
|
|
||||||
|
# ** CELL **
|
||||||
write_uint(buf, 14) # CELL record (explicit)
|
write_uint(buf, 14) # CELL record (explicit)
|
||||||
write_bstring(buf, b'A') # Cell name
|
write_bstring(buf, b'A') # Cell name
|
||||||
|
|
||||||
@ -614,7 +609,7 @@ def write_file_4_6(buf: BufferedIOBase, variant: int) -> BufferedIOBase:
|
|||||||
write_sint(buf, 300) # geometry-x (relative)
|
write_sint(buf, 300) # geometry-x (relative)
|
||||||
write_sint(buf, -400) # geometry-y (relative)
|
write_sint(buf, -400) # geometry-y (relative)
|
||||||
|
|
||||||
|
# ** CELL **
|
||||||
write_uint(buf, 14) # CELL record (explicit)
|
write_uint(buf, 14) # CELL record (explicit)
|
||||||
write_bstring(buf, b'TOP') # Cell name
|
write_bstring(buf, b'TOP') # Cell name
|
||||||
|
|
||||||
@ -991,7 +986,7 @@ def write_file_7_8_9(buf: BufferedIOBase, variant: int) -> BufferedIOBase:
|
|||||||
write_uint(buf, 10) # prop-value 0 (a-string)
|
write_uint(buf, 10) # prop-value 0 (a-string)
|
||||||
write_bstring(buf, b'CPValue0')
|
write_bstring(buf, b'CPValue0')
|
||||||
|
|
||||||
|
# ** CELL **
|
||||||
write_uint(buf, 13) # CELL record (name ref.)
|
write_uint(buf, 13) # CELL record (name ref.)
|
||||||
write_uint(buf, 0) # Cell name 0 (XYZ)
|
write_uint(buf, 0) # Cell name 0 (XYZ)
|
||||||
|
|
||||||
@ -1020,7 +1015,6 @@ def write_file_7_8_9(buf: BufferedIOBase, variant: int) -> BufferedIOBase:
|
|||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_file_7() -> None:
|
def test_file_7() -> None:
|
||||||
buf = write_file_7_8_9(BytesIO(), 7)
|
buf = write_file_7_8_9(BytesIO(), 7)
|
||||||
|
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
import pytest
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
from ..basic import InvalidRecordError, InvalidDataError
|
||||||
from ..basic import GridRepetition, ArbitraryRepetition
|
from ..basic import GridRepetition, ArbitraryRepetition
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
@ -86,12 +83,12 @@ def common_tests(layout: OasisLayout) -> None:
|
|||||||
assert geometry[13].repetition.b_vector == [-10, 10]
|
assert geometry[13].repetition.b_vector == [-10, 10]
|
||||||
|
|
||||||
assert geometry[14].repetition.a_count == 3
|
assert geometry[14].repetition.a_count == 3
|
||||||
assert geometry[14].repetition.b_count == None
|
assert geometry[14].repetition.b_count is None
|
||||||
assert geometry[14].repetition.a_vector == [11, 12]
|
assert geometry[14].repetition.a_vector == [11, 12]
|
||||||
assert geometry[14].repetition.b_vector is None
|
assert geometry[14].repetition.b_vector is None
|
||||||
|
|
||||||
assert geometry[15].repetition.a_count == 4
|
assert geometry[15].repetition.a_count == 4
|
||||||
assert geometry[15].repetition.b_count == None
|
assert geometry[15].repetition.b_count is None
|
||||||
assert geometry[15].repetition.a_vector == [-10, 10]
|
assert geometry[15].repetition.a_vector == [-10, 10]
|
||||||
assert geometry[15].repetition.b_vector is None
|
assert geometry[15].repetition.b_vector is None
|
||||||
|
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
|
|
||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
from io import BytesIO, BufferedIOBase
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
import numpy
|
|
||||||
from numpy.testing import assert_equal
|
|
||||||
|
|
||||||
from .utils import HEADER, FOOTER
|
from .utils import HEADER, FOOTER
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte, PathExtensionScheme
|
from ..basic import write_uint, write_sint, write_bstring, write_byte
|
||||||
from ..basic import InvalidRecordError, InvalidDataError
|
|
||||||
from ..main import OasisLayout
|
from ..main import OasisLayout
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
from typing import List, Tuple, Iterable
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
import pytest # type: ignore
|
|
||||||
|
|
||||||
from ..basic import read_uint, read_sint, write_uint, write_sint
|
from ..basic import read_uint, read_sint, write_uint, write_sint
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
from typing import List, Tuple, Iterable
|
from io import BytesIO
|
||||||
from itertools import chain
|
|
||||||
from io import BytesIO, BufferedIOBase
|
|
||||||
import struct
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
from ..basic import write_uint, write_bstring, write_byte
|
||||||
|
|
||||||
from ..basic import write_uint, write_sint, read_uint, read_sint, write_bstring, write_byte
|
|
||||||
from ..main import OasisLayout
|
|
||||||
|
|
||||||
|
|
||||||
MAGIC_BYTES = b'%SEMI-OASIS\r\n'
|
MAGIC_BYTES = b'%SEMI-OASIS\r\n'
|
||||||
|
Loading…
Reference in New Issue
Block a user