Age | Commit message (Collapse) | Author | Files | Lines |
|
This allows users to do two things, flatten potentially nested arrays
themselves, and, to safely convert types that may be an array to not an
array.
```meson
x = [meson.get_external_property('may_be_array)].flatten()
```
```meson
x = ['a', ['b', 'c']]
assert(x.flatten() == ['a', 'b', 'c'])
```
|
|
Do not call update() and Enum.__hash__ a gazillion times; operators
are the same for every instance of the class. In order to access
the class, just mark the methods using a decorator and build
METHODS later using __init_subclass__.
Non-primitive objects are not converted yet to keep the patch small.
They are created a lot less than other objects, especially strings
and booleans.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Do not call update() and Enum.__hash__ a gazillion times; operators
are the same for every instance of the class. In order to access
the class for non-trivial operators, the operators are first marked
using a decorator, and then OPERATORS is built via __init_subclass__.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Do not call update() and Enum.__hash__ a gazillion times; trivial
operators are the same for every instance of the class.
Introduce the infrastructure to build the MRO-resolved operators (so
the outcome same as if one called super().__init__) for each subclass
of InterpreterObject.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
In preparation for moving them to the class, make the operator functions
binary. Adjust the lambdas for trivial operators, and store unbound
methods for non-trivial ones.
Note that this requires adding operators manually for every override,
even subclasses. It's decidedly ugly at this temporary stage; later
it will result in just an extra @InterpreterObject.operator decorator
on the subclasses.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.
This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.
SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
|
|
These are only used for type checking, so don't bother importing them at
runtime.
Generally add future annotations at the same time, to make sure that
existing uses of these imports don't need to be quoted.
|
|
|
|
|
|
|
|
This is the final refactoring for extracting the bultin object
logic out of Interpreterbase. I decided to do both arrays and
dicts in one go since splitting it would have been a lot more
confusing.
|