# pydantic 2.14.2 (MIT), harvested by tools/harvest_corpus.py
=== input

    !!! warning "Discouraged"
        This function is **discouraged** in favor of using
        [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
        [`Field`][pydantic.fields.Field] instead.

        This function will be **deprecated** in Pydantic 3.0.

        The reason is that `condecimal` returns a type, which doesn't play well with static analysis tools.

        === ":x: Don't do this"
            ```python
            from pydantic import BaseModel, condecimal

            class Foo(BaseModel):
                bar: condecimal(strict=True, allow_inf_nan=True)
            ```

        === ":white_check_mark: Do this"
            ```python
            from decimal import Decimal
            from typing import Annotated

            from pydantic import BaseModel, Field

            class Foo(BaseModel):
                bar: Annotated[Decimal, Field(strict=True, allow_inf_nan=True)]
            ```

    A wrapper around Decimal that adds validation.

    Args:
        strict: Whether to validate the value in strict mode. Defaults to `None`.
        gt: The value must be greater than this. Defaults to `None`.
        ge: The value must be greater than or equal to this. Defaults to `None`.
        lt: The value must be less than this. Defaults to `None`.
        le: The value must be less than or equal to this. Defaults to `None`.
        multiple_of: The value must be a multiple of this. Defaults to `None`.
        max_digits: The maximum number of digits. Defaults to `None`.
        decimal_places: The number of decimal places. Defaults to `None`.
        allow_inf_nan: Whether to allow infinity and NaN. Defaults to `None`.

    ```python
    from decimal import Decimal

    from pydantic import BaseModel, ValidationError, condecimal

    class ConstrainedExample(BaseModel):
        constrained_decimal: condecimal(gt=Decimal('1.0'))

    m = ConstrainedExample(constrained_decimal=Decimal('1.1'))
    print(repr(m))
    #> ConstrainedExample(constrained_decimal=Decimal('1.1'))

    try:
        ConstrainedExample(constrained_decimal=Decimal('0.9'))
    except ValidationError as e:
        print(e.errors())
        '''
        [
            {
                'type': 'greater_than',
                'loc': ('constrained_decimal',),
                'msg': 'Input should be greater than 1.0',
                'input': Decimal('0.9'),
                'ctx': {'gt': Decimal('1.0')},
                'url': 'https://errors.pydantic.dev/2/v/greater_than',
            }
        ]
        '''
    ```
    
=== parse google
short_description: '!!! warning "Discouraged"'
long_description: |
      This function is **discouraged** in favor of using
      [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
      [`Field`][pydantic.fields.Field] instead.
  
      This function will be **deprecated** in Pydantic 3.0.
  
      The reason is that `condecimal` returns a type, which doesn't play well with static analysis tools.
  
      === ":x: Don't do this"
          ```python
          from pydantic import BaseModel, condecimal
  
          class Foo(BaseModel):
              bar: condecimal(strict=True, allow_inf_nan=True)
          ```
  
      === ":white_check_mark: Do this"
          ```python
          from decimal import Decimal
          from typing import Annotated
  
          from pydantic import BaseModel, Field
  
          class Foo(BaseModel):
              bar: Annotated[Decimal, Field(strict=True, allow_inf_nan=True)]
          ```
  
  A wrapper around Decimal that adds validation.
  
  ```python
  from decimal import Decimal
  
  from pydantic import BaseModel, ValidationError, condecimal
  
  class ConstrainedExample(BaseModel):
      constrained_decimal: condecimal(gt=Decimal('1.0'))
  
  m = ConstrainedExample(constrained_decimal=Decimal('1.1'))
  print(repr(m))
  #> ConstrainedExample(constrained_decimal=Decimal('1.1'))
  
  try:
      ConstrainedExample(constrained_decimal=Decimal('0.9'))
  except ValidationError as e:
      print(e.errors())
      '''
      [
          {
              'type': 'greater_than',
              'loc': ('constrained_decimal',),
              'msg': 'Input should be greater than 1.0',
              'input': Decimal('0.9'),
              'ctx': {'gt': Decimal('1.0')},
              'url': 'https://errors.pydantic.dev/2/v/greater_than',
          }
      ]
      '''
  ```
blank_after_short_description: True
blank_after_long_description: True
style: google
- DocstringParam
  description: 'Whether to validate the value in strict mode. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'strict'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The value must be greater than this. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'gt'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The value must be greater than or equal to this. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'ge'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The value must be less than this. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'lt'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The value must be less than or equal to this. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'le'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The value must be a multiple of this. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'multiple_of'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The maximum number of digits. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'max_digits'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'The number of decimal places. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'decimal_places'
  is_optional: True
  default: 'None'
- DocstringParam
  description: 'Whether to allow infinity and NaN. Defaults to `None`.'
  kind: param
  key: 'param'
  arg_name: 'allow_inf_nan'
  is_optional: True
  default: 'None'
=== detect
google
=== compose google
!!! warning "Discouraged"

    This function is **discouraged** in favor of using
    [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
    [`Field`][pydantic.fields.Field] instead.

    This function will be **deprecated** in Pydantic 3.0.

    The reason is that `condecimal` returns a type, which doesn't play well with static analysis tools.

    === ":x: Don't do this"
        ```python
        from pydantic import BaseModel, condecimal

        class Foo(BaseModel):
            bar: condecimal(strict=True, allow_inf_nan=True)
        ```

    === ":white_check_mark: Do this"
        ```python
        from decimal import Decimal
        from typing import Annotated

        from pydantic import BaseModel, Field

        class Foo(BaseModel):
            bar: Annotated[Decimal, Field(strict=True, allow_inf_nan=True)]
        ```

A wrapper around Decimal that adds validation.

```python
from decimal import Decimal

from pydantic import BaseModel, ValidationError, condecimal

class ConstrainedExample(BaseModel):
    constrained_decimal: condecimal(gt=Decimal('1.0'))

m = ConstrainedExample(constrained_decimal=Decimal('1.1'))
print(repr(m))
#> ConstrainedExample(constrained_decimal=Decimal('1.1'))

try:
    ConstrainedExample(constrained_decimal=Decimal('0.9'))
except ValidationError as e:
    print(e.errors())
    '''
    [
        {
            'type': 'greater_than',
            'loc': ('constrained_decimal',),
            'msg': 'Input should be greater than 1.0',
            'input': Decimal('0.9'),
            'ctx': {'gt': Decimal('1.0')},
            'url': 'https://errors.pydantic.dev/2/v/greater_than',
        }
    ]
    '''
```

Args:
    strict: Whether to validate the value in strict mode. Defaults to `None`.
    gt: The value must be greater than this. Defaults to `None`.
    ge: The value must be greater than or equal to this. Defaults to `None`.
    lt: The value must be less than this. Defaults to `None`.
    le: The value must be less than or equal to this. Defaults to `None`.
    multiple_of: The value must be a multiple of this. Defaults to `None`.
    max_digits: The maximum number of digits. Defaults to `None`.
    decimal_places: The number of decimal places. Defaults to `None`.
    allow_inf_nan: Whether to allow infinity and NaN. Defaults to `None`.
