Bind command to IoC
195204
protected function bindInstallCommand()
    {
        $this->app['package.install'] = $this->app->share(function ($app) {
            return $app->make('Terion\PackageInstaller\PackageInstallCommand');
        });
        $this->app['package.process'] = $this->app->share(function ($app) {
            return $app->make('Terion\PackageInstaller\PackageProcessCommand');
        });
    }
595409
private void initializeStatically() {
    bindingData.initializeBindings();
    stopwatch.resetAndLog("Binding initialization");

    for (InjectorShell shell : shells) {
      shell.getInjector().index();
    }
    stopwatch.resetAndLog("Binding indexing");

    injectionRequestProcessor.process(shells);
    stopwatch.resetAndLog("Collecting injection requests");

    bindingData.runCreationListeners(errors);
    stopwatch.resetAndLog("Binding validation");

    injectionRequestProcessor.validate();
    stopwatch.resetAndLog("Static validation");

    initializer.validateOustandingInjections(errors);
    stopwatch.resetAndLog("Instance member validation");

    new LookupProcessor(errors).process(shells);
    for (InjectorShell shell : shells) {
      ((DeferredLookups) shell.getInjector().lookups).initialize(errors);
    }
    stopwatch.resetAndLog("Provider verification");

    // This needs to come late since some user bindings rely on requireBinding calls to create
    // jit bindings during the LookupProcessor.
    bindingData.initializeDelayedBindings();
    stopwatch.resetAndLog("Delayed Binding initialization");

    for (InjectorShell shell : shells) {
      if (!shell.getElements().isEmpty()) {
        throw new AssertionError("Failed to execute " + shell.getElements());
      }
    }

    errors.throwCreationExceptionIfErrorsExist();
  }
878909
private Object handleTxCommand(TxInvocationContext ctx, TransactionBoundaryCommand command) {
      if (trace) log.tracef("handleTxCommand for command %s, origin %s", command, getOrigin(ctx));
      updateTopologyId(command);

      return invokeNextAndHandle(ctx, command, handleTxReturn);
   }
900559
public void addCompBinding(String name, InjectionBinding<?> binding) {
        if (!compLock.writeLock().isHeldByCurrentThread()) {
            throw new IllegalStateException();
        }

        if (compBindings == null) {
            compBindings = new JavaColonNamespaceBindings<InjectionBinding<?>>(NamingConstants.JavaColonNamespace.COMP, InjectionBindingClassNameProvider.instance);
        }
        compBindings.bind(name, binding);
    }
221985
def _bind_device(self):
        
        patterns = set()

        self.bound_commands = []

        for cmd in self.commands:
            bound = cmd.bind(self) or cmd.bind(self.device) or None

            if bound is None:
                raise RuntimeError(
                    'Unable to produce callable object for non-existing member \'{}\' '
                    'of device or interface.'.format(cmd.func))

            for bound_cmd in bound:
                pattern = bound_cmd.matcher.pattern
                if pattern in patterns:
                    raise RuntimeError(
                        'The regular expression {} is '
                        'associated with multiple commands.'.format(pattern))

                patterns.add(pattern)

                self.bound_commands.append(bound_cmd)
423819
function _ioCancel(o, s) {
        if (o && o.c) {
            o.e = s;
            o.c.abort();
        }
    }
