Ensure that duplicates have their @hooks object.
436789
def initialize_copy(orig)
      hooks_dup = @hooks.dup
      @hooks.each do |k, v|
        hooks_dup[k] = v.dup
      end

      @hooks = hooks_dup
    end
389403
def add_hook(self, hook):
        
        h = hook.hash
        self.hooks[h] = hook
1280111
@Override
    public void dup()
    {
        if (top < 1)
        {
            throw new EmptyStackException();
        }
        if (top >= stack.length)
        {
            stack = Arrays.copyOf(stack, (int) (stack.length*growFactor));
        }
        top++;
        stack[top-1] = stack[top-2];
    }
182233
def []=(name, value)
    name_pair = name_to_a(name).freeze
    hooks = assign(name_pair, value)
    hooks.each do |hook|
      hook.call(name_pair, value)
    end
    value
  end
377994
def ensure_hook_type_sections_exist(hash)
      Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
        hash[hook_type] ||= {}
        hash[hook_type]['ALL'] ||= {}
      end
    end
1372897
def register_hooks(self, field):
        """"""
        for hook, subhooks in field.register_hooks():
            self.hooks[hook].append(field)
            self.subhooks[hook] |= set(subhooks)
860688
function hasDuplicateDependentKeys(callExp) {
  if (!isComputedProp(callExp)) return false;

  const dependentKeys = parseDependentKeys(callExp);
  const uniqueKeys = dependentKeys
    .filter((val, index, self) => self.indexOf(val) === index);

  return uniqueKeys.length !== dependentKeys.length;
}
1053744
def fixes=(fixes)
      raise TypeException unless fixes.is_a?(Array)
      fixes.each { |item|
        raise TypeException unless item.is_a?(StatModule::Fix)
        raise DuplicateElementException if @fixes.include?(item)
        @fixes.push(item)
      }
    end
547531
def apply_hooks(hooks, tuples, *args)
      hooks.reduce(tuples) do |a, e|
        if e.is_a?(Hash)
          hook_meth, hook_args = e.to_a.flatten(1)
          __send__(hook_meth, a, *args, **hook_args)
        else
          __send__(e, a, *args)
        end
      end
    end
318992
def register_hooks(func, hooks, obj):
    
    for name, args, kwargs in hooks:
        hook = getattr(obj, name)
        force_call = kwargs.pop("_force_call", False)
        if force_call or len(args) > 0 or len(kwargs) > 0:
            hook = hook(*args, **kwargs)
        hook(func)
1173385
function nameDuplicates(duplicates) {
    // enumerate duplicate hash groups in sorted order
    var hashes = Object.keys(duplicates).sort();

    // process each group
    processGroup(0);
    function processGroup(i) {
      if(i === hashes.length) {
        // done, create JSON-LD array
        return createArray();
      }

      // name each group member
      var group = duplicates[hashes[i]];
      var results = [];
      nameGroupMember(group, 0);
      function nameGroupMember(group, n) {
        if(n === group.length) {
          // name bnodes in hash order
          results.sort(function(a, b) {
            a = a.hash;
            b = b.hash;
            return (a < b) ? -1 : ((a > b) ? 1 : 0);
          });
          for(var r in results) {
            // name all bnodes in path namer in key-entry order
            // Note: key-order is preserved in javascript
            for(var key in results[r].pathNamer.existing) {
              namer.getName(key);
            }
          }
          return processGroup(i + 1);
        }

        // skip already-named bnodes
        var bnode = group[n];
        if(namer.isNamed(bnode)) {
          return nameGroupMember(group, n + 1);
        }

        // hash bnode paths
        var pathNamer = new UniqueNamer('_:b');
        pathNamer.getName(bnode);
        _hashPaths(bnode, bnodes, namer, pathNamer,
          function(err, result) {
            if(err) {
              return callback(err);
            }
            results.push(result);
            nameGroupMember(group, n + 1);
          });
      }
    }
  }
411711
function getOveruse(duplicates, limit) {
    var duplicate;
    for (duplicate in duplicates) {
        if (duplicates[duplicate] < limit) {
            delete duplicates[duplicate]
        }
    }
    return keys(duplicates);
}
307045
def set_hooks
      # Final splat var captures any other variables we are not interested in,
      # and avoids them being squashed into the final var.
      eigen_capture(File, [:open, :new], @flag) do |klazz, path, mode, *other|
        add_path(path) if klazz == File && mode =~ /^(t|b)?((w|a)[+]?)(t|b)?$/
      end

      eigen_capture(File, [:rename, :symlink, :link], @flag) do |klazz, old, new, *other|
        add_path(new)
      end

      eigen_capture(Dir, :mkdir, @flag) do |klazz, path, *other|
        add_path(root_dir(path))
      end
    end
1235556
def callHook(self, hookname, *args, **kwargs):
        ''
        r = []
        for f in self.hooks[hookname]:
            try:
                r.append(f(*args, **kwargs))
            except Exception as e:
                exceptionCaught(e)
        return r
95839
def _validate_duplication(self, subj_and_pred, cl):
        """"""
        subj, pred = subj_and_pred

        log.info("Validating duplication of member %s" % pred)
        if (subj, pred) in self.checked_attributes:
            err = self.err("{0} - duplicated member of {1}",
                           self._field_name_from_uri(pred),
                           self._field_name_from_uri(cl))
            return ValidationWarning(ValidationResult.WARNING, err['err'],
                                     err['line'], err['num'])
1202627
def sync_repo_hook(self, repo_id):
        """"""
        # Get the hook that we may have set in the past
        gh_repo = self.api.repository_with_id(repo_id)
        hooks = (hook.id for hook in gh_repo.hooks()
                 if hook.config.get('url', '') == self.webhook_url)
        hook_id = next(hooks, None)

        # If hook on GitHub exists, get or create corresponding db object and
        # enable the hook. Otherwise remove the old hook information.
        if hook_id:
            Repository.enable(user_id=self.user_id,
                              github_id=gh_repo.id,
                              name=gh_repo.full_name,
                              hook=hook_id)
        else:
            Repository.disable(user_id=self.user_id,
                               github_id=gh_repo.id,
                               name=gh_repo.full_name)
139657
def hook_scope(self, name=""):
        """"""
        assert not self.revision
        self.cursor.execute(
            'insert into hooks (hook, date) values (?, ?)',
            (name or sys.argv[0],
             datetime.datetime.utcnow().isoformat()))
        self.revision = self.cursor.lastrowid
        try:
            yield self.revision
            self.revision = None
        except Exception:
            self.flush(False)
            self.revision = None
            raise
        else:
            self.flush()