Skip to content

Commit 4e75599

Browse files
hgollakotaFokko
andauthored
Add support for lowercase FileFormat(#1362)
* Added support for lowercase FileFormat Modified the FileFormat class so that it utilizes EnumMeta value aliases. This allows both "AVRO" and "avro" to map to AVRO. * Make mypy happy --------- Co-authored-by: Fokko Driesprong <[email protected]>
1 parent 61b3510 commit 4e75599

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pyiceberg/manifest.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,16 @@ def __repr__(self) -> str:
9494

9595

9696
class FileFormat(str, Enum):
97-
AVRO = "AVRO"
98-
PARQUET = "PARQUET"
99-
ORC = "ORC"
97+
AVRO = "AVRO", "avro"
98+
PARQUET = "PARQUET", "parquet"
99+
ORC = "ORC", "orc"
100+
101+
def __new__(cls, value: str, *value_aliases: List[str]) -> "FileFormat":
102+
obj = str.__new__(cls)
103+
obj._value_ = value
104+
for alias in value_aliases:
105+
cls._value2member_map_[alias] = obj
106+
return obj
100107

101108
@classmethod
102109
def _missing_(cls, value: object) -> Union[None, str]:

0 commit comments

Comments
 (0)