Skip to content

Commit

Permalink
remove extract service (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick <[email protected]>
  • Loading branch information
pkern90 and Patrick authored Feb 7, 2024
1 parent 0061ad9 commit 33ea482
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion redact/tools/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import typer

from redact.v3 import InputType, JobArguments, OutputType, Region, ServiceType
from redact.commons.utils import setup_logging
from redact.settings import Settings
from redact.v3 import InputType, JobArguments, OutputType, Region, ServiceType
from redact.v3.tools.redact_file import redact_file as rdct_file
from redact.v3.tools.redact_folder import redact_folder as rdct_folder

Expand Down
1 change: 0 additions & 1 deletion redact/v3/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
class ServiceType(StrEnum):
blur = "blur"
dnat = "dnat"
extract = "extract"


class InputType(StrEnum):
Expand Down
1 change: 0 additions & 1 deletion redact/v4/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class ServiceType(StrEnum):
blur = "blur"
dnat = "dnat"
extract = "extract"
redact_area = "redact_area"


Expand Down
6 changes: 2 additions & 4 deletions tests/v3/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ def redact_requests(redact_url, optional_api_key) -> RedactRequests:
return RedactRequests(redact_url=redact_url, api_key=optional_api_key)


@pytest.fixture(params=[ServiceType.dnat, ServiceType.blur, ServiceType.extract])
@pytest.fixture(params=[ServiceType.dnat, ServiceType.blur])
def any_img_redact_inst(redact_url, optional_api_key, request) -> RedactInstance:
service = request.param
out_type = (
OutputType.overlays if service == ServiceType.extract else OutputType.images
)
out_type = OutputType.images
return RedactInstance.create(
service=service,
out_type=out_type,
Expand Down
8 changes: 2 additions & 6 deletions tests/v3/functional/test_redact_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from PIL import Image

from redact.errors import RedactResponseError
from redact.v3 import JobState, RedactInstance, ServiceType
from redact.v3 import JobState, RedactInstance


@pytest.mark.timeout(90)
Expand Down Expand Up @@ -36,11 +36,7 @@ def test_download_result(
)

# THEN the response has the right media type
assert (
job_result.media_type == "image/apng"
if any_img_redact_inst.service == ServiceType.extract
else job_result.media_type == "*/*"
)
assert job_result.media_type == "*/*"

# AND it has the same size as the input image
anonymized_img = Image.open(io.BytesIO(job_result.content))
Expand Down
6 changes: 2 additions & 4 deletions tests/v4/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ def redact_requests(redact_url, optional_api_key) -> RedactRequests:
return RedactRequests(redact_url=redact_url, api_key=optional_api_key)


@pytest.fixture(params=[ServiceType.dnat, ServiceType.blur, ServiceType.extract])
@pytest.fixture(params=[ServiceType.dnat, ServiceType.blur])
def any_img_redact_inst(redact_url, optional_api_key, request) -> RedactInstance:
service = request.param
out_type = (
OutputType.overlays if service == ServiceType.extract else OutputType.images
)
out_type = OutputType.images
return RedactInstance.create(
service=service,
out_type=out_type,
Expand Down
8 changes: 2 additions & 6 deletions tests/v4/functional/test_redact_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from PIL import Image

from redact.errors import RedactResponseError
from redact.v4 import JobArguments, JobState, RedactInstance, Region, ServiceType
from redact.v4 import JobArguments, JobState, RedactInstance, Region


@pytest.mark.timeout(90)
Expand Down Expand Up @@ -38,11 +38,7 @@ def test_download_result(
)

# THEN the response has the right media type
assert (
job_result.media_type == "image/apng"
if any_img_redact_inst.service == ServiceType.extract
else job_result.media_type == "*/*"
)
assert job_result.media_type == "*/*"

# AND it has the same size as the input image
anonymized_img = Image.open(io.BytesIO(job_result.content))
Expand Down

0 comments on commit 33ea482

Please sign in to comment.