Tails the system.profile collection
508797
def _tail_profile(self, db, interval):
        """"""
        latest_doc = None
        while latest_doc is None:
            time.sleep(interval)
            latest_doc = db['system.profile'].find_one()

        current_time = latest_doc['ts']

        while True:
            time.sleep(interval)
            cursor = db['system.profile'].find({'ts': {'$gte': current_time}}).sort('ts', pymongo.ASCENDING)
            for doc in cursor:
                current_time = doc['ts']
                yield doc
415434
def profile_list(**kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('profile:list', **{
        'storage': ctx.repo.create_secure_service('storage'),
    })
1359743
def dump_profiles(self, path):
        
        if self.profiler_collector is not None:
            self.profiler_collector.dump_profiles(path)
        else:
            raise RuntimeError("'spark.python.profile' configuration must be set "
                               "to 'true' to enable Python profile.")
614893
def _call_system_profiler(datatype):
    '''
    
    '''

    p = subprocess.Popen(
        [PROFILER_BINARY, '-detailLevel', 'full',
         '-xml', datatype], stdout=subprocess.PIPE)
    (sysprofresults, sysprof_stderr) = p.communicate(input=None)

    if six.PY2:
        plist = plistlib.readPlistFromString(sysprofresults)
    else:
        plist = plistlib.readPlistFromBytes(sysprofresults)

    try:
        apps = plist[0]['_items']
    except (IndexError, KeyError):
        apps = []

    return apps
218069
def get_associated_profiles(self):
        
        uri = "{}/associatedProfiles".format(self.data['uri'])
        return self._helper.do_get(uri)
1021380
def getProfile(self, profile=None):
    '''
    
    '''
    if profile is None:
      # todo: what if the configuration `profile.default` does not exist?
      profile = self.config.get('DEFAULT', 'profile.default')
    if profile in self.profiles:
      return self.profiles[profile].init()
    for prof in self.profiles.values():
      if prof.name == profile:
        return prof.init()
    for prof in self.profiles.values():
      if prof.name.lower() == profile.lower():
        return prof.init()
    raise KeyError(profile)
496406
def lookup_profiles(self, provider, lookup):
        '''
        
        '''
        if provider is None:
            provider = 'all'
        if lookup is None:
            lookup = 'all'

        if lookup == 'all':
            profiles = set()
            provider_profiles = set()
            for alias, info in six.iteritems(self.opts['profiles']):
                providers = info.get('provider')

                if providers:
                    given_prov_name = providers.split(':')[0]
                    salt_prov_name = providers.split(':')[1]
                    if given_prov_name == provider:
                        provider_profiles.add((alias, given_prov_name))
                    elif salt_prov_name == provider:
                        provider_profiles.add((alias, salt_prov_name))
                    profiles.add((alias, given_prov_name))

            if not profiles:
                raise SaltCloudSystemExit(
                    'There are no cloud profiles configured.'
                )

            if provider != 'all':
                return provider_profiles

            return profiles
574410
def get_profiles(config):
    '''
    
    '''
    profiles = []
    for profile_name in os.listdir(os.path.join(os.path.dirname(__file__), 'profiles')):
        if profile_name.endswith('.yml'):
            profiles.append(profile_name.split('.')[0])

    return sorted(profiles)
1281058
def extract_profiles(self, pipeline_name, expose_data=True):
        
        compas_pipe = self.__profile_definition(pipeline_name)
        get_variable = compas_pipe.GEtUserVariable
        if os.path.isdir(self.path+'profiles') is not True:
            os.mkdir(self.path + 'profiles')
        target_dir = self.path + 'profiles'
        if expose_data is True:
            self.profiles[pipeline_name] = {}
        for key in PROFILE_KEYS:
            pipe = self.pipes[pipeline_name]
            pipe['data'][key] = get_variable(PROFILE_KEYS[key]).Variable()
            temp = {key: val for (key, val) in enumerate(pipe['data'][key])}
            try:
                data = pd.DataFrame(temp, index=pipe['grid'])
            except ValueError:
                data = pd.DataFrame(temp, index=pipe['non_st_grid'])
            data.columns = self.pipes[pipeline_name]['timesteps']
            data.to_csv('{}/{}-{}.csv'.format(target_dir, pipeline_name, key))
            if expose_data is True:
                self.profiles[pipeline_name][key] = data
803738
public static List<String> explicitlyDisabledProfiles(String... profiles) {
        if (profiles.length == 0) {
            return Collections.<String> emptyList();
        }
        List<String> disabled = new ArrayList<String>();
        for (String profileId : profiles) {
            if (profileId != null && (profileId.startsWith("-") || profileId.startsWith("!"))) {
                String disabledId = profileId.substring(1);
                Validate.notNullOrEmpty(disabledId, "Invalid name (\"" + profileId + "\") of a profile do be disabled");
                disabled.add(disabledId);
            }
        }

        return disabled;
    }
1219013
def network_profile_name_list(self, obj):
        """"""

        profile_list = pointer(WLAN_PROFILE_INFO_LIST())
        self._wlan_get_profile_list(self._handle,
                                    byref(obj['guid']),
                                    byref(profile_list))
        profiles = cast(profile_list.contents.ProfileInfo,
                        POINTER(WLAN_PROFILE_INFO))

        profile_name_list = []
        for i in range(profile_list.contents.dwNumberOfItems):
            profile_name = ''
            for j in range(len(profiles[i].strProfileName)):
                profile_name += profiles[i].strProfileName[j]
            profile_name_list.append(profile_name)

        return profile_name_list
261547
def run(self):
        '''
        
        '''
        profiling_enabled = self.opts.get('profiling_enabled', False)
        try:
            pr = salt.utils.profile.activate_profile(profiling_enabled)
            try:
                ret = self.call()
            finally:
                salt.utils.profile.output_profile(
                    pr,
                    stats_path=self.opts.get('profiling_path', '/tmp/stats'),
                    stop=True)
            out = ret.get('out', 'nested')
            if self.opts['print_metadata']:
                print_ret = ret
                out = 'nested'
            else:
                print_ret = ret.get('return', {})
            salt.output.display_output(
                    {'local': print_ret},
                    out=out,
                    opts=self.opts,
                    _retcode=ret.get('retcode', 0))
            # _retcode will be available in the kwargs of the outputter function
            if self.opts.get('retcode_passthrough', False):
                sys.exit(ret['retcode'])
            elif ret['retcode'] != salt.defaults.exitcodes.EX_OK:
                sys.exit(salt.defaults.exitcodes.EX_GENERIC)
        except SaltInvocationError as err:
            raise SystemExit(err)
582221
def analyze_profile(self):
        """"""
        profile_parser = ProfileParser()
        databases = self._get_requested_databases()
        connection = pymongo.MongoClient(self._db_uri,
                                         document_class=OrderedDict,
                                         read_preference=pymongo.ReadPreference.PRIMARY_PREFERRED)

        if databases == []:
            try:
                databases = connection.database_names()
            except:
                message = "Error: Could not list databases on server. Please " \
                          +         "check the auth components of your URI or provide " \
                          +         "a namespace filter with -n.\n"
                sys.stderr.write(message)
                databases = []

            for ignore_db in IGNORE_DBS:
                if ignore_db in databases:
                    databases.remove(ignore_db)

        for database in databases:

            db = connection[database]

            profile_entries = db['system.profile'].find()

            for profile_entry in profile_entries:
                self._process_query(profile_entry,
                                    profile_parser)

        self._output_aggregated_report(sys.stdout)

        return 0
933470
def user_list(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    ret = {}
    for user in kstone.users.list():
        ret[user.name] = dict((value, getattr(user, value, None)) for value in dir(user)
                              if not value.startswith('_') and
                              isinstance(getattr(user, value, None), (six.string_types, dict, bool)))
        tenant_id = getattr(user, 'tenantId', None)
        if tenant_id:
            ret[user.name]['tenant_id'] = tenant_id
    return ret
488560
function(id, profileKey, workDir) {
    console.log("Generating preprocessor string content");

    if( !profiles.hasOwnProperty("definitions") ) {
         throw("\"profiles\" dictionary is badly formed, no \"definitions\" key");
    }
    if ( !profiles.definitions.hasOwnProperty(profileKey) ) {
        throw("\"" + profileKey + "\" is not a registred SGE profile");
    }
    var string = _preprocessorDump(id, workDir, profiles.definitions[profileKey]);
    //string += _preprocessorDump(id, profiles.definitions[profileKey]);
    console.log(string);

    return string;
}
386290
def profiles(self):
        '''
        
        '''
        limit = []

        if self.is_admin():
            limit.append(_("Administrator"))
        limit.sort()

        return limit
482470
def create_all(self):
        '''
        
        '''
        ret = []

        for vm_name, vm_details in six.iteritems(self.opts['profiles']):
            ret.append(
                {vm_name: self.create(vm_details)}
            )

        return ret