Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing some ruff PLR warnings #39305

Merged
merged 2 commits into from
Jan 18, 2025
Merged
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
1 change: 0 additions & 1 deletion src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,6 @@ def check_base_ring_embedding(base_ring_embedding):
# initializing the basis extension (in case of more than 4 strands)
# ----------------------------------------------------------------------
self._init_basis_extension()
return

############################################################################
# --------------------------------------------------------------------------
Expand Down
7 changes: 2 additions & 5 deletions src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ def register_ring_hom(ring_hom):
except ValueError:
verbose('\nthe map:\n%s\ncannot be registered as conversion\n' % ring_hom)

return


# -----------------------------------------------------------------------------
# class for the Galois Group action on the generic extension ring corresponding
Expand Down Expand Up @@ -1005,11 +1003,10 @@ def __init__(self, names=('u', 'v', 'w', 's'), order='degrevlex', markov_trace_v
# Init of data used on demand
# ----------------------------------------------------------------------
self._mirror = None
return

############################################################################
# ########################################################################
# overloaded inherited methods
############################################################################
# ########################################################################
def _defining_names(self):
r"""
Return the generators of ``self`` as the defining names.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/affine_weyl_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def succ(pair):
if (length < k and i == u1.first_descent(side='left') and
u1.is_affine_grassmannian()):
yield (u1, length + 1)
return

return RecursivelyEnumeratedSet_forest(((self.one(), 0),), succ, algorithm='breadth',
category=FiniteEnumeratedSets(),
post_process=select_length)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/diagram_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -4795,7 +4795,7 @@ def insert_pairing(cur, intervals):
# Singleton intervals are vertical lines,
# so we don't need to worry about them
if len(I) > 1 and I[0] < cur[0]:
cur, level[j] = level[j], cur
cur, level[j] = I, cur
level.append([cur[0]])
level.append([cur[1]])
break
Expand Down
7 changes: 3 additions & 4 deletions src/sage/combinat/necklace.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,11 @@ def _fast_fixed_content(a, content, t, p, k, r, s, dll, equality=False):
content[j] += 1
j = dll.next(j)
a[t - 1] = k - 1
return


################################
# List Fixed Content Algorithm #
################################
# ###############################
# List Fixed Content Algorithm #
# ###############################
def _lfc(content, equality=False):
"""
EXAMPLES::
Expand Down
1 change: 0 additions & 1 deletion src/sage/combinat/non_decreasing_parking_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,5 @@ def iterator_rec(n):
return
for res in iterator_rec(self.n):
yield NonDecreasingParkingFunction(res)
return

Element = NonDecreasingParkingFunction
2 changes: 0 additions & 2 deletions src/sage/combinat/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -8133,8 +8133,6 @@ def __iter__(self):

yield self.element_class(self, tableau)

return

def list(self):
r"""
Return a list of the standard Young tableaux of the specified shape.
Expand Down
1 change: 0 additions & 1 deletion src/sage/combinat/tableau_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -4926,7 +4926,6 @@ def max_row_in_component(tab, r):
yield tableau_from_list(tab)

# all done!
return

def last(self):
r"""
Expand Down
4 changes: 0 additions & 4 deletions src/sage/combinat/words/suffix_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ def show(self, *args, **kwds):
sage: t.show() # needs sage.plot
"""
self.plot(*args, **kwds).show()
return

################################################################################
# Suffix Trees
Expand Down Expand Up @@ -656,7 +655,6 @@ def _process_letter(self, letter):
# set the active state
s, k = self._canonize(s, (k, i))
self._active_state = (s, (k, i+1))
return

def _test_and_split(self, s, k_p, letter):
r"""
Expand Down Expand Up @@ -918,7 +916,6 @@ def show(self, word_labels=None, *args, **kwds):
sage: t.show(word_labels=False) # needs sage.plot
"""
self.plot(word_labels=word_labels, *args, **kwds).show()
return

#####
# Various methods
Expand Down Expand Up @@ -1115,7 +1112,6 @@ def to_explicit_suffix_tree(self):
end_state, r = self._test_and_split(s, (k, i-1), end_of_string)
# remove the end of string symbol from the word
self._letters.pop()
return

def edge_iterator(self):
r"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/databases/cubic_hecke_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,6 @@ def update_basis_extensions(self, new_basis_extensions):
"""
self._data_library.update({self.section.basis_extensions: new_basis_extensions})
self.write(self.section.basis_extensions)
return


# -----------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/sage/graphs/bipartite_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,6 @@ def add_edge(self, u, v=None, label=None):

# add the edge
Graph.add_edge(self, u, v, label)
return

def add_edges(self, edges, loops=True):
"""
Expand Down
2 changes: 0 additions & 2 deletions src/sage/graphs/matching_covered_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2661,8 +2661,6 @@ def remove_loops(self, vertices=None):
raise TypeError(f'\'{vertices.__class__.__name__}\' '
'object is not iterable')

return

@doc_index('Miscellaneous methods')
def update_matching(self, matching):
r"""
Expand Down
9 changes: 0 additions & 9 deletions src/sage/groups/cubic_braid.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,6 @@ def __init__(self, names, cbg_type=None):
self._classical_embedding = None # if self._classical_group different from self._classical_base_group
self._centralizing_matrix = None # for Assion groups: element in classical base group commuting with self
self._centralizing_element = None # image under nat. map of the former one in the proj. classical group
return

def _repr_(self):
r"""
Expand Down Expand Up @@ -913,7 +912,6 @@ def _internal_test_attached_group(self, attached_group, tester):
if self.is_finite() and self.strands() <= 7: # not realistic for larger number of strands
att_grp_elem_back = self(att_grp_elem)
tester.assertEqual(att_grp_elem_back, elem)
return

def _test_classical_group(self, **options):
r"""
Expand All @@ -934,7 +932,6 @@ def _test_classical_group(self, **options):
classic_grp = self.as_classical_group()
if self.is_finite():
self._internal_test_attached_group(classic_grp, tester)
return

def _test_permutation_group(self, **options):
r"""
Expand All @@ -955,7 +952,6 @@ def _test_permutation_group(self, **options):
tester = self._tester(**options)
permgrp = self.as_permutation_group()
self._internal_test_attached_group(permgrp, tester)
return

def _test_matrix_group(self, **options):
r"""
Expand Down Expand Up @@ -1024,7 +1020,6 @@ def _test_reflection_group(self, **options):
tester = self._tester(**options)
reflgrp = self.as_reflection_group()
self._internal_test_attached_group(reflgrp, tester)
return

# -------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
Expand Down Expand Up @@ -1135,7 +1130,6 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
self._centralizing_matrix = centralizing_matrix
self._centralizing_element = centralizing_element
self._classical_embedding = embedding
return

# -------------------------------------------------------------------------------
# local methods to set up the classical group (specific part)
Expand Down Expand Up @@ -1210,7 +1204,6 @@ def transvec2mat(v, bas=bas, bform=bform, fact=1):
transvec_matrices = [transvec2mat(v) for v in transvections]

set_classical_realization(self, base_group, proj_group, centralizing_matrix, transvec_matrices)
return

# -------------------------------------------------------------------------------
# Case for unitary groups
Expand Down Expand Up @@ -1295,7 +1288,6 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
transvec_matrices = [transvec2mat(v) for v in transvections]

set_classical_realization(self, base_group, proj_group, centralizing_matrix, transvec_matrices)
return

# ----------------------------------------------------------------
# local functions declaration section finishes here
Expand Down Expand Up @@ -1346,7 +1338,6 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
self._classical_embedding = classical_group
if self._classical_invariant_form is None:
self._classical_invariant_form = classical_group.ambient().invariant_form()
return

def _element_constructor_(self, x, **kwds):
r"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/interfaces/octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ def quit(self, verbose=False):
if self._expect is not None:
if verbose:
print("Exiting spawned %s process." % self)
return

def _start(self):
"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/lfunctions/dokchitser.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ def _instantiate_gp(cls):

cls.__globals_re = re.compile(
'([^a-zA-Z0-9_]|^)(%s)([^a-zA-Z0-9_]|$)' % '|'.join(cls.__globals))
return

@classmethod
def _teardown_gp(cls, instance=None):
Expand Down
2 changes: 0 additions & 2 deletions src/sage/matrix/operation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,6 @@ def set_print_symbols(self, ascii, latex):
raise ValueError('LaTeX symbol must be a string, not %s' % latex)
self._ascii_symbol = ascii
self._latex_symbol = latex
return None

def column_keys(self):
r"""
Expand Down Expand Up @@ -931,7 +930,6 @@ def change_names(self, names):
(1,2)
"""
self._width, self._names, self._name_dict = self._name_maker(names)
return None

def matrix_of_variables(self):
r"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/matroids/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ def split_vertex(G, u, v=None, edges=None):
G.delete_edge(e)

# This modifies the graph without needing to return anything
return


def cmp_elements_key(x):
Expand Down
1 change: 0 additions & 1 deletion src/sage/plot/hyperbolic_arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def _bezier_path(self, z0, z1, model, first=False):
self.path.append(points[N: N + 3])
N += 3
self.last_plotted = "arc"
return


class HyperbolicArc(HyperbolicArcCore):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/quadratic_forms/quadratic_form__neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def neighbor_iteration(seeds, p, mass=None, max_classes=None,
def p_divisible_vectors(Q, max_neighbors):
yield from iter(v.lift() for v in Q.orbits_lines_mod_p(p)
if v != 0 and Q(v.lift()).valuation(p) > 0)
return

elif algorithm == 'exhaustion':
def p_divisible_vectors(Q, max_neighbors):
k = 0
Expand Down
1 change: 0 additions & 1 deletion src/sage/rings/lazy_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4948,7 +4948,6 @@ def compute_coefficients(self, i):
"""
from sage.misc.superseded import deprecation
deprecation(32367, "the method compute_coefficients obsolete and has no effect.")
return

def _im_gens_(self, codomain, im_gens, base_map=None):
"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/rings/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,3 @@ def test_karatsuba_multiplication(base_ring, maxdeg1, maxdeg2,
msg += "and\n"
msg += f"{sage_input(g)}"
raise ValueError(msg)
return
Loading