Home › Forums › Nazca › Disable naming warnings › Reply To: Disable naming warnings
2 March 2020 at 19:52
#6028
Keymaster
Dear ale35,
The best way to get rid of warnings is to solve the underlying reason or, second best, redirecting them to a log file so they do not scroll over the screen but are awaiting review on disk. For the latter see logging.
To resolve the cell rename warning avoid recreating a cell more than once, i.e. do not do the following:
import nazca as nd
def createA():
with nd.Cell('test') as C:
pass
return C
createA()
createA() # causes a renaming warning
createA() # causes a renaming warning
but instead do
import nazca as nd
def createA():
with nd.Cell('test') as C:
pass
return C
A = createA()
A.put()
A.put()
A.put()
Another way to resolve these warnings is to use the @hashme decorator. It checks on cell name reuse and returns the existing cell rather then recreating it under a new name:
import nazca as nd
@nd.bb_util.hashme('test')
def createA():
with nd.Cell() as C:
pass
return C
createA()
createA() # no more renaming warning
createA() # no more renaming warning
Ronald