File tree Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,8 @@ def broadcast_dist_samples_shape(shapes, size=None):
141
141
if size is None :
142
142
broadcasted_shape = np .broadcast_shapes (* shapes )
143
143
if broadcasted_shape is None :
144
- raise ValueError (
145
- "Cannot broadcast provided shapes {} given size: {}" .format (
146
- ", " .join ([f"{ s } " for s in shapes ]), size
147
- )
148
- )
144
+ tmp = ", " .join ([f"{ s } " for s in shapes ])
145
+ raise ValueError (f"Cannot broadcast provided shapes { tmp } given size: { size } " )
149
146
return broadcasted_shape
150
147
shapes = [_check_shape_type (s ) for s in shapes ]
151
148
_size = to_tuple (size )
@@ -154,11 +151,8 @@ def broadcast_dist_samples_shape(shapes, size=None):
154
151
try :
155
152
broadcast_shape = np .broadcast_shapes (* sp_shapes )
156
153
except ValueError :
157
- raise ValueError (
158
- "Cannot broadcast provided shapes {} given size: {}" .format (
159
- ", " .join ([f"{ s } " for s in shapes ]), size
160
- )
161
- )
154
+ tmp = ", " .join ([f"{ s } " for s in shapes ])
155
+ raise ValueError (f"Cannot broadcast provided shapes { tmp } given size: { size } " )
162
156
broadcastable_shapes = []
163
157
for shape , sp_shape in zip (shapes , sp_shapes ):
164
158
if _size == shape [: len (_size )]:
Original file line number Diff line number Diff line change @@ -143,9 +143,8 @@ def getter(self):
143
143
value = getattr (self , name , None )
144
144
if value is None :
145
145
raise AttributeError (
146
- "'{}' not set. Provide as argument "
147
- "to condition, or call 'prior' "
148
- "first" .format (name .lstrip ("_" ))
146
+ f"'{ name .lstrip ('_' )} ' not set. Provide as argument "
147
+ "to condition, or call 'prior' first"
149
148
)
150
149
else :
151
150
return value
Original file line number Diff line number Diff line change @@ -65,12 +65,11 @@ def str_for_dist(
65
65
else r"\\operatorname{Unknown}"
66
66
)
67
67
if include_params :
68
+ params = ",~" .join ([d .strip ("$" ) for d in dist_args ])
68
69
if print_name :
69
- return r"${} \sim {}({})$" .format (
70
- print_name , op_name , ",~" .join ([d .strip ("$" ) for d in dist_args ])
71
- )
70
+ return rf"${ print_name } \sim { op_name } ({ params } )$"
72
71
else :
73
- return r "${}({})$". format ( op_name , ",~" . join ([ d . strip ( "$" ) for d in dist_args ]))
72
+ return rf "${ op_name } ({ params } )$"
74
73
75
74
else :
76
75
if print_name :
@@ -83,10 +82,11 @@ def str_for_dist(
83
82
dist .owner .op ._print_name [0 ] if hasattr (dist .owner .op , "_print_name" ) else "Unknown"
84
83
)
85
84
if include_params :
85
+ params = ", " .join (dist_args )
86
86
if print_name :
87
- return r"{ } ~ {}({})". format ( print_name , dist_name , ", " . join ( dist_args ))
87
+ return rf" { print_name } ~ { dist_name } ({ params } )"
88
88
else :
89
- return r"{ }({})". format ( dist_name , ", " . join ( dist_args ))
89
+ return rf" { dist_name } ({ params } )"
90
90
else :
91
91
if print_name :
92
92
return rf"{ print_name } ~ { dist_name } "
You can’t perform that action at this time.
0 commit comments