Skip to content

Commit 57c55ae

Browse files
committed
breaking lines after else: in pyx files
1 parent dc99dc8 commit 57c55ae

File tree

8 files changed

+277
-149
lines changed

8 files changed

+277
-149
lines changed

src/sage/coding/binary_code.pyx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ cdef codeword *expand_to_ortho_basis(BinaryCode B, int n) noexcept:
617617
i = k
618618
word = <codeword>1 << k
619619
k += 1
620-
else: # NOTE THIS WILL NEVER HAPPEN AS CURRENTLY SET UP!
620+
else: # NOTE THIS WILL NEVER HAPPEN AS CURRENTLY SET UP!
621621
temp = (<codeword>1 << k) - 1
622622
i = k
623623
word = <codeword>1 << k
@@ -813,7 +813,7 @@ cdef class BinaryCode:
813813
combination ^= (1 << j)
814814
word ^= self_basis[j]
815815

816-
else: # isinstance(arg1, BinaryCode)
816+
else: # isinstance(arg1, BinaryCode)
817817
other_basis = other.basis
818818
for i from 0 <= i < nrows-1:
819819
self_basis[i] = other_basis[i]
@@ -2423,9 +2423,12 @@ cdef class PartitionStack:
24232423
cdef int *self_wd_lvls = self.wd_lvls
24242424
cdef int *self_wd_ents = self.wd_ents
24252425
while True:
2426-
if CG.is_one(self_wd_ents[wd_ptr], col): i += 1
2427-
if self_wd_lvls[wd_ptr] > k: wd_ptr += 1
2428-
else: break
2426+
if CG.is_one(self_wd_ents[wd_ptr], col):
2427+
i += 1
2428+
if self_wd_lvls[wd_ptr] > k:
2429+
wd_ptr += 1
2430+
else:
2431+
break
24292432
return i
24302433

24312434
def _wd_degree(self, C, wd, col_ptr, k):
@@ -3347,15 +3350,17 @@ cdef class BinaryCodeClassifier:
33473350
if qzb > 0: zb__Lambda_rho[k] = Lambda[k]
33483351
state = 3
33493352

3350-
elif state == 3: # attempt to rule out automorphisms while moving down the tree
3353+
elif state == 3: # attempt to rule out automorphisms while moving down the tree
33513354
# if k > hzf, then we know that nu currently does not look like zeta, the first
33523355
# terminal node encountered, thus there is no automorphism to discover. If qzb < 0,
33533356
# i.e. Lambda[k] < zb[k], then the indicator is not maximal, and we can't reach a
33543357
# canonical leaf. If neither of these is the case, then proceed to state 4.
3355-
if hzf__h_zeta <= k or qzb >= 0: state = 4
3356-
else: state = 6
3358+
if hzf__h_zeta <= k or qzb >= 0:
3359+
state = 4
3360+
else:
3361+
state = 6
33573362

3358-
elif state == 4: # at this point we have -not- ruled out the presence of automorphisms
3363+
elif state == 4: # at this point we have -not- ruled out the presence of automorphisms
33593364
if nu.is_discrete(k):
33603365
state = 7
33613366
continue # we have a terminal node, so process it
@@ -3368,7 +3373,7 @@ cdef class BinaryCodeClassifier:
33683373
e[k] = 0 # see state 12 and 17
33693374
state = 2 # continue down the tree
33703375

3371-
elif state == 5: # same as state 3, but in the case where we haven't yet defined zeta
3376+
elif state == 5: # same as state 3, but in the case where we haven't yet defined zeta
33723377
# i.e. this is our first time down the tree. Once we get to the bottom,
33733378
# we will have zeta = nu = rho, so we do:
33743379
zf__Lambda_zeta[k] = Lambda[k]

