Find all the channels that came into existence before startup. This can't
be done during the Constructor call, because it requires calls back to
AsteriskPBX which isn't finished constructing until after the Constructor
returns.
765442
void performPostCreationTasks()
    {
        StatusAction statusAction = new StatusAction();
        try
        {
            ResponseEvents events = CoherentManagerConnection.sendEventGeneratingAction(statusAction, 1000);
            for (ResponseEvent event : events.getEvents())
            {
                if (event instanceof StatusEvent)
                {
                    // do nothing. Creating the events will register the
                    // channels, which is after all what we are trying to do.
                }
            }

        }
        catch (IllegalArgumentException | IllegalStateException | IOException | TimeoutException e)
        {
            logger.error(e, e);
        }

    }
328232
function(channel){
    
        var tokenInfo   = this._tokenData,
            reader      = this._reader,
            value,
            i           =0,
            len         = tokenInfo.length,
            found       = false,
            token,
            info;
            
        //check the lookahead buffer first
        if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){  
                           
            i++;
            this._token = this._lt[this._ltIndex++];
            info = tokenInfo[this._token.type];
            
            //obey channels logic
            while((info.channel !== undefined && channel !== info.channel) &&
                    this._ltIndex < this._lt.length){
                this._token = this._lt[this._ltIndex++];
                info = tokenInfo[this._token.type];
                i++;
            }
            
            //here be dragons
            if ((info.channel === undefined || channel === info.channel) &&
                    this._ltIndex <= this._lt.length){
                this._ltIndexCache.push(i);
                return this._token.type;
            }
        }
        
        //call token retriever method
        token = this._getToken();

        //if it should be hidden, don't save a token
        if (token.type > -1 && !tokenInfo[token.type].hide){
                     
            //apply token channel
            token.channel = tokenInfo[token.type].channel;
         
            //save for later
            this._token = token;
            this._lt.push(token);

            //save space that will be moved (must be done before array is truncated)
            this._ltIndexCache.push(this._lt.length - this._ltIndex + i);  
        
            //keep the buffer under 5 items
            if (this._lt.length > 5){
                this._lt.shift();                
            }
            
            //also keep the shift buffer under 5 items
            if (this._ltIndexCache.length > 5){
                this._ltIndexCache.shift();
            }
                
            //update lookahead index
            this._ltIndex = this._lt.length;
        }
            
        /*
         * Skip to the next token if:
         * 1. The token type is marked as hidden.
         * 2. The token type has a channel specified and it isn't the current channel.
         */
        info = tokenInfo[token.type];
        if (info && 
                (info.hide || 
                (info.channel !== undefined && channel !== info.channel))){
            return this.get(channel);
        } else {
            //return just the type
            return token.type;
        }
    }
