Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sage/rings/function_field/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def create_key(self, polynomial, names):
"""
if names is None:
names = polynomial.variable_name()
if not isinstance(names,tuple):
if not isinstance(names, tuple):
names = (names,)
return (polynomial,names,polynomial.base_ring())
return (polynomial, names, polynomial.base_ring())

def create_object(self, version, key, **extra_args):
"""
Expand All @@ -197,7 +197,7 @@ def create_object(self, version, key, **extra_args):
base_field = f.base_ring()
if isinstance(base_field, function_field_rational.RationalFunctionField):
k = base_field.constant_field()
if k.is_finite(): # then we are in positive characteristic
if k.is_finite(): # then we are in positive characteristic
# irreducible and separable
if f.is_irreducible() and not all(e % k.characteristic() == 0 for e in f.exponents()):
# monic and integral
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/function_field/derivations.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FunctionFieldDerivation(RingDerivationWithoutTwist):
sage: d
d/dx
"""
def __init__(self, parent):
def __init__(self, parent) -> None:
r"""
Initialize a derivation.

Expand Down
12 changes: 6 additions & 6 deletions src/sage/rings/function_field/derivations_polymod.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FunctionFieldDerivation_separable(FunctionFieldDerivation):
sage: L.derivation()
d/dx
"""
def __init__(self, parent, d):
def __init__(self, parent, d) -> None:
"""
Initialize a derivation.

Expand Down Expand Up @@ -164,7 +164,7 @@ def _lmul_(self, factor):


class FunctionFieldDerivation_inseparable(FunctionFieldDerivation):
def __init__(self, parent, u=None):
def __init__(self, parent, u=None) -> None:
r"""
Initialize this derivation.

Expand Down Expand Up @@ -286,7 +286,7 @@ class FunctionFieldHigherDerivation(Map):
From: Rational function field in x over Finite Field of size 2
To: Rational function field in x over Finite Field of size 2
"""
def __init__(self, field):
def __init__(self, field) -> None:
"""
Initialize.

Expand Down Expand Up @@ -386,7 +386,7 @@ class RationalFunctionFieldHigherDerivation_global(FunctionFieldHigherDerivation
sage: h(x^2, 2)
1
"""
def __init__(self, field):
def __init__(self, field) -> None:
"""
Initialize.

Expand Down Expand Up @@ -580,7 +580,7 @@ class FunctionFieldHigherDerivation_global(FunctionFieldHigherDerivation):
((x^7 + 1)/x^2)*y^2 + x^3*y
"""

def __init__(self, field):
def __init__(self, field) -> None:
"""
Initialize.

Expand Down Expand Up @@ -826,7 +826,7 @@ class FunctionFieldHigherDerivation_char_zero(FunctionFieldHigherDerivation):
sage: h(h(h(e,1),1),1) == 3*2*h(e,3)
True
"""
def __init__(self, field):
def __init__(self, field) -> None:
"""
Initialize.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/function_field/derivations_rational.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FunctionFieldDerivation_rational(FunctionFieldDerivation):
sage: K.derivation()
d/dx
"""
def __init__(self, parent, u=None):
def __init__(self, parent, u=None) -> None:
"""
Initialize a derivation.

Expand Down
32 changes: 16 additions & 16 deletions src/sage/rings/function_field/differential.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class FunctionFieldDifferential(ModuleElement):
sage: y.differential() # needs sage.rings.function_field
((21/4*x/(x^7 + 27/4))*y^2 + ((3/2*x^7 + 9/4)/(x^8 + 27/4*x))*y + 7/2*x^4/(x^7 + 27/4)) d(x)
"""
def __init__(self, parent, f, t=None):
def __init__(self, parent, f, t=None) -> None:
"""
Initialize the differential `fdt`.

Expand All @@ -116,7 +116,7 @@ def __init__(self, parent, f, t=None):

self._f = f

def _repr_(self):
def _repr_(self) -> str:
"""
Return the string representation of the differential.

