* build!: Remove pycryptodome dependencies
This is added for payments app, shouldn't be added here.
ref: https://github.com/frappe/frappe/pull/9955/
* build(deps): update many python dependencies
test: change code to adapt to new werkzeug client
fix: avoid setting charset
utf8 is default and assumed now by werkzeug, setting this manually is
deprecated.
fix: use string instead of bytes for setting headers
DeprecationWarning: Passing bytes as a header value is deprecated and will not be supported in Werkzeug 3.0.
12:23:34 web.1 | response.headers["X-Page-Name"] = path.encode("ascii", errors="xmlcharrefreplace")
* refactor: replace `imaghdr` with `filetype`
```
11:52:06 worker.1 | /home/ankush/benches/develop/apps/frappe/frappe/core/doctype/file/utils.py:2: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
```
* feat: improved extension guessing using filecontent
```
File "/home/ankush/benches/develop/apps/frappe/frappe/database/database.py", line 920, in get_default
d = self.get_defaults(key, parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/database/database.py", line 936, in get_defaults
defaults = frappe.defaults.get_defaults_for(parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/defaults.py", line 222, in get_defaults_for
.run(as_dict=True)
^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/query_builder/utils.py", line 85, in execute_query
return frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/database/database.py", line 264, in sql
self.log_query(query, values, debug, explain)
File "/home/ankush/benches/develop/apps/frappe/frappe/database/mariadb/database.py", line 203, in log_query
self.last_query = query = self._cursor._last_executed
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Cursor' object has no attribute '_last_executed'. Did you mean: '_check_executed'?
```
We depend on it for escaping. Currently this works because of indirect
dependencies:
```
λ pipdeptree -p MarkupSafe --reverse
MarkupSafe==2.1.1
- Jinja2==3.1.2 [requires: MarkupSafe>=2.0]
- frappe==15.0.0.dev0 [requires: Jinja2~=3.1.2]
- Werkzeug==2.2.2 [requires: MarkupSafe>=2.1.1]
- frappe==15.0.0.dev0 [requires: Werkzeug~=2.2.2]
```
[skip ci]
- Switch to Pydantic which is under continuous development and can
support more types
- Equivalent Pydantic API will try to transform data if possible
- The previous point makes it such that we don't need to explicitly try
to parse each stringified int in app code since Pydantic can do this
- Drop typeguard since it did not handle 3.10+ native typing definitions
- Run type validations if annotations exist for whitelisted functions
- Run validations only on function calls in presense of frappe.local.request
In action:
```bash
> curl -H 'Content-Type: application/json' 'http://photos:8000/api/method/frappe.handler.download_file' -d '{"file_url": ["!=", "gavin.jpg"]}'
```
Note: This ignores stringified or ForwardRef types. If you want types to
be validated make sure they are not imported under `if TYPE_CHECKING`
blocks