Instantiates an instance of ``GamerProfile`` from
        a gamertag

        :param gamertag: Gamertag to look up

        :raises: :class:`~xbox.exceptions.GamertagNotFound`

        :returns: :class:`~xbox.GamerProfile` instance
542509
def from_gamertag(cls, gamertag):
        '''
        
        '''
        url = 'https://profile.xboxlive.com/users/gt(%s)/profile/settings' % gamertag
        try:
            return cls._fetch(url)
        except GamertagNotFound:
            raise GamertagNotFound('No such user: %s' % gamertag)
96558
def profile(self, username):
        """"""
        if not username and g.user:
            username = g.user.username

        payload = {
            'user': bootstrap_user_data(username, include_perms=True),
            'common': self.common_bootsrap_payload(),
        }

        return self.render_template(
            'superset/basic.html',
            title=_("%(user)s's profile", user=username),
            entry='profile',
            bootstrap_data=json.dumps(payload, default=utils.json_iso_dttm_ser),
        )
1216907
def lookupByName(self, name):
        
        res = yield queue.executeInThread(self.connection.lookupByName, name)
        return self.DomainClass(self, res)
1175945
def get_profile():
  
  argument_parser = ThrowingArgumentParser(add_help=False)
  argument_parser.add_argument('profile')
  try:
    args, _ = argument_parser.parse_known_args()
  except ArgumentParserError:
    # silently fails, the main parser will show usage string.
    return Profile()
  imported = get_module(args.profile)
  profile = get_module_profile(imported)
  if not profile:
    raise Exception(f"Can't get a profile from {imported}.")
  return profile
1094042
def _get_profile(self, profile_id):
        ''''''
        profile_metadata = self._registry.get(profile_id)
        if not profile_metadata:
            return

        path = self._get_absolute_path(profile_metadata.get('schema_path'))
        if path and os.path.isfile(path):
            return self._load_json_file_or_url(path)

        url = profile_metadata.get('schema')
        if url:
            return self._load_json_file_or_url(url)
1291732
def _get_userprofile_from_registry(user, sid):
    '''
    
    '''
    profile_dir = __utils__['reg.read_value'](
        'HKEY_LOCAL_MACHINE',
        'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\{0}'.format(sid),
        'ProfileImagePath'
    )['vdata']
    log.debug(
        'user %s with sid=%s profile is located at "%s"',
        user, sid, profile_dir
    )
    return profile_dir
812326
def get_profile_model():
    
    if (not hasattr(settings, 'AUTH_PROFILE_MODULE') or
            not settings.AUTH_PROFILE_MODULE):
        raise SiteProfileNotAvailable

    profile_mod = get_model(*settings.AUTH_PROFILE_MODULE.split('.'))
    if profile_mod is None:
        raise SiteProfileNotAvailable
    return profile_mod
872075
def _get_instance(hosts=None, profile=None):
    '''
    
    '''
    es = None
    proxies = None
    use_ssl = False
    ca_certs = None
    verify_certs = True
    http_auth = None
    timeout = 10

    if profile is None:
        profile = 'elasticsearch'

    if isinstance(profile, six.string_types):
        _profile = __salt__['config.option'](profile, None)
    elif isinstance(profile, dict):
        _profile = profile
    if _profile:
        hosts = _profile.get('host', hosts)
        if not hosts:
            hosts = _profile.get('hosts', hosts)
        proxies = _profile.get('proxies', None)
        use_ssl = _profile.get('use_ssl', False)
        ca_certs = _profile.get('ca_certs', None)
        verify_certs = _profile.get('verify_certs', True)
        username = _profile.get('username', None)
        password = _profile.get('password', None)
        timeout = _profile.get('timeout', 10)

        if username and password:
            http_auth = (username, password)

    if not hosts:
        hosts = ['127.0.0.1:9200']
    if isinstance(hosts, six.string_types):
        hosts = [hosts]
    try:
        if proxies:
            # Custom connection class to use requests module with proxies
            class ProxyConnection(RequestsHttpConnection):
                def __init__(self, *args, **kwargs):
                    proxies = kwargs.pop('proxies', {})
                    super(ProxyConnection, self).__init__(*args, **kwargs)
                    self.session.proxies = proxies

            es = elasticsearch.Elasticsearch(
                hosts,
                connection_class=ProxyConnection,
                proxies=proxies,
                use_ssl=use_ssl,
                ca_certs=ca_certs,
                verify_certs=verify_certs,
                http_auth=http_auth,
                timeout=timeout,
            )
        else:
            es = elasticsearch.Elasticsearch(
                    hosts,
                    use_ssl=use_ssl,
                    ca_certs=ca_certs,
                    verify_certs=verify_certs,
                    http_auth=http_auth,
                    timeout=timeout,
                )

        # Try the connection
        es.info()
    except elasticsearch.exceptions.TransportError as err:
        raise CommandExecutionError(
            'Could not connect to Elasticsearch host/ cluster {0} due to {1}'.format(hosts, err))
    return es
