@@ -56,11 +56,12 @@ class UndefinedVariableError(NameError):
56
56
"""
57
57
58
58
def __init__ (self , name , is_local : bool ):
59
+ base_msg = f"{ repr (name )} is not defined"
59
60
if is_local :
60
- msg = "local variable {0!r} is not defined "
61
+ msg = f "local variable { base_msg } "
61
62
else :
62
- msg = "name {0!r} is not defined "
63
- super ().__init__ (msg . format ( name ) )
63
+ msg = f "name { base_msg } "
64
+ super ().__init__ (msg )
64
65
65
66
66
67
class Term :
@@ -143,10 +144,7 @@ def type(self):
143
144
144
145
@property
145
146
def raw (self ) -> str :
146
- return pprint_thing (
147
- "{0}(name={1!r}, type={2})"
148
- "" .format (type (self ).__name__ , self .name , self .type )
149
- )
147
+ return f"{ type (self ).__name__ } (name={ repr (self .name )} , type={ self .type } )"
150
148
151
149
@property
152
150
def is_datetime (self ) -> bool :
@@ -374,8 +372,7 @@ def __init__(self, op: str, lhs, rhs, **kwargs):
374
372
# has to be made a list for python3
375
373
keys = list (_binary_ops_dict .keys ())
376
374
raise ValueError (
377
- "Invalid binary operator {0!r}, valid"
378
- " operators are {1}" .format (op , keys )
375
+ f"Invalid binary operator { repr (op )} , valid operators are { keys } "
379
376
)
380
377
381
378
def __call__ (self , env ):
@@ -548,8 +545,8 @@ def __init__(self, op: str, operand):
548
545
self .func = _unary_ops_dict [op ]
549
546
except KeyError :
550
547
raise ValueError (
551
- "Invalid unary operator {0!r}, valid operators "
552
- " are {1}" . format ( op , _unary_ops_syms )
548
+ f "Invalid unary operator { repr ( op ) } , "
549
+ f"valid operators are { _unary_ops_syms } "
553
550
)
554
551
555
552
def __call__ (self , env ):
0 commit comments