koatl 0.3.13__tar.gz → 0.3.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {koatl-0.3.13 → koatl-0.3.14}/Cargo.lock +1 -1
- {koatl-0.3.13 → koatl-0.3.14}/PKG-INFO +1 -1
- {koatl-0.3.13 → koatl-0.3.14}/koatl/Cargo.toml +1 -1
- koatl-0.3.14/koatl/python/koatl/runtime/vattr.py +66 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/src/emit_py.rs +6 -0
- koatl-0.3.14/koatl/tests/parse/operators.tl +1 -0
- koatl-0.3.14/python/koatl/runtime/vattr.py +66 -0
- koatl-0.3.13/koatl/python/koatl/runtime/vattr.py +0 -67
- koatl-0.3.13/python/koatl/runtime/vattr.py +0 -67
- {koatl-0.3.13 → koatl-0.3.14}/Cargo.toml +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/README.md +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/.github/workflows/CI.yml +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/.gitignore +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/LICENSE +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/README.md +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/__main__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/cli.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/notebook/magic.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/prelude/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/runtime/record.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/async.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/base.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/do.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/env.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/memo.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/control/result.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/data/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/data/list.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/data/record.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/ext.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/io.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/iter.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/json.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/lazy_module.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/pickle.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/re.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/python/koatl/std/trait.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/requirements.txt +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/src/lib.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/arguments.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/containers.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/data.txt +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/decorators.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/destructure-for-and-fn.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/destructure.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/escape_ident.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/fstr.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/functions.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/generator.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/if_expr.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/loops.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/match.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/nary-list.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/placeholder.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/precedence.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/scopes.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/semantic_whitespace.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/short_circuit.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/base/with.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/async.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/aug_assign.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/coal.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/env.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/imports.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/iterables.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/list.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/memo.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/record.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/result.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/slice.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/try.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/prelude/virtual.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/util/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/util/module0.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/util/module1.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/e2e/util/module2.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_mixed_defaults.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_multiple_kwargs.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_multiple_kwonly_markers.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_multiple_posonly_markers.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_multiple_varargs.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_posonly_after_kwonly.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/fail-parse/arguments_vararg_and_kwonly_marker.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/arith.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/assign.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/block-comments.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/deco.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/func.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/matches.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/mutual-recursion.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/parse/numbers.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/test_e2e.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/test_parse.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl/tests/test_parse_fail.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/Cargo.toml +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/ast.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/ast_builder.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/inference.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/lib.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/lift_cst.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/main.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/py/ast.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/py/ast_builder.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/py/emit.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/py/mod.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/resolve_scopes.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/transform.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/types.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-core/src/util.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-parser/Cargo.toml +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-parser/src/cst.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-parser/src/lexer.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-parser/src/lib.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-parser/src/parser.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/koatl-parser/src/simple_fmt.rs +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/pyproject.toml +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/__main__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/cli.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/notebook/magic.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/prelude/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/runtime/record.py +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/async.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/base.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/do.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/env.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/memo.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/control/result.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/data/__init__.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/data/list.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/data/record.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/ext.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/io.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/iter.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/json.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/lazy_module.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/pickle.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/re.tl +0 -0
- {koatl-0.3.13 → koatl-0.3.14}/python/koatl/std/trait.py +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from functools import partial
|
|
2
|
+
from itertools import count
|
|
3
|
+
from koatl._rs import fast_vget
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def vget(obj, name, ignore_traits=False):
|
|
7
|
+
try:
|
|
8
|
+
return getattr(obj, name)
|
|
9
|
+
except AttributeError as e:
|
|
10
|
+
# special case for iter - this could be implemented using types and trait vtbls
|
|
11
|
+
# but this is simpler and probably faster
|
|
12
|
+
if name == "iter":
|
|
13
|
+
if isinstance(obj, slice):
|
|
14
|
+
start = obj.start if obj.start is not None else 0
|
|
15
|
+
step = obj.step if obj.step is not None else 1
|
|
16
|
+
if obj.stop is None:
|
|
17
|
+
return iter(count(start, step))
|
|
18
|
+
else:
|
|
19
|
+
return iter(range(start, obj.stop, step))
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
return iter(obj.items())
|
|
23
|
+
except AttributeError:
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
return iter(obj)
|
|
28
|
+
except TypeError:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
v = fast_vget(obj, name, ignore_traits)
|
|
32
|
+
if v is not None:
|
|
33
|
+
if hasattr(v, "_property"):
|
|
34
|
+
return v(obj)
|
|
35
|
+
|
|
36
|
+
return partial(v, obj)
|
|
37
|
+
|
|
38
|
+
e.__traceback__ = None
|
|
39
|
+
raise
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def vhas(obj, name, ignore_traits=False):
|
|
43
|
+
if hasattr(obj, name):
|
|
44
|
+
return True
|
|
45
|
+
|
|
46
|
+
if name == "iter":
|
|
47
|
+
if isinstance(obj, slice):
|
|
48
|
+
return True
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
obj.items()
|
|
52
|
+
return True
|
|
53
|
+
except AttributeError:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
iter(obj)
|
|
58
|
+
return True
|
|
59
|
+
except TypeError:
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
v = fast_vget(obj, name, ignore_traits)
|
|
63
|
+
if v is not None:
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
return False
|
|
@@ -631,6 +631,12 @@ impl<'src> PyExprExt<'src> for SPyExpr<'src> {
|
|
|
631
631
|
PyBinaryOp::FloorDiv => Some("FloorDiv"),
|
|
632
632
|
PyBinaryOp::Mod => Some("Mod"),
|
|
633
633
|
PyBinaryOp::Pow => Some("Pow"),
|
|
634
|
+
PyBinaryOp::BitAnd => Some("BitAnd"),
|
|
635
|
+
PyBinaryOp::BitOr => Some("BitOr"),
|
|
636
|
+
PyBinaryOp::BitXor => Some("BitXor"),
|
|
637
|
+
PyBinaryOp::MatMult => Some("MatMult"),
|
|
638
|
+
PyBinaryOp::LShift => Some("LShift"),
|
|
639
|
+
PyBinaryOp::RShift => Some("RShift"),
|
|
634
640
|
_ => None,
|
|
635
641
|
};
|
|
636
642
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1 >> 2 << 3 ^^ 4 // 5 && 6 ** (1 || 2 @@ -3)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from functools import partial
|
|
2
|
+
from itertools import count
|
|
3
|
+
from koatl._rs import fast_vget
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def vget(obj, name, ignore_traits=False):
|
|
7
|
+
try:
|
|
8
|
+
return getattr(obj, name)
|
|
9
|
+
except AttributeError as e:
|
|
10
|
+
# special case for iter - this could be implemented using types and trait vtbls
|
|
11
|
+
# but this is simpler and probably faster
|
|
12
|
+
if name == "iter":
|
|
13
|
+
if isinstance(obj, slice):
|
|
14
|
+
start = obj.start if obj.start is not None else 0
|
|
15
|
+
step = obj.step if obj.step is not None else 1
|
|
16
|
+
if obj.stop is None:
|
|
17
|
+
return iter(count(start, step))
|
|
18
|
+
else:
|
|
19
|
+
return iter(range(start, obj.stop, step))
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
return iter(obj.items())
|
|
23
|
+
except AttributeError:
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
return iter(obj)
|
|
28
|
+
except TypeError:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
v = fast_vget(obj, name, ignore_traits)
|
|
32
|
+
if v is not None:
|
|
33
|
+
if hasattr(v, "_property"):
|
|
34
|
+
return v(obj)
|
|
35
|
+
|
|
36
|
+
return partial(v, obj)
|
|
37
|
+
|
|
38
|
+
e.__traceback__ = None
|
|
39
|
+
raise
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def vhas(obj, name, ignore_traits=False):
|
|
43
|
+
if hasattr(obj, name):
|
|
44
|
+
return True
|
|
45
|
+
|
|
46
|
+
if name == "iter":
|
|
47
|
+
if isinstance(obj, slice):
|
|
48
|
+
return True
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
obj.items()
|
|
52
|
+
return True
|
|
53
|
+
except AttributeError:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
iter(obj)
|
|
58
|
+
return True
|
|
59
|
+
except TypeError:
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
v = fast_vget(obj, name, ignore_traits)
|
|
63
|
+
if v is not None:
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
return False
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from functools import partial
|
|
2
|
-
from itertools import count
|
|
3
|
-
from koatl._rs import fast_vget
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def vget(obj, name, ignore_traits=False):
|
|
7
|
-
try:
|
|
8
|
-
return getattr(obj, name)
|
|
9
|
-
except AttributeError as e:
|
|
10
|
-
orig_err = e
|
|
11
|
-
|
|
12
|
-
# special case for iter - this could be implemented using types and trait vtbls
|
|
13
|
-
# but this is simpler and probably faster
|
|
14
|
-
if name == "iter":
|
|
15
|
-
if isinstance(obj, slice):
|
|
16
|
-
start = obj.start if obj.start is not None else 0
|
|
17
|
-
step = obj.step if obj.step is not None else 1
|
|
18
|
-
if obj.stop is None:
|
|
19
|
-
return iter(count(start, step))
|
|
20
|
-
else:
|
|
21
|
-
return iter(range(start, obj.stop, step))
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
return iter(obj.items())
|
|
25
|
-
except AttributeError:
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
try:
|
|
29
|
-
return iter(obj)
|
|
30
|
-
except TypeError:
|
|
31
|
-
pass
|
|
32
|
-
|
|
33
|
-
v = fast_vget(obj, name, ignore_traits)
|
|
34
|
-
if v is not None:
|
|
35
|
-
if hasattr(v, "_property"):
|
|
36
|
-
return v(obj)
|
|
37
|
-
|
|
38
|
-
return partial(v, obj)
|
|
39
|
-
|
|
40
|
-
raise orig_err
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def vhas(obj, name, ignore_traits=False):
|
|
44
|
-
if hasattr(obj, name):
|
|
45
|
-
return True
|
|
46
|
-
|
|
47
|
-
if name == "iter":
|
|
48
|
-
if isinstance(obj, slice):
|
|
49
|
-
return True
|
|
50
|
-
|
|
51
|
-
try:
|
|
52
|
-
obj.items()
|
|
53
|
-
return True
|
|
54
|
-
except AttributeError:
|
|
55
|
-
pass
|
|
56
|
-
|
|
57
|
-
try:
|
|
58
|
-
iter(obj)
|
|
59
|
-
return True
|
|
60
|
-
except TypeError:
|
|
61
|
-
pass
|
|
62
|
-
|
|
63
|
-
v = fast_vget(obj, name, ignore_traits)
|
|
64
|
-
if v is not None:
|
|
65
|
-
return True
|
|
66
|
-
|
|
67
|
-
return False
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from functools import partial
|
|
2
|
-
from itertools import count
|
|
3
|
-
from koatl._rs import fast_vget
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def vget(obj, name, ignore_traits=False):
|
|
7
|
-
try:
|
|
8
|
-
return getattr(obj, name)
|
|
9
|
-
except AttributeError as e:
|
|
10
|
-
orig_err = e
|
|
11
|
-
|
|
12
|
-
# special case for iter - this could be implemented using types and trait vtbls
|
|
13
|
-
# but this is simpler and probably faster
|
|
14
|
-
if name == "iter":
|
|
15
|
-
if isinstance(obj, slice):
|
|
16
|
-
start = obj.start if obj.start is not None else 0
|
|
17
|
-
step = obj.step if obj.step is not None else 1
|
|
18
|
-
if obj.stop is None:
|
|
19
|
-
return iter(count(start, step))
|
|
20
|
-
else:
|
|
21
|
-
return iter(range(start, obj.stop, step))
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
return iter(obj.items())
|
|
25
|
-
except AttributeError:
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
try:
|
|
29
|
-
return iter(obj)
|
|
30
|
-
except TypeError:
|
|
31
|
-
pass
|
|
32
|
-
|
|
33
|
-
v = fast_vget(obj, name, ignore_traits)
|
|
34
|
-
if v is not None:
|
|
35
|
-
if hasattr(v, "_property"):
|
|
36
|
-
return v(obj)
|
|
37
|
-
|
|
38
|
-
return partial(v, obj)
|
|
39
|
-
|
|
40
|
-
raise orig_err
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def vhas(obj, name, ignore_traits=False):
|
|
44
|
-
if hasattr(obj, name):
|
|
45
|
-
return True
|
|
46
|
-
|
|
47
|
-
if name == "iter":
|
|
48
|
-
if isinstance(obj, slice):
|
|
49
|
-
return True
|
|
50
|
-
|
|
51
|
-
try:
|
|
52
|
-
obj.items()
|
|
53
|
-
return True
|
|
54
|
-
except AttributeError:
|
|
55
|
-
pass
|
|
56
|
-
|
|
57
|
-
try:
|
|
58
|
-
iter(obj)
|
|
59
|
-
return True
|
|
60
|
-
except TypeError:
|
|
61
|
-
pass
|
|
62
|
-
|
|
63
|
-
v = fast_vget(obj, name, ignore_traits)
|
|
64
|
-
if v is not None:
|
|
65
|
-
return True
|
|
66
|
-
|
|
67
|
-
return False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|