MCPcopy
hub / github.com/deadc0de6/dotdrop / del_dotfile_from_profile

Method del_dotfile_from_profile

dotdrop/cfg_yaml.py:490–516  ·  view source on GitHub ↗

remove this dotfile from that profile

(self, df_key, pro_key)

Source from the content-addressed store, hash-verified

488 return True
489
490 def del_dotfile_from_profile(self, df_key, pro_key):
491 """remove this dotfile from that profile"""
492 if self._debug:
493 self._dbg(f'removing \"{df_key}\" from \"{pro_key}\"')
494 if df_key not in self.dotfiles.keys():
495 self._log.err(f'key not in dotfiles: {df_key}')
496 return False
497 if pro_key not in self.profiles.keys():
498 self._log.err(f'key not in profile: {pro_key}')
499 return False
500 # get the profile dictionary
501 profile = self._yaml_dict[self.key_profiles][pro_key]
502 if self.key_profile_dotfiles not in profile:
503 # profile does not contain any dotfiles
504 return True
505 if df_key not in profile[self.key_profile_dotfiles]:
506 return True
507 if self._debug:
508 dfs = profile[self.key_profile_dotfiles]
509 self._dbg(f'{pro_key} profile dotfiles: {dfs}')
510 self._dbg(f'remove {df_key} from profile {pro_key}')
511 profile[self.key_profile_dotfiles].remove(df_key)
512 if self._debug:
513 dfs = profile[self.key_profile_dotfiles]
514 self._dbg(f'{pro_key} profile dotfiles: {dfs}')
515 self._dirty = True
516 return True
517
518 def save(self):
519 """save this instance and return True if saved"""

Callers 1

cmd_removeFunction · 0.45

Calls 2

_dbgMethod · 0.95
errMethod · 0.80

Tested by

no test coverage detected