Collects values from the knowledge base.

    Args:
      knowledge_base (KnowledgeBase): to fill with preprocessing information.

    Raises:
      PreProcessFail: if the preprocessing fails.
191290
def Collect(self, knowledge_base):
    
    environment_variable = knowledge_base.GetEnvironmentVariable(
        'programdata')
    allusersprofile = getattr(environment_variable, 'value', None)

    if not allusersprofile:
      environment_variable = knowledge_base.GetEnvironmentVariable(
          'allusersprofile')
      allusersprofile = getattr(environment_variable, 'value', None)

      if allusersprofile:
        environment_variable = artifacts.EnvironmentVariableArtifact(
            case_sensitive=False, name='programdata', value=allusersprofile)

        try:
          logger.debug('setting environment variable: {0:s} to: "{1:s}"'.format(
              'programdata', allusersprofile))
          knowledge_base.AddEnvironmentVariable(environment_variable)
        except KeyError:
          # TODO: add and store preprocessing errors.
          pass
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
1229814
def allowed_values(self):
        
        data = clips.data.DataObject(self._env)

        lib.EnvSlotAllowedValues(
            self._env, self._cls, self._name, data.byref)

        return tuple(data.value) if isinstance(data.value, list) else ()
416416
protected void collectAttributeWithFilteredValues(final Map<String, List<Object>> attributesToRelease, final String attributeName,
                                                      final List<Object> filteredValues) {
        attributesToRelease.put(attributeName, filteredValues);
    }
1238974
def get_value_hash_txids(self, value_hash):
        
        cur = self.db.cursor()
        return namedb_get_value_hash_txids(cur, value_hash)
1108907
def _set_values(self):
        
        # Iterate all keys and values in data
        for k, v in self._data.items():
            # If it's a dict, process it (it's probably instance data)
            if isinstance(v, dict):
                try:
                    # Get related model from field (follow path)
                    rel_model = self._model
                    for attr in k.split('__'):
                        rel_model = getattr(rel_model, attr).field.related_model

                except AttributeError:
                    # Not a model, maybe it is a dict field (?)
                    pass

                else:
                    # Model, first shorten field name
                    k = k.replace('__', '_')

                    # Now init instance if required (not if we got ID None)
                    if 'id' in v and v['id'] is None:
                        # This means we grouped by ID, if it's none then FK is None
                        v = None

                    else:
                        # Either we have ID or we didn't group by ID, use instance
                        v = rel_model(**v)

            # Set value
            setattr(self, k, v)
1364813
def dbStore(self, typ, py_value):
        
        # convert base types to work in the database
        if isinstance(py_value, (list, tuple, set)):
            py_value = tuple((self.dbStore(x) for x in py_value))
        elif isinstance(py_value, orb.Collection):
            py_value = py_value.ids()
        elif isinstance(py_value, orb.Model):
            py_value = py_value.id()

        return py_value
426560
def get_workflows() -> dict:
    
    keys = DB.get_keys("workflow_definitions:*")
    known_workflows = dict()
    for key in keys:
        values = key.split(':')
        if values[1] not in known_workflows:
            known_workflows[values[1]] = list()
        known_workflows[values[1]].append(values[2])

    return known_workflows
1187149
def Parse(self, stat, file_object, knowledge_base):
    """"""
    _, _ = stat, knowledge_base
    lines = [
        l.strip()
        for l in utils.ReadFileBytesAsUnicode(file_object).splitlines()
    ]
    for index, line in enumerate(lines):
      user = self.ParseLine(index, line)
      if user is not None:
        yield user
772829
def _update_params(self):
        
        if self.data.get('title'):
            self.params['title'] = self.data.get('title')
        if self.data.get('pageid'):
            self.params['pageid'] = self.data.get('pageid')
        if self.data.get('wikibase'):
            self.params['wikibase'] = self.data.get('wikibase')
910704
def values_list(self, *fields, **kwargs):
        
        flat = kwargs.pop('flat', False)
        if kwargs:
            raise TypeError('Unexpected keyword arguments to values_list: %s'
                            % (kwargs.keys(),))
        if flat and len(fields) > 1:
            raise TypeError("'flat' is not valid when values_list is called with more than one field.")
        clone = self.only(fields)
        clone._values_list = True
        clone._flat_values_list = flat
        return clone
214861
@Override
    public boolean clearKnowledgeBase() {

        if (!this.graphStoreManager.canBeModified()) {
            log.warn("The dataset cannot be modified.");
            return false;
        }

        log.info("Clearing knowledge base.");
        this.graphStoreManager.clearDataset();

        // Generate Event
        this.getEventBus().post(new KnowledgeBaseClearedEvent(new Date()));

        return true;
    }
895924
def create_knowledge_base(project_id, display_name):
    """"""
    import dialogflow_v2beta1 as dialogflow
    client = dialogflow.KnowledgeBasesClient()
    project_path = client.project_path(project_id)

    knowledge_base = dialogflow.types.KnowledgeBase(
        display_name=display_name)

    response = client.create_knowledge_base(project_path, knowledge_base)

    print('Knowledge Base created:\n')
    print('Display Name: {}\n'.format(response.display_name))
    print('Knowledge ID: {}\n'.format(response.name))
175725
void grab(KnowledgeHelper kh) {
        assert kh != null : "kh cannot be null";
        assert this.kh == null : "The previous user of this copier forgot to call release!";
        if (this.kh != null) {
            LOGGER.log(Level.WARNING, 
                    "The previous user of this copier forgot to call release. This causes a memory leak!");
        }
        this.kh = kh;
        this.uniqueIdProvider = 
                new ProviderBasedUniqueIdFactory(new JBossRulesDerivedLocalUniqueIdValuesProvider(this.kh.getWorkingMemory(), 
                        this.propId));
    }
730348
def get_knowledge_category_metadata(self):
        
        # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template
        metadata = dict(self._mdata['knowledge_category'])
        metadata.update({'existing_id_values': self._my_map['knowledgeCategoryId']})
        return Metadata(**metadata)
836920
def gather!
      ::Knowledge::Initializer.new(
        adapters: enabled_adapters,
        params: additionnal_params,
        setter: setter,
        variables: variables
      ).run
    end
300560
def update(self, *args, **kwargs):
        '''
        
        '''
        preprocess = kwargs.get('preprocess')
        for s in args:
            for e in s:
                self._dict_set(preprocess(e) if preprocess else e, True)