From nobody Mon Feb 9 07:57:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58486+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58486+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1588287208; cv=none; d=zohomail.com; s=zohoarc; b=J3BEVWDdrmelrQcyPb5U+dZ9YjshxRVZ80D54luNVWwrJ4jQLEXcj8Jq5yynMAFZlIMXyVzu1hKPC/rLC40kDSLkVYnFhFpWTevk9Cy7ngmgXo1tFNmJeNQc+iDZfZE9G1Et1QJbD2KUOmevj3T+HWmycQk+vt16EaYGCRbwOXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588287208; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1y8UL5M8wKvC9dWXa3vdLpU/BE9nxAmX0f9GrxlbPNI=; b=nngU74/eciiRj+DC410umdPIbcJPdRLQfOy9eCbHOGxPCyvlro43odmaTaAVa9uaoVH8GGlaEwLkiRaLgz4sHf/KOS9LJOweIPxF0MELlgbfSNngx16I2JypR1dIOd6TC6HxMwkULPqlwPHX3ZxeEOEcnthozkOSp6ukiLZ1GK8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58486+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1588287208580161.2926968579036; Thu, 30 Apr 2020 15:53:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id VPrPYY1788612xzmqaEPNmmJ; Thu, 30 Apr 2020 15:53:28 -0700 X-Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web10.61.1588287204056787193 for ; Thu, 30 Apr 2020 15:53:27 -0700 IronPort-SDR: 7mrmYOz/qGmJU0J2Hdf15Ju2rDd02WLfi3iPaLWhoVWCioN04IMc94XVElcPzhhKuZzMZ9c2rw vnXgUqvB5kyQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 15:53:27 -0700 IronPort-SDR: +mVLY9pzvEc/O1Ynb2IehptU0izYfsJqA5uiGdEy/r5Vvdm5PObeNyedcWUrFcSjMzwtVX8d56 0GqpYoz3GAQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,337,1583222400"; d="scan'208";a="368300822" X-Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.212.184.120]) by fmsmga001.fm.intel.com with ESMTP; 30 Apr 2020 15:53:26 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Ashley E Desimone , Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v1 3/3] EdkRepo: Refactoring private class members Date: Thu, 30 Apr 2020 15:52:54 -0700 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,erik.c.bjorge@intel.com X-Gm-Message-State: J7i8hxwIJVVuxgLQUZBYh2eqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1588287208; bh=28GIMW6vnXm+E6h3Xx8WmmgpBlGWx4kC7GBOjNqPRec=; h=Cc:Date:From:Reply-To:Subject:To; b=b2AQiAx7Hs+gRVRbWAw2zRjpeR91cafPzAyLL9HU+MJXSuPEsQ0sh81sSa8rcCjE5kT V9BmRUh6SMwZe80V7DsQE8J4k98yNSgbNqTSay5C4K4TlEFZXbLY/j4u7i1mEoVk2/Tat jtiT/d4lpy+X2LdeQqcnhh8wpyJm+jvDwXs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Refactoring private variables to remove name mangling from double underscores to using single underscores. This allows for better creation of derived classes. Signed-off-by: Erik Bjorge Cc: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo_manifest_parser/edk_manifest.py | 100 ++++++++++++------------ 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/edkrepo_manifest_parser/edk_manifest.py b/edkrepo_manifest_par= ser/edk_manifest.py index 2ec6cd1..d65f5f6 100644 --- a/edkrepo_manifest_parser/edk_manifest.py +++ b/edkrepo_manifest_parser/edk_manifest.py @@ -73,16 +73,16 @@ class BaseXmlHelper(): class CiIndexXml(BaseXmlHelper): def __init__(self, fileref): super().__init__(fileref, 'ProjectList') - self.__projects =3D {} + self._projects =3D {} for element in self._tree.iter(tag=3D'Project'): proj =3D _Project(element) # Todo: add check for unique - self.__projects[proj.name] =3D proj + self._projects[proj.name] =3D proj =20 @property def project_list(self): proj_names =3D [] - for proj in self.__projects.values(): + for proj in self._projects.values(): if proj.archived is False: proj_names.append(proj.name) return proj_names @@ -90,14 +90,14 @@ class CiIndexXml(BaseXmlHelper): @property def archived_project_list(self): proj_names =3D [] - for proj in self.__projects.values(): + for proj in self._projects.values(): if proj.archived is True: proj_names.append(proj.name) return proj_names =20 def get_project_xml(self, project_name): - if project_name in self.__projects: - return self.__projects[project_name].xmlPath + if project_name in self._projects: + return self._projects[project_name].xmlPath else: raise ValueError(INVALID_PROJECTNAME_ERROR.format(project_name= )) =20 @@ -126,18 +126,18 @@ class ManifestXml(BaseXmlHelper): # internally gathering and storing the manifest data. As such, all= access to them should be # done through the provided methods to ensure future compatibility= if the xml schema changes super().__init__(fileref, ['Pin', 'Manifest']) - self.__project_info =3D None - self.__general_config =3D None - self.__remotes =3D {} # dict of _Remote objs, w= ith Remote.name as key - self.__client_hook_list =3D [] - self.__combinations =3D {} # dict of _Combination ob= js, with Combination.name as key - self.__combo_sources =3D {} # dict of _RepoSource obj= lists, with Combination.name as key - self.__dsc_list =3D [] - self.__sparse_settings =3D None # A single instance of pl= atform sparse checkout settings - self.__sparse_data =3D [] # List of SparseData obje= cts - self.__commit_templates =3D {} # dict of commit message = templates with the remote name as the key - self.__folder_to_folder_mappings =3D [] # List of FolderToFolderM= apping objects - self.__submodule_alternate_remotes =3D [] + self._project_info =3D None + self._general_config =3D None + self._remotes =3D {} # dict of _Remote objs, wi= th Remote.name as key + self._client_hook_list =3D [] + self._combinations =3D {} # dict of _Combination obj= s, with Combination.name as key + self._combo_sources =3D {} # dict of _RepoSource obj = lists, with Combination.name as key + self._dsc_list =3D [] + self._sparse_settings =3D None # A single instance of pla= tform sparse checkout settings + self._sparse_data =3D [] # List of SparseData objec= ts + self._commit_templates =3D {} # dict of commit message t= emplates with the remote name as the key + self._folder_to_folder_mappings =3D [] # List of FolderToFolderMa= pping objects + self._submodule_alternate_remotes =3D [] =20 # # Append include XML's to the Manifest etree before parsing @@ -161,19 +161,19 @@ class ManifestXml(BaseXmlHelper): # for subroot in self._tree.iter(tag=3D'RemoteList'): for element in subroot.iter(tag=3D'Remote'): - self._add_unique_item(_RemoteRepo(element), self.__remotes= , element.tag) + self._add_unique_item(_RemoteRepo(element), self._remotes,= element.tag) =20 # # parse tags # subroot =3D self._tree.find('ProjectInfo') - self.__project_info =3D _ProjectInfo(subroot) + self._project_info =3D _ProjectInfo(subroot) =20 # # parse tags # subroot =3D self._tree.find('GeneralConfig') - self.__general_config =3D _GeneralConfig(subroot) + self._general_config =3D _GeneralConfig(subroot) =20 # # parse tags @@ -181,7 +181,7 @@ class ManifestXml(BaseXmlHelper): # for subroot in self._tree.iter(tag=3D'ClientGitHookList'): for element in subroot.iter(tag=3D'ClientGitHook'): - self.__client_hook_list.append(_RepoHook(element, self.__r= emotes)) + self._client_hook_list.append(_RepoHook(element, self._rem= otes)) =20 # # Parse @@ -189,7 +189,7 @@ class ManifestXml(BaseXmlHelper): # for subroot in self._tree.iter(tag=3D'SubmoduleAlternateRemotes'): for element in subroot.iter(tag=3D'SubmoduleAlternateRemote'): - self.__submodule_alternate_remotes.append(_SubmoduleAltern= ateRemote(element, self.__remotes)) + self._submodule_alternate_remotes.append(_SubmoduleAlterna= teRemote(element, self._remotes)) =20 # # parse tags @@ -223,7 +223,7 @@ class ManifestXml(BaseXmlHelper): # for subroot in self._tree.iter(tag=3D'DscList'): for element in subroot.iter(tag=3D'Dsc'): - self.__dsc_list.append(element.text) + self._dsc_list.append(element.text) =20 # # Process tag @@ -231,11 +231,11 @@ class ManifestXml(BaseXmlHelper): subroot =3D self._tree.find('SparseCheckout') if subroot is not None: try: - self.__sparse_settings =3D _SparseSettings(subroot.find('S= parseSettings')) + self._sparse_settings =3D _SparseSettings(subroot.find('Sp= arseSettings')) except KeyError as k: raise KeyError(REQUIRED_ATTRIB_ERROR_MSG.format(k, subroot= .tag)) for sparse_data in subroot.iter(tag=3D'SparseData'): - self.__sparse_data.append(_SparseData(sparse_data)) + self._sparse_data.append(_SparseData(sparse_data)) =20 # # Process any commit log templates that may exist (optional) @@ -248,7 +248,7 @@ class ManifestXml(BaseXmlHelper): template_text =3D template_element.text except KeyError as k: raise KeyError(REQUIRED_ATTRIB_ERROR_MSG.format(k, sub= root.tag)) - self.__commit_templates[remote_name] =3D template_text + self._commit_templates[remote_name] =3D template_text =20 # # Process tag @@ -256,7 +256,7 @@ class ManifestXml(BaseXmlHelper): subroot =3D self._tree.find('FolderToFolderMappingList') if subroot is not None: for f2f_mapping in subroot.iter(tag=3D'FolderToFolderMapping'): - self.__folder_to_folder_mappings.append(_FolderToFolderMap= ping(f2f_mapping)) + self._folder_to_folder_mappings.append(_FolderToFolderMapp= ing(f2f_mapping)) =20 return =20 @@ -274,11 +274,11 @@ class ManifestXml(BaseXmlHelper): def _add_combo_source(self, subroot, combo): # create a list of _RepoSource objs from the tags in subr= oot # and add it to the __combo_sources dictionary - self._add_unique_item(combo, self.__combinations, subroot.tag) + self._add_unique_item(combo, self._combinations, subroot.tag) temp_sources =3D [] for element in subroot.iter(tag=3D'Source'): - temp_sources.append(_RepoSource(element, self.__remotes)) - self.__combo_sources[combo.name] =3D temp_sources + temp_sources.append(_RepoSource(element, self._remotes)) + self._combo_sources[combo.name] =3D temp_sources =20 def _add_unique_item(self, obj, item_dict, tag): # add the 'obj' to 'dict', or raise error if it already exists @@ -299,56 +299,56 @@ class ManifestXml(BaseXmlHelper): # @property def project_info(self): - return self.__project_info.tuple + return self._project_info.tuple =20 @property def general_config(self): - return self.__general_config.tuple + return self._general_config.tuple =20 @property def remotes(self): - return self._tuple_list(self.__remotes.values()) + return self._tuple_list(self._remotes.values()) =20 @property def combinations(self): - return self._tuple_list([x for x in self.__combinations.values() i= f not x.archived]) + return self._tuple_list([x for x in self._combinations.values() if= not x.archived]) =20 @property def archived_combinations(self): - return self._tuple_list([x for x in self.__combinations.values() i= f x.archived]) + return self._tuple_list([x for x in self._combinations.values() if= x.archived]) =20 def get_repo_sources(self, combo_name): - if combo_name in self.__combo_sources: - return self._tuple_list(self.__combo_sources[combo_name]) + if combo_name in self._combo_sources: + return self._tuple_list(self._combo_sources[combo_name]) elif combo_name.startswith('Pin:'): # If currently checked out onto a pin file reture the sources = in the # default combo - return self._tuple_list(self.__combo_sources[self.general_conf= ig.default_combo]) + return self._tuple_list(self._combo_sources[self.general_confi= g.default_combo]) else: raise ValueError(COMB_INVALIDINPUT_ERROR.format(combo_name)) =20 @property def repo_hooks(self): - return self._tuple_list(self.__client_hook_list) + return self._tuple_list(self._client_hook_list) =20 @property def dsc_list(self): - return self.__dsc_list + return self._dsc_list =20 @property def sparse_settings(self): - if self.__sparse_settings: - return self.__sparse_settings.tuple + if self._sparse_settings: + return self._sparse_settings.tuple return None =20 @property def sparse_data(self): - return self._tuple_list(self.__sparse_data) + return self._tuple_list(self._sparse_data) =20 @property def folder_to_folder_mappings(self): f2f_tuples =3D [] - for f2f_mapping in self.__folder_to_folder_mappings: + for f2f_mapping in self._folder_to_folder_mappings: folders =3D f2f_mapping.folders folder_tuples =3D [] for folder in folders: @@ -373,15 +373,15 @@ class ManifestXml(BaseXmlHelper): =20 @property def commit_templates(self): - return self.__commit_templates + return self._commit_templates =20 @property def submodule_alternate_remotes(self): - return self._tuple_list(self.__submodule_alternate_remotes) + return self._tuple_list(self._submodule_alternate_remotes) =20 def get_submodule_alternates_for_remote(self, remote_name): alternates =3D [] - for alternate in self.__submodule_alternate_remotes: + for alternate in self._submodule_alternate_remotes: if alternate.remote_name =3D=3D remote_name: alternates.append(alternate.tuple) return alternates @@ -409,7 +409,7 @@ class ManifestXml(BaseXmlHelper): =20 element.attrib['combination'] =3D combo_name self._tree.write(filename) - self.__general_config.current_combo =3D combo_name + self._general_config.current_combo =3D combo_name =20 def generate_pin_xml(self, description, combo_name, repo_source_list, = filename=3DNone): =20 @@ -443,7 +443,7 @@ class ManifestXml(BaseXmlHelper): =20 remote_root =3D ET.SubElement(pin_root, 'RemoteList') source_root =3D ET.SubElement(pin_root, 'Combination') - source_root.attrib['name'] =3D self.__combinations[combo_name].name + source_root.attrib['name'] =3D self._combinations[combo_name].name =20 # Add tags for each RepoSource tuple in the list provided # Only one of Branch or SHA is required to write PIN and checkout = code --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58486): https://edk2.groups.io/g/devel/message/58486 Mute This Topic: https://groups.io/mt/73386943/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-