src/sage/libs/mpmath/ext_impl.pyx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,10 +1183,14 @@ cdef MPF_exp(MPF *y, MPF *x, MPopts opts):
11831183
cdef mpz_t t, u
11841184
cdef tuple w
11851185
if x.special:
1186-
if x.special == S_ZERO: MPF_set_si(y, 1)
1187-
elif x.special == S_NINF: MPF_set_zero(y)
1188-
elif x.special == S_INF: MPF_set_inf(y)
1189-
else: MPF_set_nan(y)
1186+
if x.special == S_ZERO:
1187+
MPF_set_si(y, 1)
1188+
elif x.special == S_NINF:
1189+
MPF_set_zero(y)
1190+
elif x.special == S_INF:
1191+
MPF_set_inf(y)
1192+
else:
1193+
MPF_set_nan(y)
11901194
return
11911195
wp = opts.prec + 14
11921196
sign = mpz_sgn(x.man) < 0

src/sage/libs/mpmath/utils.pyx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,15 @@ cpdef normalize(long sign, Integer man, exp, long bc, long prec, str rnd):
134134
elif rnd == 'd':
135135
mpz_fdiv_q_2exp(res.value, man.value, shift)
136136
elif rnd == 'f':
137-
if sign: mpz_cdiv_q_2exp(res.value, man.value, shift)
138-
else: mpz_fdiv_q_2exp(res.value, man.value, shift)
137+
if sign:
138+
mpz_cdiv_q_2exp(res.value, man.value, shift)
139+
else:
140+
mpz_fdiv_q_2exp(res.value, man.value, shift)
139141
elif rnd == 'c':
140-
if sign: mpz_fdiv_q_2exp(res.value, man.value, shift)
141-
else: mpz_cdiv_q_2exp(res.value, man.value, shift)
142+
if sign:
143+
mpz_fdiv_q_2exp(res.value, man.value, shift)
144+
else:
145+
mpz_cdiv_q_2exp(res.value, man.value, shift)
142146
elif rnd == 'u':
143147
mpz_cdiv_q_2exp(res.value, man.value, shift)
144148
exp += shift

src/sage/libs/singular/singular.pyx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,18 @@ cdef Rational si2sa_QQ(number *n, number **nn, ring *_ring):
9696

9797
mpq_init(_z)
9898

99-
## Immediate integers handles carry the tag 'SR_INT', i.e. the last bit is 1.
100-
## This distinguishes immediate integers from other handles which point to
101-
## structures aligned on 4 byte boundaries and therefore have last bit zero.
102-
## (The second bit is reserved as tag to allow extensions of this scheme.)
103-
## Using immediates as pointers and dereferencing them gives address errors.
99+
# Immediate integers handles carry the tag 'SR_INT', i.e. the last bit is 1.
100+
# This distinguishes immediate integers from other handles which point to
101+
# structures aligned on 4 byte boundaries and therefore have last bit zero.
102+
# (The second bit is reserved as tag to allow extensions of this scheme.)
103+
# Using immediates as pointers and dereferencing them gives address errors.
104104
nom = nlGetNumerator(n, _ring.cf)
105105
mpz_init(nom_z)
106106

107-
if (SR_HDL(nom) & SR_INT): mpz_set_si(nom_z, SR_TO_INT(nom))
108-
else: mpz_set(nom_z,nom.z)
107+
if (SR_HDL(nom) & SR_INT):
108+
mpz_set_si(nom_z, SR_TO_INT(nom))
109+
else:
110+
mpz_set(nom_z,nom.z)
109111

110112
mpq_set_num(_z,nom_z)
111113
nlDelete(&nom,_ring.cf)
@@ -114,8 +116,10 @@ cdef Rational si2sa_QQ(number *n, number **nn, ring *_ring):
114116
denom = nlGetDenom(n, _ring.cf)
115117
mpz_init(denom_z)
116118

117-
if (SR_HDL(denom) & SR_INT): mpz_set_si(denom_z, SR_TO_INT(denom))
118-
else: mpz_set(denom_z,denom.z)
119+
if (SR_HDL(denom) & SR_INT):
120+
mpz_set_si(denom_z, SR_TO_INT(denom))
121+
else:
122+
mpz_set(denom_z,denom.z)
119123

120124
mpq_set_den(_z, denom_z)
121125
nlDelete(&denom,_ring.cf)

0 commit comments

Comments
 (0)