diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py index 9b12b49eecb..a3311085ca5 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py @@ -74,7 +74,7 @@ class RepresentationType(Enum): sage: chmr.RepresentationType.RegularLeft.is_regular() True """ - def is_split(self): + def is_split(self) -> bool: r""" Return ``True`` if this representation type is absolutely split, ``False`` else-wise. @@ -88,7 +88,7 @@ def is_split(self): """ return self.value['split'] - def is_regular(self): + def is_regular(self) -> bool: r""" Return ``True`` if this representation type is regular, ``False`` else-wise. diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index c32f99895a0..5c995a0a632 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -152,7 +152,7 @@ def example(self, choice='highwt', **kwds): class MorphismMethods: @cached_method - def is_isomorphism(self): + def is_isomorphism(self) -> bool: """ Check if ``self`` is a crystal isomorphism. @@ -178,7 +178,7 @@ def is_isomorphism(self): # TODO: This could be moved to sets @cached_method - def is_embedding(self): + def is_embedding(self) -> bool: """ Check if ``self`` is an injective crystal morphism. @@ -213,7 +213,7 @@ def is_embedding(self): return True @cached_method - def is_strict(self): + def is_strict(self) -> bool: """ Check if ``self`` is a strict crystal morphism. @@ -1301,7 +1301,7 @@ def number_of_connected_components(self): """ return len(self.connected_components_generators()) - def is_connected(self): + def is_connected(self) -> bool: """ Return ``True`` if ``self`` is a connected crystal. @@ -1528,7 +1528,7 @@ def s(self, i): b = b.e(i) return b - def is_highest_weight(self, index_set=None): + def is_highest_weight(self, index_set=None) -> bool: r""" Return ``True`` if ``self`` is a highest weight. @@ -1550,9 +1550,10 @@ def is_highest_weight(self, index_set=None): index_set = self.index_set() return all(self.e(i) is None for i in index_set) - def is_lowest_weight(self, index_set=None): + def is_lowest_weight(self, index_set=None) -> bool: r""" Return ``True`` if ``self`` is a lowest weight. + Specifying the option ``index_set`` to be a subset `I` of the index set of the underlying crystal, finds all lowest weight vectors for arrows in `I`. diff --git a/src/sage/categories/monoids.py b/src/sage/categories/monoids.py index 313ec5d6374..2e8ebae94a0 100644 --- a/src/sage/categories/monoids.py +++ b/src/sage/categories/monoids.py @@ -274,7 +274,7 @@ def _div_(left, right): """ return left * ~right - def is_one(self): + def is_one(self) -> bool: r""" Return whether ``self`` is the one of the monoid. @@ -603,7 +603,7 @@ def algebra_generators(self): class ElementMethods: - def is_central(self): + def is_central(self) -> bool: r""" Return whether the element ``self`` is central. diff --git a/src/sage/combinat/partition_kleshchev.py b/src/sage/combinat/partition_kleshchev.py index 444a46f2cf1..85a9a30bf39 100644 --- a/src/sage/combinat/partition_kleshchev.py +++ b/src/sage/combinat/partition_kleshchev.py @@ -428,7 +428,7 @@ def mullineux_conjugate(self): KP = mu.parent() return KP.element_class(KP, mu.add_cell(*mu.cogood_cells( r-c-self.parent()._multicharge[0]) )) - def is_regular(self): + def is_regular(self) -> bool: r""" Return ``True`` if ``self`` is a `e`-regular partition tuple. @@ -454,7 +454,7 @@ def is_regular(self): KP = self.parent() return super().is_regular(KP._e, KP._multicharge) - def is_restricted(self): + def is_restricted(self) -> bool: r""" Return ``True`` if ``self`` is an `e`-restricted partition tuple. @@ -811,7 +811,7 @@ def mullineux_conjugate(self): KP = mu.parent() return KP.element_class(KP, mu.add_cell(*mu.cogood_cells( r-c-self.parent()._multicharge[k]))) - def is_regular(self): + def is_regular(self) -> bool: r""" Return ``True`` if ``self`` is a `e`-regular partition tuple. @@ -835,7 +835,7 @@ def is_regular(self): KP = self.parent() return _is_regular(self.to_list(), KP._multicharge, KP._convention) - def is_restricted(self): + def is_restricted(self) -> bool: r""" Return ``True`` if ``self`` is an `e`-restricted partition tuple. diff --git a/src/sage/combinat/root_system/reflection_group_complex.py b/src/sage/combinat/root_system/reflection_group_complex.py index c213a2dcf6c..38c23595a44 100644 --- a/src/sage/combinat/root_system/reflection_group_complex.py +++ b/src/sage/combinat/root_system/reflection_group_complex.py @@ -852,7 +852,7 @@ def discriminant_in_invariant_ring(self, invariants=None): return sum(coeffs[i] * mons[i] for i in range(m)) @cached_method - def is_crystallographic(self): + def is_crystallographic(self) -> bool: r""" Return ``True`` if ``self`` is crystallographic. @@ -890,9 +890,10 @@ def is_crystallographic(self): sage: W.is_crystallographic() False """ - return self.is_real() and all(t.to_matrix().base_ring() is QQ for t in self.simple_reflections()) + return self.is_real() and all(t.to_matrix().base_ring() is QQ + for t in self.simple_reflections()) - def number_of_irreducible_components(self): + def number_of_irreducible_components(self) -> int: r""" Return the number of irreducible components of ``self``. @@ -908,7 +909,7 @@ def number_of_irreducible_components(self): """ return len(self._type) - def irreducible_components(self): + def irreducible_components(self) -> list: r""" Return a list containing the irreducible components of ``self`` as finite reflection groups. diff --git a/src/sage/combinat/species/structure.py b/src/sage/combinat/species/structure.py index 43dbd854ba7..87619524b28 100644 --- a/src/sage/combinat/species/structure.py +++ b/src/sage/combinat/species/structure.py @@ -182,11 +182,10 @@ def _relabel(self, i): [1, 2, 3] """ if isinstance(i, (int, Integer)): - return self._labels[i-1] - else: - return i + return self._labels[i - 1] + return i - def is_isomorphic(self, x): + def is_isomorphic(self, x) -> bool: """ EXAMPLES:: @@ -203,7 +202,7 @@ def is_isomorphic(self, x): if self.parent() != x.parent(): return False - #We don't care about the labels for isomorphism testing + # We don't care about the labels for isomorphism testing return self.canonical_label()._list == x.canonical_label()._list diff --git a/src/sage/combinat/subword_complex.py b/src/sage/combinat/subword_complex.py index 8dcbd2d64cd..f2d8b46f7e7 100644 --- a/src/sage/combinat/subword_complex.py +++ b/src/sage/combinat/subword_complex.py @@ -349,7 +349,7 @@ def root_configuration(self): Phi = self.parent().group().roots() return [Phi[i] for i in self._root_configuration_indices()] - def kappa_preimage(self): + def kappa_preimage(self) -> list: r""" Return the fiber of ``self`` under the `\kappa` map. @@ -403,7 +403,7 @@ def kappa_preimage(self): if all(w.action_on_root_indices(i, side='left') < N for i in root_conf)] - def is_vertex(self): + def is_vertex(self) -> bool: r""" Return ``True`` if ``self`` is a vertex of the brick polytope of ``self.parent``. @@ -1445,7 +1445,7 @@ def greedy_facet(self, side='positive'): # topological properties - def is_sphere(self): + def is_sphere(self) -> bool: r""" Return ``True`` if the subword complex ``self`` is a sphere. @@ -1472,7 +1472,7 @@ def is_sphere(self): w = W.demazure_product(self._Q) return w == self._pi - def is_ball(self): + def is_ball(self) -> bool: r""" Return ``True`` if the subword complex ``self`` is a ball. @@ -1499,7 +1499,7 @@ def is_ball(self): """ return not self.is_sphere() - def is_pure(self): + def is_pure(self) -> bool: r""" Return ``True`` since all subword complexes are pure. @@ -1541,7 +1541,7 @@ def dimension(self): # root and weight @cached_method - def is_root_independent(self): + def is_root_independent(self) -> bool: r""" Return ``True`` if ``self`` is root-independent. @@ -1569,7 +1569,7 @@ def is_root_independent(self): return M.rank() == max(M.ncols(), M.nrows()) @cached_method - def is_double_root_free(self): + def is_double_root_free(self) -> bool: r""" Return ``True`` if ``self`` is double-root-free. diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index 5a093784996..759c5758488 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -142,7 +142,7 @@ def __init__(self, polys): vars = R.variable_names() A = ProductProjectiveSpaces([2, 2],R.base_ring(),vars) CR = A.coordinate_ring() - #Check for following: + # Check for following: # Is the user calling in 2 polynomials from a list or tuple? # Is there one biquadratic and one bilinear polynomial? if len(polys) != 2: @@ -411,7 +411,7 @@ def Hpoly(self, component, i, j): sage: X.Hpoly(0, 1, 0) 2*y0*y1^3 + 2*y0*y1*y2^2 - y1*y2^3 """ - #Check Errors in Passed in Values + # Check Errors in Passed in Values if component not in [0, 1]: raise ValueError("component can only be 1 or 0") @@ -709,7 +709,7 @@ def Ramification_poly(self, i): 4*((self._Lcoeff(i, 2))**2)*(self._Qcoeff(i, 1, 1))*(self._Qcoeff(i, 0, 0)) @cached_method - def is_degenerate(self): + def is_degenerate(self) -> bool: r""" Function will return ``True`` if there is a fiber (over the algebraic closure of the base ring) of dimension greater than 0 and ``False`` otherwise. @@ -751,7 +751,7 @@ def is_degenerate(self): PP = self.ambient_space() K = FractionField(PP[0].base_ring()) R = PP.coordinate_ring() - PS = PP[0] #check for x fibers + PS = PP[0] # check for x fibers vars = list(PS.gens()) R0 = PolynomialRing(K, 3, vars) #for dimension calculation to work, #must be done with Polynomial ring over a field @@ -763,7 +763,7 @@ def is_degenerate(self): if I.dimension() != 0: return True - PS = PP[1] #check for y fibers + PS = PP[1] # check for y fibers vars = list(PS.gens()) R0 = PolynomialRing(K,3,vars) #for dimension calculation to work, #must be done with Polynomial ring over a field @@ -840,7 +840,7 @@ def degenerate_fibers(self): phi = R.hom(vars + [0, 0, 0], R0) I = phi(I) xFibers = [] - #check affine charts + # check affine charts for n in range(3): affvars = list(R0.gens()) del affvars[n] @@ -871,7 +871,7 @@ def degenerate_fibers(self): phi = PP.coordinate_ring().hom([0, 0, 0] + vars, R0) I = phi(I) yFibers = [] - #check affine charts + # check affine charts for n in range(3): affvars = list(R0.gens()) del affvars[n] @@ -898,7 +898,7 @@ def degenerate_fibers(self): @cached_method def degenerate_primes(self, check=True): r""" - Determine which primes `p` ``self`` has degenerate fibers over `\GF{p}`. + Determine primes `p` such that ``self`` has degenerate fibers over `\GF{p}`. If ``check`` is ``False``, then may return primes that do not have degenerate fibers. Raises an error if the surface is degenerate. @@ -995,7 +995,7 @@ def degenerate_primes(self, check=True): if power == 1: bad_primes = bad_primes+GB[i].lt().coefficients()[0].support() bad_primes = sorted(set(bad_primes)) - #check to return only the truly bad primes + # check to return only the truly bad primes if check: for p in bad_primes: X = self.change_ring(GF(p)) @@ -1041,7 +1041,7 @@ def is_smooth(self) -> bool: R = self.ambient_space().coordinate_ring() I = R.ideal(M.minors(2) + [self.L,self.Q]) T = PolynomialRing(self.ambient_space().base_ring().fraction_field(), 4, 'h') - #check the 9 affine charts for a singular point + # check the 9 affine charts for a singular point for l in xmrange([3, 3]): vars = list(T.gens()) vars.insert(l[0], 1) @@ -1577,7 +1577,7 @@ def phi(self, a, **kwds): (-1 : 0 : 1 , 0 : 1 : 0) """ A = self.sigmaX(a, **kwds) - kwds.update({"check":False}) + kwds.update({"check": False}) return self.sigmaY(A, **kwds) def psi(self, a, **kwds): @@ -1617,7 +1617,7 @@ def psi(self, a, **kwds): (0 : 0 : 1 , 0 : 1 : 0) """ A = self.sigmaY(a, **kwds) - kwds.update({"check":False}) + kwds.update({"check": False}) return self.sigmaX(A, **kwds) def lambda_plus(self, P, v, N, m, n, prec=100): @@ -2411,9 +2411,9 @@ def orbit_psi(self, P, N, **kwds): Orb.append(Q) return Orb - def is_isomorphic(self, right): + def is_isomorphic(self, right) -> bool: r""" - Check to see if two K3 surfaces have the same defining ideal. + Check whether two K3 surfaces have the same defining ideal. INPUT: @@ -2449,10 +2449,12 @@ def is_isomorphic(self, right): """ return self.defining_ideal() == right.defining_ideal() - def is_symmetric_orbit(self, orbit): + def is_symmetric_orbit(self, orbit) -> bool: r""" - Check to see if the orbit is symmetric (i.e. if one of the points on the - orbit is fixed by '\sigma_x' or '\sigma_y'). + Check whether the orbit is symmetric. + + This means that one of the points on the + orbit is fixed by '\sigma_x' or '\sigma_y'. INPUT: diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index f807025956d..3f8f47bad37 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -1454,7 +1454,7 @@ def has_good_reduction(self, p) -> bool: q = a.intersection_poset() return p.is_isomorphic(q) - def is_linear(self): + def is_linear(self) -> bool: r""" Test whether all hyperplanes pass through the origin. @@ -1478,7 +1478,7 @@ def is_linear(self): """ return all(hyperplane.b() == 0 for hyperplane in self) - def is_essential(self): + def is_essential(self) -> bool: r""" Test whether the hyperplane arrangement is essential. @@ -3016,7 +3016,7 @@ def whitney_number(self, k, kind=1): return self.whitney_data()[1][0, k] raise ValueError('argument out of range') - def is_separating_hyperplane(self, region1, region2, hyperplane): + def is_separating_hyperplane(self, region1, region2, hyperplane) -> bool: r""" Test whether the ``hyperplane`` separates the given regions. @@ -3320,7 +3320,7 @@ def minimal_generated_number(self): return i return self.n_hyperplanes() - def is_formal(self): + def is_formal(self) -> bool: """ Return if ``self`` is formal. @@ -3410,7 +3410,7 @@ def derivation_module_free_chain(self): return construct_free_chain(self) @cached_method(key=lambda self, a: None) - def is_free(self, algorithm='singular'): + def is_free(self, algorithm='singular') -> bool: r""" Return if ``self`` is free. diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 3383c2bd44b..9e026298c7b 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -14177,7 +14177,7 @@ def degree_sequence(self): """ return sorted(self.degree_iterator(), reverse=True) - def is_regular(self, k=None): + def is_regular(self, k=None) -> bool: """ Check whether this graph is (`k`-)regular. diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index b2adea8b740..934ad843a26 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -1336,7 +1336,7 @@ def gen(self, i=None): raise ValueError("you must specify which generator you want") return gens[i] - def ngens(self): + def ngens(self) -> int: """ Return the number of generators of ``self``. @@ -4260,11 +4260,12 @@ def is_cyclic(self) -> bool: """ return bool(self._libgap_().IsCyclic()) - def is_elementary_abelian(self): + def is_elementary_abelian(self) -> bool: """ - Return ``True`` if this group is elementary abelian. An elementary - abelian group is a finite abelian group, where every nontrivial - element has order `p`, where `p` is a prime. + Return ``True`` if this group is elementary abelian. + + An elementary abelian group is a finite abelian group, where + every nontrivial element has order `p`, where `p` is a prime. EXAMPLES:: @@ -4327,7 +4328,7 @@ def isomorphism_to(self, right): from .permgroup_morphism import PermutationGroupMorphism_im_gens return PermutationGroupMorphism_im_gens(self, right, dsts) - def is_isomorphic(self, right): + def is_isomorphic(self, right) -> bool: """ Return ``True`` if the groups are isomorphic. @@ -4419,7 +4420,7 @@ def is_perfect(self) -> bool: """ return bool(self._libgap_().IsPerfectGroup()) - def is_pgroup(self) -> bools: + def is_pgroup(self) -> bool: r""" Return ``True`` if this group is a `p`-group. @@ -4466,7 +4467,7 @@ def is_simple(self) -> bool: """ return bool(self._libgap_().IsSimpleGroup()) - def is_solvable(self): + def is_solvable(self) -> bool: """ Return ``True`` if the group is solvable. @@ -4478,7 +4479,7 @@ def is_solvable(self): """ return bool(self._libgap_().IsSolvableGroup()) - def is_subgroup(self, other): + def is_subgroup(self, other) -> bool: """ Return ``True`` if ``self`` is a subgroup of ``other``. @@ -4489,9 +4490,9 @@ def is_subgroup(self, other): sage: G.is_subgroup(H) True """ - return all((x in other) for x in self.gens()) + return all(x in other for x in self.gens()) - def is_supersolvable(self): + def is_supersolvable(self) -> bool: """ Return ``True`` if the group is supersolvable. @@ -4548,7 +4549,7 @@ def fixed_points(self): non_fixed_points = self.non_fixed_points() return [i for i in self.domain() if i not in non_fixed_points] - def is_transitive(self, domain=None): + def is_transitive(self, domain=None) -> bool: r""" Return ``True`` if ``self`` acts transitively on ``domain``. @@ -4604,7 +4605,7 @@ def is_transitive(self, domain=None): return bool(self._libgap_().IsTransitive(domain)) - def is_primitive(self, domain=None): + def is_primitive(self, domain=None) -> bool: r""" Return ``True`` if ``self`` acts primitively on ``domain``. @@ -4657,7 +4658,7 @@ def is_primitive(self, domain=None): return bool(self._libgap_().IsPrimitive(domain)) - def is_semi_regular(self, domain=None): + def is_semi_regular(self, domain=None) -> bool: r""" Return ``True`` if ``self`` acts semi-regularly on ``domain``. @@ -4689,7 +4690,7 @@ def is_semi_regular(self, domain=None): return False return bool(self._libgap_().IsSemiRegular(domain)) - def is_regular(self, domain=None): + def is_regular(self, domain=None) -> bool: r""" Return ``True`` if ``self`` acts regularly on ``domain``. @@ -5270,11 +5271,12 @@ def ambient_group(self): """ return self._ambient_group - def is_normal(self, other=None): + def is_normal(self, other=None) -> bool: """ - Return ``True`` if this group is a normal subgroup of - ``other``. If ``other`` is not specified, then it is assumed - to be the ambient group. + Return ``True`` if this group is a normal subgroup of ``other``. + + If ``other`` is not specified, then it is assumed to be the + ambient group. EXAMPLES:: diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx index 1db2850130f..42bdca96bfa 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -497,7 +497,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ self._is_immutable = True - def is_immutable(self): + def is_immutable(self) -> bool: """ Return ``True`` if this matrix is immutable. @@ -515,7 +515,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self._is_immutable - def is_mutable(self): + def is_mutable(self) -> bool: """ Return ``True`` if this matrix is mutable. @@ -4136,7 +4136,7 @@ cdef class Matrix(sage.structure.element.Matrix): # Predicates ################################################### - def is_symmetric(self): + def is_symmetric(self) -> bool: """ Return ``True`` if this is a symmetric matrix. @@ -4316,7 +4316,7 @@ cdef class Matrix(sage.structure.element.Matrix): self.cache(key, True) return True - def is_hermitian(self): + def is_hermitian(self) -> bool: r""" Return ``True`` if the matrix is equal to its conjugate-transpose. @@ -4393,7 +4393,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self._is_hermitian(skew=False, tolerance=0) - def is_skew_hermitian(self): + def is_skew_hermitian(self) -> bool: r""" Return ``True`` if the matrix is equal to the negative of its conjugate transpose. @@ -4452,7 +4452,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self._is_hermitian(skew=True, tolerance=0) - def is_skew_symmetric(self): + def is_skew_symmetric(self) -> bool: """ Return ``True`` if ``self`` is a skew-symmetric matrix. @@ -4500,7 +4500,7 @@ cdef class Matrix(sage.structure.element.Matrix): return False return True - def is_alternating(self): + def is_alternating(self) -> bool: """ Return ``True`` if ``self`` is an alternating matrix. @@ -4656,7 +4656,7 @@ cdef class Matrix(sage.structure.element.Matrix): raise ValueError("The matrix is not a square matrix") return self._check_symmetrizability(return_diag=return_diag, skew=True, positive=positive) - def is_dense(self): + def is_dense(self) -> bool: """ Return ``True`` if this is a dense matrix. @@ -4672,7 +4672,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self.is_dense_c() - def is_sparse(self): + def is_sparse(self) -> bool: """ Return ``True`` if this is a sparse matrix. @@ -4688,10 +4688,11 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self.is_sparse_c() - def is_square(self): + def is_square(self) -> bool: """ - Return ``True`` precisely if this matrix is square, i.e., has the same - number of rows and columns. + Return ``True`` precisely if this matrix is square. + + This means that it has the same number of rows and columns. EXAMPLES:: @@ -4702,7 +4703,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self._nrows == self._ncols - def is_invertible(self): + def is_invertible(self) -> bool: r""" Return ``True`` if this matrix is invertible. @@ -4754,7 +4755,7 @@ cdef class Matrix(sage.structure.element.Matrix): is_unit = is_invertible - def is_singular(self): + def is_singular(self) -> bool: r""" Return ``True`` if ``self`` is singular. diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index 18be930317a..261c8a9ef51 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -467,7 +467,7 @@ def subfields(self, degree=0, name=None): ans = Sequence(ans, immutable=True, cr=bool(ans)) return ans - def is_absolute(self): + def is_absolute(self) -> bool: r""" Return ``False``, since this is not an absolute field. @@ -1171,14 +1171,15 @@ def _pari_base_nf(self): sage: k._pari_base_nf() [y^2 + 2, [0, 1], -8, 1, ..., [1, 0, 0, -2; 0, 1, 1, 0]] """ - abs_base, from_abs_base, to_abs_base = self.absolute_base_field() + abs_base, _, _ = self.absolute_base_field() return abs_base.pari_nf() - def is_galois(self): + def is_galois(self) -> bool: r""" For a relative number field, :meth:`is_galois` is deliberately not implemented, since it is not clear whether this would mean "Galois over `\QQ`" or "Galois over the given base field". + Use either :meth:`is_galois_absolute` or :meth:`is_galois_relative`, respectively. EXAMPLES:: @@ -1193,7 +1194,7 @@ def is_galois(self): """ raise NotImplementedError("For a relative number field L you must use either L.is_galois_relative() or L.is_galois_absolute() as appropriate") - def is_galois_relative(self): + def is_galois_relative(self) -> bool: r""" Return ``True`` if for this relative extension `L/K`, `L` is a Galois extension of `K`. @@ -1223,7 +1224,7 @@ def is_galois_relative(self): rel_poly = self.relative_polynomial() return d == len(rel_poly.base_extend(self).factor()) - def is_galois_absolute(self): + def is_galois_absolute(self) -> bool: r""" Return ``True`` if for this relative extension `L/K`, `L` is a Galois extension of `\QQ`. @@ -1238,7 +1239,7 @@ def is_galois_absolute(self): f = self.absolute_polynomial() return f.galois_group(pari_group=True).order() == self.absolute_degree() - def is_isomorphic_relative(self, other, base_isom=None): + def is_isomorphic_relative(self, other, base_isom=None) -> bool: r""" For this relative extension `L/K` and another relative extension `M/K`, return ``True`` if there is a `K`-linear isomorphism from `L` to `M`. More generally, ``other`` can be a @@ -1325,10 +1326,12 @@ def is_isomorphic_relative(self, other, base_isom=None): raise ValueError("base_isom is not a homomorphism from self's base_field to other's base_field") raise ValueError("other must be a relative number field.") - def is_CM_extension(self): + def is_CM_extension(self) -> bool: """ - Return ``True`` is this is a CM extension, i.e. a totally imaginary - quadratic extension of a totally real field. + Return ``True`` is this is a CM extension. + + This means a totally imaginary quadratic extension of a + totally real field. EXAMPLES:: @@ -2481,11 +2484,11 @@ def order(self, *gens, **kwds): gens = [self(x) for x in gens] return relative_order_from_ring_generators(gens, **kwds) - def is_free(self, proof=None): + def is_free(self, proof=None) -> bool: r""" Determine whether or not `L/K` is free. - (i.e. if `\mathcal{O}_L` is a free `\mathcal{O}_K`-module). + This means that `\mathcal{O}_L` is a free `\mathcal{O}_K`-module. INPUT: diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index be072ba3873..81434007b40 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -351,7 +351,7 @@ def singular_points(self, F=None): X = self.singular_subscheme() return [self.point(p, check=False) for p in X.rational_points(F=F)] - def is_singular(self, P=None): + def is_singular(self, P=None) -> bool: r""" Return whether ``P`` is a singular point of this curve, or if no point is passed, whether this curve is singular or not. diff --git a/src/sage/schemes/curves/point.py b/src/sage/schemes/curves/point.py index 782fc4abe14..35759171c91 100644 --- a/src/sage/schemes/curves/point.py +++ b/src/sage/schemes/curves/point.py @@ -42,7 +42,7 @@ class ProjectiveCurvePoint_field(SchemeMorphism_point_projective_field): """ Point of a projective curve over a field. """ - def is_singular(self): + def is_singular(self) -> bool: r""" Return whether this point is a singular point of the projective curve it is on. @@ -98,7 +98,7 @@ def tangents(self): """ return self.codomain().tangents(self) - def is_ordinary_singularity(self): + def is_ordinary_singularity(self) -> bool: r""" Return whether this point is an ordinary singularity of the projective plane curve it is on. @@ -127,7 +127,7 @@ def is_ordinary_singularity(self): """ return self.codomain().is_ordinary_singularity(self) - def is_transverse(self, D): + def is_transverse(self, D) -> bool: r""" Return whether the intersection of the curve ``D`` at this point with the curve this point is on is transverse or not. @@ -250,7 +250,7 @@ class IntegralProjectivePlaneCurvePoint_finite_field(ProjectivePlaneCurvePoint_f class AffineCurvePoint_field(SchemeMorphism_point_affine_field): - def is_singular(self): + def is_singular(self) -> bool: r""" Return whether this point is a singular point of the affine curve it is on. @@ -311,7 +311,7 @@ def tangents(self): """ return self.codomain().tangents(self) - def is_ordinary_singularity(self): + def is_ordinary_singularity(self) -> bool: r""" Return whether this point is an ordinary singularity of the affine plane curve it is on. @@ -336,7 +336,7 @@ def is_ordinary_singularity(self): """ return self.codomain().is_ordinary_singularity(self) - def is_transverse(self, D): + def is_transverse(self, D) -> bool: r""" Return whether the intersection of the curve ``D`` at this point with the curve this point is on is transverse or not. diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 56871de729a..4c3e644145b 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -817,7 +817,7 @@ def plot(self, *args, **kwds): C = Curve(self.affine_patch(patch)) return C.plot(*args, **kwds) - def is_singular(self, P=None): + def is_singular(self, P=None) -> bool: r""" Return whether this curve is singular or not, or if a point ``P`` is provided, whether ``P`` is a singular point of this curve. @@ -992,7 +992,7 @@ def tangents(self, P, factor=True): phi = H(G) return [phi(g).homogenize(x) for g in L] - def is_ordinary_singularity(self, P): + def is_ordinary_singularity(self, P) -> bool: r""" Return whether the singular point ``P`` of this projective plane curve is an ordinary singularity. @@ -1523,7 +1523,7 @@ def extension(self): pts.append(pt) return phi - def is_transverse(self, C, P): + def is_transverse(self, C, P) -> bool: r""" Return whether the intersection of this curve with the curve ``C`` at the point ``P`` is transverse. @@ -1652,7 +1652,7 @@ def arithmetic_genus(self): """ return 1 - self.defining_ideal().hilbert_polynomial()(0) - def is_complete_intersection(self): + def is_complete_intersection(self) -> bool: r""" Return whether this projective curve is a complete intersection. diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 0513edd70c3..f2d3629a9c9 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -739,7 +739,7 @@ def __richcmp__(self, other, op): return richcmp(self._filt, other._filt, op) - def is_isomorphic(self, other): + def is_isomorphic(self, other) -> bool: """ Test whether two bundles are isomorphic. diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 289246716cb..8bf6eb4c3d7 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -1232,7 +1232,7 @@ def dimension_singularities(self): return self.dimension() - codim return -1 - def is_homogeneous(self, polynomial): + def is_homogeneous(self, polynomial) -> bool: r""" Check if ``polynomial`` is homogeneous. @@ -1307,7 +1307,7 @@ def is_homogeneous(self, polynomial): return False return True - def is_isomorphic(self, another): + def is_isomorphic(self, another) -> bool: r""" Check if ``self`` is isomorphic to ``another``. diff --git a/src/sage/topology/cell_complex.py b/src/sage/topology/cell_complex.py index e2276fb8839..f69522b7c33 100644 --- a/src/sage/topology/cell_complex.py +++ b/src/sage/topology/cell_complex.py @@ -721,7 +721,7 @@ def betti(self, dim=None, subcomplex=None): else: return dic - def is_acyclic(self, base_ring=ZZ): + def is_acyclic(self, base_ring=ZZ) -> bool: """ Return ``True`` if the reduced homology with coefficients in ``base_ring`` of this cell complex is zero. @@ -1104,7 +1104,7 @@ def graph(self): """ raise NotImplementedError - def is_connected(self): + def is_connected(self) -> bool: """ Return ``True`` if this cell complex is connected. diff --git a/src/sage/topology/cubical_complex.py b/src/sage/topology/cubical_complex.py index 5df0a809e56..bfdb16d4c60 100644 --- a/src/sage/topology/cubical_complex.py +++ b/src/sage/topology/cubical_complex.py @@ -1015,7 +1015,7 @@ def __hash__(self): """ return hash(frozenset(self._facets)) - def is_subcomplex(self, other): + def is_subcomplex(self, other) -> bool: r""" Return ``True`` if ``self`` is a subcomplex of ``other``. diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index b6b58d72e98..fb4fc213421 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -431,7 +431,7 @@ def set(self): """ return self.__set - def is_face(self, other): + def is_face(self, other) -> bool: """ Return ``True`` iff this simplex is a face of other. @@ -552,7 +552,7 @@ def dimension(self): """ return len(self.__tuple) - 1 - def is_empty(self): + def is_empty(self) -> bool: """ Return ``True`` iff this simplex is the empty simplex. @@ -1410,7 +1410,7 @@ def face_iterator(self, increasing=True): n_faces = GenericCellComplex.n_cells - def is_pure(self): + def is_pure(self) -> bool: """ Return ``True`` iff this simplicial complex is pure. @@ -1718,7 +1718,7 @@ def flip_graph(self): edges[coF].append(F) return flipG - def is_pseudomanifold(self): + def is_pseudomanifold(self) -> bool: """ Return ``True`` if ``self`` is a pseudomanifold. @@ -2843,7 +2843,7 @@ def remove_faces(self, faces, check=False): for f in faces: self.remove_face(f, check=check) - def is_subcomplex(self, other): + def is_subcomplex(self, other) -> bool: """ Return ``True`` if this is a subcomplex of ``other``. @@ -3001,7 +3001,7 @@ def star(self, simplex, is_mutable=True): faces.append(f) return SimplicialComplex(faces, is_mutable=is_mutable) - def is_cohen_macaulay(self, base_ring=QQ, ncpus=0): + def is_cohen_macaulay(self, base_ring=QQ, ncpus=0) -> bool: r""" Return ``True`` if ``self`` is Cohen-Macaulay. @@ -3102,7 +3102,7 @@ def generated_subcomplex(self, sub_vertex_set, is_mutable=True): return SimplicialComplex(faces, maximality_check=True, is_mutable=is_mutable) - def is_shelling_order(self, shelling_order, certificate=False): + def is_shelling_order(self, shelling_order, certificate=False) -> bool: r""" Return if the order of the facets given by ``shelling_order`` is a shelling order for ``self``. @@ -3172,7 +3172,7 @@ def is_shelling_order(self, shelling_order, certificate=False): return True @cached_method - def is_shellable(self, certificate=False): + def is_shellable(self, certificate=False) -> bool: r""" Return if ``self`` is shellable. @@ -3800,7 +3800,7 @@ def delta_complex(self, sort_simplices=False): n_cells = bdries return DeltaComplex(data) - def is_flag_complex(self): + def is_flag_complex(self) -> bool: """ Return ``True`` if and only if ``self`` is a flag complex. @@ -4208,7 +4208,7 @@ def fundamental_group(self, base_point=None, simplify=True): else: return FG.quotient(rels) - def is_isomorphic(self, other, certificate=False): + def is_isomorphic(self, other, certificate=False) -> bool: r""" Check whether two simplicial complexes are isomorphic. @@ -4555,7 +4555,7 @@ def set_immutable(self): self._is_immutable = True self._facets = tuple(self._facets) - def is_mutable(self): + def is_mutable(self) -> bool: """ Return ``True`` if mutable. @@ -4576,7 +4576,7 @@ def is_mutable(self): """ return not self._is_immutable - def is_immutable(self): + def is_immutable(self) -> bool: """ Return ``True`` if immutable. @@ -4591,7 +4591,7 @@ def is_immutable(self): """ return self._is_immutable - def cone_vertices(self): + def cone_vertices(self) -> list: r""" Return the list of cone vertices of ``self``. @@ -4632,7 +4632,7 @@ def decone(self): V = set(self.vertices()).difference(self.cone_vertices()) return self.generated_subcomplex(V) - def is_balanced(self, check_purity=False, certificate=False): + def is_balanced(self, check_purity=False, certificate=False) -> bool: r""" Determine whether ``self`` is balanced. @@ -5004,6 +5004,8 @@ def is_golod(self) -> bool: Massey operations in the associated Tor-algebra are trivial. This is done by checking the bigraded Betti numbers. + .. SEEALSO:: :meth:`is_minimally_non_golod` + EXAMPLES:: sage: # needs sage.modules @@ -5014,11 +5016,11 @@ def is_golod(self) -> bool: sage: Y.is_golod() True """ - H = [a+b for a, b in self.bigraded_betti_numbers()] + H = [a + b for a, b in self.bigraded_betti_numbers()] if 0 in H: H.remove(0) - return not any(i+j in H for ii, i in enumerate(H) for j in H[ii:]) + return not any(i + j in H for ii, i in enumerate(H) for j in H[ii:]) def is_minimally_non_golod(self) -> bool: r"""