Skip to content

Commit edb42ac

Browse files
Fix some spelling issues in the readme
1 parent 1ec9d01 commit edb42ac

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ aexpr(lambda: tmp.method())
9494
The dependencies are `self.f` and `self.g` (from object `tmp`).
9595
To be able to monitor the dependencies of the expression, we have to find them first.
9696

97-
## Step 1: Find the dependencies
97+
### Step 1: Find the dependencies
9898

9999
Therefore this library performs a static byte-code analysis of the expression and all nested methods.
100100
It converts the binary byte-code of the expression and all nested methods with the library [`dis`](https://docs.python.org/2/library/dis.html).
101-
Afterwards it simulates an object-stack and an own variable mapping and processes all byte-code instruction itself.
101+
Afterwards it simulates an object-stack and an own variable mapping and processes all byte-code instructions itself.
102102

103103
**Short Example** (the complete one is in the [presentation](https://github.com/active-expressions/active-expressions-static-python/blob/master/presentation/presentation.pdf)):
104104
```
@@ -122,10 +122,10 @@ An addition for example only takes two elements from the object stack and pushes
122122
A multiplication does the same.
123123
Thats the reason why all elements on our own object stack are wrapped in an [ObjectWrapper](https://github.com/active-expressions/active-expressions-static-python/blob/master/aexpr/aexpr.py#L29), which can be an real object or a placeholder.
124124

125-
## Step 2: Monitor the dependencies
125+
### Step 2: Monitor the dependencies
126126

127127
When we found the dependencies we have to monitor them to be able to trigger if something changes.
128-
For all dependencies (attribute of a object) we modify the `__setattr__`-method of the object, which will be called when setting a attribute of that object.
128+
For all dependencies (fields of a object) we modify the `__setattr__`-method of the object, which will be called when setting a attribute of that object.
129129
We install a hook in that `__setattr__`-method which checks if we monitor that specific attribute and calls all triggers if so.
130130
The [method `placeaexpr`](https://github.com/active-expressions/active-expressions-static-python/blob/master/aexpr/aexpr.py#L46) installs these hooks.
131131

@@ -144,22 +144,23 @@ The full example for this analysis is shown in the [presentation](https://github
144144

145145
This library has the few following limitations. Feel free to contribute and fix these limitations:
146146

147-
- **Lists, Sets, Maps:** Datastructures are not supported so far. Means if you store a dependency in a list and access the an attribute later, you can not monitor on that attribute.
147+
- **Lists, Sets, Maps:** Datastructures are not supported so far. Means if you store a dependency in a list and access an attribute later, you can not monitor on that attribute.
148148
- **Local Variables:** Local Variables are not instrumentable since they do not have a `__setattr__` or something else. Only fields of objects are instrumentable.
149149
- **External Resources:** Monitoring if a server is available or a file exists would require to poll this information repeatedly. This is not supported.
150150
- **Transactions:** Each time a dependency changes all triggers are triggered. Its not possible to pause this to change more attributes at once.
151-
- **Other language features:** Not supported are for examples *exceptions* and *closures*; *concurreny*, *asynchrony* and *meta-programming* can cause issues as well.
151+
- **Other language features:** Not supported are for examples *exceptions* and *closures*; *concurrency*, *asynchrony* and *meta-programming* can cause issues as well.
152152

153153
You can find some code examples for some of them in the [presentation](https://github.com/active-expressions/active-expressions-static-python/blob/master/presentation/presentation.pdf).
154154

155155
## Contribution
156156

157157
If you have some complex expression to monitor it can happen that you get an `UnimplementedInstructionException`.
158-
This means that you try to perform an instruction which is not so far supported.
158+
This means that you try to process an instruction which is so far not supported.
159159
Afterwards you see the unsupported byte-code-instruction.
160-
Feel free to create pull request to this repository to support that instruction.
160+
Feel free to create pull requests to this repository to support unknown instructions.
161161

162162
To support a new instruction you have to modify the content of the `aexpr`-method.
163163
Call the method `opcode` once with the new supported op-codes of the instruction and call the result with a method which performs the required actions.
164164
Therefore you get the instruction, the rest of the instruction queue, the object stack and the variable mapping as parameters.
165165
There are already a lot of examples for this in this method.
166+
You can find an overview over all opcodes [here](http://unpyc.sourceforge.net/Opcodes.html).

0 commit comments

Comments
 (0)