patch all compress

    we need access to variables from widget scss

    for example we have::

        /themes/bootswatch/cyborg/_variables

    but only if is cyborg active for this reasone we need
    dynamically append import to every scss file
167848
def compress_monkey_patch():
    
    from compressor.templatetags import compress as compress_tags
    from compressor import base as compress_base

    compress_base.Compressor.filter_input = filter_input
    compress_base.Compressor.output = output
    compress_base.Compressor.hunks = hunks
    compress_base.Compressor.precompile = precompile

    compress_tags.CompressorMixin.render_compressed = render_compressed

    from django_pyscss import compressor as pyscss_compressor

    pyscss_compressor.DjangoScssFilter.input = input
1018118
def add_variables(*vars)
      # create bound variables for each variable
      bound_vars = vars.collect do |v|
        BoundVariable.new v, self
      end

      # add all the bound variables to the variables hash
      keys = vars.collect(&:name)
      append_hash = Hash[ keys.zip(bound_vars) ]
      @variables_hash.merge!(append_hash) do |key, oldval, newval|
        oldval # the first bound variable
      end
    end
1258604
def patch(filepath, debug):
    
    print("patch 'pause' in %r" % filepath)
    with open(filepath, "r") as infile:
        origin_content = infile.read()

    new_content = origin_content.replace("pause\n", """echo "'pause'"\n""")
    assert new_content!=origin_content, "not changed: %s" % origin_content

    with open(filepath, "w") as outfile:
        outfile.write(new_content)

    print("%r patched" % filepath)
    if debug:
        print("-"*79)
        print(repr(new_content))
        print("-"*79)
        print(new_content)
        print("-"*79)
671168
def load_vars(opt):
    """"""
    if not hasattr(opt, '_vars_cache'):
        cli_opts = cli_hash(opt.extra_vars)
        setattr(opt, '_vars_cache',
                merge_dicts(load_var_files(opt, cli_opts), cli_opts))

    return getattr(opt, '_vars_cache')
332392
public function sync_config() {
    $db_class_vars = get_class_vars('DB'); // the DB::$$var syntax only works in 5.3+

    foreach (DB::$variables_to_sync as $variable) {
      if ($this->$variable !== $db_class_vars[$variable]) {
        $this->$variable = $db_class_vars[$variable];
      }
    }
  }
1337839
def as_widget(self, widget=None, attrs=None, only_initial=False):
        
        attrs = attrs or {}
        attrs.update(self.form.get_widget_attrs(self))
        if hasattr(self.field, 'widget_css_classes'):
            css_classes = self.field.widget_css_classes
        else:
            css_classes = getattr(self.form, 'widget_css_classes', None)
        if css_classes:
            attrs.update({'class': css_classes})
        widget_classes = self.form.fields[self.name].widget.attrs.get('class', None)
        if widget_classes:
            if attrs.get('class', None):
                attrs['class'] += ' ' + widget_classes
            else:
                attrs.update({'class': widget_classes})
        return super(NgBoundField, self).as_widget(widget, attrs, only_initial)
