Create properties that perform lazy loading of attributes.
171350
def lazy_property_factory(lazy_property):
    """"""
    def lazy_property_getter(self):
        if not hasattr(self, '_' + lazy_property):
            self.load()
        if not hasattr(self, '_' + lazy_property):
            raise ValueError("{} wasn't loaded".format(lazy_property))
        return getattr(self, '_' + lazy_property)

    def lazy_property_setter(self, value):
        setattr(self, '_' + lazy_property, value)

    return lazy_property_getter, lazy_property_setter
346074
public static void loadCustomerProperties(Properties props){
        for(Entry<Object, Object> entry : props.entrySet()){
            setProperty((String)entry.getKey(), entry.getValue());
        }
    }
126988
function lazyDefinePropertyValue(propertyName, loader) {
  return function() {
    var value = loader.apply(this, arguments);

    Object.defineProperty(this, propertyName, {
      value: value,
      enumerable: true,
      configurable: true,
    });

    return value;
  };
}
1058564
private void reloadProperties() {
        Properties temp = new Properties();
        BufferedReader bufferedReader = null;
        try {
            bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(propertiesFile), "UTF8"));
            temp.load(bufferedReader);
            this.properties = temp;
        } catch (IOException e) {
            error("Error while trying to load the Properties-File: "
                    + propertiesFile.getAbsolutePath(), e);
        } finally {
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException e) {
                    error("Unable to close input stream", e);
                }
            }
        }
    }
502278
def _create_properties(self):
        """"""
        self._rcbag = {}  # bag for row/column prop editors
        self._fgrid = f = ttk.Labelframe(self._sframe.innerframe,
                                         text=_('Grid options:'), padding=5)
        f.grid(sticky='nswe')
        #  hack to resize correctly when properties are hidden
        label = ttk.Label(f)
        label.grid()

        label_tpl = "{0}:"
        row = 0
        col = 0

        groups = (
            ('00', properties.GRID_PROPERTIES, properties.LAYOUT_OPTIONS),
        )

        for gcode, plist, propdescr in groups:
            for name in plist:
                kwdata = propdescr[name]
                labeltext = label_tpl.format(name)
                label = ttk.Label(self._fgrid, text=labeltext, anchor=tk.W)
                label.grid(row=row, column=col, sticky=tk.EW, pady=2)
                widget = self._create_editor(self._fgrid, name, kwdata)
                widget.grid(row=row, column=col+1, sticky=tk.EW, pady=2)
                row += 1
                self._propbag[gcode+name] = (label, widget)

        # Grid row/col properties
        #labels
        gcode = '01'
        self._fgrc = fgrc = ttk.LabelFrame(self._sframe.innerframe,
                                           text=_('Grid row/column options:'),
                                           padding=5)
        fgrc.grid(row=1, column=0, sticky=tk.NSEW, pady='10 0')

        #hack to resize correctly when properties are hidden
        label = ttk.Label(fgrc)
        label.grid()

        row = col = 0
        icol = 1
        headers = []
        for pname in properties.GRID_RC_PROPERTIES:
            label = ttk.Label(fgrc, text=pname)
            label.grid(row=row, column=icol)
            headers.append(label)
            icol += 1
        self._internal = {'grc_headers': headers}

        #
        name_format = '{}_{}_{}'  # {row/column}_{number}_{name}
        MAX_RC = 50
        #rowconfig
        row += 1
        trow_label = _('Row {0}:')
        tcol_label = _('Column {0}:')
        for index in range(0, MAX_RC):
            labeltext = trow_label.format(index)
            label = ttk.Label(fgrc, text=labeltext)
            label.grid(row=row, column=0)

            labeltext = tcol_label.format(index)
            labelc = ttk.Label(fgrc, text=labeltext)
            labelc.grid(row=row + MAX_RC, column=0, sticky=tk.E, pady=2)

            icol = 1
            for pname in properties.GRID_RC_PROPERTIES:
                kwdata = properties.LAYOUT_OPTIONS[pname]

                alias = name_format.format('row', index, pname)
                widget = self._create_editor(fgrc, alias, kwdata)
                widget.grid(row=row, column=icol, pady=2, sticky='ew')
                self._rcbag[alias] = (label, widget)

                alias = name_format.format('column', index, pname)
                widget = self._create_editor(fgrc, alias, kwdata)
                widget.grid(row=row + MAX_RC, column=icol, pady=2, sticky='ew')
                self._rcbag[alias] = (labelc, widget)

                icol += 1
            row += 1
