[pypy-commit] pypy default: Merged file edited online.
anton_gulenko
noreply at buildbot.pypy.org
Wed Apr 22 12:21:02 CEST 2015
Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch:
Changeset: r76882:f1984a4d5583
Date: 2015-03-12 15:04 +0100
http://bitbucket.org/pypy/pypy/changeset/f1984a4d5583/
Log: Merged file edited online.
diff --git a/rpython/doc/rstrategies.rst b/rpython/doc/rstrategies.rst
--- a/rpython/doc/rstrategies.rst
+++ b/rpython/doc/rstrategies.rst
@@ -98,18 +98,18 @@
::
-class AbstractStrategy(AbstractStrategy):
- _attrs_ = ['space']
- _immutable_fields_ = ['space']
- __metaclass__ = rstrat.StrategyMetaclass
- import_from_mixin(rstrat.AbstractStrategy)
- import_from_mixin(rstrategies.SafeIndexingMixin)
-
- def __init__(self, space):
- self.space = space
-
- def strategy_factory(self):
- return self.space.strategy_factory
+ class AbstractStrategy(AbstractStrategy):
+ _attrs_ = ['space']
+ _immutable_fields_ = ['space']
+ __metaclass__ = rstrat.StrategyMetaclass
+ import_from_mixin(rstrat.AbstractStrategy)
+ import_from_mixin(rstrategies.SafeIndexingMixin)
+
+ def __init__(self, space):
+ self.space = space
+
+ def strategy_factory(self):
+ return self.space.strategy_factory
Strategy classes
@@ -144,14 +144,14 @@
::
- at rstrat.strategy(generalize=[GenericStrategy])
-class IntegerOrNilStrategy(AbstractStrategy):
- import_from_mixin(rstrat.TaggingStrategy)
- contained_type = model.W_Integer
- def wrap(self, val): return self.space.wrap_int(val)
- def unwrap(self, w_val): return self.space.unwrap_int(w_val)
- def wrapped_tagged_value(self): return self.space.w_nil
- def unwrapped_tagged_value(self): return constants.MAXINT
+ @rstrat.strategy(generalize=[GenericStrategy])
+ class IntegerOrNilStrategy(AbstractStrategy):
+ import_from_mixin(rstrat.TaggingStrategy)
+ contained_type = model.W_Integer
+ def wrap(self, val): return self.space.wrap_int(val)
+ def unwrap(self, w_val): return self.space.unwrap_int(w_val)
+ def wrapped_tagged_value(self): return self.space.w_nil
+ def unwrapped_tagged_value(self): return constants.MAXINT
Strategy Factory
----------------
@@ -188,22 +188,22 @@
::
-class StrategyFactory(rstrategies.StrategyFactory):
- _attrs_ = ['space']
- _immutable_fields_ = ['space']
-
- def __init__(self, space):
- self.space = space
- rstrat.StrategyFactory.__init__(self, AbstractStrategy)
-
- def instantiate_strategy(self, strategy_type):
- return strategy_type(self.space)
-
- def strategy_type_for(self, list_w, weak=False):
- """
- Helper method for handling weak objects specially
- """
- if weak:
- return WeakListStrategy
+ class StrategyFactory(rstrategies.StrategyFactory):
+ _attrs_ = ['space']
+ _immutable_fields_ = ['space']
+
+ def __init__(self, space):
+ self.space = space
+ rstrat.StrategyFactory.__init__(self, AbstractStrategy)
+
+ def instantiate_strategy(self, strategy_type):
+ return strategy_type(self.space)
+
+ def strategy_type_for(self, list_w, weak=False):
+ """
+ Helper method for handling weak objects specially
+ """
+ if weak:
+ return WeakListStrategy
return rstrategies.StrategyFactory.strategy_type_for(self, list_w)
\ No newline at end of file
More information about the pypy-commit
mailing list