175419
private static List<String> loadChannels(Map<String, String[]> channels) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
        List<String> createdChannels = new ArrayList<String>(channels.size());
        boolean fireMissingEvent = false;

        final EndPointMgr epm = EndPointMgrImpl.getRef();
        String key, value;
        for (Entry<String, String[]> entry : channels.entrySet()) {
            String channel = entry.getKey();
            Map<Object, Object> props = new HashMap<Object, Object>();
            int weight = -1;
            Class<?> factoryType = null;
            for (String prop : entry.getValue()) {
                key = extractKey(prop);
                value = extractValue(prop);
                if ("type".equalsIgnoreCase(key)) {
                    if (null != factoryType) {
                        // already set
                        continue;
                    }
                    factoryType = cf.lookupFactory(value);
                } else if ("endpoint".equalsIgnoreCase(key)) {
                    if (props.containsKey("hostname")) {
                        // already set
                        continue;
                    }
                    // convert to host/port
                    if (null != epm) {
                        EndPointInfo ep = epm.getEndPoint(value);
                        if (null != ep) {
                            if (bTrace && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Using endpoint: " + ep);
                            }
                            props.put("endPointName", value);
                            props.put("hostname", ep.getHost());
                            props.put("port", String.valueOf(ep.getPort()));
                        } else {
                            if (bTrace && tc.isEventEnabled()) {
                                Tr.event(tc, "Unknown endpoint: " + value);
                            }
                        }
                    } else {
                        if (bTrace && tc.isEventEnabled()) {
                            Tr.event(tc, "Unable to convert endpoint: " + value);
                        }
                    }
                } else if ("weight".equalsIgnoreCase(key)) {
                    if (0 > weight) {
                        // already set
                        continue;
                    }
                    try {
                        weight = Integer.parseInt(value);
                    } catch (NumberFormatException nfe) {
                        FFDCFilter.processException(nfe, "ChannelUtils.loadChannels",
                                                    "weight", new Object[] { entry, cf });
                        if (bTrace && tc.isEventEnabled()) {
                            Tr.event(tc, "Invalid discrimination weight: " + value);
                        }
                    }
                } else {
                    props.put(key, value);
                }
            } // end-props
            if (null == factoryType) {
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Delay; channel missing factory; " + channel);
                }
                delayedConfig.put(CHANNEL_PREFIX + channel, entry.getValue());
                createdChannels.add(channel);
                fireMissingEvent = true;
                continue;
            }
            // change invalid weights to the default number
            if (0 > weight) {
                weight = 10;
            }
            try {
                ChannelData cd = cf.getChannel(channel);
                if (null == cd) {
                    cd = cf.addChannel(channel, factoryType, props, weight);
                } else {
                    cf.updateAllChannelProperties(channel, props);
                }
                createdChannels.add(channel);
            } catch (Exception e) {
                FFDCFilter.processException(e, "ChannelUtils.loadChannels",
                                            "update", new Object[] { entry, cf });
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Unable to add channel: " + channel + "; " + e);
                }
            }
        } // end-channels

        if (fireMissingEvent) {
            fireMissingEvent();
        }

        return createdChannels;
    }
625858
private void determineChannelAccessor() throws ChannelFrameworkException, ChannelFactoryException {
        // Extract the factory class from the application side channel definition.
        OutboundChannelDefinition first = this.outboundChannelDefs.getFirst();
        Class<?> factoryClass = first.getOutboundFactory();
        if (factoryClass == null) {
            throw new ChannelFrameworkException("No factory class associated with outbound channel " + first);
        }
        // Get an instance of the channel factory from the framework.
        ChannelFactory outboundFactory = framework.getChannelFactoryInternal(factoryClass, false);
        if (outboundFactory == null) {
            throw new ChannelFrameworkException("No channel factory could be found for factory class " + factoryClass);
        }
        // Get the channel accessor from the factory instance.
        this.channelAccessor = outboundFactory.getApplicationInterface();
    }
996846
def get_channels(self):
        """"""
        self.request(EP_GET_TV_CHANNELS)
        return {} if self.last_response is None else self.last_response.get('payload').get('channelList')
1362851
public void init() throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "UDP Channel: " + getConfig().getExternalName() + " listening port: " + String.valueOf(getConfig().getPort()));
        }
    }
1365862
def _detect(self):
        
        results = []

        self.results = []
        self.visited_all_paths = {}

        for contract in self.slither.contracts:
            for function in contract.functions:
                if function.is_implemented:
                    uninitialized_storage_variables = [v for v in function.local_variables if v.is_storage and v.uninitialized]
                    function.entry_point.context[self.key] = uninitialized_storage_variables
                    self._detect_uninitialized(function, function.entry_point, [])

        for(function, uninitialized_storage_variable) in self.results:
            var_name = uninitialized_storage_variable.name

            info = "{} in {}.{} ({}) is a storage variable never initialiazed\n"
            info = info.format(var_name, function.contract.name, function.name, uninitialized_storage_variable.source_mapping_str)


            json = self.generate_json_result(info)
            self.add_variable_to_json(uninitialized_storage_variable, json)
            self.add_function_to_json(function, json)
            results.append(json)

        return results