518037
private Map<String, Object> bindParams(CallableSignatureContext sig, CallableInvocationContext inv) {
    
    if(inv == null) {
      return Collections.emptyMap();
    }

    Map<String, Object> vals = new HashMap<>();
    
    if (inv.posParams != null) {

      //
      // Ensure legality of call
      //

      // Can only use positional or named; not both
      if (inv.namedParams != null) {
        throw new InvocationException("only positional or named parameters are allowed", getLocation(inv));
      }

      //
      // Match up parameters
      //

      ListIterator<ParameterDeclContext> paramDeclIter = sig.paramDecls.listIterator();
      ListIterator<ExpressionContext> paramExprIter = inv.posParams.exprs.listIterator();
      
      ParameterDeclContext allDecl = null;

      while (paramDeclIter.hasNext()) {

        ParameterDeclContext paramDecl = paramDeclIter.next();

        if (paramDecl.flag != null && paramDecl.flag.getText().equals("*")) {
          if (allDecl != null) {
            throw new ExecutionException("only a single parameter can be marked with '*'", getLocation(paramDecl));
          }
          allDecl = paramDecl;
          continue;
        }
        
        String paramName = name(paramDecl);
        
        // Find expression (or use default)
        ExpressionContext paramExpr = paramExprIter.hasNext() ? paramExprIter.next() : paramDecl.expr;

        // Evaluate expression -> value
        Object paramVal = eval(paramExpr);

        vals.put(paramName, paramVal);
        
      }
      
      //
      // Add rest of parameters (if requested)
      //
      
      if (allDecl != null) {
        
        Map<String, Object> otherParams = new LinkedHashMap<>();
        
        while (paramExprIter.hasNext()) {
          
          int paramIdx = paramExprIter.nextIndex();
          
          ExpressionContext paramExpr = paramExprIter.next();
          
          Object paramVal = eval(paramExpr);
          
          otherParams.put(Integer.toString(paramIdx), paramVal);
        }
        
        vals.put(allDecl.id.getText(), otherParams);
      }
      
    }
    else if (inv.namedParams != null) {

      //
      // Ensure legality of call
      //

      // Can only use positional or named; not both
      if (inv.posParams != null) {
        throw new InvocationException("only positional or named parameters are allowed", getLocation(inv));
      }

      //
      // Load parameters
      //

      List<NamedValueContext> namedParameters = new ArrayList<>(inv.namedParams.namedValues);
      Iterator<ParameterDeclContext> paramDeclIter = sig.paramDecls.iterator();
      
      ParameterDeclContext allDecl = null;

      while (paramDeclIter.hasNext()) {

        ParameterDeclContext paramDecl = paramDeclIter.next();
        
        if (paramDecl.flag != null && paramDecl.flag.getText().equals("*")) {
          allDecl = paramDecl;
          continue;
        }
        
        String paramName = name(paramDecl);

        // Find expression
        ExpressionContext paramExpr = findAndRemoveValue(namedParameters, paramName);

        // Assign default (is needed)
        paramExpr = paramExpr != null ? paramExpr : paramDecl.expr;

        // Evaluate expression -> value
        Object paramVal = eval(paramExpr);

        vals.put(paramName, paramVal);
        
      }
      
      //
      // Add rest of parameters (if requested)
      //
      
      if (allDecl != null) {
        
        Map<String, Object> otherParams = new LinkedHashMap<>();
        
        for (NamedValueContext namedValue : namedParameters) {
          
          String paramName = namedValue.name.getText();
          
          Object paramVal = eval(namedValue.expr);
          
          otherParams.put(paramName, paramVal);
          
        }

        vals.put(allDecl.id.getText(), otherParams);
      }
      

    }

    return vals;
  }
1024549
def write_ioc_string(root, force=False):
    
    root_tag = 'OpenIOC'
    if not force and root.tag != root_tag:
        raise ValueError('Root tag is not "{}".'.format(root_tag))
    default_encoding = 'utf-8'
    tree = root.getroottree()
    # noinspection PyBroadException
    try:
        encoding = tree.docinfo.encoding
    except:
        log.debug('Failed to get encoding from docinfo')
        encoding = default_encoding
    return et.tostring(tree, encoding=encoding, xml_declaration=True, pretty_print=True)
764000
def command(self, rule, **options):
        
        options.setdefault("direct", False)
        options.setdefault("override", True)
        options.setdefault("inject", False)
        options.setdefault("flags", 0)
        if not options["direct"]:
            rule = self.regexy(rule)
        regex = re.compile(rule, flags=options["flags"])
        self.handlers.setdefault(regex, [])
        def handler(f):
            if f == noop:
                f.options = {}
            else:
                f.options = options
            if options["override"]:
                self.handlers[regex] = [f]
            else:
                self.handlers[regex].append(f)
            f.no_args = self.no_args(f)
            return f
        return handler
677785
function (command) {
    if (!command || !_.isObject(command)) {
      var err = new Error('Please inject a valid command object!');
      debug(err);
      throw err;
    }

    if (!command.payload && command.payload !== '') {
      command.payload = this.defaultCommandPayload;
    }

    command.defineAggregate(this);

    if (this.commands.indexOf(command) < 0) {
      this.commands.push(command);
    }
  }
153295
def bind_cli(cls, parser, group):
        
        try:
            with open("./parse_build_args.py") as f:
                source = f.read()
        except Exception as e:
            return

        # detect what extra args have been added
        before_args = set(x.dest for x in parser._actions)

        try:
            exec source in {"parser": group}
        except Exception as e:
            print_warning("Error in ./parse_build_args.py: %s" % str(e))

        after_args = set(x.dest for x in parser._actions)
        extra_args = after_args - before_args

        # store extra args onto parser so we can get to it in self.build()
        setattr(parser, "_rezbuild_extra_args", list(extra_args))
