|
| 1 | +""" |
| 2 | + Groundlight API |
| 3 | +
|
| 4 | + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 |
| 5 | +
|
| 6 | + The version of the OpenAPI document: 0.15.3 |
| 7 | + Contact: support@groundlight.ai |
| 8 | + Generated by: https://openapi-generator.tech |
| 9 | +""" |
| 10 | + |
| 11 | +import re # noqa: F401 |
| 12 | +import sys # noqa: F401 |
| 13 | + |
| 14 | +from groundlight_openapi_client.model_utils import ( # noqa: F401 |
| 15 | + ApiTypeError, |
| 16 | + ModelComposed, |
| 17 | + ModelNormal, |
| 18 | + ModelSimple, |
| 19 | + cached_property, |
| 20 | + change_keys_js_to_python, |
| 21 | + convert_js_args_to_python_args, |
| 22 | + date, |
| 23 | + datetime, |
| 24 | + file_type, |
| 25 | + none_type, |
| 26 | + validate_get_composed_info, |
| 27 | + OpenApiModel, |
| 28 | +) |
| 29 | +from groundlight_openapi_client.exceptions import ApiAttributeError |
| 30 | + |
| 31 | + |
| 32 | +def lazy_import(): |
| 33 | + from groundlight_openapi_client.model.blank_enum import BlankEnum |
| 34 | + from groundlight_openapi_client.model.escalation_type_enum import EscalationTypeEnum |
| 35 | + from groundlight_openapi_client.model.status_enum import StatusEnum |
| 36 | + |
| 37 | + globals()["BlankEnum"] = BlankEnum |
| 38 | + globals()["EscalationTypeEnum"] = EscalationTypeEnum |
| 39 | + globals()["StatusEnum"] = StatusEnum |
| 40 | + |
| 41 | + |
| 42 | +class DetectorRequest(ModelNormal): |
| 43 | + """NOTE: This class is auto generated by OpenAPI Generator. |
| 44 | + Ref: https://openapi-generator.tech |
| 45 | +
|
| 46 | + Do not edit the class manually. |
| 47 | +
|
| 48 | + Attributes: |
| 49 | + allowed_values (dict): The key is the tuple path to the attribute |
| 50 | + and the for var_name this is (var_name,). The value is a dict |
| 51 | + with a capitalized key describing the allowed value and an allowed |
| 52 | + value. These dicts store the allowed enum values. |
| 53 | + attribute_map (dict): The key is attribute name |
| 54 | + and the value is json key in definition. |
| 55 | + discriminator_value_class_map (dict): A dict to go from the discriminator |
| 56 | + variable value to the discriminator class name. |
| 57 | + validations (dict): The key is the tuple path to the attribute |
| 58 | + and the for var_name this is (var_name,). The value is a dict |
| 59 | + that stores validations for max_length, min_length, max_items, |
| 60 | + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, |
| 61 | + inclusive_minimum, and regex. |
| 62 | + additional_properties_type (tuple): A tuple of classes accepted |
| 63 | + as additional properties values. |
| 64 | + """ |
| 65 | + |
| 66 | + allowed_values = {} |
| 67 | + |
| 68 | + validations = { |
| 69 | + ("name",): { |
| 70 | + "max_length": 200, |
| 71 | + "min_length": 1, |
| 72 | + }, |
| 73 | + ("confidence_threshold",): { |
| 74 | + "inclusive_maximum": 1.0, |
| 75 | + "inclusive_minimum": 0.0, |
| 76 | + }, |
| 77 | + ("patience_time",): { |
| 78 | + "inclusive_maximum": 3600, |
| 79 | + "inclusive_minimum": 0, |
| 80 | + }, |
| 81 | + } |
| 82 | + |
| 83 | + @cached_property |
| 84 | + def additional_properties_type(): |
| 85 | + """ |
| 86 | + This must be a method because a model may have properties that are |
| 87 | + of type self, this must run after the class is loaded |
| 88 | + """ |
| 89 | + lazy_import() |
| 90 | + return ( |
| 91 | + bool, |
| 92 | + date, |
| 93 | + datetime, |
| 94 | + dict, |
| 95 | + float, |
| 96 | + int, |
| 97 | + list, |
| 98 | + str, |
| 99 | + none_type, |
| 100 | + ) # noqa: E501 |
| 101 | + |
| 102 | + _nullable = False |
| 103 | + |
| 104 | + @cached_property |
| 105 | + def openapi_types(): |
| 106 | + """ |
| 107 | + This must be a method because a model may have properties that are |
| 108 | + of type self, this must run after the class is loaded |
| 109 | +
|
| 110 | + Returns |
| 111 | + openapi_types (dict): The key is attribute name |
| 112 | + and the value is attribute type. |
| 113 | + """ |
| 114 | + lazy_import() |
| 115 | + return { |
| 116 | + "name": (str,), # noqa: E501 |
| 117 | + "confidence_threshold": (float,), # noqa: E501 |
| 118 | + "patience_time": (float,), # noqa: E501 |
| 119 | + "status": ( |
| 120 | + bool, |
| 121 | + date, |
| 122 | + datetime, |
| 123 | + dict, |
| 124 | + float, |
| 125 | + int, |
| 126 | + list, |
| 127 | + str, |
| 128 | + none_type, |
| 129 | + ), # noqa: E501 |
| 130 | + "escalation_type": ( |
| 131 | + bool, |
| 132 | + date, |
| 133 | + datetime, |
| 134 | + dict, |
| 135 | + float, |
| 136 | + int, |
| 137 | + list, |
| 138 | + str, |
| 139 | + none_type, |
| 140 | + ), # noqa: E501 |
| 141 | + } |
| 142 | + |
| 143 | + @cached_property |
| 144 | + def discriminator(): |
| 145 | + return None |
| 146 | + |
| 147 | + attribute_map = { |
| 148 | + "name": "name", # noqa: E501 |
| 149 | + "confidence_threshold": "confidence_threshold", # noqa: E501 |
| 150 | + "patience_time": "patience_time", # noqa: E501 |
| 151 | + "status": "status", # noqa: E501 |
| 152 | + "escalation_type": "escalation_type", # noqa: E501 |
| 153 | + } |
| 154 | + |
| 155 | + read_only_vars = {} |
| 156 | + |
| 157 | + _composed_schemas = {} |
| 158 | + |
| 159 | + @classmethod |
| 160 | + @convert_js_args_to_python_args |
| 161 | + def _from_openapi_data(cls, name, *args, **kwargs): # noqa: E501 |
| 162 | + """DetectorRequest - a model defined in OpenAPI |
| 163 | +
|
| 164 | + Args: |
| 165 | + name (str): A short, descriptive name for the detector. |
| 166 | +
|
| 167 | + Keyword Args: |
| 168 | + _check_type (bool): if True, values for parameters in openapi_types |
| 169 | + will be type checked and a TypeError will be |
| 170 | + raised if the wrong type is input. |
| 171 | + Defaults to True |
| 172 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 173 | + drill down to the model in received_data |
| 174 | + when deserializing a response |
| 175 | + _spec_property_naming (bool): True if the variable names in the input data |
| 176 | + are serialized names, as specified in the OpenAPI document. |
| 177 | + False if the variable names in the input data |
| 178 | + are pythonic names, e.g. snake case (default) |
| 179 | + _configuration (Configuration): the instance to use when |
| 180 | + deserializing a file_type parameter. |
| 181 | + If passed, type conversion is attempted |
| 182 | + If omitted no type conversion is done. |
| 183 | + _visited_composed_classes (tuple): This stores a tuple of |
| 184 | + classes that we have traveled through so that |
| 185 | + if we see that class again we will not use its |
| 186 | + discriminator again. |
| 187 | + When traveling through a discriminator, the |
| 188 | + composed schema that is |
| 189 | + is traveled through is added to this set. |
| 190 | + For example if Animal has a discriminator |
| 191 | + petType and we pass in "Dog", and the class Dog |
| 192 | + allOf includes Animal, we move through Animal |
| 193 | + once using the discriminator, and pick Dog. |
| 194 | + Then in Dog, we will make an instance of the |
| 195 | + Animal class but this time we won't travel |
| 196 | + through its discriminator because we passed in |
| 197 | + _visited_composed_classes = (Animal,) |
| 198 | + confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501 |
| 199 | + patience_time (float): How long Groundlight will attempt to generate a confident prediction. [optional] if omitted the server will use the default value of 30.0 # noqa: E501 |
| 200 | + status (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 |
| 201 | + escalation_type (bool, date, datetime, dict, float, int, list, str, none_type): Category that define internal proccess for labeling image queries * `STANDARD` - STANDARD * `NO_HUMAN_LABELING` - NO_HUMAN_LABELING. [optional] # noqa: E501 |
| 202 | + """ |
| 203 | + |
| 204 | + _check_type = kwargs.pop("_check_type", True) |
| 205 | + _spec_property_naming = kwargs.pop("_spec_property_naming", False) |
| 206 | + _path_to_item = kwargs.pop("_path_to_item", ()) |
| 207 | + _configuration = kwargs.pop("_configuration", None) |
| 208 | + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) |
| 209 | + |
| 210 | + self = super(OpenApiModel, cls).__new__(cls) |
| 211 | + |
| 212 | + if args: |
| 213 | + raise ApiTypeError( |
| 214 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." |
| 215 | + % ( |
| 216 | + args, |
| 217 | + self.__class__.__name__, |
| 218 | + ), |
| 219 | + path_to_item=_path_to_item, |
| 220 | + valid_classes=(self.__class__,), |
| 221 | + ) |
| 222 | + |
| 223 | + self._data_store = {} |
| 224 | + self._check_type = _check_type |
| 225 | + self._spec_property_naming = _spec_property_naming |
| 226 | + self._path_to_item = _path_to_item |
| 227 | + self._configuration = _configuration |
| 228 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 229 | + |
| 230 | + self.name = name |
| 231 | + for var_name, var_value in kwargs.items(): |
| 232 | + if ( |
| 233 | + var_name not in self.attribute_map |
| 234 | + and self._configuration is not None |
| 235 | + and self._configuration.discard_unknown_keys |
| 236 | + and self.additional_properties_type is None |
| 237 | + ): |
| 238 | + # discard variable. |
| 239 | + continue |
| 240 | + setattr(self, var_name, var_value) |
| 241 | + return self |
| 242 | + |
| 243 | + required_properties = set([ |
| 244 | + "_data_store", |
| 245 | + "_check_type", |
| 246 | + "_spec_property_naming", |
| 247 | + "_path_to_item", |
| 248 | + "_configuration", |
| 249 | + "_visited_composed_classes", |
| 250 | + ]) |
| 251 | + |
| 252 | + @convert_js_args_to_python_args |
| 253 | + def __init__(self, name, *args, **kwargs): # noqa: E501 |
| 254 | + """DetectorRequest - a model defined in OpenAPI |
| 255 | +
|
| 256 | + Args: |
| 257 | + name (str): A short, descriptive name for the detector. |
| 258 | +
|
| 259 | + Keyword Args: |
| 260 | + _check_type (bool): if True, values for parameters in openapi_types |
| 261 | + will be type checked and a TypeError will be |
| 262 | + raised if the wrong type is input. |
| 263 | + Defaults to True |
| 264 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 265 | + drill down to the model in received_data |
| 266 | + when deserializing a response |
| 267 | + _spec_property_naming (bool): True if the variable names in the input data |
| 268 | + are serialized names, as specified in the OpenAPI document. |
| 269 | + False if the variable names in the input data |
| 270 | + are pythonic names, e.g. snake case (default) |
| 271 | + _configuration (Configuration): the instance to use when |
| 272 | + deserializing a file_type parameter. |
| 273 | + If passed, type conversion is attempted |
| 274 | + If omitted no type conversion is done. |
| 275 | + _visited_composed_classes (tuple): This stores a tuple of |
| 276 | + classes that we have traveled through so that |
| 277 | + if we see that class again we will not use its |
| 278 | + discriminator again. |
| 279 | + When traveling through a discriminator, the |
| 280 | + composed schema that is |
| 281 | + is traveled through is added to this set. |
| 282 | + For example if Animal has a discriminator |
| 283 | + petType and we pass in "Dog", and the class Dog |
| 284 | + allOf includes Animal, we move through Animal |
| 285 | + once using the discriminator, and pick Dog. |
| 286 | + Then in Dog, we will make an instance of the |
| 287 | + Animal class but this time we won't travel |
| 288 | + through its discriminator because we passed in |
| 289 | + _visited_composed_classes = (Animal,) |
| 290 | + confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501 |
| 291 | + patience_time (float): How long Groundlight will attempt to generate a confident prediction. [optional] if omitted the server will use the default value of 30.0 # noqa: E501 |
| 292 | + status (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501 |
| 293 | + escalation_type (bool, date, datetime, dict, float, int, list, str, none_type): Category that define internal proccess for labeling image queries * `STANDARD` - STANDARD * `NO_HUMAN_LABELING` - NO_HUMAN_LABELING. [optional] # noqa: E501 |
| 294 | + """ |
| 295 | + |
| 296 | + _check_type = kwargs.pop("_check_type", True) |
| 297 | + _spec_property_naming = kwargs.pop("_spec_property_naming", False) |
| 298 | + _path_to_item = kwargs.pop("_path_to_item", ()) |
| 299 | + _configuration = kwargs.pop("_configuration", None) |
| 300 | + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) |
| 301 | + |
| 302 | + if args: |
| 303 | + raise ApiTypeError( |
| 304 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." |
| 305 | + % ( |
| 306 | + args, |
| 307 | + self.__class__.__name__, |
| 308 | + ), |
| 309 | + path_to_item=_path_to_item, |
| 310 | + valid_classes=(self.__class__,), |
| 311 | + ) |
| 312 | + |
| 313 | + self._data_store = {} |
| 314 | + self._check_type = _check_type |
| 315 | + self._spec_property_naming = _spec_property_naming |
| 316 | + self._path_to_item = _path_to_item |
| 317 | + self._configuration = _configuration |
| 318 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 319 | + |
| 320 | + self.name = name |
| 321 | + for var_name, var_value in kwargs.items(): |
| 322 | + if ( |
| 323 | + var_name not in self.attribute_map |
| 324 | + and self._configuration is not None |
| 325 | + and self._configuration.discard_unknown_keys |
| 326 | + and self.additional_properties_type is None |
| 327 | + ): |
| 328 | + # discard variable. |
| 329 | + continue |
| 330 | + setattr(self, var_name, var_value) |
| 331 | + if var_name in self.read_only_vars: |
| 332 | + raise ApiAttributeError( |
| 333 | + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " |
| 334 | + "class with read only attributes." |
| 335 | + ) |
0 commit comments