예제 #1
0
파일: hdfs.py 프로젝트: denkuzin/deepr
 def __init__(self, filesystem: FileSystem, path: str, mode: str = "rb"):
     self.filesystem = filesystem
     self.path = path
     self.mode = mode
     self._file = filesystem.open(self.path,
                                  mode={
                                      "r": "rb",
                                      "w": "wb"
                                  }.get(mode, mode))
예제 #2
0
 def __init__(self,
              filesystem: FileSystem,
              path: str,
              mode: str = "rb",
              encoding: Optional[str] = "utf-8"):
     self.filesystem = filesystem
     self.path = path
     self.mode = mode
     self.encoding = None if "b" in mode else encoding
     self._file = filesystem.open(self.path,
                                  mode={
                                      "r": "rb",
                                      "w": "wb"
                                  }.get(mode, mode))