mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 06:58:38 +00:00
refactor: Update the type annotation in ConvertLengthUnit.py to be a literal
This commit is contained in:
committed by
Dion Moult
parent
9ac159e0af
commit
a252b459a2
@@ -24,6 +24,31 @@ import ifcopenshell.util.element
|
|||||||
import ifcopenshell.util.unit
|
import ifcopenshell.util.unit
|
||||||
from logging import Logger
|
from logging import Logger
|
||||||
|
|
||||||
|
import typing
|
||||||
|
|
||||||
|
LengthUnit = typing.Literal[
|
||||||
|
"ATTOMETER",
|
||||||
|
"CENTIMETER",
|
||||||
|
"DECAMETER",
|
||||||
|
"DECIMETER",
|
||||||
|
"EXAMETER",
|
||||||
|
"FEMTOMETER",
|
||||||
|
"GIGAMETER",
|
||||||
|
"HECTOMETER",
|
||||||
|
"KILOMETER",
|
||||||
|
"MEGAMETER",
|
||||||
|
"METER",
|
||||||
|
"MICROMETER",
|
||||||
|
"MILLIMETER",
|
||||||
|
"NANOMETER",
|
||||||
|
"PETAMETER",
|
||||||
|
"PICOMETER",
|
||||||
|
"TERAMETER",
|
||||||
|
"INCH",
|
||||||
|
"FOOT",
|
||||||
|
"MILE",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Patcher:
|
class Patcher:
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -31,7 +56,7 @@ class Patcher:
|
|||||||
src: str,
|
src: str,
|
||||||
file: ifcopenshell.file,
|
file: ifcopenshell.file,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
unit: str = "METER",
|
unit: LengthUnit = "METER",
|
||||||
):
|
):
|
||||||
"""Converts the length unit of a model to the specified unit
|
"""Converts the length unit of a model to the specified unit
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user