4745
function fixPrepatch(to, ___) {
  var _this3 = this;

  if (this._hashChanged) return;

  __WEBPACK_IMPORTED_MODULE_6_vue__["default"].nextTick(function () {
    var instances = Object(__WEBPACK_IMPORTED_MODULE_9__utils__["g" /* getMatchedComponentsInstances */])(to);

    _lastComponentsFiles = instances.map(function (instance, i) {
      if (!instance) return '';

      if (_lastPaths[i] === instance.constructor._path && typeof instance.constructor.options.data === 'function') {
        var newData = instance.constructor.options.data.call(instance);
        for (var key in newData) {
          __WEBPACK_IMPORTED_MODULE_6_vue__["default"].set(instance.$data, key, newData[key]);
        }
      }

      return instance.constructor.options.__file;
    });

    // Hide error component if no error
    if (_this3._hadError && _this3._dateLastError === _this3.$options._nuxt.dateErr) {
      _this3.error();
    }

    // Set layout
    var layout = _this3.$options._nuxt.err ? __WEBPACK_IMPORTED_MODULE_8__index__["a" /* NuxtError */].layout : to.matched[0].components.default.options.layout;
    if (typeof layout === 'function') {
      layout = layout(_this3._context);
    }
    _this3.setLayout(layout);

    // Hot reloading
    setTimeout(function () {
      return hotReloadAPI(_this3);
    }, 100);
  });
}
561069
def load_cfg(self, src_dir):
        

        # last files override previous ones
        cfg_files = [os.path.expanduser(USER_CFG_FILE),
                     os.path.abspath(os.path.join(src_dir, '.dirsync'))]

        cfg = ConfigParser()
        cfg.read(cfg_files)

        if not cfg.has_section('defaults'):
            return

        defaults = {}
        for name, val in cfg.items('defaults'):
            try:
                opt = OPTIONS[name][1]
            except KeyError:
                if name == 'action':
                    if val in OPTIONS:
                        defaults['action'] = val
                    else:
                        raise ValueError('Invalid value for "action" option '
                                         'in configuration file: %s' % val)
                continue

            curdef = opt.get('default', '')
            if isinstance(curdef, bool):
                newdef = val not in ('0', 'False', 'false')
            elif isinstance(curdef, string_types):
                newdef = val
            else:
                newdef = val.strip('\n').split('\n')

            defaults[name] = newdef

        self.set_defaults(**defaults)
1277145
def edit
    @config_var = ConfigVar.where(name: params[:name]).first
    unless @config_var
      @config_var = ConfigVar.new name: params[:name]
      if descriptor = ConfigvarsRails.variable_descriptor(params[:name])
        @config_var.value = descriptor.default_value
      end
    end
  end
608268
public function saveConfVars()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        oxAdminDetails::save();

        $sShopId = $myConfig->getShopId();

        $sModule = $this->_getModuleForConfigVars();

        foreach ($this->_aConfParams as $sType => $sParam) {
            $aConfVars = $myConfig->getRequestParameter($sParam);
            if (is_array($aConfVars)) {
                foreach ($aConfVars as $sName => $sValue) {
                    $myConfig->saveShopConfVar(
                        $sType,
                        $sName,
                        $this->_serializeConfVar($sType, $sName, $sValue),
                        $sShopId,
                        $sModule
                    );
                }
            }
        }
    }
766899
def import_variables(self, container, varnames=None):
        """"""
        if varnames is None:
            for keyword in self.tkvariables:
                setattr(container, keyword, self.tkvariables[keyword])
        else:
            for keyword in varnames:
                if keyword in self.tkvariables:
                    setattr(container, keyword, self.tkvariables[keyword])
110215
def _load_config(self, t_thresh):
        
        # Load and configure user config dir when controller starts
        if not user_config_dir_exists():
            user_config_dir = make_user_config_dir()
        else:
            user_config_dir = get_user_config_dir()

        if user_config_dir is None:
            logging.warning("Failed to find or create scripts directory,\
                             proceeding without scripting support")
            self.script_hooks_enabled = False
        else:
            self.script_loader = ScriptHookLoader(user_config_dir)

        # Use user config file if one was saved before
        self.conf = None
        if user_config_file_exists():
            self.conf = configparser.ConfigParser()
            self.conf.read(get_user_config_file())
        else:
            logging.debug("Config file not found")

        # Load refresh refresh rate from config
        try:
            self.refresh_rate = str(self.conf.getfloat(
                'GraphControll', 'refresh'))
            logging.debug("User refresh rate: %s", self.refresh_rate)
        except (AttributeError, ValueError, configparser.NoOptionError,
                configparser.NoSectionError):
            logging.debug("No refresh rate configed")

        # Change UTF8 setting from config
        try:
            if self.conf.getboolean('GraphControll', 'UTF8'):
                self.smooth_graph_mode = True
            else:
                logging.debug("UTF8 selected as %s",
                              self.conf.get('GraphControll', 'UTF8'))
        except (AttributeError, ValueError, configparser.NoOptionError,
                configparser.NoSectionError):
            logging.debug("No user config for utf8")

        # Try to load high temperature threshold if configured
        if t_thresh is None:
            try:
                self.temp_thresh = self.conf.get('GraphControll', 'TTHRESH')
                logging.debug("Temperature threshold set to %s",
                              self.temp_thresh)
            except (AttributeError, ValueError, configparser.NoOptionError,
                    configparser.NoSectionError):
                logging.debug("No user config for temp threshold")

        # This should be the only place where sources are configured
        possible_sources = [TempSource(self.temp_thresh),
                            FreqSource(),
                            UtilSource(),
                            RaplPowerSource(),
                            FanSource()]

        # Load sensors config if available
        sources = [x.get_source_name() for x in possible_sources
                   if x.get_is_available()]
        for source in sources:
            try:
                options = list(self.conf.items(source + ",Graphs"))
                for option in options:
                    # Returns tuples of values in order
                    self.graphs_default_conf[source].append(
                        str_to_bool(option[1]))
                options = list(self.conf.items(source + ",Summaries"))
                for option in options:
                    # Returns tuples of values in order
                    self.summary_default_conf[source].append(
                        str_to_bool(option[1]))
            except (AttributeError, ValueError, configparser.NoOptionError,
                    configparser.NoSectionError):
                logging.debug("Error reading sensors config")

        return possible_sources
