def run_delproperty(self, *args): """ Delete a global AiiDA property from the config file in .aiida. """ from aiida.common.setup import del_property if len(args) != 1: print >> sys.stderr, ("usage: {} PROPERTYNAME".format( self.get_full_command_name())) sys.exit() try: del_property(args[0]) except KeyError: print >> sys.stderr, ("No such property '{}' in the config " "file.".format(args[0])) sys.exit(1) except Exception as e: print >> sys.stderr, ("{} while getting the " "property: {}".format( type(e).__name__, e.message)) sys.exit(1) print "Property '{}' successfully deleted.".format(args[0])
def devel_delproperty(prop): """Delete the global PROPERTY from the configuration file.""" from aiida.common.setup import del_property try: del_property(prop) except ValueError: echo.echo_critical('property {} not found'.format(prop)) except Exception as exception: # pylint: disable=broad-except echo.echo_critical('{} while getting the property: {}'.format( type(exception).__name__, exception.message)) else: echo.echo_success( 'deleted the {} property from the configuration file'.format(prop))
def tearDown(self): """Delete any properties that were set.""" for prop in sorted(_property_table.keys()): if exists_property(prop): del_property(prop)