730657
def fromProfileName(cls, name):
        
        with profiles.ProfileStore.open() as config:
            return cls.fromProfile(config.load(name))
1026509
def setProfile(self, name):
        
        if self.name or self.useBegin:
            if self.name == name:
                return
            raise VObjectError("This component already has a PROFILE or "
                               "uses BEGIN.")
        self.name = name.upper()
85728
def get_profile(name=None, **kwargs):
    
    if isinstance(name, Profile):
        return name

    clazz = get_profile_class(name or 'default')
    return clazz(**kwargs)
1271305
def _populate_profile_from_group_memberships(self, profile):
        
        save_profile = False

        for field, group_dns in self.settings.PROFILE_FLAGS_BY_GROUP.items():
            if isinstance(group_dns, six.string_types):
                group_dns = [group_dns]
            value = any(self._get_groups().is_member_of(dn) for dn in group_dns)
            setattr(profile, field, value)
            save_profile = True

        return save_profile
1112295
def profile(self):
        ''''''
        with self._mutex:
            if not self._profile:
                profile = self._obj.get_profile()
                self._profile = utils.nvlist_to_dict(profile.properties)
        return self._profile
493146
def create_identity(self, name, attrs=[]):
        
        params = {
            'name': name,
            'a': attrs
        }
        resp = self.request('CreateIdentity', {'identity': params})
        return zobjects.Identity.from_dict(resp['identity'])
204885
async def profile(self, ctx, tag):
        ''''''
        if not self.check_valid_tag(tag):
            return await ctx.send('Invalid tag!')

        profile = await self.cr.get_profile(tag)

        em = discord.Embed(color=0x00FFFFF)
        em.set_author(name=str(profile), icon_url=profile.clan_badge_url)
        em.set_thumbnail(url=profile.arena.badge_url)

        # Example of adding data. (Bad)
        for attr in self.cdir(profile):
            value = getattr(profile, attr) 
            if not callable(value):
                em.add_field(
                    name=attr.replace('_').title(), 
                    value=str(value)
                    )

        await ctx.send(embed=em)
1235309
def get_user(self, username):
        
        User = get_user_model()
        try:
            user = User.objects.get(**{
                User.USERNAME_FIELD: username,
            })
            if user.is_active:
                raise ActivationError(
                    self.ALREADY_ACTIVATED_MESSAGE,
                    code='already_activated'
                )
            return user
        except User.DoesNotExist:
            raise ActivationError(
                self.BAD_USERNAME_MESSAGE,
                code='bad_username'
            )
102505
def _find_account(app, user, account_name):
    
    if not account_name:
        raise ConsoleError("Empty account name given")

    accounts = api.search_accounts(app, user, account_name)

    if account_name[0] == "@":
        account_name = account_name[1:]

    for account in accounts:
        if account['acct'] == account_name:
            return account

    raise ConsoleError("Account not found")