@@ -191,7 +191,7 @@ class DirichletCharacter(MultiplicativeGroupElement):
191
191
"""
192
192
A Dirichlet character.
193
193
"""
194
- def __init__ (self , parent , x , check = True ):
194
+ def __init__ (self , parent , x , check = True ) -> None :
195
195
r"""
196
196
Create a Dirichlet character with specified values on
197
197
generators of `(\ZZ/n\ZZ)^*`.
@@ -401,7 +401,7 @@ def change_ring(self, R):
401
401
G = self .parent ().change_ring (R )
402
402
return G .element_class (G , [R (x ) for x in self .values_on_gens ()])
403
403
404
- def _richcmp_ (self , other , op ):
404
+ def _richcmp_ (self , other , op ) -> bool :
405
405
"""
406
406
Compare ``self`` to ``other``.
407
407
@@ -429,7 +429,7 @@ def _richcmp_(self, other, op):
429
429
"""
430
430
return richcmp (self .values_on_gens (), other .values_on_gens (), op )
431
431
432
- def __hash__ (self ):
432
+ def __hash__ (self ) -> int :
433
433
"""
434
434
Return the hash of ``self``.
435
435
@@ -527,7 +527,7 @@ def __pow__(self, n):
527
527
x = tuple (z ** n for z in self .values_on_gens ())
528
528
return G .element_class (G , x , check = False )
529
529
530
- def _repr_short_ (self ):
530
+ def _repr_short_ (self ) -> str :
531
531
r"""
532
532
A short string representation of ``self``, often used in string representations of modular forms.
533
533
@@ -539,7 +539,7 @@ def _repr_short_(self):
539
539
"""
540
540
return str (list (self .values_on_gens ()))
541
541
542
- def _repr_ (self ):
542
+ def _repr_ (self ) -> str :
543
543
"""
544
544
String representation of ``self``.
545
545
@@ -569,7 +569,7 @@ def _repr_(self):
569
569
s += str (self .parent ().unit_gens ()[i ]) + ' |--> ' + str (self .values_on_gens ()[i ])
570
570
return s
571
571
572
- def _latex_ (self ):
572
+ def _latex_ (self ) -> str :
573
573
r"""
574
574
LaTeX representation of ``self``.
575
575
@@ -1048,7 +1048,7 @@ def fixed_field(self):
1048
1048
return NumberField (self .fixed_field_polynomial (), 'a' )
1049
1049
1050
1050
@cached_method
1051
- def decomposition (self ):
1051
+ def decomposition (self ) -> list :
1052
1052
r"""
1053
1053
Return the decomposition of ``self`` as a product of Dirichlet
1054
1054
characters of prime power modulus, where the prime powers exactly
@@ -1229,7 +1229,7 @@ def conrey_number(self):
1229
1229
G , v = self ._pari_init_ ()
1230
1230
return pari .znconreyexp (G , v ).sage ()
1231
1231
1232
- def lmfdb_page (self ):
1232
+ def lmfdb_page (self ) -> None :
1233
1233
r"""
1234
1234
Open the LMFDB web page of the character in a browser.
1235
1235
@@ -1246,7 +1246,7 @@ def lmfdb_page(self):
1246
1246
url = lmfdb_url .format (self .modulus (), self .conrey_number ())
1247
1247
webbrowser .open (url )
1248
1248
1249
- def galois_orbit (self , sort = True ):
1249
+ def galois_orbit (self , sort = True ) -> list :
1250
1250
r"""
1251
1251
Return the orbit of this character under the action of the absolute
1252
1252
Galois group of the prime subfield of the base ring.
@@ -1548,7 +1548,7 @@ def jacobi_sum(self, char, check=True):
1548
1548
1549
1549
And sums where exactly one character is nontrivial (see :issue:`6393`)::
1550
1550
1551
- sage: G = DirichletGroup(5); X = G.list(); Y= X[0]; Z= X[1]
1551
+ sage: G = DirichletGroup(5); X = G.list(); Y = X[0]; Z = X[1]
1552
1552
sage: Y.jacobi_sum(Z)
1553
1553
-1
1554
1554
sage: Z.jacobi_sum(Y)
@@ -1828,7 +1828,7 @@ def is_trivial(self) -> bool:
1828
1828
one = self .base_ring ().one ()
1829
1829
return all (x == one for x in self .values_on_gens ())
1830
1830
1831
- def kernel (self ):
1831
+ def kernel (self ) -> list :
1832
1832
r"""
1833
1833
Return the kernel of this character.
1834
1834
@@ -2042,7 +2042,7 @@ def restrict(self, M):
2042
2042
return H (self )
2043
2043
2044
2044
@cached_method
2045
- def values (self ):
2045
+ def values (self ) -> list :
2046
2046
"""
2047
2047
Return a list of the values of this character on each integer
2048
2048
between 0 and the modulus.
@@ -2130,7 +2130,7 @@ def values(self):
2130
2130
i += 1
2131
2131
2132
2132
@cached_method (do_pickle = True )
2133
- def values_on_gens (self ):
2133
+ def values_on_gens (self ) -> tuple :
2134
2134
r"""
2135
2135
Return a tuple of the values of ``self`` on the standard
2136
2136
generators of `(\ZZ/N\ZZ)^*`, where `N` is the modulus.
@@ -2456,6 +2456,12 @@ class DirichletGroupFactory(UniqueFactory):
2456
2456
2457
2457
sage: DirichletGroup(60) is DirichletGroup(60)
2458
2458
True
2459
+
2460
+ Test for pickling::
2461
+
2462
+ sage: G = DirichletGroup(9)
2463
+ sage: loads(dumps(G)) is G
2464
+ True
2459
2465
"""
2460
2466
def create_key (self , N , base_ring = None , zeta = None , zeta_order = None ,
2461
2467
names = None , integral = False ):
@@ -2563,7 +2569,7 @@ def create_object(self, version, key, **extra_args):
2563
2569
DirichletGroup = DirichletGroupFactory ("DirichletGroup" )
2564
2570
2565
2571
2566
- def is_DirichletGroup (x ):
2572
+ def is_DirichletGroup (x ) -> bool :
2567
2573
"""
2568
2574
Return ``True`` if ``x`` is a Dirichlet group.
2569
2575
@@ -2592,7 +2598,7 @@ class DirichletGroup_class(WithEqualityById, Parent):
2592
2598
2593
2599
Element = DirichletCharacter
2594
2600
2595
- def __init__ (self , base_ring , modulus , zeta , zeta_order ):
2601
+ def __init__ (self , base_ring , modulus , zeta , zeta_order ) -> None :
2596
2602
"""
2597
2603
Create a Dirichlet group.
2598
2604
@@ -2631,21 +2637,6 @@ def __init__(self, base_ring, modulus, zeta, zeta_order):
2631
2637
self ._modulus = modulus
2632
2638
self ._integers = IntegerModRing (modulus )
2633
2639
2634
- def __setstate__ (self , state ):
2635
- """
2636
- Used for unpickling old instances.
2637
-
2638
- TESTS::
2639
-
2640
- sage: G = DirichletGroup(9)
2641
- sage: loads(dumps(G)) is G
2642
- True
2643
- """
2644
- self ._set_element_constructor ()
2645
- if '_zeta_order' in state :
2646
- state ['_zeta_order' ] = Integer (state ['_zeta_order' ])
2647
- super ().__setstate__ (state )
2648
-
2649
2640
@property
2650
2641
def _module (self ):
2651
2642
"""
@@ -2686,7 +2677,7 @@ def _zeta_powers(self):
2686
2677
return w
2687
2678
2688
2679
@property
2689
- def _zeta_dlog (self ):
2680
+ def _zeta_dlog (self ) -> dict :
2690
2681
"""
2691
2682
Return a dictionary that can be used to compute discrete
2692
2683
logarithms in the value group of this Dirichlet group.
@@ -2870,7 +2861,7 @@ def _element_constructor_(self, x):
2870
2861
a .append (R (x (v )))
2871
2862
return self .element_class (self , a )
2872
2863
2873
- def _coerce_map_from_ (self , X ):
2864
+ def _coerce_map_from_ (self , X ) -> bool :
2874
2865
"""
2875
2866
Decide whether there is a coercion map from `X`.
2876
2867
@@ -2915,7 +2906,7 @@ def __len__(self):
2915
2906
"""
2916
2907
return self .order ()
2917
2908
2918
- def _repr_ (self ):
2909
+ def _repr_ (self ) -> str :
2919
2910
"""
2920
2911
Return a print representation of this group, which can be renamed.
2921
2912
@@ -2935,7 +2926,7 @@ def _repr_(self):
2935
2926
return s
2936
2927
2937
2928
@cached_method
2938
- def decomposition (self ):
2929
+ def decomposition (self ) -> list :
2939
2930
r"""
2940
2931
Return the Dirichlet groups of prime power modulus corresponding
2941
2932
to primes dividing modulus.
@@ -3140,7 +3131,7 @@ def integers_mod(self):
3140
3131
3141
3132
__iter__ = multiplicative_iterator
3142
3133
3143
- def list (self ):
3134
+ def list (self ) -> list :
3144
3135
"""
3145
3136
Return a list of the Dirichlet characters in this group.
3146
3137
@@ -3166,7 +3157,7 @@ def modulus(self):
3166
3157
"""
3167
3158
return self ._modulus
3168
3159
3169
- def ngens (self ):
3160
+ def ngens (self ) -> int :
3170
3161
"""
3171
3162
Return the number of generators of ``self``.
3172
3163
@@ -3244,7 +3235,7 @@ def random_element(self):
3244
3235
e *= g ** n
3245
3236
return e
3246
3237
3247
- def unit_gens (self ):
3238
+ def unit_gens (self ) -> tuple :
3248
3239
r"""
3249
3240
Return the minimal generators for the units of
3250
3241
`(\ZZ/N\ZZ)^*`, where `N` is the
0 commit comments