From fc47a49587f1af6ea0db0804be2d984042486cd2 Mon Sep 17 00:00:00 2001 From: int3l Date: Sat, 23 Apr 2016 03:24:29 +0300 Subject: import/docstring adjustments in decorator module --- pyramid/decorator.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pyramid/decorator.py b/pyramid/decorator.py index df30c5e10..890bd3461 100644 --- a/pyramid/decorator.py +++ b/pyramid/decorator.py @@ -1,4 +1,4 @@ -import functools +from functools import update_wrapper class reify(object): @@ -19,17 +19,22 @@ class reify(object): And usage of Foo: >>> f = Foo() - >>> v = f.jammy + >>> print(f.jammy) 'jammy called' - >>> print(v) 1 - >>> f.jammy + >>> print(f.jammy) 1 >>> # jammy func not called the second time; it replaced itself with 1 + + Note: reassignment is possible + + >>> f.jammy = 2 + >>> f.jammy + 2 """ def __init__(self, wrapped): self.wrapped = wrapped - functools.update_wrapper(self, wrapped) + update_wrapper(self, wrapped) def __get__(self, inst, objtype=None): if inst is None: -- cgit v1.2.3 From 4509b306114d8de13e1b90d46829286f7dbb30f3 Mon Sep 17 00:00:00 2001 From: int3l Date: Sat, 23 Apr 2016 11:57:21 +0300 Subject: adjustment and update docstring to be consistant --- pyramid/decorator.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyramid/decorator.py b/pyramid/decorator.py index 890bd3461..72c8b3800 100644 --- a/pyramid/decorator.py +++ b/pyramid/decorator.py @@ -19,15 +19,14 @@ class reify(object): And usage of Foo: >>> f = Foo() - >>> print(f.jammy) + >>> v = f.jammy 'jammy called' + >>> print(v) 1 - >>> print(f.jammy) + >>> f.jammy 1 >>> # jammy func not called the second time; it replaced itself with 1 - - Note: reassignment is possible - + >>> # Note: reassignment is possible >>> f.jammy = 2 >>> f.jammy 2 -- cgit v1.2.3