Skip to content

Commit 9288dc1

Browse files
committed
Add "tuple" as an alias for Sequence in isinstance function.
1 parent 330e154 commit 9288dc1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

docs/functions.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ isinstance(obj: object, t: str) -> bool
2424

2525
Return `True` if the type of _obj_ matches _t_. This function allows _t_ to be one of several aliases for the real Python "type". Some of these aliases follow JavaScript/JSON semantics.
2626

27-
| type | aliases |
28-
| --------------------- | ----------------------------- |
29-
| UNDEFINED | "undefined" |
30-
| None | "null", "nil", "None", "none" |
31-
| str | "str", "string" |
32-
| Sequence (array-like) | "array", "list", "sequence" |
33-
| Mapping (dict-like) | "object", "dict", "mapping" |
34-
| bool | "bool", "boolean" |
35-
| int | "number", "int" |
36-
| float | "number", "float" |
27+
| type | aliases |
28+
| --------------------- | ------------------------------------ |
29+
| UNDEFINED | "undefined" |
30+
| None | "null", "nil", "None", "none" |
31+
| str | "str", "string" |
32+
| Sequence (array-like) | "array", "list", "sequence", "tuple" |
33+
| Mapping (dict-like) | "object", "dict", "mapping" |
34+
| bool | "bool", "boolean" |
35+
| int | "number", "int" |
36+
| float | "number", "float" |
3737

3838
For example :
3939

jsonpath/function_extensions/is_instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __call__(self, obj: object, t: str) -> bool: # noqa: PLR0911
2323
if isinstance(obj, str):
2424
return t in ("str", "string")
2525
if isinstance(obj, Sequence):
26-
return t in ("array", "list", "sequence")
26+
return t in ("array", "list", "sequence", "tuple")
2727
if isinstance(obj, Mapping):
2828
return t in ("object", "dict", "mapping")
2929
if isinstance(obj, bool):

0 commit comments

Comments
 (0)