コード例 #1
0
ファイル: config.py プロジェクト: wpkita/py_hypergolix
    def user_id(self):
        ''' Gets the user_id from the config. Returns a ghid.
        '''
        try:
            user_id = self._cfg['user'].user_id

            # May be undefined, in which case return None
            if user_id is None:
                return user_id

            # Convert to a ghid if defined.
            else:
                return Ghid.from_str(user_id)

        except Exception as exc:
            raise ConfigError('Invalid configuration.') from exc
コード例 #2
0
ファイル: config.py プロジェクト: wpkita/py_hypergolix
    def fingerprint(self):
        ''' The fingerprint! Use this for a sharing target.
        '''
        try:
            fingerprint = self._cfg['user'].fingerprint

            # May be undefined, in which case return None
            if fingerprint is None:
                return fingerprint

            # Convert to a ghid if defined.
            else:
                return Ghid.from_str(fingerprint)

        except Exception as exc:
            raise ConfigError('Invalid configuration.') from exc