Add generic directives. This functionality should match up to the generic.directives.js
client side code.
963158
function getGenericDirectives() {
    var directives = {};
    var genericDirectives = {
        'src':          'file',
        'title':        'i18n',
        'placeholder':  'i18n',
        'popover':      'i18n',
        'value':        'i18n',
        'alt':          'i18n',
        'text':         'i18n',
        'id':           null,
        'type':         null,
        'class':        null
    };
    var me = this;

    _.each(genericDirectives, function (type, attr) {

        // no b-class because it is just adding classes one time
        if (attr !== 'class') {
            directives['b-' + attr] = me.getGenericDirective('b', attr, null, true, false);
        }

        directives['bo-' + attr] = me.getGenericDirective('bo', attr, null, true, false);

        if (type) {
            directives['f-' + attr] = me.getGenericDirective('f', attr, type, false, true);
            directives['fo-' + attr] = me.getGenericDirective('fo', attr, type, false, true);
            directives['bf-' + attr] = me.getGenericDirective('bf', attr, type, true, true);
            directives['bfo-' + attr] = me.getGenericDirective('bfo', attr, type, true, true);
        }
    });

    return directives;
}
1095167
public void addField(String scope, String type, String name, String defaultValue) {
        fields.put(name, new FieldCode(scope, name, type, defaultValue));
    }
496344
public JsCodeBuilder append(String... codeFragments) {
    for (String codeFragment : codeFragments) {
      code.append(codeFragment);
    }
    return this;
  }
370085
function(name, extendee) {
      // build side-chained lists to optimize iterations
      this.optimizePropertyMaps(this.prototype);
      this.createPropertyAccessors(this.prototype);
      // install mdv delegate on template
      this.installBindingDelegate(this.fetchTemplate());
      // install external stylesheets as if they are inline
      this.installSheets();
      // adjust any paths in dom from imports
      this.resolveElementPaths(this);
      // compile list of attributes to copy to instances
      this.accumulateInstanceAttributes();
      // parse on-* delegates declared on `this` element
      this.parseHostEvents();
      //
      // install a helper method this.resolvePath to aid in 
      // setting resource urls. e.g.
      // this.$.image.src = this.resolvePath('images/foo.png')
      this.addResolvePathApi();
      // under ShadowDOMPolyfill, transforms to approximate missing CSS features
      if (hasShadowDOMPolyfill) {
        WebComponents.ShadowCSS.shimStyling(this.templateContent(), name,
          extendee);
      }
      // allow custom element access to the declarative context
      if (this.prototype.registerCallback) {
        this.prototype.registerCallback(this);
      }
    }
537442
function add({
  id, path, types: t, key, value,
}) {
  const programPath = path.findParent(p => p.isProgram());
  const keyMapNode = getKeyMapNode({ id, programPath, types: t });

  keyMapNode.properties.push(t.objectProperty(
    t.identifier(key), t.stringLiteral(value),
  ));
}
747970
def generic_insert_module(module_name, args, **kwargs):
    
    file = create_or_open(
        '{}.py'.format(module_name), 
        os.path.join(
            BASE_TEMPLATES_DIR, 
            '{}_initial.py.tmpl'.format(module_name)
        ), 
        args
    )
        
    render_template_with_args_in_file(
        file, 
        os.path.join(
            BASE_TEMPLATES_DIR, 
            '{}.py.tmpl'.format(module_name)
        ), 
        **kwargs
        )
    file.close()
450252
public Engine addDirective(String directiveName, Class<? extends Directive> directiveClass) {
		config.addDirective(directiveName, directiveClass);
		return this;
	}
626067
function(scope, element)
              {
                  // Compile the contents
                  if( !compiledContents )
                  {
                      compiledContents = $compile(contents);
                  }

                  // Re-add the compiled contents to the element
                  compiledContents( scope, function(clone)
                  {
                      element.append(clone);
                  });

                  // Call the post-linking function, if any
                  if ( link && link.post )
                  {
                      link.post.apply( null, arguments );
                  }

                  if ( angular.isFunction( postLink ) )
                  {
                    postLink.apply( null, arguments );
                  }
              }
1051883
function addHandler(name, definition) {
    var handler = new $$MdGestureHandler(name);
    angular.extend(handler, definition);
    HANDLERS[name] = handler;

    return self;
  }
877661
def __add_callback(self, type_, func, serialised_if_crud=True):
        """"""
        Validation.callable_check(func)
        with self.__callbacks:
            self.__callbacks[type_].append((func, serialised_if_crud))
1126670
public void add(int var, Type t) {
    Set<Integer> tVars = t.getTypeVariables();
    Set<Integer> intersection = Sets.intersection(tVars, bindings.keySet());
    Preconditions.checkArgument(intersection.size() == 0,
        "Tried to replace %s with %s, but already have bindings for %s", var, t, intersection);
    Preconditions.checkArgument(!tVars.contains(var),
        "Recursive replacement: tried to replace %s with %s", var, t);
    
    Map<Integer, Type> newBinding = Maps.newHashMap();
    newBinding.put(var, t);
    for (int boundVar : bindings.keySet()) {
      bindings.put(boundVar, bindings.get(boundVar).substitute(newBinding));
    }
    bindings.put(var, t);
  }
