Skip to content

Commit 193054b

Browse files
Merge pull request #205 from fchapoton/fix_code_E701
fix E701
2 parents 1c19c76 + c09d402 commit 193054b

File tree

10 files changed

+156
-82
lines changed

10 files changed

+156
-82
lines changed

src/flint/flintlib/fmpz_mpoly.pxd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ cdef extern from "flint/fmpz_mpoly.h":
242242
void fmpz_mpoly_symmetric_gens(fmpz_mpoly_t res, ulong k, slong * vars, slong n, const fmpz_mpoly_ctx_t ctx)
243243
void fmpz_mpoly_symmetric(fmpz_mpoly_t res, ulong k, const fmpz_mpoly_ctx_t ctx)
244244
# undocumented functions
245-
void _fmpz_mpoly_push_exp_ffmpz(fmpz_mpoly_t A, const fmpz_struct * exp, const fmpz_mpoly_ctx_t ctx);
246-
void _fmpz_mpoly_push_exp_pfmpz(fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx);
247-
void _fmpz_mpoly_push_exp_ui(fmpz_mpoly_t A, const ulong * exp, const fmpz_mpoly_ctx_t ctx);
245+
void _fmpz_mpoly_push_exp_ffmpz(fmpz_mpoly_t A, const fmpz_struct * exp, const fmpz_mpoly_ctx_t ctx)
246+
void _fmpz_mpoly_push_exp_pfmpz(fmpz_mpoly_t A, fmpz_struct * const * exp, const fmpz_mpoly_ctx_t ctx)
247+
void _fmpz_mpoly_push_exp_ui(fmpz_mpoly_t A, const ulong * exp, const fmpz_mpoly_ctx_t ctx)
248248

249249
# Macros
250250
fmpz_mpoly_struct *fmpz_mpoly_vec_entry(fmpz_mpoly_vec_t vec, slong i)

src/flint/flintlib/fmpz_mpoly_factor.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cdef extern from "flint/fmpz_mpoly_factor.h":
1414
slong num
1515
slong alloc
1616

17-
ctypedef fmpz_mpoly_factor_struct fmpz_mpoly_factor_t[1];
17+
ctypedef fmpz_mpoly_factor_struct fmpz_mpoly_factor_t[1]
1818

1919
void fmpz_mpoly_factor_init(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx)
2020
void fmpz_mpoly_factor_clear(fmpz_mpoly_factor_t f, const fmpz_mpoly_ctx_t ctx)

src/flint/flintlib/fq_nmod.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ cdef extern from "flint/fq_nmod.h":
100100
void fq_nmod_one(fq_nmod_t rop, const fq_nmod_ctx_t ctx)
101101
void fq_nmod_gen(fq_nmod_t rop, const fq_nmod_ctx_t ctx)
102102
int fq_nmod_get_fmpz(fmpz_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx)
103-
void fq_nmod_get_nmod_poly(nmod_poly_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx);
104-
void fq_nmod_set_nmod_poly(fq_nmod_t a, const nmod_poly_t b, const fq_nmod_ctx_t ctx);
103+
void fq_nmod_get_nmod_poly(nmod_poly_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx)
104+
void fq_nmod_set_nmod_poly(fq_nmod_t a, const nmod_poly_t b, const fq_nmod_ctx_t ctx)
105105
void fq_nmod_get_nmod_mat(nmod_mat_t col, const fq_nmod_t a, const fq_nmod_ctx_t ctx)
106106
void fq_nmod_set_nmod_mat(fq_nmod_t a, const nmod_mat_t col, const fq_nmod_ctx_t ctx)
107107
int fq_nmod_is_zero(const fq_nmod_t op, const fq_nmod_ctx_t ctx)

src/flint/types/acb.pyx

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ cdef class acb(flint_scalar):
202202
res = acb_eq(s.val, tval)
203203
else:
204204
res = acb_ne(s.val, tval)
205-
if ttype == FMPZ_TMP: acb_clear(tval)
205+
if ttype == FMPZ_TMP:
206+
acb_clear(tval)
206207
return res
207208

208209
def __contains__(self, other):
@@ -402,7 +403,8 @@ cdef class acb(flint_scalar):
402403
return NotImplemented
403404
u = acb.__new__(acb)
404405
acb_add((<acb>u).val, (<acb>s).val, tval, getprec())
405-
if ttype == FMPZ_TMP: acb_clear(tval)
406+
if ttype == FMPZ_TMP:
407+
acb_clear(tval)
406408
return u
407409

408410
def __radd__(s, t):
@@ -413,7 +415,8 @@ cdef class acb(flint_scalar):
413415
return NotImplemented
414416
u = acb.__new__(acb)
415417
acb_add((<acb>u).val, tval, s.val, getprec())
416-
if ttype == FMPZ_TMP: acb_clear(tval)
418+
if ttype == FMPZ_TMP:
419+
acb_clear(tval)
417420
return u
418421

