Skip to content

Commit c1f2b22

Browse files
committed
more % formatting to f-string
1 parent e0d083a commit c1f2b22

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

share/lib/python/neuron/rxd/geometry3d/graphicsPrimitives.pyx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cdef class Complement:
2828
def __init__(self, obj):
2929
self.obj = obj
3030
def __repr__(self):
31-
return 'Complement(%r)' % self.obj
31+
return f"Complement({self.obj!r})"
3232
def distance(self, px, py, pz):
3333
return -self.obj.distance(px, py, pz)
3434
def starting_points(self, xs, ys, zs):
@@ -42,7 +42,7 @@ cdef class Union:
4242
def __init__(self, list objects):
4343
self.objects = objects
4444
def __repr__(self):
45-
return 'Union(%r)' % self.objects
45+
return f"Union({self.objects!r})"
4646
@cython.boundscheck(False)
4747
@cython.wraparound(False)
4848
cpdef double distance(self, px, py, pz):
@@ -64,7 +64,7 @@ cdef class Intersection:
6464
def __init__(self, list objects):
6565
self.objects = objects
6666
def __repr__(self):
67-
return 'Intersection(%r)' % self.objects
67+
return f"Intersection({self.objects!r})"
6868
@cython.boundscheck(False)
6969
@cython.wraparound(False)
7070
cpdef double distance(self, px, py, pz):
@@ -440,9 +440,11 @@ cdef class Cone:
440440
else:
441441
order = [self.x0, self.y0, self.z0, self.r0, self.x1, self.y1, self.z1, self.r1]
442442
if self.clips:
443-
return 'Cone(%g, %g, %g, %g, %g, %g, %g, %g; clips=%r)' % tuple(order + [self.clips])
443+
return (f"Cone({order[0]:g}, {order[1]:g}, {order[2]:g}, {order[3]:g}, "
444+
f"{order[4]:g}, {order[5]:g}, {order[6]:g}, {order[7]:g}; clips={self.clips!r})")
444445
else:
445-
return 'Cone(%g, %g, %g, %g, %g, %g, %g, %g)' % tuple(order)
446+
return (f"Cone({order[0]:g}, {order[1]:g}, {order[2]:g}, {order[3]:g}, "
447+
f"{order[4]:g}, {order[5]:g}, {order[6]:g}, {order[7]:g})")
446448

447449
property _x0:
448450
def __get__(self):

0 commit comments

Comments
 (0)