Show transformer rules
517485
def cli(ctx, stage):
    """"""
    if not ctx.bubble:
        ctx.say_yellow('There is no bubble present, ' +
                       'will not show any transformer rules')
        raise click.Abort()

    path = ctx.home + '/'
    RULES = None
    ctx.say('Stage:'+stage, verbosity=10)
    if stage in STAGES:
        if stage in ctx.cfg.CFG:
            STAGE = ctx.cfg.CFG[stage]
            ctx.say('Stage found:', stuff=STAGE,verbosity=100)


        if 'TRANSFORM' in STAGE:
            TRANSFORM = STAGE.TRANSFORM
            ctx.say('Transform found:', stuff=TRANSFORM, verbosity=100)

            if 'RULES' in TRANSFORM:
                RULES = TRANSFORM.RULES
                ctx.say('Rules found:', stuff=RULES, verbosity=100)


    if not RULES:
        ctx.say_red('There is no TRANSFORM.RULES in stage:' + stage)
        ctx.say_yellow('please check configuration in ' +
                       ctx.home + '/config/config.yaml')
        raise click.Abort()

    if type(RULES) == str and RULES.endswith('.bubble'):
        ctx.say('loading rules',verbosity=10)
        rules = get_bubble(ctx, path + RULES)
        rule_type = 'bubble'
        transformer = Transformer(rules=rules,
                                  rule_type=rule_type,
                                  bubble_path=path,
                                  verbose=ctx.get_verbose())
        rules = transformer._rules.get_rules()
        ctx.say('current number of rules:' + str(len(rules)),
                verbosity=1)
        for r in rules:
            ctx.say('rule: ' + str(r), verbosity=1)

        ctx.gbc.say('rules: ', stuff=rules, verbosity=100)
    else:
        ctx.say('no rules!')

    return True
343456
private void paintRule(final Rule rule, final XmlStringBuilder xml) {
		if (rule.getCondition() == null) {
			throw new SystemException("Rule cannot be painted as it has no condition");
		}

		paintCondition(rule.getCondition(), xml);

		for (Action action : rule.getOnTrue()) {
			paintAction(action, "ui:onTrue", xml);
		}

		for (Action action : rule.getOnFalse()) {
			paintAction(action, "ui:onFalse", xml);
		}
	}
222231
function (rules, options) {
    this.rules = new Config(rules, options);
    this.parser = new Parser();
    this.inlineConfig = new InlineConfig(this.rules);
}
1308287
def _validate(self):
        '''
        
        '''
        if self.f_labels is None:
            raise NotFittedError('FeatureRepMix')

        if not self.transformers:
            return

        names, transformers, _ = zip(*self.transformers)

        # validate names
        self._validate_names(names)

        # validate transformers
        for trans in transformers:
            if not isinstance(trans, FeatureRep):
                raise TypeError("All transformers must be an instance of FeatureRep."
                                " '%s' (type %s) doesn't." % (trans, type(trans)))
161010
function transform(transformerCtx, options) {
    var html = options.template;
    for (var i = 0; i < transformers.length; i++) {
        html = transformers[i](html, transformerCtx, options);
    }
    return html;
}
739879
function transformer(data, id) {
	function checkValue(obj) {
		if (!obj || typeof obj !== 'object') {
			return;
		}

		var keys = Object.keys(obj);

		if (keys.indexOf('value') !== -1) {
			obj.values = {};
			obj.values[id] = obj.value;
			delete obj.value;
			return;
		}

		for (var i = 0; i < keys.length; i++) {
			checkValue(obj[keys[i]]);
		}
	}

	checkValue(data);

	return data;
}
626302
def rules(self, x, y):
        # type: (int, int) -> List[Type[Rule]]
        
        return [r for r in self._field[y][x]]
1189132
def show(self, filter=None):
        
        for command in self._commands:
            if command[0] is None:  # or command[1] in self._invalid_objects:
                continue  # Skip nill commands
            if filter and command[0] != filter:
                continue
            t = []
            for e in command:
                if isinstance(e, np.ndarray):
                    t.append('array %s' % str(e.shape))
                elif isinstance(e, str):
                    s = e.strip()
                    if len(s) > 20:
                        s = s[:18] + '... %i lines' % (e.count('\n')+1)
                    t.append(s)
                else:
                    t.append(e)
            print(tuple(t))
