def parse(self):
        """
        Parses the configuration file.
        """
        with open(self.filename) as f:
            self.doc = yaml.safe_load(f.read())
        if "current-context" in self.doc and self.doc["current-context"]:
            current_context = filter(lambda x:
                                     x['name'] == self.doc['current-context'],
                                     self.doc['contexts'])[0]['context']
            username = current_context['user']
            clustername = current_context['cluster']
            self.user = filter(lambda x: x['name'] == username,
                               self.doc['users'])[0]['user']
            self.cluster = filter(lambda x: x['name'] == clustername,
                                  self.doc['clusters'])[0]['cluster']
dataset/ETHPy150Open chiradeep/nitrox/kubernetes/client.py/K8sConfig.parse/original