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):
141141 if size is None :
142142 broadcasted_shape = np .broadcast_shapes (* shapes )
143143 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 } " )
149146 return broadcasted_shape
150147 shapes = [_check_shape_type (s ) for s in shapes ]
151148 _size = to_tuple (size )
@@ -154,11 +151,8 @@ def broadcast_dist_samples_shape(shapes, size=None):
154151 try :
155152 broadcast_shape = np .broadcast_shapes (* sp_shapes )
156153 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 } " )
162156 broadcastable_shapes = []
163157 for shape , sp_shape in zip (shapes , sp_shapes ):
164158 if _size == shape [: len (_size )]:
Original file line number Diff line number Diff line change @@ -143,9 +143,8 @@ def getter(self):
143143 value = getattr (self , name , None )
144144 if value is None :
145145 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"
149148 )
150149 else :
151150 return value
Original file line number Diff line number Diff line change @@ -65,12 +65,11 @@ def str_for_dist(
6565 else r"\\operatorname{Unknown}"
6666 )
6767 if include_params :
68+ params = ",~" .join ([d .strip ("$" ) for d in dist_args ])
6869 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 } )$"
7271 else :
73- return r "${}({})$". format ( op_name , ",~" . join ([ d . strip ( "$" ) for d in dist_args ]))
72+ return rf "${ op_name } ({ params } )$"
7473
7574 else :
7675 if print_name :
@@ -83,10 +82,11 @@ def str_for_dist(
8382 dist .owner .op ._print_name [0 ] if hasattr (dist .owner .op , "_print_name" ) else "Unknown"
8483 )
8584 if include_params :
85+ params = ", " .join (dist_args )
8686 if print_name :
87- return r"{ } ~ {}({})". format ( print_name , dist_name , ", " . join ( dist_args ))
87+ return rf" { print_name } ~ { dist_name } ({ params } )"
8888 else :
89- return r"{ }({})". format ( dist_name , ", " . join ( dist_args ))
89+ return rf" { dist_name } ({ params } )"
9090 else :
9191 if print_name :
9292 return rf"{ print_name } ~ { dist_name } "
You can’t perform that action at this time.
0 commit comments