183914
def _show_or_save(self, save, show, animate,
                      draw_sidebars=True,
                      draw_title=True,
                      tight_layout=False,
                      subplot_grid=None,
                      **kwargs):
        
        if animate and not show and not save:
            logger.warning("setting show to True since animate=True and save not provided")
            show = True

        if animate:
            # prefer times over time
            times = kwargs.get('times', kwargs.get('time', None))
            save_kwargs = kwargs.get('save_kwargs', {})

            if times is None:
                # then let's try to get all SYNTHETIC times
                # it would be nice to only do ENABLED, but then we have to worry about compute
                # it would also be nice to worry about models... but then you should filter first
                logger.info("no times were providing, so defaulting to animate over all dataset times")
                times = []
                for dataset in self.datasets:
                    ps = self.filter(dataset=dataset, context='model')
                    if len(ps.times):
                        # for the case of meshes/spectra
                        times += [float(t) for t in ps.times]
                    else:
                        for param in ps.filter(qualifier='times').to_list():
                            times += list(param.get_value())

                times = sorted(list(set(times)))

            logger.info("calling autofig.animate(i={}, draw_sidebars={}, draw_title={}, tight_layout={}, save={}, show={}, save_kwargs={})".format(times, draw_sidebars, draw_title, tight_layout, save, show, save_kwargs))

            mplanim = self.gcf().animate(i=times,
                                         draw_sidebars=draw_sidebars,
                                         draw_title=draw_title,
                                         tight_layout=tight_layout,
                                         subplot_grid=subplot_grid,
                                         save=save,
                                         show=show,
                                         save_kwargs=save_kwargs)

            afig = self.gcf()

            # clear the autofig figure
            self.clf()

            return afig, mplanim

        else:
            time = kwargs.get('time', None)

            if isinstance(time, str):
                time = self.get_value(time, context=['component', 'system'])

            logger.info("calling autofig.draw(i={}, draw_sidebars={}, draw_title={}, tight_layout={}, save={}, show={})".format(time, draw_sidebars, draw_title, tight_layout, save, show))
            fig = self.gcf().draw(i=time,
                                  draw_sidebars=draw_sidebars,
                                  draw_title=draw_title,
                                  tight_layout=tight_layout,
                                  subplot_grid=subplot_grid,
                                  save=save, show=show)
            # clear the figure so next call will start over and future shows will work
            afig = self.gcf()
            self.clf()

            return afig, fig
580847
public void execute(TransformerImpl transformer) throws TransformerException
  {

    transformer.pushCurrentTemplateRuleIsNull(true);    
    try
    {
      transformSelectedNodes(transformer);
    }
    finally
    {
      transformer.popCurrentTemplateRuleIsNull();
    }
  }
161431
function toRules (cssText) {
  const node = parseCss(cssText)
  let rules = []

  if (node.rules && node.rules.length > 0) {
    rules = node.rules
      .filter(filterUnusedVendorRule)
      .map((rule) => toCssText(rule))
  } else {
    const cssText = toCssText(node)
    if (cssText) {
      rules = [cssText]
    }
  }

  return rules
}
1033294
private void initializeTransformer() {
    TransformerFactory transformerFactory = new TransformerFactory();
    transformer = transformerFactory.getTransformer(topViewResize, dragView, this);
    transformer.setViewHeight(topViewHeight);
    transformer.setXScaleFactor(scaleFactorX);
    transformer.setYScaleFactor(scaleFactorY);
    transformer.setMarginRight(marginRight);
    transformer.setMarginBottom(marginBottom);
  }
269255
def compose_transformers(transformers, types, preprocessors, postprocessors)
      if types.length < 2
        raise ArgumentError, "too few transform types: #{types.inspect}"
      end

      processors = types.each_cons(2).map { |src, dst|
        unless processor = transformers[src][dst]
          raise ArgumentError, "missing transformer for type: #{src} to #{dst}"
        end
        processor
      }

      compose_transformer_list processors, preprocessors, postprocessors
    end
684696
def _build_rules(specs):
    
    for spec in specs:
        if "context" in spec:
            yield Context(spec["context"], list(_build_rules(spec.get("routes", []))))
        else:
            rulespec = spec.copy()
            match = rulespec.pop("match")
            name = rulespec.pop("name")
            yield Rule(match, endpoint=name, **rulespec)
779627
function RuleSet(language) {
  var data = englishRuleSet;
  DEBUG && console.log(data);
  switch (language) {
    case 'EN':
      data = englishRuleSet;
      break;
    case 'DU':
      data = dutchRuleSet;
      break;
  }
  if (data.rules) {
    this.rules = {};
    var that = this;
    data.rules.forEach(function(ruleString) {
      that.addRule(TF_Parser.parse(ruleString));
    })
  }
  DEBUG && console.log(this.rules);
  DEBUG && console.log('Brill_POS_Tagger.read_transformation_rules: number of transformation rules read: ' + Object.keys(this.rules).length);
}
647918
public static void initialize(Retransformer trans) throws Exception {
        transformer = trans;

        List<String> scripts = new ArrayList<>();
        List<String> scriptNames = new ArrayList<>();

        // Load default and custom rules
        Enumeration<URL> iter = ClassLoader.getSystemResources(ROOT_RULE_FOLDER);
        while (iter.hasMoreElements()) {
            loadRules(iter.nextElement().toURI(), scriptNames, scripts);
        }

        try (PrintWriter writer = new PrintWriter(new StringWriter())) {
            try {
                transformer.installScript(scripts, scriptNames, writer);
            } catch (Exception e) {
                log.log(Level.SEVERE, "Failed to install scripts", e);
            }
        }

        if (log.isLoggable(Level.FINE)) {
            log.fine("Installed rules");
        }
    }
769444
def show(self, func_name, values, labels=None):
        """"""
        s = self.Stanza(self.indent)
        if func_name == '<module>' and self.in_console:
            func_name = '<console>'
        s.add([func_name + ': '])
        reprs = map(self.safe_repr, values)
        if labels:
            sep = ''
            for label, repr in zip(labels, reprs):
                s.add([label + '=', self.CYAN, repr, self.NORMAL], sep)
                sep = ', '
        else:
            sep = ''
            for repr in reprs:
                s.add([self.CYAN, repr, self.NORMAL], sep)
                sep = ', '
        self.writer.write(s.chunks)