419422
def __sub__(s, t):
@@ -424,7 +427,8 @@ cdef class acb(flint_scalar):
424427
return NotImplemented
425428
u = acb.__new__(acb)
426429
acb_sub((<acb>u).val, (<acb>s).val, tval, getprec())
427-
if ttype == FMPZ_TMP: acb_clear(tval)
430+
if ttype == FMPZ_TMP:
431+
acb_clear(tval)
428432
return u
429433

430434
def __rsub__(s, t):
@@ -435,7 +439,8 @@ cdef class acb(flint_scalar):
435439
return NotImplemented
436440
u = acb.__new__(acb)
437441
acb_sub((<acb>u).val, tval, s.val, getprec())
438-
if ttype == FMPZ_TMP: acb_clear(tval)
442+
if ttype == FMPZ_TMP:
443+
acb_clear(tval)
439444
return u
440445

441446
def __mul__(s, t):
@@ -446,7 +451,8 @@ cdef class acb(flint_scalar):
446451
return NotImplemented
447452
u = acb.__new__(acb)
448453
acb_mul((<acb>u).val, (<acb>s).val, tval, getprec())
449-
if ttype == FMPZ_TMP: acb_clear(tval)
454+
if ttype == FMPZ_TMP:
455+
acb_clear(tval)
450456
return u
451457

452458
def __rmul__(s, t):
@@ -457,7 +463,8 @@ cdef class acb(flint_scalar):
457463
return NotImplemented
458464
u = acb.__new__(acb)
459465
acb_mul((<acb>u).val, tval, s.val, getprec())
460-
if ttype == FMPZ_TMP: acb_clear(tval)
466+
if ttype == FMPZ_TMP:
467+
acb_clear(tval)
461468
return u
462469

463470
def __truediv__(s, t):
@@ -468,7 +475,8 @@ cdef class acb(flint_scalar):
468475
return NotImplemented
469476
u = acb.__new__(acb)
470477
acb_div((<acb>u).val, (<acb>s).val, tval, getprec())
471-
if ttype == FMPZ_TMP: acb_clear(tval)
478+
if ttype == FMPZ_TMP:
479+
acb_clear(tval)
472480
return u
473481

474482
def __rtruediv__(s, t):
@@ -479,7 +487,8 @@ cdef class acb(flint_scalar):
479487
return NotImplemented
480488
u = acb.__new__(acb)
481489
acb_div((<acb>u).val, tval, s.val, getprec())
482-
if ttype == FMPZ_TMP: acb_clear(tval)
490+
if ttype == FMPZ_TMP:
491+
acb_clear(tval)
483492
return u
484493

485494
def __pow__(s, t, u):
@@ -492,7 +501,8 @@ cdef class acb(flint_scalar):
492501
return NotImplemented
493502
u = acb.__new__(acb)
494503
acb_pow((<acb>u).val, (<acb>s).val, tval, getprec())
495-
if ttype == FMPZ_TMP: acb_clear(tval)
504+
if ttype == FMPZ_TMP:
505+
acb_clear(tval)
496506
return u
497507

498508
def __rpow__(s, t, u):
@@ -505,7 +515,8 @@ cdef class acb(flint_scalar):
505515
return NotImplemented
506516
u = acb.__new__(acb)
507517
acb_pow((<acb>u).val, tval, s.val, getprec())
508-
if ttype == FMPZ_TMP: acb_clear(tval)
518+
if ttype == FMPZ_TMP:
519+
acb_clear(tval)
509520
return u
510521

511522
def union(s, t):
@@ -1535,11 +1546,16 @@ cdef class acb(flint_scalar):
15351546
c = any_as_acb(c)
15361547
u = acb.__new__(acb)
15371548
flags = 0
1538-
if regularized: flags |= 1
1539-
if ab: flags |= 2
1540-
if ac: flags |= 4
1541-
if bc: flags |= 8
1542-
if abc: flags |= 16
1549+
if regularized:
1550+
flags |= 1
1551+
if ab:
1552+
flags |= 2
1553+
if ac:
1554+
flags |= 4
1555+
if bc:
1556+
flags |= 8
1557+
if abc:
1558+
flags |= 16
15431559
acb_hypgeom_2f1((<acb>u).val, (<acb>a).val, (<acb>b).val, (<acb>c).val,
15441560
(<acb>self).val, flags, getprec())
15451561
return u

