neuroo / equip Goto Github PK
View Code? Open in Web Editor NEWPython bytecode instrumentation library
Home Page: http://equip.readthedocs.org
License: Apache License 2.0
Python bytecode instrumentation library
Home Page: http://equip.readthedocs.org
License: Apache License 2.0
It would be lovely if this library was compatible with Python 3.
Trying to log time taken by a method. So want to store the time.time() in a variable in insert_before() and print the time taken in the insert_after () as follows -
MY_BEFORE_CODE = '__t1 = time.time(); print ("PERF LOG -START-'+ meth_decl.method_name +'", t1)'
MY_AFTER_CODE = 'print ("PERF LOG -END-'+ meth_decl.method_name +'", time.time() - t1)'
rewriter.insert_before(MY_BEFORE_CODE)
rewriter.insert_after(MY_AFTER_CODE)
getting following error -
SystemError: no locals found when storing '__t1'
Any pointers?
I want to instrument every if function encountered inside a function. For example if my code hits
if x > 2:
I want to record/ print "x > 2" to the console.
Can equip help me out in this regard?
Global lambda expressions are confusing the parenting heuristic.
import foo
A = lambda x, y: x + y
def foobar():
print A(2, 3)
The above code currently produce the following decl:
-> Module
-> Method <lambda>
-> Method foobar
Hey Romain, great tool you have here, I see you must have ran into the same problems I'm running into, you wrapped it with a try: .. except Exception: :)
https://github.com/neuroo/equip/blob/master/equip/analysis/graph/dominators.py#L61
Do you have any ideas how we should fix this? I can give you a specific test-case but it's not hard to trigger it, it's caused by a JUMP_ABSOLUTE being followed by a RETURN_VALUE and nothing jumping to the JUMP_ABSOLUTE.
115(1322) LOAD_GLOBAL(116) ('something')
115(1325) LOAD_CONST(100) ('/hey/foo.html')
115(1328) CALL_FUNCTION(131) (1)
115(1331) RETURN_VALUE( 83)
115(1332) JUMP_ABSOLUTE(113) (1797) -------------> (1797)
You can't really fix it via
if b not in doms or doms[b] != new_idom:
if new_idom not in post_order_number:
logger.debug("WELL WELL WELL new_idom is %s", new_idom)
else:
doms[b] = new_idom
changed = True
because then you run into problems in __build_df.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.