Sets the detail levels from the input dictionary in detail_levels.
554623
def set_detail_level(self, detail_levels):
        
        if detail_levels is None:
            return

        self.detail_levels = detail_levels
        if 'api' in detail_levels:
            self.api_detail_level = detail_levels['api']
        if 'http' in detail_levels:
            self.http_detail_level = detail_levels['http']
        if isinstance(self.api_detail_level, int):
            self.api_maxlen = self.api_detail_level
        if isinstance(self.http_detail_level, int):
            self.http_maxlen = self.http_detail_level
1146137
def record_set_details(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
1004037
def override_level_names(self, mapping):
        
        if not isinstance(mapping, dict):
            return
        for key, val in mapping.items():
            if key in self._level_names:
                self._level_names[key] = val
66950
def generate_detail_view(self):
        """"""

        name = model_class_form(self.model + 'DetailView')
        detail_args = dict(
            detailview_excludes=self.detailview_excludes,
            model=self.get_model_class,
            template_name=self.get_template('detail'),
            login_required=self.check_login_required,
            permissions=self.view_permission('detail'),
            inlineformset=self.inlineformset,
            permission_required=self.check_permission_required,
            custom_postfix_url=self.custom_postfix_url
        )

        detail_class = type(name, (BaseDetailViewMixin, DetailView), detail_args)
        self.classes[name] = detail_class
        return detail_class
1354584
def set_nested(self, klist, value):
        """"""
        keys = list(klist)
        if len(keys) > 0:
            curr_dict = self
            last_key = keys.pop()
            for key in keys:
                if not curr_dict.has_key(key) or not isinstance(curr_dict[key], 
                                                                NestedDict):
                    curr_dict[key] = type(self)()
                curr_dict = curr_dict[key]
            curr_dict[last_key] = value
588475
def __diff_set(self, level):
        """"""
        t1_hashtable = self.__create_hashtable(level.t1, level)
        t2_hashtable = self.__create_hashtable(level.t2, level)

        t1_hashes = set(t1_hashtable.keys())
        t2_hashes = set(t2_hashtable.keys())

        hashes_added = t2_hashes - t1_hashes
        hashes_removed = t1_hashes - t2_hashes

        items_added = [t2_hashtable[i].item for i in hashes_added]
        items_removed = [t1_hashtable[i].item for i in hashes_removed]

        for item in items_added:
            change_level = level.branch_deeper(
                notpresent, item, child_relationship_class=SetRelationship)
            self.__report_result('set_item_added', change_level)

        for item in items_removed:
            change_level = level.branch_deeper(
                item, notpresent, child_relationship_class=SetRelationship)
            self.__report_result('set_item_removed', change_level)
971672
public void setLevel(Level level)
  {
    _level = level;

    if (level.intValue() < _lowLevel.intValue())
      _lowLevel = level;
  }
192525
public void setLevels(List<String> levels, List<Integer> codes, boolean isOrdered) throws DDFException {
    if (levels == null || levels.isEmpty()) throw new DDFException("Levels cannot be null or empty");
    if (codes != null && codes.size() != levels.size()) throw new DDFException(String.format(
        "The number of levels is %d which does not match the number of codes %d", levels.size(), codes.size()));

    if (mLevelMap == null) mLevelMap = this.instantiateSynchronizedLevelMap();

    if (codes == null) {
      // Auto-create a 1-based level-code map
      codes = new ArrayList<Integer>();
      for (int i = 1; i <= levels.size(); i++) {
        codes.add(i);
      }
    }

    Iterator<String> levelIter = levels.iterator();
    Iterator<Integer> codeIter = codes.iterator();
    while (levelIter.hasNext()) {
      mLevelMap.put(levelIter.next(), codeIter.next());
    }
    this.mLevels = new ArrayList<String>(levels);
    this.setOrdered(isOrdered);
  }
1163855
def zeroize_after_level(self, base_level):
        
        index = _LEVELS.index(base_level) + 1
        for level in _LEVELS[index:]:
            self.version_info[level] = 0
1032392
public void setProvisioningArtifactDetails(java.util.Collection<ProvisioningArtifactDetail> provisioningArtifactDetails) {
        if (provisioningArtifactDetails == null) {
            this.provisioningArtifactDetails = null;
            return;
        }

        this.provisioningArtifactDetails = new java.util.ArrayList<ProvisioningArtifactDetail>(provisioningArtifactDetails);
    }
653433
def _add_details(self, info):
        
        for (key, val) in six.iteritems(info):
            if isinstance(key, six.text_type) and six.PY2:
                key = key.encode(pyrax.get_encoding())
            elif isinstance(key, bytes):
                key = key.decode("utf-8")
            setattr(self, key, val)
128024
@Override
  public void setLevel(Level level)
  {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    
    if (loader == null) {
      loader = _systemClassLoader;
    }

    if (loader != _systemClassLoader) {
      if (_localLevel == null)
        _localLevel = new EnvironmentLocal<Level>();
      
      _localLevel.set(level);
      
      if (level != null) {
        addLoader(loader);
      }
    }
    else {
      _systemLevel = level;
    }
    
    updateEffectiveLevel(loader);
  }
617686
def get_details(exc):
    """"""
    detail = None
    fields = collections.OrderedDict()

    if exc.detail:
        detail = exc.detail

    if exc.fields:
        for k, v in six.iteritems(exc.fields):
            try:
                field_detail = v["detail"]
            except (TypeError, KeyError):
                field_detail = v

            if isinstance(field_detail, (list, tuple)):
                field_detail = " ".join(field_detail)

            if k == "non_field_errors":
                if detail:
                    detail += " " + field_detail
                else:
                    detail = field_detail
                continue

            fields[k] = field_detail

    return detail, fields
1326753
def workflow_set_details(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
1160174
def to_dict(self):
        """"""
        return {
            'level': self.level,
            'id': self.id,
            'text': self.text,
            'inner_html': self.inner_html,
            'children': [child.to_dict() for child in self.children]
        }
1094061
def make_level_set(level):
    ''''''
    new_level = dict()
    for key,value in level.items():
        if isinstance(value,list):
            new_level[key] = set(value)
        else:
            new_level[key] = value
    return new_level
292928
def set_widgets(self):
        """"""
        purpose = self.parent.step_kw_purpose.selected_purpose()
        subcategory = self.parent.step_kw_subcategory.selected_subcategory()

        classification = self.parent.step_kw_classification.\
            selected_classification()
        classification_name = classification['name']

        if is_raster_layer(self.parent.layer):
            self.lblClassify.setText(classify_raster_question % (
                subcategory['name'], purpose['name'], classification_name))
            dataset = gdal.Open(self.parent.layer.source(), GA_ReadOnly)
            active_band = self.parent.step_kw_band_selector.selected_band()
            unique_values = numpy.unique(numpy.array(
                dataset.GetRasterBand(active_band).ReadAsArray()))
            field_type = 0
            # Convert datatype to a json serializable type
            if numpy.issubdtype(unique_values.dtype, float):
                unique_values = [float(i) for i in unique_values]
            else:
                unique_values = [int(i) for i in unique_values]
        else:
            field = self.parent.step_kw_field.selected_fields()
            field_index = self.parent.layer.fields().indexFromName(field)
            field_type = self.parent.layer.fields()[field_index].type()
            self.lblClassify.setText(classify_vector_question % (
                subcategory['name'], purpose['name'],
                classification_name, field.upper()))
            unique_values = self.parent.layer.uniqueValues(field_index)

        clean_unique_values = []
        for unique_value in unique_values:
            if (unique_value is None
                    or (hasattr(unique_value, 'isNull')
                        and unique_value.isNull())):
                # Don't classify features with NULL value
                continue
            clean_unique_values.append(unique_value)

        # get default classes
        default_classes = deepcopy(classification['classes'])
        if classification['key'] == data_driven_classes['key']:
            for unique_value in clean_unique_values:
                name = str(unique_value).upper().replace('_', ' ')
                default_class = {'key': unique_value,
                                 'name': name,
                                 # 'description': tr('Settlement'),
                                 'string_defaults': [name]}

                default_classes.append(default_class)

        # Assign unique values to classes (according to default)
        unassigned_values = list()
        assigned_values = dict()

        for default_class in default_classes:
            assigned_values[default_class['key']] = list()
        for unique_value in clean_unique_values:
            # Capitalization of the value and removing '_' (raw OSM data).
            value_as_string = str(unique_value).upper().replace('_', ' ')
            assigned = False
            for default_class in default_classes:
                if 'string_defaults' in default_class:
                    # To make it case insensitive
                    upper_string_defaults = [
                        c.upper() for c in default_class['string_defaults']]
                    in_string_default = (
                        value_as_string in upper_string_defaults)
                    condition_1 = field_type > 9 and in_string_default
                else:
                    condition_1 = False
                condition_2 = (
                    field_type < 10
                    and 'numeric_default_min' in default_class
                    and 'numeric_default_max' in default_class
                    and (default_class['numeric_default_min']
                         <= unique_value
                         <= default_class['numeric_default_max']))
                if condition_1 or condition_2:
                    assigned_values[default_class['key']] += [unique_value]
                    assigned = True

            if not assigned:
                # add to unassigned values list otherwise
                unassigned_values += [unique_value]

        self.populate_classified_values(
            unassigned_values, assigned_values, default_classes)

        # Overwrite assigned values according to existing keyword (if present).
        # Note the default_classes and unique_values are already loaded!

        value_map = self.parent.get_existing_keyword('value_map')
        value_map_classification_name = self.parent.get_existing_keyword(
            'classification')
        # Do not continue if there is no value_map in existing keywords
        if (value_map is None
                or value_map_classification_name != classification['key']):
            return

        # Do not continue if user selected different field
        field_keyword = self.parent.field_keyword_for_the_layer()
        field = self.parent.get_existing_keyword('inasafe_fields').get(
            field_keyword)
        if (not is_raster_layer(self.parent.layer)
                and field != self.parent.step_kw_field.selected_fields()):
            return

        unassigned_values = list()
        assigned_values = dict()
        for default_class in default_classes:
            assigned_values[default_class['key']] = list()
        if isinstance(value_map, str):
            try:
                value_map = json.loads(value_map)
            except ValueError:
                return

        for unique_value in clean_unique_values:
            # check in value map
            assigned = False
            for key, value_list in list(value_map.items()):
                if unique_value in value_list and key in assigned_values:
                    assigned_values[key] += [unique_value]
                    assigned = True
            if not assigned:
                unassigned_values += [unique_value]
        self.populate_classified_values(
            unassigned_values, assigned_values, default_classes)