792006
@Override
    public Channel getChannelOrFail() throws ChannelClosedException {
        final Channel ch = Channel.current();
        if (ch == null) {
            throw new ChannelClosedException(new IllegalStateException("No channel associated with the thread"));
        }
        return ch;
    }
70491
def _find_constructor(self):
        

        def isconstructor(object):
            return inspect.isfunction(object) and object.__name__ == '__init__'

        # find all the dependencies from the constructor
        constructors = inspect.getmembers(self.class_type, predicate=isconstructor)

        if constructors:
            name, func = constructors[0]
            return func

        # No explicit __init__
        return None
907782
def _get_initialized_channels_for_service(self, org_id, service_id):
        ''''''
        channels_dict = self._get_initialized_channels_dict_for_service(org_id, service_id)
        return list(channels_dict.values())
1221392
private ChannelInitializer<SocketChannel> getChannelInitializer(final PravegaNodeUri location,
                                                                    final FlowHandler handler) {
        final SslContext sslCtx = getSslContext();

        return new ChannelInitializer<SocketChannel>() {
            @Override
            public void initChannel(SocketChannel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                if (sslCtx != null) {
                    SslHandler sslHandler = sslCtx.newHandler(ch.alloc(), location.getEndpoint(), location.getPort());

                    if (clientConfig.isValidateHostName()) {
                        SSLEngine sslEngine = sslHandler.engine();
                        SSLParameters sslParameters = sslEngine.getSSLParameters();
                        sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
                        sslEngine.setSSLParameters(sslParameters);
                    }
                    p.addLast(sslHandler);
                }
                p.addLast(
                        new ExceptionLoggingHandler(location.getEndpoint()),
                        new CommandEncoder(handler.getBatchSizeTracker()),
                        new LengthFieldBasedFrameDecoder(WireCommands.MAX_WIRECOMMAND_SIZE, 4, 4),
                        new CommandDecoder(),
                        handler);
            }
        };
    }
1257120
@Override
    public void start() throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "start");
        }

        stop0Called = false;

        try {
            // If this is an inbound channel, we can pull out the listening host/port/endpointName.
            if (getConfig().isInbound()) {
                // Get access to the ChainData object for future use.
                ChainData chainData = SSLChannelProvider.getCfw().getInternalRunningChains(getConfig().getName())[0];
                ChannelData channelData = chainData.getChannelList()[0];
                Map<?, ?> channelProperties = channelData.getPropertyBag();
                this.inboundHost = (String) channelProperties.get("hostname");
                this.inboundPort = (String) channelProperties.get("port");
                // End point name will only ever get a value when running in was. Otherwise, null is fine.
                this.endPointName = (String) channelProperties.get("endPointName");
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "inboundHost = " + this.inboundHost
                                 + " inboundPort = " + this.inboundPort
                                 + " endPointName = " + this.endPointName);

                }
            }
        } catch (Exception e) {
            // no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Caught exception during start, throwing up stack.  " + e);
            }
            throw new ChannelException(e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "start");
        }
    }
1268824
@Override
    protected void checkTransitions(StreamTokenizer streamTokenizer) throws FSMParseException {

        // Only if no states are defined we add all from the transitions we found.
        // This is necessary because states are not necessarily defined in FSMs.
        if (getStates().isEmpty()) {
            getStates().addAll(transitionsFSM.keySet());
        }

        // copy the set of states
        final Set<Integer> newStates = new HashSet<>(getStates());

        // retrieve the initial state in the FSM source
        final Integer initialState = getStates().iterator().next();

        // make the actual FSM transitions
        makeTransitions(initialState, null, newStates, 0, output != null ? new WordBuilder<>() : null, streamTokenizer);

        // check we do not have a partial FSM
        if (!newStates.isEmpty()) {
            throw new FSMParseException(String.format(PARTIAL_FSM, newStates, initialState), streamTokenizer);
        }
    }