784052
def _load(self):
        """"""
        for attr_name, config_prop in self._iter_config_props():
            found = False
            for loader in self._loaders:
                if loader.exists(config_prop.property_key):
                    raw_value = loader.get(config_prop.property_key)
                    converted_value = config_prop.load(raw_value)

                    self._set_instance_prop(attr_name, config_prop, converted_value)
                    found = True
                    break

            if not found:
                if not config_prop.required or config_prop.default is not None:
                    self._set_instance_prop(attr_name, config_prop, config_prop.default)
                else:
                    raise ValueError('Missing required ConfigProperty {}'.format(attr_name))
632391
def _lazy(self, method, *args):
        
        if list.__len__(self) == 0:
            self.load()
            setattr(self, method, types.MethodType(getattr(list, method), self))
        return getattr(list, method)(self, *args)
511354
def add_properties_callbacks(cls):
    """"""
    for name in cls._mutators:                                                 #pylint: disable=protected-access
        if not hasattr(cls, name):
            continue
        setattr(cls, name, properties_mutator(cls, name))
    for name in cls._operators:                                                #pylint: disable=protected-access
        if not hasattr(cls, name):
            continue
        setattr(cls, name, properties_operator(cls, name))
    for name in cls._ioperators:                                               #pylint: disable=protected-access
        if not hasattr(cls, name):
            continue
        setattr(cls, name, properties_mutator(cls, name, True))
    return cls
530710
private void setAttributes(Map attrs, int offset) {
        if (runCount == 0) {
            createRunAttributeDataVectors();
        }

        int index = ensureRunBreak(offset, false);
        int size;

        if (attrs != null && (size = attrs.size()) > 0) {
            Vector runAttrs = new Vector(size);
            Vector runValues = new Vector(size);
            Iterator iterator = attrs.entrySet().iterator();

            while (iterator.hasNext()) {
                Map.Entry entry = (Map.Entry)iterator.next();

                runAttrs.add(entry.getKey());
                runValues.add(entry.getValue());
            }
            runAttributes[index] = runAttrs;
            runAttributeValues[index] = runValues;
        }
    }
152045
def _load_attributes(new_class):
        """"""
        for field_name, field_obj in new_class.meta_.declared_fields.items():
            new_class.meta_.attributes[field_obj.get_attribute_name()] = field_obj
224188
private void initializeAttributes(AttributeSet attrs) {
    TypedArray attributes = getContext().obtainStyledAttributes(attrs, R.styleable.draggable_view);
    this.enableHorizontalAlphaEffect =
        attributes.getBoolean(R.styleable.draggable_view_enable_minimized_horizontal_alpha_effect,
            DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT);
    this.enableClickToMaximize =
        attributes.getBoolean(R.styleable.draggable_view_enable_click_to_maximize_view,
            DEFAULT_ENABLE_CLICK_TO_MAXIMIZE);
    this.enableClickToMinimize =
        attributes.getBoolean(R.styleable.draggable_view_enable_click_to_minimize_view,
            DEFAULT_ENABLE_CLICK_TO_MINIMIZE);
    this.topViewResize =
            attributes.getBoolean(R.styleable.draggable_view_top_view_resize, DEFAULT_TOP_VIEW_RESIZE);
    this.topViewHeight = attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_height,
            DEFAULT_TOP_VIEW_HEIGHT);
    this.scaleFactorX = attributes.getFloat(R.styleable.draggable_view_top_view_x_scale_factor,
            DEFAULT_SCALE_FACTOR);
    this.scaleFactorY = attributes.getFloat(R.styleable.draggable_view_top_view_y_scale_factor,
            DEFAULT_SCALE_FACTOR);
    this.marginBottom = attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_margin_bottom,
            DEFAULT_TOP_VIEW_MARGIN);
    this.marginRight = attributes.getDimensionPixelSize(R.styleable.draggable_view_top_view_margin_right,
            DEFAULT_TOP_VIEW_MARGIN);
    this.dragViewId =
            attributes.getResourceId(R.styleable.draggable_view_top_view_id, R.id.drag_view);
    this.secondViewId =
            attributes.getResourceId(R.styleable.draggable_view_bottom_view_id, R.id.second_view);
    attributes.recycle();
  }
