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

simplify some iterations (ruff PERF102) #38390

Merged
merged 1 commit into from
Aug 3, 2024
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
4 changes: 2 additions & 2 deletions src/sage/categories/pushout.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,12 +1985,12 @@ def _apply_functor(self, R):
name = self.name_mapping.get(R, None)
latex_name = self.latex_name_mapping.get(R, None)
if name is None:
for base_ring, name in self.name_mapping.items():
for name in self.name_mapping.values():
name = f'{name}_base_ext'
break
if latex_name is None:
from sage.misc.latex import latex
for base_ring, latex_name in self.latex_name_mapping.items():
for latex_name in self.latex_name_mapping.values():
latex_name = fr'{latex_name} \otimes {latex(R)}'
break
if name is None and latex_name is None:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/scalarfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def _del_derived(self):
ScalarField._del_derived(self) # derived quantities of the mother class
self._differential = None # reset of the differential
# First deletes any reference to self in the vectors' dictionaries:
for vid, val in self._lie_derivatives.items():
for val in self._lie_derivatives.values():
del val[0]._lie_der_along_self[id(self)]
# Then clears the dictionary of Lie derivatives
self._lie_derivatives.clear()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/tensorfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def _del_derived(self):

"""
# First deletes any reference to self in the vectors' dictionaries:
for vid, val in self._lie_derivatives.items():
for val in self._lie_derivatives.values():
del val[0]._lie_der_along_self[id(self)]
# Then clears the dictionary of Lie derivatives
self._lie_derivatives.clear()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/vectorfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@

"""
if self._lie_der_along_self != {}:
for idtens, tens in self._lie_der_along_self.items():
for tens in self._lie_der_along_self.values():

Check warning on line 303 in src/sage/manifolds/differentiable/vectorfield.py

View check run for this annotation

Codecov / codecov/patch

src/sage/manifolds/differentiable/vectorfield.py#L303

Added line #L303 was not covered by tests
del tens._lie_derivatives[id(self)]
self._lie_der_along_self.clear()

Expand Down
2 changes: 1 addition & 1 deletion src/sage/repl/rich_output/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def available_options(self):
(align_latex, graphics, supplemental_plot, text)
"""
options = []
for key, value in self.__class__.__dict__.items():
for value in self.__class__.__dict__.values():
if isinstance(value, Property):
options.append(value)
return tuple(sorted(options, key=str))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/conway_polynomials.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def _frobenius_shift(K, generators, check_only=False):
q, x = compatible[m].popitem()
except KeyError:
break
for qq, xx in compatible[m].items():
for xx in compatible[m].values():
assert x == xx
return
crt = {}
Expand Down
Loading