python-download 0.0.3__tar.gz → 0.0.4__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.
@@ -1,31 +1,35 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-download
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Python for download.
5
- Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-download
6
5
  License: MIT
6
+ License-File: LICENSE
7
7
  Keywords: download
8
8
  Author: ChenyangGao
9
9
  Author-email: wosiwujm@gmail.com
10
- Requires-Python: >=3.11,<4.0
10
+ Requires-Python: >=3.10,<4.0
11
11
  Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
17
18
  Classifier: Programming Language :: Python :: 3.11
18
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
19
22
  Classifier: Programming Language :: Python :: 3 :: Only
20
23
  Classifier: Topic :: Software Development
21
24
  Classifier: Topic :: Software Development :: Libraries
22
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Requires-Dist: http_response
24
- Requires-Dist: python-asynctools
25
- Requires-Dist: python-concurrenttools
26
- Requires-Dist: python-filewrap
27
- Requires-Dist: python-urlopen
28
- Project-URL: Repository, https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-download
26
+ Requires-Dist: http_response (>=0.0.9)
27
+ Requires-Dist: python-asynctools (>=0.1.3)
28
+ Requires-Dist: python-concurrenttools (>=0.1.4)
29
+ Requires-Dist: python-filewrap (==0.2.9)
30
+ Requires-Dist: python-http_request (>=0.1.6.3)
31
+ Project-URL: Homepage, https://github.com/ChenyangGao/python-modules/tree/main/python-download
32
+ Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/python-download
29
33
  Description-Content-Type: text/markdown
30
34
 
31
35
  # Python for download..
@@ -2,7 +2,7 @@
2
2
  # encoding: utf
3
3
 
4
4
  __author__ = "ChenyangGao <https://chenyanggao.github.io>"
5
- __version__ = (0, 0, 3)
5
+ __version__ = (0, 0, 4)
6
6
  __all__ = [
7
7
  "DownloadTaskStatus", "DownloadProgress",
8
8
  "DownloadTask", "AsyncDownloadTask",
@@ -38,21 +38,12 @@ from asynctools import ensure_aiter, ensure_async, as_thread
38
38
  from concurrenttools import run_as_thread
39
39
  from filewrap import bio_chunk_iter, bio_chunk_async_iter, bio_skip_iter, bio_skip_async_iter, SupportsWrite
40
40
  from http_response import get_filename, get_length, is_chunked, is_range_request
41
- from urlopen import urlopen
41
+ from http_request.extension.request import urlopen
42
42
 
43
43
 
44
44
  DEFAULT_ITER_BYTES = lambda resp: bio_chunk_iter(resp, chunksize=COPY_BUFSIZE)
45
45
  DEFAULT_ASYNC_ITER_BYTES = lambda resp: bio_chunk_async_iter(resp, chunksize=COPY_BUFSIZE)
46
46
 
47
- try:
48
- from aiofile import async_open, FileIOWrapperBase
49
- aiofile_installed = True
50
- except ImportError:
51
- aiofile_installed = False
52
- else:
53
- if "__getattr__" not in FileIOWrapperBase.__dict__:
54
- setattr(FileIOWrapperBase, "__getattr__", lambda self, attr, /: getattr(self.file, attr))
55
-
56
47
 
57
48
  class DownloadTaskStatus(IntEnum):
58
49
  PENDING = 0
@@ -116,7 +107,7 @@ class BaseDownloadTask(ABC):
116
107
  name = type(self).__qualname__
117
108
  state = self.state
118
109
  if state is DownloadTaskStatus.FAILED:
119
- return f"<{name} :: state={state!r} progress={self.progress!r} exception={self.exception()}>"
110
+ return f"<{name} :: state={state!r} progress={self.progress!r} exception={self.exception()!r}>"
120
111
  return f"<{name} :: state={state!r} progress={self.progress!r}>"
121
112
 
122
113
  @property
@@ -296,7 +287,7 @@ class DownloadTask(BaseDownloadTask):
296
287
  except:
297
288
  pass
298
289
 
299
- def start(self, /, wait: bool = False):
290
+ def start(self, /, wait: bool = True):
300
291
  with self._state_lock:
301
292
  if self.state in (DownloadTaskStatus.PENDING, DownloadTaskStatus.PAUSED):
302
293
  self.submit(self.run)
@@ -562,20 +553,12 @@ async def download_async_iter(
562
553
  file = abspath(fsdecode(file))
563
554
  if isdir(file):
564
555
  file = joinpath(file, get_filename(resp, "download"))
565
- if aiofile_installed:
566
- try:
567
- fdst = await async_open(file, "ab" if resume else "wb")
568
- except FileNotFoundError:
569
- makedirs(dirname(file), exist_ok=True)
570
- fdst = await async_open(file, "ab" if resume else "wb")
571
- file_async_close = fdst.close
572
- else:
573
- try:
574
- fdst = open(file, "ab" if resume else "wb")
575
- except FileNotFoundError:
576
- makedirs(dirname(file), exist_ok=True)
577
- fdst = open(file, "ab" if resume else "wb")
578
- file_async_close = as_thread(fdst.close)
556
+ try:
557
+ fdst = open(file, "ab" if resume else "wb")
558
+ except FileNotFoundError:
559
+ makedirs(dirname(file), exist_ok=True)
560
+ fdst = open(file, "ab" if resume else "wb")
561
+ file_async_close = as_thread(fdst.close)
579
562
 
580
563
  extra = {"url": url, "file": file, "resume": resume}
581
564
  filesize = 0
@@ -1,19 +1,19 @@
1
1
  [tool.poetry]
2
2
  name = "python-download"
3
- version = "0.0.3"
3
+ version = "0.0.4"
4
4
  description = "Python for download."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
7
7
  readme = "readme.md"
8
- homepage = "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-download"
9
- repository = "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/python-download"
8
+ homepage = "https://github.com/ChenyangGao/python-modules/tree/main/python-download"
9
+ repository = "https://github.com/ChenyangGao/python-modules/tree/main/python-download"
10
10
  keywords = ["download"]
11
11
  classifiers = [
12
12
  "License :: OSI Approved :: MIT License",
13
13
  "Development Status :: 5 - Production/Stable",
14
14
  "Programming Language :: Python",
15
15
  "Programming Language :: Python :: 3",
16
- "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.10",
17
17
  "Programming Language :: Python :: 3 :: Only",
18
18
  "Operating System :: OS Independent",
19
19
  "Intended Audience :: Developers",
@@ -26,12 +26,12 @@ include = [
26
26
  ]
27
27
 
28
28
  [tool.poetry.dependencies]
29
- python = "^3.11"
30
- http_response = "*"
31
- python-asynctools = "*"
32
- python-concurrenttools = "*"
33
- python-filewrap = "*"
34
- python-urlopen = "*"
29
+ python = "^3.10"
30
+ http_response = ">=0.0.9"
31
+ python-asynctools = ">=0.1.3"
32
+ python-concurrenttools = ">=0.1.4"
33
+ python-filewrap = "0.2.9"
34
+ python-http_request = ">=0.1.6.3"
35
35
 
36
36
  [tool.poetry.scripts]
37
37
  python-download = "download.__main__:main"
File without changes