Ticket #5538: family_pickle_fix-fh.patch

File family_pickle_fix-fh.patch, 8.4 KB (added by hivert, 13 years ago)

Fixing the Pickle + Minimal doc header.

  • sage/combinat/family.py

    # HG changeset patch
    # User Florent Hivert <Florent.Hivert@univ-rouen.fr>
    # Date 1239807286 -7200
    # Node ID b03750263d284c99964625b998d2c9086a13f53b
    # Parent  577d69c6e488a1d48c2a8a57d384a11c71582d81
    Fixes the pickle problem due to moving some files.
    Added a minimal doc header. 
    
    diff -r 577d69c6e488 -r b03750263d28 sage/combinat/family.py
    a b  
    1 # Backward compatibility pointer
    2 from sage.sets.family import Family
     1"""
     2Families
     3
     4This is a backward compatibility stub. Use :mod:`sage.sets.family` instead.
     5"""
     6
     7# Backward compatibility pointer
     8# Needed for unpickling.
     9from sage.sets.family import (Family, FiniteFamily, LazyFamily,
     10                              FiniteFamilyWithHiddenKeys)
  • sage/combinat/finite_class.py

    diff -r 577d69c6e488 -r b03750263d28 sage/combinat/finite_class.py
    a b  
    123123            [0, 1, 2]
    124124        """
    125125        return range(len(self.l))
     126
     127# Backward compatibility pointer
     128# Needed for unpickling.
     129FiniteCombinatorialClass_l = FiniteCombinatorialClass   
  • sage/sets/all.py

    diff -r 577d69c6e488 -r b03750263d28 sage/sets/all.py
    a b  
    22
    33from primes import Primes
    44
    5 from family import Family, FiniteFamily, LazyFamily, TrivialFamily
     5from family import Family
  • sage/sets/family.py

    diff -r 577d69c6e488 -r b03750263d28 sage/sets/family.py
    a b  
    11"""
    22Families
     3
     4A Family is an associative container which models a family
     5`(f_i)_{i \in I}`. Then, ``f[i]`` returns the element of the family indexed by
     6``i``. Whenever available, set and combinatorial class operations (counting,
     7iteration, listing) on the family are induced from those of the index
     8set. Families should be created through the :func:`Family` function.
     9
     10AUTHORS:
     11
     12- Nicolas Thiery (2008-02): initial release
     13
     14- Florent Hivert (2008-04): various fixes, cleanups and improvements. 
     15
    316"""
    417#*****************************************************************************
    518#       Copyright (C) 2008 Nicolas Thiery <nthiery at users.sf.net>,
     
    291304        'b'
    292305
    293306    The factory ``Family`` is supposed to be idempotent. We test this feature here::
    294    
     307
     308        sage: from sage.sets.family import FiniteFamily, LazyFamily, TrivialFamily
    295309        sage: f = FiniteFamily({3: 'a', 4: 'b', 7: 'd'})
    296310        sage: g = Family(f)
    297311        sage: f == g
     
    417431   
    418432    ::
    419433   
     434        sage: from sage.sets.family import FiniteFamily
    420435        sage: f = FiniteFamily({3: 'a', 4: 'b', 7: 'd'})
    421436   
    422437    Individual elements are accessible as in a usual dictionary::
     
    443458        """
    444459        TESTS::
    445460       
     461            sage: from sage.sets.family import FiniteFamily
    446462            sage: f = FiniteFamily({3: 'a', 4: 'b', 7: 'd'})
    447463            sage: f == loads(dumps(f))
    448464            True
     
    464480        """
    465481        EXAMPLES::
    466482       
     483            sage: from sage.sets.family import FiniteFamily
    467484            sage: FiniteFamily({3: 'a'})
    468485            Finite family {3: 'a'}
    469486        """
     
    473490        """
    474491        EXAMPLES::
    475492       
     493            sage: from sage.sets.family import FiniteFamily
    476494            sage: f = FiniteFamily({3: 'a'})
    477495            sage: 'a' in f
    478496            True
     
    487505
    488506        EXAMPLES::
    489507       
     508            sage: from sage.sets.family import FiniteFamily
    490509            sage: f = FiniteFamily({3: 'a', 4: 'b', 7: 'd'})
    491510            sage: len(f)
    492511            3       
     
    499518       
    500519        EXAMPLES::
    501520       
     521            sage: from sage.sets.family import FiniteFamily
    502522            sage: f = FiniteFamily({3: 'a', 4: 'b', 7: 'd'})
    503523            sage: f.cardinality()
    504524            3
     
    509529        """
    510530        EXAMPLES::
    511531       
     532            sage: from sage.sets.family import FiniteFamily
    512533            sage: f = FiniteFamily({3: 'a'})
    513534            sage: i = iter(f)
    514535            sage: i.next()
     
    525546       
    526547        EXAMPLES::
    527548       
     549            sage: from sage.sets.family import FiniteFamily
    528550            sage: f = FiniteFamily({3: 'a', 4: 'b', 7: 'd'})
    529551            sage: f[3]
    530552            'a'
     
    536558        """
    537559        TESTS::
    538560       
     561            sage: from sage.sets.family import FiniteFamily
    539562            sage: f = FiniteFamily({3: 'a'})
    540563            sage: f.__getstate__()
    541564            {'dictionary': {3: 'a'}}
     
    546569        """
    547570        TESTS::
    548571       
     572            sage: from sage.sets.family import FiniteFamily
    549573            sage: f = FiniteFamily({3: 'a'})
    550574            sage: f.__setstate__({'dictionary': {4:'b'}})
    551575            sage: f
     
    666690        """
    667691        TESTS::
    668692       
     693            sage: from sage.sets.family import LazyFamily
    669694            sage: f = LazyFamily([3,4,7], lambda i: 2r*i); f
    670695            Lazy family (<lambda>(i))_{i in [3, 4, 7]}
    671696            sage: f == loads(dumps(f))
     
    690715        """
    691716        EXAMPLES::
    692717       
     718            sage: from sage.sets.family import LazyFamily
    693719            sage: def fun(i): 2*i
    694720            sage: f = LazyFamily([3,4,7], fun); f
    695721            Lazy family (fun(i))_{i in [3, 4, 7]}
     
    719745       
    720746        EXAMPLES::
    721747       
     748            sage: from sage.sets.family import LazyFamily
    722749            sage: f = LazyFamily([3,4,7], lambda i: 2*i)
    723750            sage: f.keys()
    724751            [3, 4, 7]
     
    731758       
    732759        EXAMPLES::
    733760       
     761            sage: from sage.sets.family import LazyFamily
    734762            sage: f = LazyFamily([3,4,7], lambda i: 2*i)
    735763            sage: f.cardinality()
    736764            3
     
    744772        """
    745773        EXAMPLES::
    746774       
     775            sage: from sage.sets.family import LazyFamily
    747776            sage: f = LazyFamily([3,4,7], lambda i: 2*i)
    748777            sage: [i for i in f]
    749778            [6, 8, 14]
     
    755784        """       
    756785        EXAMPLES::
    757786       
     787            sage: from sage.sets.family import LazyFamily
    758788            sage: f = LazyFamily([3,4,7], lambda i: 2*i)
    759789            sage: f[3]
    760790            6
     
    770800        """       
    771801        EXAMPLES::
    772802       
     803            sage: from sage.sets.family import LazyFamily
    773804            sage: f = LazyFamily([3,4,7], lambda i: 2r*i)
    774805            sage: d = f.__getstate__()
    775806            sage: d['set']
     
    797828        """
    798829        EXAMPLES::
    799830       
     831            sage: from sage.sets.family import LazyFamily
    800832            sage: f = LazyFamily([3,4,7], lambda i: 2r*i)
    801833            sage: d = f.__getstate__()
    802834            sage: f = LazyFamily([4,5,6], lambda i: 2r*i)
     
    828860        """
    829861        EXAMPLES::
    830862       
     863            sage: from sage.sets.family import TrivialFamily
    831864            sage: f = TrivialFamily((3,4,7)); f
    832865            Family (3, 4, 7)
    833866            sage: f = TrivialFamily([3,4,7]); f
     
    841874        """
    842875        EXAMPLES::
    843876       
     877            sage: from sage.sets.family import TrivialFamily
    844878            sage: f = TrivialFamily([3,4,7]); f
    845879            Family (3, 4, 7)
    846880        """
     
    852886       
    853887        EXAMPLES::
    854888       
     889            sage: from sage.sets.family import TrivialFamily
    855890            sage: f = TrivialFamily([3,4,7])
    856891            sage: f.keys()
    857892            [0, 1, 2]
     
    864899       
    865900        EXAMPLES::
    866901       
     902            sage: from sage.sets.family import TrivialFamily
    867903            sage: f = TrivialFamily([3,4,7])
    868904            sage: f.cardinality()
    869905            3
     
    874910        """
    875911        EXAMPLES::
    876912       
     913            sage: from sage.sets.family import TrivialFamily
    877914            sage: f = TrivialFamily([3,4,7])
    878915            sage: [i for i in f]
    879916            [3, 4, 7]
     
    884921        """       
    885922        EXAMPLES::
    886923       
     924            sage: from sage.sets.family import TrivialFamily
    887925            sage: f = TrivialFamily([3,4,7])
    888926            sage: f[1]
    889927            4       
     
    894932        """
    895933        TESTS::
    896934       
     935            sage: from sage.sets.family import TrivialFamily
    897936            sage: f = TrivialFamily([3,4,7])
    898937            sage: f.__getstate__()
    899938            {'_enumeration': (3, 4, 7)}
     
    904943        """
    905944        TESTS::
    906945       
     946            sage: from sage.sets.family import TrivialFamily
    907947            sage: f = TrivialFamily([3,4,7])
    908948            sage: f.__setstate__({'_enumeration': (2, 4, 8)})
    909949            sage: f