Comments (2)
I would like to add that in our API we now use venusian like this:
def step_names_and_handlers_for_category_name(self, *category_names):
handlers = []
scanner = venusian.Scanner(handlers=handlers)
if len(category_names) == 0:
category_names = None
class MockModule(object):
# This seems to be the only way to force the scanner to scan
# the actual instance instead of the class
game_run = self
delegate = self.delegate
scanner.scan(MockModule, categories=category_names)
return handlers
To scan instances of classes and venusian callbacks like this:
def callback(scanner, name, obj):
bound_method = getattr(obj, wrapped.func_name)
scanner.handlers.append(dict(step_name=step_name, handler=bound_method))
venusian.attach(wrapped, callback, category=category_name)
To get the real bound decorated methods, but it is all a bit fragile as we can't support methods under multiple names (as noted above).
from venusian.
Oh my dear this issue is old. Sorry about that. If you have any context into this still, maybe you can propose a patch? I honestly don't know how to support this particular usage.
from venusian.
Related Issues (20)
- Document how to create new directives better
- Class decorators shadow method decorators. HOT 2
- Why Venusian gives such an exception? HOT 1
- Loader error on Python 3.4 HOT 2
- AttributeError: 'Scanner' object has no attribute 'test' HOT 1
- Venusian should work with code using unicode_literals HOT 2
- It's 2017, let's get v1.1! HOT 3
- The imp module is deprecated in Python 3.6 HOT 4
- Question about multiple decorators
- Basic usage question HOT 5
- Missing git tag for 1.2.0 release HOT 1
- changelog says unreleased for 1.2.0 HOT 1
- Doctest decorator? HOT 3
- pip doesn't discover the correct python-requires. HOT 10
- Scan folders that do not contain an __init__.py HOT 5
- Resolve License issue HOT 6
- Run Black for 20.8b1 HOT 2
- Fixup new deprecations coming soon in Python 3.12
- ignore does not quite work as it should... HOT 6
- Please release 3.1.1 / 3.2.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from venusian.