Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files

One less function call.

One less function call when calling any rule in fmn.rules.  They almost all
have an ``@hint(...)`` decorator attached to them, which meant that
(unnecessarily) they all had one extra function call executed every time you
called them.

This cuts that out, and so should make everything *slightly* faster.
  • Loading branch information...
ralphbean committed Jun 21, 2016
1 parent ee2217b commit b4edbe1c6fcb700718f4278ae8e830c0fc8ac12e
Showing with 7 additions and 14 deletions.
  1. +7 −13 fmn/lib/
  2. +0 −1
@@ -15,7 +15,6 @@

import collections
import decorator

import fedmsg.config

@@ -26,19 +25,14 @@
def hint(invertible=True, callable=None, **hints):
""" A decorator that can optionally hang datanommer hints on a rule. """

def wrapper(fn, *args, **kwargs):
return fn(*args, **kwargs)
def wrapper(fn):
# Hang hints on fn.
fn.hints = hints
fn.hinting_invertible = invertible
fn.hinting_callable = callable
return fn

def wrapper_wrapper(fn):
wrapped = wrapper(fn)
# Hang hints on the wrapped function.
wrapped.hints = hints
wrapped.hinting_invertible = invertible
wrapped.hinting_callable = callable
return wrapped

return wrapper_wrapper
return wrapper

def prefixed(topic, prefix='org.fedoraproject'):
@@ -25,7 +25,6 @@ def get_description():

0 comments on commit b4edbe1

Please sign in to comment.
You can’t perform that action at this time.