Commit Graph

18 Commits

Author SHA1 Message Date
Adam Dangoor
55b552121b Fix type of Docker BuildError.build_log (#11917)
In working this out I also had a go at changing the json_stream
functions used to create every BuildError in docker-py.

There are two `BuildError`s raised in docker-py, both in
b6464dbed9/docker/models/images.py (L304-L315)

```python
result_stream, internal_stream = itertools.tee(json_stream(resp))
for chunk in internal_stream:
    if 'error' in chunk:
	raise BuildError(chunk['error'], result_stream)
    if 'stream' in chunk:
	match = re.search(
	    r'(^Successfully built |sha256:)([0-9a-f]+)$',
	    chunk['stream']
	)
	if match:
	    image_id = match.group(2)
    last_event = chunk
if image_id:
    return (self.get(image_id), result_stream)
raise BuildError(last_event or 'Unknown', result_stream)
```
2024-05-18 08:26:17 -04:00
Adam Dangoor
a9d7e861f7 Add a number of types to docker.models.containers (#11912) 2024-05-14 11:15:32 +02:00
Adam Dangoor
0382803c4c Add many types to docker.api.container (#11911) 2024-05-12 13:58:56 -07:00
Adam Dangoor
a4c4076b61 Add types to all "container" parameters in docker.api.container (#11908) 2024-05-12 18:07:48 +02:00
Adam Dangoor
96697a835b Add remaining parameter types to docker.api.container logs (#11907) 2024-05-12 17:12:32 +02:00
Adam Dangoor
932311d441 Add return type to Docker Container.logs (#11888) 2024-05-12 13:39:18 +02:00
Adam Dangoor
488bc24c43 Add return type for Docker container start (#11905) 2024-05-12 13:37:00 +02:00
Adam Dangoor
bbad7f2f24 Fix "tail" parameter type for Docker container logs (#11906) 2024-05-12 13:09:47 +02:00
Adam Dangoor
f75211b801 Allow Image type for docker container run image parameter (#11900) 2024-05-12 12:14:06 +02:00
Adam Dangoor
9174db0d7d Add some types to Docker ContainerCollection parameters (#11857) 2024-05-10 10:08:47 +02:00
Adam Dangoor
727f3c4320 Add return type to Docker Container.stop (#11869)
We can see at
b6464dbed9/docker/models/containers.py (L452)
that this returns the return value of `self.client.api.stop`.

We can see at
b6464dbed9/docker/api/container.py (L1187)
that this returns None.
2024-05-06 11:05:43 +02:00
Adam Dangoor
113b2ccd42 Add return type to Docker Container.remove (#11868) 2024-05-06 11:01:55 +02:00
kasium
4005c2f214 Improve types in docker models (#11859) 2024-05-05 12:32:37 +02:00
Adam Dangoor
5883898b0a [docker-py] Add return type for building a Docker image (#11851) 2024-05-02 10:08:32 +02:00
kasium
f244be921e Improve docker api types (#11846) 2024-04-30 13:43:08 +02:00
kasium
78a86de5d9 Add types to docker/context (#11818) 2024-04-29 14:27:55 +02:00
kasium
312dfe5791 Fully type docker/api/build (#11789) 2024-04-23 08:34:19 +02:00
kasium
bc8fc36739 Add docker-py stubs (#11749) 2024-04-12 15:30:36 +02:00