get the layerdef text string from an object literal
@param {Object} defs
356569
function getLayerDefsString_(defs) {
  var strDefs = '';
  for (var x in defs) {
    if (defs.hasOwnProperty(x)) {
      if (strDefs.length > 0) {
        strDefs += ';';
      }
      strDefs += (x + ':' + defs[x]);
    }
  }
  return strDefs;
}
925264
function getDeclarationDeps($ast, declaration, scope) {
  if(scope !== SCOPE_EXPLICIT) {
    return {};
  }

  const depParentNodes = $ast(declaration).parents(node => {
    if(node.node.type === 'mixin') {
      return true;
    } else if(node.node.type === 'atrule') {
      const atruleIdentNode = $ast(node).children('atkeyword').children('ident');
      return atruleIdentNode.length() > 0 && atruleIdentNode.first().value() === 'function'
    } else {
      return false;
    }
  });

  if(depParentNodes.length() === 0) {
    return {};
  }

  const depParentNode = depParentNodes.last();
  const depKeywordNode = depParentNode.children('atkeyword').children('ident');

  if(depKeywordNode.length() === 0) {
    return {};
  }

  const atKeyword = depKeywordNode.first().value();

  if(!DEP_HOST[atKeyword]) {
    return {};
  }

  const depHostNode = DEP_HOST[atKeyword](depParentNode);
  const atKeywordIdentifierNode = depHostNode.children('ident');

  if(atKeywordIdentifierNode.length() === 0) {
    return {};
  }

  const atIdentifier = atKeywordIdentifierNode.first().value();
  const argumentsNode = depHostNode.children('arguments');

  // Count arguments to mixin/function @atrule
  const requiredArgsCount = argumentsNode.children('variable').length();
  const optionalArgsCount = argumentsNode.children('declaration').length();
  const totalArgsCount = requiredArgsCount + optionalArgsCount;

  if(!DEP_KEYWORDS[atKeyword]) {
    return {};
  }

  return {
    [DEP_KEYWORDS[atKeyword]]: {
      name: atIdentifier,
      argsCount: {
        total: totalArgsCount,
        required: requiredArgsCount,
        optional: optionalArgsCount,
      },
    },
  };
}
855412
def getNodeRefs(self):
        '''
        
        '''
        retn = []

        for name, valu in self.props.items():

            pobj = self.form.props.get(name)

            if isinstance(pobj.type, s_types.Ndef):
                retn.append((name, valu))
                continue

            if self.snap.model.forms.get(pobj.type.name) is None:
                continue

            ndef = (pobj.type.name, valu)
            if ndef == self.ndef:
                continue

            retn.append((name, ndef))

        return retn
862565
private void  defs(Attributes attributes) throws SVGParseException
   {
      debug("<defs>");

      if (currentElement == null)
         throw new SVGParseException("Invalid document. Root element must be <svg>");
      SVG.Defs  obj = new SVG.Defs();
      obj.document = svgDocument;
      obj.parent = currentElement;
      parseAttributesCore(obj, attributes);
      parseAttributesStyle(obj, attributes);
      parseAttributesTransform(obj, attributes);
      currentElement.addChild(obj);
      currentElement = obj;
   }
861345
private void addDefines(final String[] defs, final boolean isDefine) {
    for (final String def2 : defs) {
      UndefineArgument def;
      if (isDefine) {
        def = new DefineArgument();
      } else {
        def = new UndefineArgument();
      }
      def.setName(def2);
      this.defineList.addElement(def);
    }
  }
1272927
function highlightTokens(defs: Object, text: string) {
  return text.replace(jsTokens, function(...args) {
    const type = getTokenType(args);
    const colorize = defs[type];
    if (colorize) {
      return args[0]
        .split(NEWLINE)
        .map(str => colorize(str))
        .join("\n");
    } else {
      return args[0];
    }
  });
}
856232
def visitObjectDef(self, ctx: jsgParser.ObjectDefContext):
        
        name = as_token(ctx)
        self._context.grammarelts[name] = JSGObjectExpr(self._context, ctx.objectExpr(), name)
940905
public String getAttribute(String name, String def) {
		String value = dom.getAttribute(name);
		if ((value == null) || (value.length() == 0)) {
			return def;
		}
		
		return value;
	}
1252375
function mockElementFromString( str ) {
		var element = parseRulesString( str ).$1,
			styles = element.styles,
			classes = element.classes;

		element.name = element.elements;
		element.classes = classes = ( classes ? classes.split( /\s*,\s*/ ) : [] );
		element.styles = mockHash( styles );
		element.attributes = mockHash( element.attributes );
		element.children = [];

		if ( classes.length )
			element.attributes[ 'class' ] = classes.join( ' ' );
		if ( styles )
			element.attributes.style = CKEDITOR.tools.writeCssText( element.styles );

		return element;
	}
210113
function getSvgDefsElement() {
  // return if found
  const defsElement = document.getElementById('precision-inputs-svg-defs');
  if (defsElement) { return defsElement; }

  // otherwise create it
  const svg = document.createElementNS(svgNS, 'svg');
  svg.style.position = 'absolute';
  svg.style.left = 0;
  svg.style.top = 0;
  svg.style.width = 0;
  svg.style.height = 0;
  svg.style.opacity = 0;
  const defs = document.createElementNS(svgNS, 'defs');
  defs.id = 'precision-inputs-svg-defs';
  svg.appendChild(defs);
  document.body.appendChild(svg);

  return defs;
}
787592
function getDefs(chalk) {
  return {
    keyword: chalk.cyan,
    capitalized: chalk.yellow,
    jsx_tag: chalk.yellow,
    punctuator: chalk.yellow,
    // bracket:  intentionally omitted.
    number: chalk.magenta,
    string: chalk.green,
    regex: chalk.magenta,
    comment: chalk.grey,
    invalid: chalk.white.bgRed.bold,
  };
}
309599
function(s) {
			var type = (YL.isNull(s) || YL.isUndefined(s)) ? ('' + s) : typeof s;
			return 'string' === type ? s : type + this.DELIMITER + s;
		}