1150341
function Resource(attributes) {
  this.engine = engine;
  this.name = !this.name ? this.name : this.name.toLowerCase();
  this.queryParams = {};
  this.attributes = {};
  this.load(attributes || {});
}
900319
function lazy(schema, defaults, options) {
  if (kindOf(schema) !== 'function') {
    if (process.env.NODE_ENV !== 'production') {
      throw new Error(
        `Lazy structs must be defined as an function that returns a schema, but you passed: ${schema}`
      )
    } else {
      throw new Error(`Invalid schema: ${schema}`)
    }
  }

  let kind
  let struct
  const name = 'lazy'
  const type = `lazy...`
  const compile = value => {
    struct = schema()
    kind.name = struct.kind
    kind.type = struct.type
    kind.validate = struct.validate
    return kind.validate(value)
  }

  kind = new Kind(name, type, compile)
  return kind
}
787023
def _initialize_attributes(self, data):
    """"""
    attrs = dict(self.attrs)

    if self.primary_key_name is None:
      pass
    elif isinstance(self.primary_key_name, str):
      if self.primary_key_name not in attrs:
        attrs[self.primary_key_name] = None
    else:
      for pkey in self.primary_key_name:
        if pkey not in attrs:
          attrs[pkey] = None

    if self.timestamps:
      for ts_name in self.timestamps:
        if ts_name is not None and ts_name not in attrs:
          attrs[ts_name] = None

    for attr_name in attrs:
      setattr(self, attr_name, get_value(data, attr_name, attrs[attr_name]))
60676
function createSet(values) {
    var set = new Set();
    Lazy(values || []).flatten().each(function(e) {
      set.add(e);
    });
    return set;
  }
913239
def lazy_property(function):
    
    cached_val = []
    def _wrapper(*args):
        try:
            return cached_val[0]
        except IndexError:
            ret_val = function(*args)
            cached_val.append(ret_val)
            return ret_val
    return _wrapper
490504
public void loadStyledAttributes(AttributeSet attrs, int defStyleAttr) {
        if (attrs != null) {
            final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.CircularViewPager,
                    defStyleAttr, 0);

            mStartLineEnabled = attributes.getBoolean(R.styleable.CircularViewPager_progress_start_line_enabled, true);

            mClockwiseArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_clockwise_color, default_clockwise_reached_color);
            mCounterClockwiseArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_counter_clockwise_color, default_counter_clockwise_reached_color);
            mClockwiseOutlineArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_clockwise_outline_color, default_clockwise_outline_color);
            mCounterClockwiseOutlineArcColor = attributes.getColor(R.styleable.CircularViewPager_progress_arc_counter_clockwise_outline_color, default_counter_clockwise_outline_color);

            mClockwiseReachedArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_clockwise_width, default_reached_arc_width);
            mCounterClockwiseReachedArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_counter_clockwise_width, default_reached_arc_width);
            mClockwiseOutlineArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_clockwise_outline_width, default_outline_arc_width);
            mCounterClockwiseOutlineArcWidth = attributes.getDimension(R.styleable.CircularViewPager_progress_arc_counter_clockwise_outline_width, default_outline_arc_width);

            mCircleFillColor = attributes.getColor(R.styleable.CircularViewPager_progress_pager_fill_circle_color, default_circle_fill_color);
            mCircleFillMode = attributes.getInt(R.styleable.CircularViewPager_progress_pager_fill_mode, default_circle_fill_mode);
            cicleFillEnable(mCircleFillColor != default_circle_fill_color);

            setMax(attributes.getInt(R.styleable.CircularViewPager_progress_arc_max, 100));
            setProgress(attributes.getInt(R.styleable.CircularViewPager_arc_progress, 0));

            attributes.recycle();

            initializePainters();
        }
    }