Return path where all profiles of current user are stored.
556521
def get_profile_dir ():
    """"""
    basedir = unicode(os.environ["HOME"])
    return os.path.join(basedir, u"Library", u"Safari")
816595
def vanity(self):
        
        purl = self.profile_url.strip('/')
        if purl.find("/id/") != -1:
            return os.path.basename(purl)
38283
def Parse(self, stat, knowledge_base):
    """"""
    _ = knowledge_base  # Unused.
    sid_str = stat.pathspec.Dirname().Basename()

    if SID_RE.match(sid_str):
      kb_user = rdf_client.User()
      kb_user.sid = sid_str
      if stat.pathspec.Basename() == "ProfileImagePath":
        if stat.resident:
          # Support old clients.
          kb_user.homedir = utils.SmartUnicode(stat.resident)
        else:
          kb_user.homedir = stat.registry_data.GetValue()

        kb_user.userprofile = kb_user.homedir
        try:
          # Assume username is the last component of the path. This is not
          # robust, but other user artifacts will override it if there is a
          # better match.
          kb_user.username = kb_user.homedir.rsplit("\\", 1)[-1]
        except IndexError:
          pass

      yield kb_user
1266642
def read_profiles(profiles_dir=None):
    """"""
    if profiles_dir is None:
        profiles_dir = PROFILES_DIR

    raw_profiles = read_profile(profiles_dir)

    if raw_profiles is None:
        profiles = {}
    else:
        profiles = {k: v for (k, v) in raw_profiles.items() if k != 'config'}

    return profiles
1064495
def profile_list(default_only=False):
    '''
    
    '''
    profiles = {}
    default_profiles = ['All']

    ## lookup default profile(s)
    with salt.utils.files.fopen('/etc/security/policy.conf', 'r') as policy_conf:
        for policy in policy_conf:
            policy = salt.utils.stringutils.to_unicode(policy)
            policy = policy.split('=')
            if policy[0].strip() == 'PROFS_GRANTED':
                default_profiles.extend(policy[1].strip().split(','))

    ## read prof_attr file (profname:res1:res2:desc:attr)
    with salt.utils.files.fopen('/etc/security/prof_attr', 'r') as prof_attr:
        for profile in prof_attr:
            profile = salt.utils.stringutils.to_unicode(profile)
            profile = profile.split(':')

            # skip comments and non complaint lines
            if len(profile) != 5:
                continue

            # add profile info to dict
            profiles[profile[0]] = profile[3]

    ## filtered profiles
    if default_only:
        for p in [p for p in profiles if p not in default_profiles]:
            del profiles[p]

    return profiles
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)
181685
function (){
    var out = {}

    if(this.profiles.length !== 0){
      out.profiles = this.profiles
    }

    if(this.noProfilesFound.length !== 0){
      out.noProfilesFound = this.noProfilesFound;
    }

    if(utils.hasProperties(this.combinedProfile)){
      out.combinedProfile = this.combinedProfile
    }

    return out;
  }
182918
def details(self):
        """"""
        return self.dest_user.profile.details.convert_and_update(
            self.source_profile.details.as_dict
        )
496035
def _export_profiles(self, profile_name, user_pageviews, user_downloads,
                         ip_user=False):
        """"""
        views_min = self.config.get('user_views_min')
        views_max = self.config.get('user_views_max')
        ip_user_id = 500000000000
        add_user_id = 100000000000
        stat_records = 0
        with self.storage.get_user_profiles(profile_name) as store:
            store.clear()
            for user in user_pageviews:
                # Only users with unique pageviews.
                unique_views = len(set(user_pageviews[user]))
                if views_max > unique_views >= views_min:
                    nodes, weight = self._calculate_user_record_weights(
                            record_list=user_pageviews[user],
                            download_list=user_downloads.get(user))
                    if ip_user:
                        store.add_user(ip_user_id, nodes, weight)
                        ip_user_id += 1
                    else:
                        user = str(add_user_id + int(user))
                        store.add_user(user, nodes, weight)
                    self.stat_long['User_num_records'].append(len(nodes))
                    stat_records += len(nodes)

                elif unique_views >= views_min:
                    # TODO: Add stat for to many views.
                    print("Drop user {} with {} views".format(user,
                                                              unique_views))
        self.stat['user_profiles'] = len(self.stat_long.get(
                                                        'User_num_records'))
        self.stat['user_profiles_records'] = stat_records

        print("Stats: {}".format(self.stat))
876046
def get_cache_path(profile_name):
    ''''''
    path = os.path.join(CACHE_DIR, profile_name, 'cache')
    if not os.path.exists(path):
        os.makedirs(path, exist_ok=True)
    return path
381889
def owner_profile(self) -> 'Profile':
        """"""
        if not self._owner_profile:
            if 'username' in self._node['owner']:
                owner_struct = self._node['owner']
            else:
                # Sometimes, the 'owner' structure does not contain the username, only the user's ID.  In that case,
                # this call triggers downloading of the complete Post metadata struct, where the owner username
                # is contained.
                # Note that we cannot use Profile.from_id() here since that would lead us into a recursion.
                owner_struct = self._full_metadata['owner']
            self._owner_profile = Profile(self._context, owner_struct)
        return self._owner_profile
1160527
def user_cache_dir():
    
    """
    if WINDOWS:
        path = os.path.join(os.environ.get('LOCALAPPDATA') or os.environ.get('APPDATA'),
                            'glances', 'cache')
    elif MACOS:
        path = os.path.expanduser('~/Library/Caches/glances')
    else:
        path = os.path.join(os.environ.get('XDG_CACHE_HOME') or os.path.expanduser('~/.cache'),
                            'glances')

    return path
885348
def all(self):
        
        attribute = self._attr[0]
        return self.profile.data.get(attribute, [])
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
1255007
def get_profile(session):
    """"""
    response = session.get(PROFILE_URL, allow_redirects=False)
    if response.status_code == 302:
        raise USPSError('expired session')
    parsed = BeautifulSoup(response.text, HTML_PARSER)
    profile = parsed.find('div', {'class': 'atg_store_myProfileInfo'})
    data = {}
    for row in profile.find_all('tr'):
        cells = row.find_all('td')
        if len(cells) == 2:
            key = ' '.join(cells[0].find_all(text=True)).strip().lower().replace(' ', '_')
            value = ' '.join(cells[1].find_all(text=True)).strip()
            data[key] = value
    return data
407804
public static Profile getCurrentProfile() {
        RequestContext context = RequestContext.getCurrent();
        if (context != null) {
            return getProfile(context.getRequest());
        } else {
            return null;
        }
    }
218069
def get_associated_profiles(self):
        
        uri = "{}/associatedProfiles".format(self.data['uri'])
        return self._helper.do_get(uri)