190092
function addTemplateVariables (req, res, next) {
  res.locals.profile = req.user;
  res.locals.login = '/auth/login?return=' +
    encodeURIComponent(req.originalUrl);
  res.locals.logout = '/auth/logout?return=' +
    encodeURIComponent(req.originalUrl);
  next();
}
692914
private function loadConstantsIfNotLoaded() {
		if ($this->constants == null) {
			$proxy = new MoufReflectionProxy();
			// TODO: really not very clean.
			// We need to move out of "selfedit" into a "managed dir" view of things.
			if ($this->configFileName == "../../../../../config.php") {
				$selfEdit = false;
			} else {
				$selfEdit = true;
			}
			$this->constants = $proxy->getConfigConstants($selfEdit);
		}	
	}
1308158
protected function prepareVars()
    {
        if ($this->formField->disabled) {
            $this->previewMode = true;
        }

        if ($this->previewMode) {
            $this->useCaption = false;
        }

        $this->vars['fileList'] = $fileList = $this->getFileList();
        $this->vars['singleFile'] = $fileList->first();
        $this->vars['displayMode'] = $this->getDisplayMode();
        $this->vars['emptyIcon'] = $this->getConfig('emptyIcon', 'icon-upload');
        $this->vars['imageHeight'] = $this->imageHeight;
        $this->vars['imageWidth'] = $this->imageWidth;
        $this->vars['acceptedFileTypes'] = $this->getAcceptedFileTypes(true);
        $this->vars['cssDimensions'] = $this->getCssDimensions();
        $this->vars['cssBlockDimensions'] = $this->getCssDimensions('block');
        $this->vars['useCaption'] = $this->useCaption;
        $this->vars['prompt'] = $this->getPromptText();
    }
540125
def on_add(self, widget, data=None):
        
        gv_name = "new_global_%s" % self.global_variable_counter
        self.global_variable_counter += 1
        try:
            self.model.global_variable_manager.set_variable(gv_name, None)
        except (RuntimeError, AttributeError, TypeError) as e:
            logger.warning("Addition of new global variable '{0}' failed: {1}".format(gv_name, e))
        self.select_entry(gv_name)
        return True
567433
function (cfg, ctxt) {
        this.$Container.constructor.apply(this, arguments);
        // make a call to the AriaSkinInterface to get access to the skin object applicable here
        if (!this._frame) {
            /* this._frame could be overriden in sub-classes */
            this._frame = ariaWidgetsFramesFrameFactory.createFrame({
                skinnableClass : this._skinnableClass,
                sclass : cfg.sclass,
                state : "normal",
                width : cfg.width,
                height : cfg.height,
                printOptions : cfg.printOptions,
                cssClass : cfg.cssClass,
                block : cfg.block,
                scrollBarX : cfg.scrollBarX,
                scrollBarY : cfg.scrollBarY
            });
        }
        this._skinObj = this._frame.getSkinObject();
        this._selected = false;
    }