class_docstr: Imposes an optional maximum filesize limit for uploaded files
class_docstr_tok: ["Imposes","an","optional","maximum","filesize","limit","for","uploaded","files"]
code: def __call__(self, form: dict[str, Any], field: Any) -> None:
      if self.max_size is None:
          return
  
      field.data.flush()
      size = os.fstat(field.data.fileno()).st_size
      if size > self.max_size:
          raise ValidationError(
              _(
                  "File size must be less than or equal to %(max_size)s bytes",
                  max_size=self.max_size,
              )
          )
  
file_path: superset/superset/forms.py
imports: import json
  import os
  from typing import Any, Optional
  from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
  from flask_babel import gettext
  from wtforms import Field, ValidationError
label_desc: Use image node_id 2 for calling the FileSizeLimit obj's underlying member method code with example usage: obj.__call__(form, field) without return types