1353927
function treeDFS(tree, callback) {
  for (let it of tree.slice()) {
    callback(it, tree);
    if (typeof it === 'object') {
      treeDFS(it.children, callback);
    }
  }
}
428315
def get_es_label(obj, def_obj):
    
    label_flds = LABEL_FIELDS
    if def_obj.es_defs.get('kds_esLabel'):
        label_flds = def_obj.es_defs['kds_esLabel'] + LABEL_FIELDS
    try:
        for label in label_flds:
            if def_obj.cls_defs.get(label):
                 obj['label'] = def_obj.cls_defs[label][0]
                 break
        if not obj.get('label'):
            obj['label'] = def_obj.__class__.__name__.split("_")[-1]
    except AttributeError:
        # an attribute error is caused when the class is only
        # an instance of the BaseRdfClass. We will search the rdf_type
        # property and construct a label from rdf_type value
        if def_obj.get('rdf_type'):
            obj['label'] = def_obj['rdf_type'][-1].value[-1]
        else:
            obj['label'] = "no_label"
    return obj
431401
def nsDefs(self):
        
        ret = libxml2mod.xmlNodeGetNsDefs(self._o)
        if ret is None:return None
        __tmp = xmlNs(_obj=ret)
        return __tmp
341974
function(defs) {

      // few checks
      assert(defs.length >= 2, 'Error! At least one input layer and one loss layer are required.');
      assert(defs[0].type === 'input', 'Error! First layer must be the input layer, to declare size of inputs');

      // desugar layer_defs for adding activation, dropout layers etc
      var desugar = function() {
        var new_defs = [];
        for(var i=0;i<defs.length;i++) {
          var def = defs[i];
          
          if(def.type==='softmax' || def.type==='svm') {
            // add an fc layer here, there is no reason the user should
            // have to worry about this and we almost always want to
            new_defs.push({type:'fc', num_neurons: def.num_classes});
          }

          if(def.type==='regression') {
            // add an fc layer here, there is no reason the user should
            // have to worry about this and we almost always want to
            new_defs.push({type:'fc', num_neurons: def.num_neurons});
          }

          if((def.type==='fc' || def.type==='conv') 
              && typeof(def.bias_pref) === 'undefined'){
            def.bias_pref = 0.0;
            if(typeof def.activation !== 'undefined' && def.activation === 'relu') {
              def.bias_pref = 0.1; // relus like a bit of positive bias to get gradients early
              // otherwise it's technically possible that a relu unit will never turn on (by chance)
              // and will never get any gradient and never contribute any computation. Dead relu.
            }
          }

          new_defs.push(def);

          if(typeof def.activation !== 'undefined') {
            if(def.activation==='relu') { new_defs.push({type:'relu'}); }
            else if (def.activation==='sigmoid') { new_defs.push({type:'sigmoid'}); }
            else if (def.activation==='tanh') { new_defs.push({type:'tanh'}); }
            else if (def.activation==='maxout') {
              // create maxout activation, and pass along group size, if provided
              var gs = def.group_size !== 'undefined' ? def.group_size : 2;
              new_defs.push({type:'maxout', group_size:gs});
            }
            else { console.log('ERROR unsupported activation ' + def.activation); }
          }
          if(typeof def.drop_prob !== 'undefined' && def.type !== 'dropout') {
            new_defs.push({type:'dropout', drop_prob: def.drop_prob});
          }

        }
        return new_defs;
      }
      defs = desugar(defs);

      // create the layers
      this.layers = [];
      for(var i=0;i<defs.length;i++) {
        var def = defs[i];
        if(i>0) {
          var prev = this.layers[i-1];
          def.in_sx = prev.out_sx;
          def.in_sy = prev.out_sy;
          def.in_depth = prev.out_depth;
        }

        switch(def.type) {
          case 'fc': this.layers.push(new global.FullyConnLayer(def)); break;
          case 'lrn': this.layers.push(new global.LocalResponseNormalizationLayer(def)); break;
          case 'dropout': this.layers.push(new global.DropoutLayer(def)); break;
          case 'input': this.layers.push(new global.InputLayer(def)); break;
          case 'softmax': this.layers.push(new global.SoftmaxLayer(def)); break;
          case 'regression': this.layers.push(new global.RegressionLayer(def)); break;
          case 'conv': this.layers.push(new global.ConvLayer(def)); break;
          case 'pool': this.layers.push(new global.PoolLayer(def)); break;
          case 'relu': this.layers.push(new global.ReluLayer(def)); break;
          case 'sigmoid': this.layers.push(new global.SigmoidLayer(def)); break;
          case 'tanh': this.layers.push(new global.TanhLayer(def)); break;
          case 'maxout': this.layers.push(new global.MaxoutLayer(def)); break;
          case 'svm': this.layers.push(new global.SVMLayer(def)); break;
          default: console.log('ERROR: UNRECOGNIZED LAYER TYPE: ' + def.type);
        }
      }
    }
380410
def get_defs(self, position=None):
        """"""
        if position is None:
            position = self.position
        return self.checkdefs[position][1]