1048161
def get_channel_names(self):
        """"""
        names_s, names_n = self.channel_names_s, self.channel_names_n

        # Figure out which channel names to use
        if self._channel_naming == '$PnS':
            channel_names, channel_names_alternate = names_s, names_n
        else:
            channel_names, channel_names_alternate = names_n, names_s

        if len(channel_names) == 0:
            channel_names = channel_names_alternate

        if len(set(channel_names)) != len(channel_names):
            msg = (u'The default channel names (defined by the {} '
                   u'parameter in the FCS file) were not unique. To avoid '
                   u'problems in downstream analysis, the channel names '
                   u'have been switched to the alternate channel names '
                   u'defined in the FCS file. To avoid '
                   u'seeing this warning message, explicitly instruct '
                   u'the FCS parser to use the alternate channel names by '
                   u'specifying the channel_naming parameter.')
            msg = msg.format(self._channel_naming)
            warnings.warn(msg)
            channel_names = channel_names_alternate

        return channel_names
207499
def _fetch_channels(self):
        """"""
        json = requests.get(self._channels_url).json()
        self._channels = {c['channel']['code']: c['channel']['name']
                          for c in json['channels']}
428358
private static List<String> loadChains(Map<String, String[]> chains, boolean start, boolean restart) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
        List<String> createdChains = new ArrayList<String>(chains.size());

        String key, value;
        for (Entry<String, String[]> entry : chains.entrySet()) {
            String chain = entry.getKey();
            FlowType flow = FlowType.INBOUND;
            boolean enable = true;
            boolean missingChannels = false;
            String[] chanList = null;
            for (String prop : entry.getValue()) {
                key = extractKey(prop);
                value = extractValue(prop);
                if ("enable".equalsIgnoreCase(key)) {
                    enable = Boolean.parseBoolean(value);
                } else if ("channels".equalsIgnoreCase(key)) {
                    // parse the channel list
                    chanList = extractList(value, ',');
                    for (String channel : chanList) {
                        if (null == cf.getChannel(channel)) {
                            if (bTrace && tc.isEventEnabled()) {
                                Tr.event(tc, "Chain contains missing channel: " + channel);
                            }
                            chanList = null;
                            missingChannels = true;
                            break; // out of channel check loop
                        }
                    }
                } else if ("flow".equalsIgnoreCase(key)) {
                    flow = "inbound".equalsIgnoreCase(value) ? FlowType.INBOUND : FlowType.OUTBOUND;
                }
            }
            if (null == chanList) {
                // chain either had no channels configured or it has channels
                // that are waiting on their providers
                if (!missingChannels) {
                    if (bTrace && tc.isEventEnabled()) {
                        Tr.event(tc, "Chain had no channels; " + chain);
                    }
                    continue;
                }
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Delay; chain missing channels; " + chain);
                }
                if (start) {
                    delayedStarts.put(chain, Boolean.valueOf(restart));
                }
                delayedConfig.put(CHAIN_PREFIX + chain, entry.getValue());
                createdChains.add(chain);
                continue;
            }
            try {
                ChainData cd = cf.getChain(chain);
                if (null == cd) {
                    cd = cf.addChain(chain, flow, chanList);
                } else {
                    cd = cf.updateChain(chain, chanList);
                }
                cd.setEnabled(enable);
                createdChains.add(chain);
            } catch (Exception e) {
                FFDCFilter.processException(e, "ChannelUtils.loadChains",
                                            "create", new Object[] { entry, cf });
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Unable to add chain " + chain + "; " + e);
                }
            }
        } // end-chains

        return createdChains;
    }
32094
def output_channels(self):
    """"""
    if callable(self._output_channels):
      self._output_channels = self._output_channels()
    # Channel must be integer.
    self._output_channels = int(self._output_channels)
    return self._output_channels