Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
Update LasHeader.__init__ type hints & add doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Jan 9, 2021
1 parent 3f0d6e7 commit ee532cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pylas/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import struct
from datetime import date, timedelta
from typing import NamedTuple, BinaryIO, Optional, List
from typing import NamedTuple, BinaryIO, Optional, List, Union
from uuid import UUID

import numpy as np
Expand Down Expand Up @@ -109,6 +109,10 @@ class LasHeader:
>>> header = LasHeader(version=Version(1, 4), point_format=PointFormat(6))
>>> header
<LasHeader(1.4, <PointFormat(6, 0 bytes of extra dims)>)>
>>> header = LasHeader(version="1.4", point_format=6)
>>> header
<LasHeader(1.4, <PointFormat(6, 0 bytes of extra dims)>)>
"""

#: The default version used when None is given to init
Expand All @@ -119,8 +123,8 @@ class LasHeader:
def __init__(
self,
*,
version: Optional[Version] = None,
point_format: Optional[PointFormat] = None,
version: Optional[Union[Version, str]] = None,
point_format: Optional[Union[PointFormat, int]] = None,
) -> None:
if isinstance(point_format, int):
point_format = PointFormat(point_format)
Expand Down

0 comments on commit ee532cb

Please sign in to comment.