Skip to content

Commit c73d6b8

Browse files
author
Release Manager
committed
sagemathgh-39348: fix details in q_numbers just a few things in the modified file in particular the ruff warning about PLR1716 ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: sagemath#39348 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 148e652 + d1d3288 commit c73d6b8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/sage/algebras/quantum_groups/q_numbers.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
typically used in combinatorics (see :mod:`sage.combinat.q_analogues`).
88
"""
99

10-
#*****************************************************************************
10+
# ***************************************************************************
1111
# Copyright (C) 2013-2017 Travis Scrimshaw <tcscrims at gmail.com>
1212
#
1313
# This program is free software: you can redistribute it and/or modify
1414
# it under the terms of the GNU General Public License as published by
1515
# the Free Software Foundation, either version 2 of the License, or
1616
# (at your option) any later version.
17-
# http://www.gnu.org/licenses/
18-
#*****************************************************************************
17+
# https://www.gnu.org/licenses/
18+
# ***************************************************************************
1919

2020
from sage.misc.misc_c import prod
2121
from sage.rings.integer_ring import ZZ
@@ -181,7 +181,8 @@ def q_binomial(n, k, q=None):
181181
TESTS::
182182
183183
sage: from sage.algebras.quantum_groups.q_numbers import q_binomial
184-
sage: all(q_binomial(n, k, 1) == binomial(n, k) for n in range(7) for k in range(n+1))
184+
sage: all(q_binomial(n, k, 1) == binomial(n, k)
185+
....: for n in range(6) for k in range(n+1))
185186
True
186187
sage: q_binomial(-2, 1)
187188
Traceback (most recent call last):
@@ -190,13 +191,13 @@ def q_binomial(n, k, q=None):
190191
"""
191192
# sanity checks
192193
if not (n in ZZ and k in ZZ):
193-
raise ValueError("arguments ({}, {}) must be integers".format(n, k))
194+
raise ValueError(f"arguments ({n}, {k}) must be integers")
194195
if n < 0:
195196
raise ValueError('n must be nonnegative')
196-
if not (0 <= k and k <= n):
197+
if not (0 <= k <= n):
197198
return 0
198199

199-
k = min(n - k, k) # Pick the smallest k
200+
k = min(n - k, k) # Pick the smallest k
200201
denomin = q_factorial(n - k, q) * q_factorial(k, q)
201202
numerat = q_factorial(n, q)
202203
try:

0 commit comments

Comments
 (0)