src/flint/types/arb.pyx

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,22 @@ cdef class arb(flint_scalar):
479479
if ttype == FMPZ_UNKNOWN:
480480
return NotImplemented
481481
res = 0
482-
if op == 2: res = arb_eq(sval, tval)
483-
elif op == 3: res = arb_ne(sval, tval)
484-
elif op == 0: res = arb_lt(sval, tval)
485-
elif op == 1: res = arb_le(sval, tval)
486-
elif op == 4: res = arb_gt(sval, tval)
487-
elif op == 5: res = arb_ge(sval, tval)
488-
if stype == FMPZ_TMP: arb_clear(sval)
489-
if ttype == FMPZ_TMP: arb_clear(tval)
482+
if op == 2:
483+
res = arb_eq(sval, tval)
484+
elif op == 3:
485+
res = arb_ne(sval, tval)
486+
elif op == 0:
487+
res = arb_lt(sval, tval)
488+
elif op == 1:
489+
res = arb_le(sval, tval)
490+
elif op == 4:
491+
res = arb_gt(sval, tval)
492+
elif op == 5:
493+
res = arb_ge(sval, tval)
494+
if stype == FMPZ_TMP:
495+
arb_clear(sval)
496+
if ttype == FMPZ_TMP:
497+
arb_clear(tval)
490498
return res
491499

492500
def __contains__(self, other):
@@ -563,7 +571,8 @@ cdef class arb(flint_scalar):
563571
return NotImplemented
564572
u = arb.__new__(arb)
565573
arb_add((<arb>u).val, (<arb>s).val, tval, getprec())
566-
if ttype == FMPZ_TMP: arb_clear(tval)
574+
if ttype == FMPZ_TMP:
575+
arb_clear(tval)
567576
return u
568577

569578
def __radd__(s, t):
@@ -574,7 +583,8 @@ cdef class arb(flint_scalar):
574583
return NotImplemented
575584
u = arb.__new__(arb)
576585
arb_add((<arb>u).val, tval, s.val, getprec())
577-
if ttype == FMPZ_TMP: arb_clear(tval)
586+
if ttype == FMPZ_TMP:
587+
arb_clear(tval)
578588
return u
579589

580590
def __sub__(s, t):
@@ -585,7 +595,8 @@ cdef class arb(flint_scalar):
585595
return NotImplemented
586596
u = arb.__new__(arb)
587597
arb_sub((<arb>u).val, (<arb>s).val, tval, getprec())
588-
if ttype == FMPZ_TMP: arb_clear(tval)
598+
if ttype == FMPZ_TMP:
599+
arb_clear(tval)
589600
return u
590601

591602
def __rsub__(s, t):
@@ -596,7 +607,8 @@ cdef class arb(flint_scalar):
596607
return NotImplemented
597608
u = arb.__new__(arb)
598609
arb_sub((<arb>u).val, tval, s.val, getprec())
599-
if ttype == FMPZ_TMP: arb_clear(tval)
610+
if ttype == FMPZ_TMP:
611+
arb_clear(tval)
600612
return u
601613

602614
def __mul__(s, t):
@@ -607,7 +619,8 @@ cdef class arb(flint_scalar):
607619
return NotImplemented
608620
u = arb.__new__(arb)
609621
arb_mul((<arb>u).val, (<arb>s).val, tval, getprec())
610-
if ttype == FMPZ_TMP: arb_clear(tval)
622+
if ttype == FMPZ_TMP:
623+
arb_clear(tval)
611624
return u
612625

613626
def __rmul__(s, t):
@@ -618,7 +631,8 @@ cdef class arb(flint_scalar):
618631
return NotImplemented
619632
u = arb.__new__(arb)
620633
arb_mul((<arb>u).val, tval, s.val, getprec())
621-
if ttype == FMPZ_TMP: arb_clear(tval)
634+
if ttype == FMPZ_TMP:
635+
arb_clear(tval)
622636
return u
623637

624638
def __truediv__(s, t):
@@ -629,7 +643,8 @@ cdef class arb(flint_scalar):
629643
return NotImplemented
630644
u = arb.__new__(arb)
631645
arb_div((<arb>u).val, (<arb>s).val, tval, getprec())
632-
if ttype == FMPZ_TMP: arb_clear(tval)
646+
if ttype == FMPZ_TMP:
647+
arb_clear(tval)
633648
return u
634649

635650
def __rtruediv__(s, t):
@@ -640,7 +655,8 @@ cdef class arb(flint_scalar):
640655
return NotImplemented
641656
u = arb.__new__(arb)
642657
arb_div((<arb>u).val, tval, s.val, getprec())
643-
if ttype == FMPZ_TMP: arb_clear(tval)
658+
if ttype == FMPZ_TMP:
659+
arb_clear(tval)
644660
return u
645661

