Creates a temporary {BunnyMock::Channel} instance, yields it to
 the block given, then closes it

 @param [Integer] n Channel identifier

 @return [BunnyMock::Session] self
 @api public
487003
def with_channel(n = nil)
      ch = create_channel(n)
      begin
        yield ch
      ensure
        ch.close if ch.open?
      end

      self
    end
419419
def _fetch_new(&client_block)
      if (@never_block || (_total_current_size < @max_size))
        if client_block.arity == 0
          nc = yield
        else
          nc = yield @sessions_key
        end
        HotTub.logger.info "[HotTub] Adding client: #{nc.class.name} to #{@name}." if HotTub.log_trace?
        nc
      end
    end
1032758
function BlockPacket(block, witness) {
  if (!(this instanceof BlockPacket))
    return new BlockPacket(block, witness);

  Packet.call(this);

  this.block = block || new MemBlock();
  this.witness = witness || false;
}
580308
def new_scope(names)
      values = names.collect { |n| self[n] }
      self.class.new(names, values, self)
    end
232996
def state_run_block(channel)
      debug :run_block
      channel[:state] = nil
      blk = channel[:block]
      channel[:block] = nil
      begin
        instance_eval &blk
      rescue => ex
        channel[:exception] = ex
      end
      channel[:state] = :exit
    end
1323594
def let! meth, &proc
      proc || raise(ArgumentError, 'block is missing')
      vars[meth] = proc
      define_method(meth, &proc)
    end
767354
def create_channel(self, queue_name):
        
        channel = self.connection.channel()
        channel.queue_declare(queue=queue_name, durable=True)
        return channel
114607
function createSession(config, cb) {
  cb = utils.callOnce(cb)

  DEBUG("create", utils.JS(config))

  var channel = channels.createChannel(config.url)
  var session = new Session(channel, config, cb)
}
984618
@Deprecated
    @SuppressWarnings("unchecked")
    public static <T> ChannelOption<T> newInstance(String name) {
        return (ChannelOption<T>) pool.newInstance(name);
    }
694323
public Channel.ID createChannel()
	{
		final int num = getNextPathNum();
		return new Channel.ID(this.paths[num], num, this.random);
	}
997453
def create(input_block: ModelFactory, rnn_type: str, hidden_layers: typing.List[int],
           output_dim: int, dropout=0.0):
    
    def instantiate(**_):
        return MultilayerRnnSequenceModel(
            input_block.instantiate(), rnn_type=rnn_type, hidden_layers=hidden_layers, output_dim=output_dim, dropout=dropout
        )

    return ModelFactory.generic(instantiate)
348331
function(sessionId, socketId, cb) {
      return api.store.get().load(sessionId, function(err, session) {
        // Create a new session if we don't have this sessionId in memory
        // Note: in production you should be using Redis or another
        // persistent store so this should rarely happen
        if (!session) {
          session = strategy.create(sessionId);
          debug('created session for %s',sessionId);
        } else {
          debug('using existing session for %s',sessionId);
        }

        // Append methods to session object
        session.channel = channels(ss, session, socketId);
        session.setUserId = function(userId, cb) {
          if (!cb) {
            cb = function() {};
          }
          if (userId) {
            this.userId = userId;
            this._bindToSocket();
          } else if (this.userId) {  // if null (i.e. user has signed out)
            subscriptions.user.remove(this.userId, socketId);
            delete this.userId;
          }
          return this.save(cb);
        };

        // Bind username and any channel subscriptions to this socketID on each request
        session._bindToSocket = function() {
          if (session.userId) {
            subscriptions.user.add(session.userId, socketId);
          }
          if ((session.channels) && session.channels.length > 0) {
            session.channel._bindToSocket();
          }
          return this;
        };
        session.save = function(cb) {
          return sessionStore.set(sessionId, session, cb);
        };
        session._bindToSocket();
        return cb(session);
      });
    }
537940
private <RequestT, ResponseT>
      ServerStreamingCallable<RequestT, ResponseT> createUserFacingServerStreamingCallable(
          String methodName, ServerStreamingCallable<RequestT, ResponseT> inner) {

    ServerStreamingCallable<RequestT, ResponseT> traced =
        new TracedServerStreamingCallable<>(
            inner,
            clientContext.getTracerFactory(),
            SpanName.of(TRACING_OUTER_CLIENT_NAME, methodName));

    return traced.withDefaultCallContext(clientContext.getDefaultCallContext());
  }
1064607
def make_channel(name, samples, data=None, verbose=False):
    
    if verbose:
        llog = log['make_channel']
        llog.info("creating channel {0}".format(name))
    # avoid segfault if name begins with a digit by using "channel_" prefix
    chan = Channel('channel_{0}'.format(name))
    chan.SetStatErrorConfig(0.05, "Poisson")

    if data is not None:
        if verbose:
            llog.info("setting data")
        chan.SetData(data)

    for sample in samples:
        if verbose:
            llog.info("adding sample {0}".format(sample.GetName()))
        chan.AddSample(sample)

    return chan
872471
def new
      @channel = Channel.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @channel }
      end
    end
26556
def get_channelstate_by_canonical_identifier(
        chain_state: ChainState,
        canonical_identifier: CanonicalIdentifier,
) -> Optional[NettingChannelState]:
    
    token_network = get_token_network_by_identifier(
        chain_state,
        TokenNetworkID(canonical_identifier.token_network_address),
    )

    channel_state = None
    if token_network:
        channel_state = token_network.channelidentifiers_to_channels.get(
            canonical_identifier.channel_identifier,
        )

    return channel_state
26172
def _pre_create(cls, atdepth, stackdepth, *argl, **argd):
    
    from time import time
    if not atdepth:
        rstack = _reduced_stack()
        reduced = len(rstack)
        if msg.will_print(3): # pragma: no cover
            sstack = [' | '.join(map(str, r)) for r in rstack]
            msg.info("{} => stack ({}): {}".format(cls.__fqdn__, len(rstack),
                                                   ', '.join(sstack)), 3)
    else:
        reduced = stackdepth + 10

    if reduced <= stackdepth:
        args = _check_args(*argl, **argd)
        entry = {
            "m": "{}.__new__".format(cls.__fqdn__),
            "a": args,
            "s": time(),
            "r": None,
            "stack": reduced
            }
    else:
        atdepth = True
        entry = None

    return (entry, atdepth)