Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ regula/documentreader/webclient/gen/models/fiber_result.py
regula/documentreader/webclient/gen/models/field_item.py
regula/documentreader/webclient/gen/models/file_image.py
regula/documentreader/webclient/gen/models/get_transactions_by_tag_response.py
regula/documentreader/webclient/gen/models/glares_check_params.py
regula/documentreader/webclient/gen/models/graph_data.py
regula/documentreader/webclient/gen/models/graphic_field.py
regula/documentreader/webclient/gen/models/graphic_field_type.py
Expand Down
3 changes: 3 additions & 0 deletions regula/documentreader/webclient/gen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"FieldItem",
"FileImage",
"GetTransactionsByTagResponse",
"GlaresCheckParams",
"GraphData",
"GraphicField",
"GraphicFieldType",
Expand Down Expand Up @@ -339,6 +340,7 @@
from regula.documentreader.webclient.gen.models.field_item import FieldItem as FieldItem
from regula.documentreader.webclient.gen.models.file_image import FileImage as FileImage
from regula.documentreader.webclient.gen.models.get_transactions_by_tag_response import GetTransactionsByTagResponse as GetTransactionsByTagResponse
from regula.documentreader.webclient.gen.models.glares_check_params import GlaresCheckParams as GlaresCheckParams
from regula.documentreader.webclient.gen.models.graph_data import GraphData as GraphData
from regula.documentreader.webclient.gen.models.graphic_field import GraphicField as GraphicField
from regula.documentreader.webclient.gen.models.graphic_field_type import GraphicFieldType as GraphicFieldType
Expand Down Expand Up @@ -592,6 +594,7 @@
from regula.documentreader.webclient.gen.models.field_item import FieldItem as FieldItem
from regula.documentreader.webclient.gen.models.file_image import FileImage as FileImage
from regula.documentreader.webclient.gen.models.get_transactions_by_tag_response import GetTransactionsByTagResponse as GetTransactionsByTagResponse
from regula.documentreader.webclient.gen.models.glares_check_params import GlaresCheckParams as GlaresCheckParams
from regula.documentreader.webclient.gen.models.graph_data import GraphData as GraphData
from regula.documentreader.webclient.gen.models.graphic_field import GraphicField as GraphicField
from regula.documentreader.webclient.gen.models.graphic_field_type import GraphicFieldType as GraphicFieldType
Expand Down
2 changes: 2 additions & 0 deletions regula/documentreader/webclient/gen/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
from regula.documentreader.webclient.gen.models.field_item import FieldItem
from regula.documentreader.webclient.gen.models.file_image import FileImage
from regula.documentreader.webclient.gen.models.get_transactions_by_tag_response import GetTransactionsByTagResponse
from regula.documentreader.webclient.gen.models.glares_check_params import GlaresCheckParams
from regula.documentreader.webclient.gen.models.graph_data import GraphData
from regula.documentreader.webclient.gen.models.graphic_field import GraphicField
from regula.documentreader.webclient.gen.models.graphic_field_type import GraphicFieldType
Expand Down Expand Up @@ -312,6 +313,7 @@
from regula.documentreader.webclient.gen.models.field_item import FieldItem
from regula.documentreader.webclient.gen.models.file_image import FileImage
from regula.documentreader.webclient.gen.models.get_transactions_by_tag_response import GetTransactionsByTagResponse
from regula.documentreader.webclient.gen.models.glares_check_params import GlaresCheckParams
from regula.documentreader.webclient.gen.models.graph_data import GraphData
from regula.documentreader.webclient.gen.models.graphic_field import GraphicField
from regula.documentreader.webclient.gen.models.graphic_field_type import GraphicFieldType
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# coding: utf-8

"""
Generated by: https://openapi-generator.tech
"""

from __future__ import annotations
import pprint
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
from pydantic import SkipValidation, Field

class GlaresCheckParams(BaseModel):
"""
GlaresCheckParams
""" # noqa: E501
img_margin_part: SkipValidation[Optional[float]] = Field(alias="imgMarginPart", default=None, description="Margin from the edges of the image. 0.35 = 35%")
max_glaring_part: SkipValidation[Optional[float]] = Field(alias="maxGlaringPart", default=None, description="The maximum allowable part of the area occupied by the glare. The same: 0.06 = 6%")
__properties: ClassVar[List[str]] = ["imgMarginPart", "maxGlaringPart"]

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
arbitrary_types_allowed=True,
use_enum_values=True
)


def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of GlaresCheckParams from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:

* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of GlaresCheckParams from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({
"imgMarginPart": obj.get("imgMarginPart"),
"maxGlaringPart": obj.get("maxGlaringPart")
})
return _obj


10 changes: 8 additions & 2 deletions regula/documentreader/webclient/gen/models/image_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from regula.documentreader.webclient.gen.models.glares_check_params import GlaresCheckParams
from regula.documentreader.webclient.gen.models.input_image_quality_checks import InputImageQualityChecks
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -29,7 +30,8 @@ class ImageQA(BaseModel):
moire_check: SkipValidation[Optional[bool]] = Field(alias="moireCheck", default=None, description="This option enables screen capture (moire patterns) check while performing image quality validation.")
document_position_indent: SkipValidation[Optional[int]] = Field(alias="documentPositionIndent", default=None, description="This parameter specifies the necessary margin. Default 0.")
expected_pass: SkipValidation[Optional[List[InputImageQualityChecks]]] = Field(alias="expectedPass", default=None, description="This parameter controls the quality checks that the image should pass to be considered a valid input during the scanning process.")
__properties: ClassVar[List[str]] = ["brightnessThreshold", "dpiThreshold", "angleThreshold", "focusCheck", "glaresCheck", "colornessCheck", "moireCheck", "documentPositionIndent", "expectedPass"]
glares_check_params: SkipValidation[Optional[GlaresCheckParams]] = Field(alias="glaresCheckParams", default=None)
__properties: ClassVar[List[str]] = ["brightnessThreshold", "dpiThreshold", "angleThreshold", "focusCheck", "glaresCheck", "colornessCheck", "moireCheck", "documentPositionIndent", "expectedPass", "glaresCheckParams"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -72,6 +74,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of glares_check_params
if self.glares_check_params:
_dict['glaresCheckParams'] = self.glares_check_params.to_dict()
return _dict

@classmethod
Expand All @@ -92,7 +97,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"colornessCheck": obj.get("colornessCheck"),
"moireCheck": obj.get("moireCheck"),
"documentPositionIndent": obj.get("documentPositionIndent"),
"expectedPass": obj.get("expectedPass")
"expectedPass": obj.get("expectedPass"),
"glaresCheckParams": GlaresCheckParams.from_dict(obj["glaresCheckParams"]) if obj.get("glaresCheckParams") is not None else None
})
return _obj

Expand Down