@@ -85,6 +85,7 @@ def set_code_builder(ctx, param, value):
8585 """Set the code spec for defaults of following options."""
8686 from aiida .orm .utils .builders .code import CodeBuilder
8787
88+ # TODO(danielhollas): CodeBuilder is deprecated, rewrite this somehow?
8889 with warnings .catch_warnings (record = True ):
8990 ctx .code_builder = CodeBuilder .from_code (value )
9091 return value
@@ -125,6 +126,7 @@ def setup_code(ctx, non_interactive, **kwargs):
125126 if kwargs ['input_plugin' ]:
126127 kwargs ['input_plugin' ] = kwargs ['input_plugin' ].name
127128
129+ # TODO(danielhollas): CodeBuilder is deprecated
128130 with warnings .catch_warnings (record = True ):
129131 code_builder = CodeBuilder (** kwargs )
130132
@@ -227,10 +229,16 @@ def show(code):
227229 table .append (['PK' , code .pk ])
228230 table .append (['UUID' , code .uuid ])
229231 table .append (['Type' , code .entry_point .name ])
232+ # TODO(danielhollas): This code is a bit too clever, make it simpler!
233+ # It generates warnings because it accessess deprecated attributes such as
234+ # Code.repository_metadata -> Code.base.repository.metadata
235+ # Code.attributes -> Code.base.attributes.all
236+ # Code.extras -> Code.base.extras.all
237+ # Also also, the blanket `except AttributeError` is evil and can hide bugs.
230238 for key in code .Model .model_fields .keys ():
231239 try :
232- with warnings .catch_warnings (record = True ):
233- table .append ([key .capitalize ().replace ('_' , ' ' ), getattr (code , key )])
240+ # with warnings.catch_warnings(record=True):
241+ table .append ([key .capitalize ().replace ('_' , ' ' ), getattr (code , key )])
234242 except AttributeError :
235243 continue
236244 if is_verbose ():
0 commit comments