Commit graph

24 commits

Author SHA1 Message Date
Ankush Menat
004990e53e
perf: Make frappe._dict great again (#28824)
* perf: Restore dict's flat overrides

Using `super()` is unnecessary cost. This class is used A LOT. Ref: https://github.com/frappe/frappe/pull/16449/

Please consider performance while adding types, it's almost always possible to achieve good typing without this.

Also `frappe._dict` is almost always used as `dict[Any, Any]` or
`dict[str, Any]`, type annotations are useless here.

* ci: ugh wait for processes to exit
2024-12-18 16:36:31 +05:30
David Arnold
6e02bfedcd
fix: add backward compatibility for 5 item filter (#28678) 2024-12-05 09:10:45 +00:00
David Arnold
75377aaaf5
refactor(typing): type filters (#28218)
* chore(typing): type filters

* chore(typing): type filters for get_list et al

* fix: dashboard chart filter expression

* test: fix case with new-style right hand object to equality check

* chore: place new typed filter under typing verification

* chore: remove debug print statment

* chore: inverse logic of type guard

* fix: add float to filter value types

* chore: clarify value naming
2024-12-04 23:18:53 +00:00
David Arnold
d3cbd2d4be
fix: type narrowing (#28673) 2024-12-04 16:58:37 +00:00
Akhil Narang
a390992408
chore: python3.13 support (#28624)
* chore: python3.13 support

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: bump pydantic

```
  error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
        = help: please check if an updated version of PyO3 is available. Current version: 0.21.2
        = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
```

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: bump uuid-utils

https://katb.in/ahaqabugefo

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: bump RestrictedPython

7.4 has support for py3.13
https://restrictedpython.readthedocs.io/en/latest/changes.html#id1

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix(deprecation_dumpster): import functools uncondtionally

Used here: 60f0b1d5c7/frappe/deprecation_dumpster.py (L177C10-L177C19)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore(docref): improve error message

* fix: error on unability to hash; TypeError expected

* fix: migrate from 3.10 onwards

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: David <dgx.arnold@gmail.com>
2024-12-04 15:35:06 +00:00
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Balamurali M
efc5f89227 chore(DF): Check can be considered bool 2024-11-08 15:31:26 +05:30
David Arnold
6574896e39
fix: don't allow hashing of unnamed documents (#28348) 2024-11-03 11:50:27 +01:00
Raffael Meyer
ce01f8ada8
fix: controller path for exporting types (#28251) 2024-10-25 03:13:28 +02:00
David Arnold
d5fd8d7c20
chore(docref): fix circular imports (#28282) 2024-10-24 22:31:12 +02:00
David Arnold
6a5466578f
chore(typing): type _dict (#28205) 2024-10-21 01:16:35 +00:00
David Arnold
f7a7cef54a
chore: split custom types into types module (#28204) 2024-10-20 23:01:36 +00:00
Akhil Narang
18961172f6
fix: we want DF.Literal[None], not DF.LiteralNone
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-13 15:57:46 +05:30
Ankush Menat
b1a8bc9312
fix: Export None as type if select as no options (#25211)
Select options can be dynamic, in that case we should at least the
default value `None` as a value `DF.Literal` otherwise is invalid type
annotation.
2024-03-04 06:42:41 +00:00
Ankush Menat
dd50cc0cf1
fix: Correct type hint (#24990)
closes https://github.com/frappe/frappe/issues/24987
2024-02-21 19:12:21 +05:30
Raffael Meyer
8c9275ba4e
fix: add blank line after auto-generated types (#23430) 2023-11-30 13:22:28 +05:30
Akhil Narang
8d91e4524f
feat(exporter): handle docfield being non-nullable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
85c3be814d
fix(exporter): some methods had the wrong return types
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-12 13:57:48 +05:30
Akhil Narang
92218e443b
chore(exporter): fix typo in method name
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-12 13:57:48 +05:30
Sagar Vora
b6b7fafe72 chore: export black-compatible types 2023-10-09 19:20:20 +05:30
Ankush Menat
8f34d6fc3e perf: docinfo
- Dont query versions if disabled
2023-09-17 14:16:47 +05:30
gavin
453690ecc0
fix(types): Exporter unconditionally marks fields as Nullable (#21997)
* fix(types): Exporter unconditionally marks fields as Nullable

* fix: correct fieldtype names

* fix: table multi-select type annotations

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-08-10 10:18:10 +05:30
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
Ankush Menat
0bc5d1dc3b feat(DX): type annotated python controllers 2023-07-24 15:32:46 +05:30