Setup a new dependency.

 @param on_dep [Proc] a proc to be called the first time a computation depends
   on this dependency.
 @param on_stop_dep [Proc] a proc to be called when no computations are depending
   on this dependency anymore.
978643
def depend
      # If there is no @dependencies, don't depend because it has been removed
      return unless @dependencies

      current = Computation.current
      if current
        added = @dependencies.add?(current)

        if added
          # The first time the dependency is depended on by this computation, we call on_dep
          @on_dep.call if @on_dep && @dependencies.size == 1

          current.on_invalidate do
            # If @dependencies is nil, this Dependency has been removed
            if @dependencies
              # For set, .delete returns a boolean if it was deleted
              deleted = @dependencies.delete?(current)

              # Call on stop dep if no more deps
              @on_stop_dep.call if @on_stop_dep && deleted && @dependencies.size == 0
            end
          end
        end
      end
    end
71975
@Override
	public void dependenciesLoaded(IDependencies deps, long sequence) {
		/*
		 * Aggregate the dependent features from all the modules into a single,
		 * alphabetically sorted, list of features.
		 */
		Set<String> features = new TreeSet<String>();
		try {
			for (String mid : deps.getDependencyNames()) {
				features.addAll(deps.getDependentFeatures(mid));
			}
			dependentFeatures = Collections.unmodifiableList(Arrays.asList(features.toArray(new String[features.size()])));
			depFeatureListResource = createFeatureListResource(dependentFeatures, getFeatureListResourceUri(), deps.getLastModified());
			generateModuleIdMap(deps);
			depsInitialized.countDown();
		} catch (ProcessingDependenciesException e) {
			if (log.isLoggable(Level.WARNING)) {
				log.log(Level.WARNING, e.getMessage(), e);
			}
			// Don't clear the latch as another call to this method can be expected soon
		} catch (Throwable t) {
			if (log.isLoggable(Level.SEVERE)) {
				log.log(Level.SEVERE, t.getMessage(), t);
			}
			// Clear the latch to allow the waiting thread to wake up.  If
			// dependencies have never been initialized, then NullPointerExceptions
			// will be thrown for any threads trying to access the uninitialized
			// dependencies.
			depsInitialized.countDown();

		}
	}
1277520
def make_dep_graph(depender):
	
	shutit_global.shutit_global_object.yield_to_draw()
	digraph = ''
	for dependee_id in depender.depends_on:
		digraph = (digraph + '"' + depender.module_id + '"->"' + dependee_id + '";\n')
	return digraph
709672
def _check_dep(self, depinfo, deptile, resolver):
        

        try:
            settings = self._load_depsettings(deptile)
        except IOError:
            return False

        # If this dependency was initially resolved with a different resolver, then
        # we cannot check if it is up to date
        if settings['resolver'] != resolver.__class__.__name__:
            return None

        resolver_settings = {}
        if 'settings' in settings:
            resolver_settings = settings['settings']

        return resolver.check(depinfo, deptile, resolver_settings)
1064647
public static synchronized void initialise()
   {
      // Only initialise if it has not already been created
      if (_instance == null)
      {
         // Check what environment we are running in. If we are in server mode we must use the 
         // server diagnostic module.
    	 //Liberty COMMS TODO:
    	 //For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner
    	 // without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat
    	 // the purpose of COMMS client independence w.r.to COMMS server
    	 //Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.
    	
    	 /*
         if (RuntimeInfo.isServer())
         {
            if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode");
            
            try
            {
               Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);
               Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]);
               _instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);
            }
            catch (Exception e)
            {
               FFDCFilter.processException(e, CLASS_NAME + ".initialise", 
                                           CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,
                                           CommsConstants.SERVER_DIAG_MODULE_CLASS);
               
               if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e);
               
               // In this case, fall out of here with a null _instance and default to the client
               // one. At least in that case we get _some_ diagnostics...
               // This is the point where I mention that that shouldn't ever happen :-).
            }
         }
         */

         // In all other cases use the client diagnostic module. Note we can instantiate this
         // directly as we are located in the same build component
         if (_instance == null)
         {
            if (tc.isDebugEnabled()) SibTr.debug(tc, "We are NOT in Server mode");
            
            _instance = ClientCommsDiagnosticModule.getInstance();
         }
         
         // Now register the packages
         _instance.register(packageList);
      }
   }
646459
def OnDependencies(self, event):
        """"""

        dlg = DependencyDialog(self.main_window)
        dlg.ShowModal()
        dlg.Destroy()
316002
private void initialize(Function<SqlTask, ?> onDone, CounterStat failedTasks)
    {
        requireNonNull(onDone, "onDone is null");
        requireNonNull(failedTasks, "failedTasks is null");
        taskStateMachine.addStateChangeListener(new StateChangeListener<TaskState>()
        {
            @Override
            public void stateChanged(TaskState newState)
            {
                if (!newState.isDone()) {
                    return;
                }

                // Update failed tasks counter
                if (newState == FAILED) {
                    failedTasks.update(1);
                }

                // store final task info
                while (true) {
                    TaskHolder taskHolder = taskHolderReference.get();
                    if (taskHolder.isFinished()) {
                        // another concurrent worker already set the final state
                        return;
                    }

                    if (taskHolderReference.compareAndSet(taskHolder, new TaskHolder(createTaskInfo(taskHolder), taskHolder.getIoStats()))) {
                        break;
                    }
                }

                // make sure buffers are cleaned up
                if (newState == FAILED || newState == ABORTED) {
                    // don't close buffers for a failed query
                    // closed buffers signal to upstream tasks that everything finished cleanly
                    outputBuffer.fail();
                }
                else {
                    outputBuffer.destroy();
                }

                try {
                    onDone.apply(SqlTask.this);
                }
                catch (Exception e) {
                    log.warn(e, "Error running task cleanup callback %s", SqlTask.this.taskId);
                }
            }
        });
    }
