Author: anton_gulenko <anton.gule...@googlemail.com> Branch: Changeset: r76880:7d7e19e7f237 Date: 2015-03-12 13:58 +0000 http://bitbucket.org/pypy/pypy/changeset/7d7e19e7f237/
Log: Fixed source-code formatting in doc (rstrategies.rst edited online with Bitbucket) 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 @@ :: -@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 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit