@@ -174,7 +174,7 @@ cdef class LazyImport():
174
174
EXAMPLES::
175
175
176
176
sage: from sage.misc.lazy_import import LazyImport
177
- sage: my_integer = LazyImport('sage.rings.integer_ring ', 'Integer')
177
+ sage: my_integer = LazyImport('sage.rings.integer ', 'Integer')
178
178
sage: my_integer(4)
179
179
4
180
180
sage: my_integer('101', base=2)
@@ -365,7 +365,7 @@ cdef class LazyImport():
365
365
EXAMPLES::
366
366
367
367
sage: from sage.misc.lazy_import import LazyImport
368
- sage: my_integer = LazyImport('sage.rings.integer_ring ', 'Integer')
368
+ sage: my_integer = LazyImport('sage.rings.integer ', 'Integer')
369
369
sage: my_integer.sqrt is Integer.sqrt
370
370
True
371
371
"""
@@ -395,7 +395,7 @@ cdef class LazyImport():
395
395
EXAMPLES::
396
396
397
397
sage: from sage.misc.lazy_import import LazyImport
398
- sage: my_isprime = LazyImport('sage.rings.integer_ring ', 'is_prime')
398
+ sage: my_isprime = LazyImport('sage.arith.misc ', 'is_prime')
399
399
sage: is_prime(12) == my_isprime(12)
400
400
True
401
401
sage: is_prime(13) == my_isprime(13)
@@ -485,6 +485,7 @@ cdef class LazyImport():
485
485
example, we add manually a function in :mod:`sage.all__sagemath_objects`::
486
486
487
487
sage: def my_method(self): return self
488
+ sage: import sage.all__sagemath_objects
488
489
sage: sage.all__sagemath_objects.my_method = my_method
489
490
490
491
Now we lazy import it as a method of a new class ``Foo``::
@@ -568,6 +569,7 @@ cdef class LazyImport():
568
569
TESTS::
569
570
570
571
sage: from sage.misc.lazy_import import LazyImport
572
+ sage: import sage.all__sagemath_objects
571
573
sage: sage.all__sagemath_objects.foo = list(range(10))
572
574
sage: lazy_foo = LazyImport('sage.all__sagemath_objects', 'foo')
573
575
sage: lazy_foo[1] = 100
@@ -583,7 +585,8 @@ cdef class LazyImport():
583
585
TESTS::
584
586
585
587
sage: from sage.misc.lazy_import import LazyImport
586
- sage: sage.all.foo = list(range(10))
588
+ sage: import sage.all__sagemath_objects
589
+ sage: sage.all__sagemath_objects.foo = list(range(10))
587
590
sage: lazy_foo = LazyImport('sage.all__sagemath_objects', 'foo')
588
591
sage: del lazy_foo[1]
589
592
sage: print(lazy_foo)
@@ -623,6 +626,7 @@ cdef class LazyImport():
623
626
"""
624
627
TESTS::
625
628
629
+ sage: import sage.all__sagemath_objects
626
630
sage: sage.all__sagemath_objects.foo = 10
627
631
sage: lazy_import('sage.all__sagemath_objects', 'foo')
628
632
sage: foo + 1
@@ -634,6 +638,7 @@ cdef class LazyImport():
634
638
"""
635
639
TESTS::
636
640
641
+ sage: import sage.all__sagemath_objects
637
642
sage: sage.all__sagemath_objects.foo = 10
638
643
sage: lazy_import('sage.all__sagemath_objects', 'foo')
639
644
sage: foo - 1
@@ -645,6 +650,7 @@ cdef class LazyImport():
645
650
"""
646
651
TESTS::
647
652
653
+ sage: import sage.all__sagemath_objects
648
654
sage: sage.all__sagemath_objects.foo = 10
649
655
sage: lazy_import('sage.all__sagemath_objects', 'foo')
650
656
sage: foo * 2
@@ -657,6 +663,7 @@ cdef class LazyImport():
657
663
TESTS::
658
664
659
665
sage: from sympy import Matrix
666
+ sage: import sage.all__sagemath_objects
660
667
sage: sage.all__sagemath_objects.foo = Matrix([[1,1],[0,1]])
661
668
sage: lazy_import('sage.all__sagemath_objects', 'foo')
662
669
sage: foo.__matmul__(foo)
@@ -670,6 +677,7 @@ cdef class LazyImport():
670
677
"""
671
678
TESTS::
672
679
680
+ sage: import sage.all__sagemath_objects
673
681
sage: sage.all__sagemath_objects.foo = 10
674
682
sage: lazy_import('sage.all__sagemath_objects', 'foo')
675
683
sage: foo // 3
@@ -681,6 +689,7 @@ cdef class LazyImport():
681
689
"""
682
690
TESTS::
683
691
692
+ sage: import sage.all__sagemath_objects
684
693
sage: sage.all__sagemath_objects.foo = 10
685
694
sage: lazy_import('sage.all__sagemath_objects', 'foo')
686
695
sage: operator.truediv(foo, 3)
@@ -692,6 +701,7 @@ cdef class LazyImport():
692
701
"""
693
702
TESTS::
694
703
704
+ sage: import sage.all__sagemath_objects
695
705
sage: sage.all__sagemath_objects.foo = 10
696
706
sage: lazy_import('sage.all__sagemath_objects', 'foo')
697
707
sage: foo ** 2
@@ -703,6 +713,7 @@ cdef class LazyImport():
703
713
"""
704
714
TESTS::
705
715
716
+ sage: import sage.all__sagemath_objects
706
717
sage: sage.all__sagemath_objects.foo = 10
707
718
sage: lazy_import('sage.all__sagemath_objects', 'foo')
708
719
sage: foo % 7
@@ -714,6 +725,7 @@ cdef class LazyImport():
714
725
"""
715
726
TESTS::
716
727
728
+ sage: import sage.all__sagemath_objects
717
729
sage: sage.all__sagemath_objects.foo = 10
718
730
sage: lazy_import('sage.all__sagemath_objects', 'foo')
719
731
sage: foo << 3
@@ -725,6 +737,7 @@ cdef class LazyImport():
725
737
"""
726
738
TESTS::
727
739
740
+ sage: import sage.all__sagemath_objects
728
741
sage: sage.all__sagemath_objects.foo = 10
729
742
sage: lazy_import('sage.all__sagemath_objects', 'foo')
730
743
sage: foo >> 2
@@ -736,6 +749,7 @@ cdef class LazyImport():
736
749
"""
737
750
TESTS::
738
751
752
+ sage: import sage.all__sagemath_objects
739
753
sage: sage.all__sagemath_objects.foo = 10
740
754
sage: lazy_import('sage.all__sagemath_objects', 'foo')
741
755
sage: foo & 7
@@ -747,6 +761,7 @@ cdef class LazyImport():
747
761
"""
748
762
TESTS::
749
763
764
+ sage: import sage.all__sagemath_objects
750
765
sage: sage.all__sagemath_objects.foo = 10
751
766
sage: lazy_import('sage.all__sagemath_objects', 'foo')
752
767
sage: foo | 7
@@ -758,6 +773,7 @@ cdef class LazyImport():
758
773
"""
759
774
TESTS::
760
775
776
+ sage: import sage.all__sagemath_objects
761
777
sage: sage.all__sagemath_objects.foo = 10
762
778
sage: lazy_import('sage.all__sagemath_objects', 'foo')
763
779
sage: foo ^^ 7
@@ -769,6 +785,7 @@ cdef class LazyImport():
769
785
"""
770
786
TESTS::
771
787
788
+ sage: import sage.all__sagemath_objects
772
789
sage: sage.all__sagemath_objects.foo = 10
773
790
sage: lazy_import('sage.all__sagemath_objects', 'foo')
774
791
sage: -foo
@@ -780,6 +797,7 @@ cdef class LazyImport():
780
797
"""
781
798
TESTS::
782
799
800
+ sage: import sage.all__sagemath_objects
783
801
sage: sage.all__sagemath_objects.foo = 10
784
802
sage: lazy_import('sage.all__sagemath_objects', 'foo')
785
803
sage: +foo
@@ -791,6 +809,7 @@ cdef class LazyImport():
791
809
"""
792
810
TESTS::
793
811
812
+ sage: import sage.all__sagemath_objects
794
813
sage: sage.all__sagemath_objects.foo = -1000
795
814
sage: lazy_import('sage.all__sagemath_objects', 'foo')
796
815
sage: abs(foo)
@@ -802,6 +821,7 @@ cdef class LazyImport():
802
821
"""
803
822
TESTS::
804
823
824
+ sage: import sage.all__sagemath_objects
805
825
sage: sage.all__sagemath_objects.foo = 10
806
826
sage: lazy_import('sage.all__sagemath_objects', 'foo')
807
827
sage: ~foo
@@ -813,6 +833,7 @@ cdef class LazyImport():
813
833
"""
814
834
TESTS::
815
835
836
+ sage: import sage.all__sagemath_objects
816
837
sage: sage.all__sagemath_objects.foo = 10
817
838
sage: lazy_import('sage.all__sagemath_objects', 'foo')
818
839
sage: complex(foo)
@@ -824,6 +845,7 @@ cdef class LazyImport():
824
845
"""
825
846
TESTS::
826
847
848
+ sage: import sage.all__sagemath_objects
827
849
sage: sage.all__sagemath_objects.foo = 10
828
850
sage: lazy_import('sage.all__sagemath_objects', 'foo')
829
851
sage: int(foo)
@@ -835,6 +857,7 @@ cdef class LazyImport():
835
857
"""
836
858
TESTS::
837
859
860
+ sage: import sage.all__sagemath_objects
838
861
sage: sage.all__sagemath_objects.foo = 10
839
862
sage: lazy_import('sage.all__sagemath_objects', 'foo')
840
863
sage: float(foo)
@@ -846,6 +869,7 @@ cdef class LazyImport():
846
869
"""
847
870
TESTS::
848
871
872
+ sage: import sage.all__sagemath_objects
849
873
sage: sage.all__sagemath_objects.foo = 10
850
874
sage: lazy_import('sage.all__sagemath_objects', 'foo')
851
875
sage: oct(foo)
@@ -857,6 +881,7 @@ cdef class LazyImport():
857
881
"""
858
882
TESTS::
859
883
884
+ sage: import sage.all__sagemath_objects
860
885
sage: sage.all__sagemath_objects.foo = 10
861
886
sage: lazy_import('sage.all__sagemath_objects', 'foo')
862
887
sage: hex(foo)
@@ -868,6 +893,7 @@ cdef class LazyImport():
868
893
"""
869
894
TESTS::
870
895
896
+ sage: import sage.all__sagemath_objects
871
897
sage: sage.all__sagemath_objects.foo = 10
872
898
sage: lazy_import('sage.all__sagemath_objects', 'foo')
873
899
sage: list(range(100))[foo]
@@ -881,8 +907,8 @@ cdef class LazyImport():
881
907
882
908
TESTS::
883
909
884
-
885
910
sage: from sage.misc.lazy_import import LazyImport
911
+ sage: import sage.all__sagemath_objects
886
912
sage: sage.all__sagemath_objects.foo = [[1,2], 3]
887
913
sage: lazy_foo = LazyImport('sage.all__sagemath_objects', 'foo')
888
914
sage: a = copy(lazy_foo)
@@ -903,6 +929,7 @@ cdef class LazyImport():
903
929
TESTS::
904
930
905
931
sage: from sage.misc.lazy_import import LazyImport
932
+ sage: import sage.all__sagemath_objects
906
933
sage: sage.all__sagemath_objects.foo = [[1,2], 3]
907
934
sage: lazy_foo = LazyImport('sage.all__sagemath_objects', 'foo')
908
935
sage: a = deepcopy(lazy_foo)
0 commit comments