1075415
function setParents () {
		var q = async.queue(processFile, 1)
		q.drain = function () { self.emit('drain') }

		// Process files with no dependency first
		self.nodeps.forEach( q.push )

		function processFile (item, cb) {
			debug('dep:', item.id)
			// Add files with no dependency left to be processed
			self.deps
				.forEach(function (file) {
					if ( file.count > 0 && file.deps.indexOf(item.id) >= 0 ) {
						item.parents.push(file.id)
						file.count--
						debug('file %s -> %d', file.id, file.count)
						if (file.count === 0) q.push(file)
					}
				})
			cb()
		}
	}
1048560
def check_no_self_dependency(cls, dap):
        ''''''
        problems = list()

        if 'package_name' in dap.meta and 'dependencies' in dap.meta:
            dependencies = set()

            for dependency in dap.meta['dependencies']:
                if 'dependencies' in dap._badmeta and dependency in dap._badmeta['dependencies']:
                    continue

                # No version specified
                if not re.search(r'[<=>]', dependency):
                    dependencies.add(dependency)

                # Version specified
                for mark in ['==', '>=', '<=', '<', '>']:
                    dep = dependency.split(mark)
                    if len(dep) == 2:
                        dependencies.add(dep[0].strip())
                        break

            if dap.meta['package_name'] in dependencies:
                msg = 'Depends on dap with the same name as itself'
                problems.append(DapProblem(msg))

        return problems
90813
def build_context(operation, dependencies)
      RailsWorkflow::Context.new(
        parent: operation,
        data: prepare_context_data(dependencies) || operation.process.data
      )
    end
335818
def add_dependency (self, targets, sources):
        
        if isinstance (targets, str):
            targets = [targets]
        if isinstance (sources, str):
            sources = [sources]
        assert is_iterable(targets)
        assert is_iterable(sources)

        for target in targets:
            for source in sources:
                self.do_add_dependency (target, source)
1119716
def _init(self, *args, **kwargs):
        
        self._init_attr('_deps', None)

        self._init_attr('_ban_optimize', False)
        self._init_attr('_engine', None)
        self._init_attr('_Expr__execution', None)

        self._init_attr('_need_cache', False)
        self._init_attr('_mem_cache', False)

        if '_id' not in kwargs:
            kwargs['_id'] = new_id()

        super(Expr, self)._init(*args, **kwargs)
679641
def _process_dependencies(self, anexec, contents, mode="insert"):
        
        #At this point we don't necessarily know which module the executables are
        #in, so we just extract the names. Once all the modules in the library
        #have been parsed, we can do the associations at that level for linking.
        for dmatch in self.RE_DEPEND.finditer(contents):
            isSubroutine = dmatch.group("sub") is not None
            if "!" in dmatch.group("exec"):
                execline = self._depend_exec_clean(dmatch.group("exec"))
            else:
                execline = "(" + dmatch.group("exec").split("!")[0].replace(",", ", ") + ")"

            if not "::" in execline:
                try:
                    dependent = self.nester.parseString(execline).asList()[0]
                except:
                    msg.err("parsing executable dependency call {}".format(anexec.name))
                    msg.gen("\t" + execline)
            
                #Sometimes the parameter passed to a subroutine or function is 
                #itself a function call. These are always the first elements in
                #their nested lists.
                self._process_dependlist(dependent, anexec, isSubroutine, mode)
860723
function init(app) {
    var keys = Object.keys(DependenciesMap);
    var allDeps = _.uniq(_.flatten(_.values(DependenciesMap)));

    allDeps.forEach(function (d) {
        if (!_.contains(keys, d)) {
            throw new Error("Unresolved dependency: " + d)
        }
    });


    keys.forEach(function (k) {
        var dep = DependenciesMap[k];
        if (_.contains(dep, k)) {
            throw new Error('Circular dependency: key: ' + k);
        }

        if (dep.length == 0) {
            HandlerArray.push(getHandler(app, k, PluginsData[k]));
        }
    });

    async.series(HandlerArray, function (err, end) {
        if (err)
            throw err;

        saveSchemas(app);
    });
}
490658
public static void addDependency(Dependency depend,
                                   ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        ((EnvironmentClassLoader) loader).addDependency(depend);
        return;
      }
    }
  }
109976
def debug
      ::RSpec.configure do |config|
        config.add_setting :debugger_proc
        config.debugger_proc = ->(ex) do
          exception = ex.exception
          defined?(Pry) ? binding.pry : debugger # rubocop:disable Debugger
        end
        config.after(debug: true) do |ex|
          instance_exec(ex, &config.debugger_proc) if ex.exception
        end
      end
    end
1005279
protected function init_dependencies() {
		array_walk( $this->handlers,
			function ( $handler, $dependency_type ) {
				if ( $this->hasConfigKey( $dependency_type ) ) {
					$this->dependencies[ $dependency_type ] = $this->init_dependency_type( $dependency_type );
				}
			} );
	}