628910
function addScopedHandler (event, handler, scope) {
    if (handlers[event] === undefined) {
        handlers[event] = [];
    }

    let scopedHandler = scope ? handler.bind(scope) : handler;

    handlers[event].push({
        original: handler,
        scoped: scopedHandler
    });

    return scopedHandler;
}
1123201
function addDots(scope) {
        scope.List.push({
            value: scope.dots,
            liClass: scope.disabledClass
        });
    }
543527
function addHttpEndpointNames(spec) {
  for(var i = 0; i < spec.endpoints.length; i++) {
    var endpoint = spec.endpoints[i];
    if (endpoint.response.contentType.contentType.toLowerCase() === 'javascript') {
      endpoint.response.contentType.contentType = 'application/json';
      endpoint.response.contentType.eval = true;
    } else {
      endpoint.response.content = endpoint.response.content.replace(/(\r\n|\n|\r)/gm,"");
    }
    endpoint.httpMethod = endpoint.method.toLowerCase();
  }
  return spec;
}
123529
function initCustomPointerTypemaps(typemapsdir) {
  return fs.readdirAsync(typemapsdir).then(function(dirs) {
    return Promise.all(_.map(dirs, function(dir) {
      // get all js*.i directives from class-specific subdirectories, to be parsed below for %typemaps directives
      return fs.readdirAsync(typemapsdir + '/' + dir).then(function(files) {
        var directive = _.find(files, function(fn) {
          return ((path.extname(fn) == '.i') && (path.basename(fn).search(/^js/) != -1));
        });
        var data = {};
        if (directive) {
          data[dir] = typemapsdir + '/' + dir + '/' + directive;
        }
        return data;
      }).catch(function(e) {
        // get all .i directives from top level directory, and parse for %array_class directives
        if (e.code == 'ENOTDIR') {
          var fn = dir;
          if (path.extname(fn) == '.i') {
            return fs.readFileAsync(typemapsdir + '/' + fn, 'utf8').then(function(directives) {
              var arraytypes = _.filter(directives.split(/\n/), function(line) {
                return (line.search(/^%array_class/) != -1);
              });
              _.each(arraytypes, function(arraytype) {
                var parsed = arraytype.match(/%array_class\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
                if (parsed) {
                  var from = parsed[1];
                  var to = parsed[2];
                  xml2js.ARRAY_TYPEMAPS[from] = { arrayType: to, classes: [] };
                } else {
                  console.log('Incorrectly parsed array_class from ' + fn + ': ' + arraytype);
                }
              });
            });
          }
        } else {
          throw e;
        }
      });
    }));
  }).then(function(__directivesFiles) {
    // parse for %typemaps & %pointer_functions directives
    var _directivesFiles = _.filter(__directivesFiles, function(data) { return !_.isEmpty(data); });
    var directivesFiles = _.object(_.map(_directivesFiles, _.keys), _.flatten(_.map(_directivesFiles, _.values)));
    return Promise.all(_.map(directivesFiles, function(directivesFn, className) {
      return fs.readFileAsync(directivesFn, 'utf8').then(function(directives) {
        var typemaps = _.filter(directives.split(/\n/), function(line) {
          return (line.search(/^%typemap/) != -1);
        });
        _.each(typemaps, function(typemap) {
          var parsed = typemap.match(/%typemap\((in|out)\)[\s]+([A-Za-z0-9_]+[\s]*[\*])/);
          if (parsed) {
            var dir = parsed[1]; // TODO: ignored for now
            var type = normalizePointer(parsed[2]);
            var datatype = getPointerDataType(type);
            if (_.has(xml2js.ARRAY_TYPEMAPS, datatype)) {
              xml2js.ARRAY_TYPEMAPS[datatype].classes.push(className);
            } else {
              console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (no %array_class directive found for ' + datatype + ')');
            }
          } else {
            console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (only considering in/out typemaps of pointer types)');
          }
        });
        var ptrfns = _.filter(directives.split(/\n/), function(line) {
          return (line.search(/^%pointer_functions/) != -1);
        });
        _.each(ptrfns, function(ptrfn) {
          var parsed = ptrfn.match(/%pointer_functions\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
          if (parsed) {
            var from = parsed[1];
            var to = parsed[2];
            if (!_.has(xml2js.POINTER_TYPEMAPS, className)) {
              xml2js.POINTER_TYPEMAPS[className] = {};
            }
            xml2js.POINTER_TYPEMAPS[className][from] = to;
          }
        });
      });
    }));
  });
}
423334
def add(self, name, extends, **kwargs):
        
        f = extends
        self._push(name=name,
                   module_=f.__module__,
                   class_=f.__name__,
                   method_=f.__name__,
                   is_class_=False,
                   **kwargs)
555065
def directives(entrystream, type=None):
    
    for directive in entry_type_filter(entrystream, tag.Directive):
        if not type or type == directive.type:
            yield directive