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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

various ruff fixes in combinat #37958

Merged
merged 4 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/sage/combinat/cluster_algebra_quiver/quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,8 @@ def qmu_save(self, filename=None):
string.append('1')
string.append('//Matrix')
string.append(str(m) + ' ' + str(m))
for i in range(m):
string.append(' '.join(str(M[i, j])
for j in range(m)))
string.extend(' '.join(str(M[i, j]) for j in range(m))
for i in range(m))
string.append('//Points')

for i in range(m):
Expand Down
88 changes: 44 additions & 44 deletions src/sage/combinat/nu_dyck_word.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def _latex_(self):
if latex_options['show_grid']:
grid = [((0, 0), (self.width(), self.height()))]
for v1, v2 in grid:
res += " \\draw[dotted] %s grid %s;" % (str(v1), str(v2))
res += f" \\draw[dotted] {v1} grid {v2};"
res += "\n"

# Add points if wanted
Expand All @@ -838,8 +838,8 @@ def _latex_(self):
radius = 0.15 + .03 * latex_options['line width']
for v in self.points():
res += " \\draw[line width=2,"
res += "color=%s,fill=%s]" % (pt_color, pt_color)
res += "%s circle (%s);" % (str(v), str(radius))
res += f"color={pt_color},fill={pt_color}]"
res += f"{v} circle ({radius});"
res += "\n"

# Add nu if wanted
Expand All @@ -853,7 +853,7 @@ def _latex_(self):
res += ";\n"

# setup Path
res += " \\draw[rounded corners=1, color=%s, line width=%s]" % (
res += " \\draw[rounded corners=1, color={}, line width={}]".format(
latex_options['color'],
str(latex_options['line width'])
)
Expand Down Expand Up @@ -1210,46 +1210,46 @@ class options(GlobalOptions):
"""
NAME = 'NuDyckWords'
module = 'sage.combinat.nu_dyck_path'
display = dict(default="list",
description='Specifies how nu Dyck words should be printed',
values=dict(list='displayed as a list',
lattice='displayed on the lattice defined by ``diagram_style``'),
case_sensitive=False)
ascii_art = dict(default="pretty_output",
description='Specifies how the ascii art of nu Dyck words should be printed',
values=dict(pretty_output="Using pretty printing"),
alias=dict(pretty_print="pretty_output",),
case_sensitive=False)
diagram_style = dict(default="grid",
values=dict(
grid='printing as paths on a grid using N and E steps',),
alias={'N-E': 'grid'},
case_sensitive=False)
latex_tikz_scale = dict(default=1,
description='The default value for the tikz scale when latexed',
checker=lambda x: True) # More trouble than it's worth to check
latex_line_width_scalar = dict(default=2,
description='The default value for the line width as a '
'multiple of the tikz scale when latexed',
checker=lambda x: True) # More trouble than it's worth to check
latex_color = dict(default="black",
description='The default value for the color when latexed',
checker=lambda x: isinstance(x, str))
latex_show_points = dict(default=False,
description='The default value for showing points',
checker=lambda x: isinstance(x, bool))
latex_points_color = dict(default='black',
description='The default value for path color.',
checker=lambda x: isinstance(x, str))
latex_show_grid = dict(default=True,
description='The default value for showing grid',
checker=lambda x: isinstance(x, bool))
latex_show_nu = dict(default=True,
description='The default value for showing nu',
checker=lambda x: isinstance(x, bool))
latex_nu_options = dict(default='rounded corners=1, color=red, line width=1',
description='The default value for options for nu path',
checker=lambda x: isinstance(x, str))
display = {'default': "list",
'description': 'Specifies how nu Dyck words should be printed',
'values': {'list': 'displayed as a list',
'lattice': 'displayed on the lattice defined by ``diagram_style``'},
'case_sensitive': False}
ascii_art = {'default': "pretty_output",
'description': 'Specifies how the ascii art of nu Dyck words should be printed',
'values': {'pretty_output': "Using pretty printing"},
'alias': {'pretty_print': "pretty_output"},
'case_sensitive': False}
diagram_style = {'default': "grid",
'values': {
'grid': 'printing as paths on a grid using N and E steps'},
'alias': {'N-E': 'grid'},
'case_sensitive': False}
latex_tikz_scale = {'default': 1,
'description': 'The default value for the tikz scale when latexed',
'checker': lambda x: True} # More trouble than it's worth to check
latex_line_width_scalar = {'default': 2,
'description': 'The default value for the line width as a '
'multiple of the tikz scale when latexed',
'checker': lambda x: True} # More trouble than it's worth to check
latex_color = {'default': "black",
'description': 'The default value for the color when latexed',
'checker': lambda x: isinstance(x, str)}
latex_show_points = {'default': False,
'description': 'The default value for showing points',
'checker': lambda x: isinstance(x, bool)}
latex_points_color = {'default': 'black',
'description': 'The default value for path color.',
'checker': lambda x: isinstance(x, str)}
latex_show_grid = {'default': True,
'description': 'The default value for showing grid',
'checker': lambda x: isinstance(x, bool)}
latex_show_nu = {'default': True,
'description': 'The default value for showing nu',
'checker': lambda x: isinstance(x, bool)}
latex_nu_options = {'default': 'rounded corners=1, color=red, line width=1',
'description': 'The default value for options for nu path',
'checker': lambda x: isinstance(x, str)}

def _element_constructor_(self, word):
"""
Expand Down