Expand All @@ -132,7 +132,7 @@ def _repr_(self):
sage: f.differential()
(-1/x^2) d(x)
"""
if self._f.is_zero(): # zero differential
if self._f.is_zero(): # zero differential
return '0'

r = 'd({})'.format(self.parent()._gen_base_differential)
Expand All @@ -142,7 +142,7 @@ def _repr_(self):

return '({})'.format(self._f) + ' ' + r

def _latex_(self):
def _latex_(self) -> str:
r"""
Return a latex representation of the differential.

Expand All @@ -155,7 +155,7 @@ def _latex_(self):
sage: latex(w) # needs sage.rings.function_field
\left( x y^{2} + \frac{1}{x} y \right)\, dx
"""
if self._f.is_zero(): # zero differential
if self._f.is_zero(): # zero differential
return '0'

r = 'd{}'.format(self.parent()._gen_base_differential)
Expand All @@ -165,7 +165,7 @@ def _latex_(self):

return '\\left(' + latex(self._f) + '\\right)\\,' + r

def __hash__(self):
def __hash__(self) -> int:
"""
Return the hash of ``self``.

Expand Down Expand Up @@ -396,7 +396,7 @@ def divisor(self):
"""
F = self.parent().function_field()
x = F.base_field().gen()
return self._f.divisor() + (-2)*F(x).divisor_of_poles() + F.different()
return self._f.divisor() + (-2) * F(x).divisor_of_poles() + F.different()

def valuation(self, place):
"""
Expand All @@ -416,7 +416,7 @@ def valuation(self, place):
"""
F = self.parent().function_field()
x = F.base_field().gen()
return (self._f.valuation(place) + 2*min(F(x).valuation(place), 0)
return (self._f.valuation(place) + 2 * min(F(x).valuation(place), 0)
+ F.different().valuation(place))

def residue(self, place):
Expand Down Expand Up @@ -471,7 +471,7 @@ def residue(self, place):
sage: sum([QQ(w.residue(p)) for p in d.support()])
0
"""
R,fr_R,to_R = place._residue_field()
R, fr_R, to_R = place._residue_field()

# Step 1: compute f such that fds equals this differential.
s = place.local_uniformizer()
Expand All @@ -485,10 +485,10 @@ def residue(self, place):
return R.zero()
else:
g_shifted = g * s**(-r)
c = g_shifted.higher_derivative(-r-1, s)
c = g_shifted.higher_derivative(-r - 1, s)
return to_R(c)

def monomial_coefficients(self, copy=True):
def monomial_coefficients(self, copy: bool = True):
"""
Return a dictionary whose keys are indices of basis elements in the
support of ``self`` and whose values are the corresponding coefficients.
Expand Down Expand Up @@ -600,7 +600,7 @@ class DifferentialsSpace(UniqueRepresentation, Parent):
"""
Element = FunctionFieldDifferential

def __init__(self, field, category=None):
def __init__(self, field, category=None) -> None:
"""
Initialize the space of differentials of the function field.

Expand All @@ -627,7 +627,7 @@ def __init__(self, field, category=None):
self._gen_base_differential = F.gen()
self._gen_derivative_inv = ~der(F.gen()) # used for fast computation

def _repr_(self):
def _repr_(self) -> str:
"""
Return the string representation of the space of differentials.

Expand Down Expand Up @@ -770,7 +770,7 @@ class DifferentialsSpaceInclusion(Morphism):
To: Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3
"""

def _repr_(self):
def _repr_(self) -> str:
"""
Return the string representation of this morphism.

Expand All @@ -790,7 +790,7 @@ def _repr_(self):
s += "\n To: {}".format(self.codomain())
return s

def is_injective(self):
def is_injective(self) -> bool:
"""
Return ``True``, since the inclusion morphism is injective.

Expand Down Expand Up @@ -849,4 +849,4 @@ def _call_(self, v):
"""
domain = self.domain()
F = self.codomain().function_field()
return F(v._f)*F(domain._gen_base_differential).differential()
return F(v._f) * F(domain._gen_base_differential).differential()
Loading
Loading