Skip to content

Commit

Permalink
Trac #33536: Some changes suggested by lgtm
Browse files Browse the repository at this point in the history
Namely, caution about arguments with default value `{}`.

URL: https://trac.sagemath.org/33536
Reported by: chapoton
Ticket author(s): Frédéric Chapoton
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Mar 31, 2022
2 parents b9cdb7c + 0f8e0d8 commit a5446db
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/sage/combinat/designs/bibd.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ def v_4_1_BIBD(v, check=True):

return bibd

def BIBD_from_PBD(PBD,v,k,check=True,base_cases={}):

def BIBD_from_PBD(PBD, v, k, check=True, base_cases=None):
r"""
Return a `(v,k,1)`-BIBD from a `(r,K)`-PBD where `r=(v-1)/(k-1)`.
Expand Down Expand Up @@ -868,6 +869,8 @@ def BIBD_from_PBD(PBD,v,k,check=True,base_cases={}):
sage: PBD = PBD_4_5_8_9_12(17)
sage: bibd = is_pairwise_balanced_design(BIBD_from_PBD(PBD,52,4),52,[4])
"""
if base_cases is None:
base_cases = {}
r = (v-1) // (k-1)
bibd = []
for X in PBD:
Expand Down
5 changes: 3 additions & 2 deletions src/sage/quivers/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ def __truediv__(self, sub):
"""
return self.quotient(sub)

def _submodule(self, spaces={}):
def _submodule(self, spaces=None):
"""
Return the submodule specified by the data.
Expand Down Expand Up @@ -1552,7 +1552,8 @@ def _submodule(self, spaces={}):
sage: M.submodule(M.gens()) is M # indirect doctest
True
"""

if spaces is None:
spaces = {}
# Add zero submodules
for v in self._quiver:
if v not in spaces:
Expand Down
11 changes: 5 additions & 6 deletions src/sage/rings/fraction_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def some_elements(self):
for a in self._R.some_elements():
for b in self._R.some_elements():
if a != b and self(a) and self(b):
ret.append(self(a)/self(b))
ret.append(self(a) / self(b))
return ret

def _gcd_univariate_polynomial(self, f, g):
Expand Down Expand Up @@ -945,6 +945,7 @@ def _gcd_univariate_polynomial(self, f, g):
g1 = Num(g.numerator())
return Pol(f1.gcd(g1)).monic()


class FractionField_1poly_field(FractionField_generic):
"""
The fraction field of a univariate polynomial ring over a field.
Expand Down Expand Up @@ -1065,7 +1066,6 @@ def _coerce_map_from_(self, R):
return super(FractionField_1poly_field, self)._coerce_map_from_(R)



class FractionFieldEmbedding(DefaultConvertMap_unique):
r"""
The embedding of an integral domain into its field of fractions.
Expand Down Expand Up @@ -1256,7 +1256,7 @@ def _call_(self, x, check=True):

def _call_with_args(self, x, args=(), kwds={}):
r"""
Evaluation this map at ``x``.
Evaluate this map at ``x``.
INPUT:
Expand All @@ -1268,10 +1268,9 @@ def _call_with_args(self, x, args=(), kwds={}):
sage: K = R.fraction_field()
sage: R(K.gen(), check=True)
x
"""
check = kwds.pop('check', True)
if args or kwds:
check = kwds.get('check', True)
if args or any(key != 'check' for key in kwds):
raise NotImplementedError("__call__ cannot be called with additional arguments other than check=True/False")
return self._call_(x, check=check)

Expand Down

0 comments on commit a5446db

Please sign in to comment.