646662
def __pow__(s, t, modulus):
@@ -653,7 +669,8 @@ cdef class arb(flint_scalar):
653669
return NotImplemented
654670
u = arb.__new__(arb)
655671
arb_pow((<arb>u).val, (<arb>s).val, tval, getprec())
656-
if ttype == FMPZ_TMP: arb_clear(tval)
672+
if ttype == FMPZ_TMP:
673+
arb_clear(tval)
657674
return u
658675

659676
def __rpow__(s, t, modulus):
@@ -666,7 +683,8 @@ cdef class arb(flint_scalar):
666683
return NotImplemented
667684
u = arb.__new__(arb)
668685
arb_pow((<arb>u).val, tval, s.val, getprec())
669-
if ttype == FMPZ_TMP: arb_clear(tval)
686+
if ttype == FMPZ_TMP:
687+
arb_clear(tval)
670688
return u
671689

672690
def floor(s):
@@ -2252,11 +2270,16 @@ cdef class arb(flint_scalar):
22522270
c = any_as_arb(c)
22532271
u = arb.__new__(arb)
22542272
flags = 0
2255-
if regularized: flags |= 1
2256-
if ab: flags |= 2
2257-
if ac: flags |= 4
2258-
if bc: flags |= 8
2259-
if abc: flags |= 16
2273+
if regularized:
2274+
flags |= 1
2275+
if ab:
2276+
flags |= 2
2277+
if ac:
2278+
flags |= 4
2279+
if bc:
2280+
flags |= 8
2281+
if abc:
2282+
flags |= 16
22602283
arb_hypgeom_2f1((<arb>u).val, (<arb>a).val, (<arb>b).val, (<arb>c).val,
22612284
(<arb>self).val, flags, getprec())
22622285
return u

src/flint/types/arf.pyx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,18 @@ cdef class arf:
127127
cdef bint res = 0
128128
if not typecheck(t, arf):
129129
t = arf(t)
130-
if op == 2: res = arf_equal((<arf>s).val, (<arf>t).val)
131-
elif op == 3: res = not arf_equal((<arf>s).val, (<arf>t).val)
132-
elif op == 0: res = arf_cmp((<arf>s).val, (<arf>t).val) < 0
133-
elif op == 1: res = arf_cmp((<arf>s).val, (<arf>t).val) <= 0
134-
elif op == 4: res = arf_cmp((<arf>s).val, (<arf>t).val) > 0
135-
elif op == 5: res = arf_cmp((<arf>s).val, (<arf>t).val) >= 0
130+
if op == 2:
131+
res = arf_equal((<arf>s).val, (<arf>t).val)
132+
elif op == 3:
133+
res = not arf_equal((<arf>s).val, (<arf>t).val)
134+
elif op == 0:
135+
res = arf_cmp((<arf>s).val, (<arf>t).val) < 0
136+
elif op == 1:
137+
res = arf_cmp((<arf>s).val, (<arf>t).val) <= 0
138+
elif op == 4:
139+
res = arf_cmp((<arf>s).val, (<arf>t).val) > 0
140+
elif op == 5:
141+
res = arf_cmp((<arf>s).val, (<arf>t).val) >= 0
136142
return res
137143

138144
def __pos__(self):

src/flint/types/fmpq.pyx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ cdef class fmpq(flint_scalar):
120120
return res
121121
else:
122122
# todo: use fmpq_cmp when available
123-
if op == 0: res = (s-t).p < 0
124-
elif op == 1: res = (s-t).p <= 0
125-
elif op == 4: res = (s-t).p > 0
126-
elif op == 5: res = (s-t).p >= 0
127-
else: raise ValueError
123+
if op == 0:
124+
res = (s-t).p < 0
125+
elif op == 1:
126+
res = (s-t).p <= 0
127+
elif op == 4:
128+
res = (s-t).p > 0
129+
elif op == 5:
130+
res = (s-t).p >= 0
131+
else:
132+
raise ValueError
128133
return res
129134

130135
def numer(self):
@@ -474,13 +479,15 @@ cdef class fmpq(flint_scalar):
474479
return NotImplemented
475480

476481
if fmpq_is_zero((<fmpq>self).val) and fmpz_sgn(nval) == -1:
477-
if ntype == FMPZ_TMP: fmpz_clear(nval)
482+
if ntype == FMPZ_TMP:
483+
fmpz_clear(nval)
478484
raise ZeroDivisionError
479485

480486
v = fmpq.__new__(fmpq)
481487
success = fmpq_pow_fmpz(v.val, (<fmpq>self).val, nval)
482488

483-
if ntype == FMPZ_TMP: fmpz_clear(nval)
489+
if ntype == FMPZ_TMP:
490+
fmpz_clear(nval)
484491

485492
if success:
486493
return v

0 commit comments

Comments
 (0)