tostorchconnector 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tostorchconnector might be problematic. Click here for more details.

Files changed (22) hide show
  1. {tostorchconnector-1.0.1/tostorchconnector.egg-info → tostorchconnector-1.0.2}/PKG-INFO +1 -1
  2. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/pyproject.toml +1 -1
  3. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/__init__.py +2 -1
  4. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_object_reader.py +4 -4
  5. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_object_writer.py +2 -3
  6. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2/tostorchconnector.egg-info}/PKG-INFO +1 -1
  7. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector.egg-info/SOURCES.txt +0 -1
  8. tostorchconnector-1.0.1/tostorchconnector/tos_error.py +0 -11
  9. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/LICENSE +0 -0
  10. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/README.md +0 -0
  11. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/setup.cfg +0 -0
  12. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tests/test_tos_dataset.py +0 -0
  13. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tests/test_tosnativeclient.py +0 -0
  14. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_checkpoint.py +0 -0
  15. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_client.py +0 -0
  16. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_common.py +0 -0
  17. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_iterable_dataset.py +0 -0
  18. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_map_dataset.py +0 -0
  19. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector/tos_object_meta.py +0 -0
  20. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector.egg-info/dependency_links.txt +0 -0
  21. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector.egg-info/requires.txt +0 -0
  22. {tostorchconnector-1.0.1 → tostorchconnector-1.0.2}/tostorchconnector.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tostorchconnector
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: TOS connector integration for PyTorch
5
5
  Author-email: xiangshijian <xiangshijian@bytedance.com>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "tostorchconnector"
8
- version = "1.0.1"
8
+ version = "1.0.2"
9
9
  description = "TOS connector integration for PyTorch"
10
10
  authors = [{ name = "xiangshijian", email = "xiangshijian@bytedance.com" }]
11
11
  requires-python = ">=3.8,<3.13"
@@ -3,7 +3,7 @@ from .tos_object_writer import TosObjectWriter
3
3
  from .tos_iterable_dataset import TosIterableDataset
4
4
  from .tos_map_dataset import TosMapDataset
5
5
  from .tos_checkpoint import TosCheckpoint
6
- from .tos_error import TosError
6
+ from tosnativeclient import TosException, TosError
7
7
 
8
8
  __all__ = [
9
9
  'TosObjectReader',
@@ -12,4 +12,5 @@ __all__ = [
12
12
  'TosMapDataset',
13
13
  'TosCheckpoint',
14
14
  'TosError',
15
+ 'TosException',
15
16
  ]
@@ -2,7 +2,7 @@ import io
2
2
  import logging
3
3
  from functools import cached_property
4
4
  from os import SEEK_SET, SEEK_CUR, SEEK_END
5
- from typing import Optional, Callable, Iterator
5
+ from typing import Optional, Callable, Any
6
6
 
7
7
  from tos.models2 import GetObjectOutput
8
8
  from tosnativeclient.tosnativeclient import ReadStream
@@ -16,14 +16,14 @@ class TosObjectReader(io.BufferedIOBase):
16
16
 
17
17
  def __init__(self, bucket: str, key: str,
18
18
  get_object_meta: Optional[Callable[[], TosObjectMeta]],
19
- get_object_stream: Callable[[str, int], ReadStream | GetObjectOutput]):
19
+ get_object_stream: Callable[[str, int], Any]):
20
20
  if not bucket:
21
21
  raise ValueError('bucket is empty')
22
22
  self._bucket = bucket
23
23
  self._key = key
24
24
  self._get_object_meta = get_object_meta
25
25
  self._get_object_stream = get_object_stream
26
- self._object_stream: Optional[ReadStream | GetObjectOutput] = None
26
+ self._object_stream: Optional[Any] = None
27
27
  self._object_stream_offset = 0
28
28
  self._total_size: Optional[int] = None
29
29
  self._read_offset = 0
@@ -57,7 +57,7 @@ class TosObjectReader(io.BufferedIOBase):
57
57
  self._buffer.write(chunk)
58
58
  finally:
59
59
  self._object_stream.close()
60
- else:
60
+ elif isinstance(self._object_stream, GetObjectOutput):
61
61
  for chunk in self._object_stream:
62
62
  self._buffer.write(chunk)
63
63
 
@@ -1,10 +1,9 @@
1
1
  import io
2
2
  import logging
3
3
  import threading
4
- from typing import Callable, Optional, Any
4
+ from typing import Callable, Any
5
5
 
6
6
  from tos.models2 import PutObjectOutput
7
- from tosnativeclient.tosnativeclient import WriteStream
8
7
 
9
8
  log = logging.getLogger(__name__)
10
9
 
@@ -24,7 +23,7 @@ class PutObjectStream(object):
24
23
 
25
24
  class TosObjectWriter(io.BufferedIOBase):
26
25
 
27
- def __init__(self, bucket: str, key: str, put_object_stream: WriteStream | PutObjectStream):
26
+ def __init__(self, bucket: str, key: str, put_object_stream: Any):
28
27
  if not bucket:
29
28
  raise ValueError('bucket is empty')
30
29
  self._bucket = bucket
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tostorchconnector
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: TOS connector integration for PyTorch
5
5
  Author-email: xiangshijian <xiangshijian@bytedance.com>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -7,7 +7,6 @@ tostorchconnector/__init__.py
7
7
  tostorchconnector/tos_checkpoint.py
8
8
  tostorchconnector/tos_client.py
9
9
  tostorchconnector/tos_common.py
10
- tostorchconnector/tos_error.py
11
10
  tostorchconnector/tos_iterable_dataset.py
12
11
  tostorchconnector/tos_map_dataset.py
13
12
  tostorchconnector/tos_object_meta.py
@@ -1,11 +0,0 @@
1
- from typing import Optional
2
-
3
-
4
- class TosError(Exception):
5
- def __init__(self, message: str, status_code: Optional[int] = None, ec: Optional[str] = None,
6
- request_id: Optional[str] = None):
7
- super().__init__(message)
8
- self.message = message
9
- self.status_code = status_code
10
- self.ec = ec
11
- self.request_id = request_id