184249
public function bind($cmd, $handler) {
		$allCmds = array_keys($this->commands);
		$cmds = array();
		foreach(explode(' ', $cmd) as $_cmd) {
			if ($_cmd !== '') {
				if ($all = strpos($_cmd, '*') !== false) {
					list(, $sub) = array_pad(explode('.', $_cmd), 2, '');
					if ($sub) {
						$sub = str_replace('\'', '\\\'', $sub);
						$addSub = create_function('$cmd', 'return $cmd . \'.\' . trim(\'' . $sub . '\');');
						$cmds = array_merge($cmds, array_map($addSub, $allCmds));
					} else {
						$cmds = array_merge($cmds, $allCmds);
					}
				} else {
					$cmds[] = $_cmd;
				}
			}
		}
		$cmds = array_unique($cmds);
		
		foreach ($cmds as $cmd) {
			if (!isset($this->listeners[$cmd])) {
				$this->listeners[$cmd] = array();
			}

			if (is_callable($handler)) {
				$this->listeners[$cmd][] = $handler;
			}
		}

		return $this;
	}
327508
function executeBinding(binding) {
			var invocation = binding.invocation;
			if (invocation) {
				var command = binding.command;
				if (typeof(command.hrefCallback) === 'function') {
					var href = command.hrefCallback.call(invocation.handler || window, invocation);
					if (href.then){
						href.then(function(l){
							window.open(urlModifier(l));
						});
					} else {
						// We assume window open since there's no link gesture to tell us what to do.
						window.open(urlModifier(href));
					}
					return true;
				} else if (invocation.commandRegistry) {
					// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=411282
					invocation.commandRegistry._invoke(invocation);
					return true;
				} else if (command.onClick || command.callback) {
					// TODO: what is this timeout for?
					window.setTimeout(function() {
						(command.onClick || command.callback).call(invocation.handler || window, invocation);
					}, 0);
					return true;
				}
			}
			return false;
		}
894304
def bind_to_constructor(self, cls, constructor):
        """"""
        self._check_class(cls)
        if constructor is None:
            raise InjectorException('Constructor cannot be None, key=%s' % cls)

        self._bindings[cls] = _ConstructorBinding(constructor)
        logger.debug('Bound %s to a constructor %s', cls, constructor)
        return self
1361750
def process_ioc(args):
    """"""
    client = IndicatorClient.from_config()
    client.set_debug(True)

    if args.get:
        response = client.get_indicators()
    elif args.single:
        response = client.add_indicators(indicators=[args.single],
                                         private=args.private, tags=args.tags)
    else:
        if not os.path.isfile(args.file):
            raise Exception("File path isn't valid!")

        indicators = list()
        with open(args.file, 'r') as handle:
            for line in handle:
                line = line.strip()
                if line == '':
                    continue
                indicators.append(line)

        response = client.add_indicators(indicators=indicators,
                                         private=args.private, tags=args.tags)

    return response
284067
private static void bindService() {
        synchronized (Command.class) {
            if (!IS_BIND) {
                Context context = Cmd.getContext();
                if (context == null) {
                    throw new NullPointerException("Context not should null. Please call Cmd.init(Context)");
                } else {
                    // Cmd service
                    context.bindService(new Intent(context, CommandService.class), I_CONN, Context.BIND_AUTO_CREATE);
                    IS_BIND = true;
                }
            }
        }
    }
1229396
@Override
    protected void initializeImpl()
    {
        //get use windows command prefix flag
        String value=this.getConfigurationValue(FaxClientSpiConfigurationConstants.USE_WINDOWS_PREFIX_PROPERTY_KEY);
        this.useWindowsCommandPrefix=Boolean.parseBoolean(value);
        
        //get windows command prefix
        this.windowsCommandPrefix=this.getConfigurationValue(FaxClientSpiConfigurationConstants.WINDOWS_PREFIX_PROPERTY_KEY);
        if(this.windowsCommandPrefix==null)
        {
            this.windowsCommandPrefix=ProcessFaxClientSpi.WINDOWS_EXECUTE_PREFIX_DEFAULT_VALUE;
        }

        //create process output validator
        this.processOutputValidator=this.createProcessOutputValidator();
        if(this.processOutputValidator==null)
        {
            throw new FaxException("Unable to create a new process output validator.");
        }

        //create process output handler
        this.processOutputHandler=this.createProcessOutputHandler();
    }