Skip to content

Commit

Permalink
revert FlyteFile's change
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Jul 15, 2024
1 parent 4528744 commit 7055eec
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions flytekit/types/file/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def noop(): ...

T = typing.TypeVar("T")


@dataclass
class FlyteFile(SerializableType, os.PathLike, typing.Generic[T], DataClassJSONMixin):
path: typing.Union[str, os.PathLike] = field(default=None, metadata=config(mm_field=fields.String())) # type: ignore
Expand Down Expand Up @@ -350,27 +351,11 @@ def copy_file(ff: FlyteFile) -> FlyteFile:
yield f
f.close()



def __repr__(self):
return self.path
# return str(self.path)

def __str__(self):
return self.path
# return str(self.path)

# @classmethod
# def validate(cls, value: str, info: ValidationInfo):
# return cls(value, info.field_name)
#
# @classmethod
# def __get_pydantic_core_schema__(
# cls, source_type: typing.Any, handler: GetCoreSchemaHandler
# ) -> core_schema.CoreSchema:
# return core_schema.with_info_after_validator_function(
# cls.validate, handler(source_type), field_name=handler.field_name
# )


class FlyteFilePathTransformer(TypeTransformer[FlyteFile]):
Expand All @@ -381,7 +366,7 @@ def __init__(self):
def get_format(t: typing.Union[typing.Type[FlyteFile], os.PathLike]) -> str:
if t is os.PathLike:
return ""
return typing.cast(FlyteFile, t).extension()
return cast(FlyteFile, t).extension()

def _blob_type(self, format: str) -> BlobType:
return BlobType(format=format, dimensionality=BlobType.BlobDimensionality.SINGLE)
Expand Down

0 comments on commit 7055eec

Please sign in to comment.