Return input reader objects. Helper for split_input.
421571
def _split_input_from_params(cls, app, namespaces, entity_kind_name,
                               params, shard_count):
    """"""
    # pylint: disable=redefined-outer-name
    key_ranges = []  # KeyRanges for all namespaces
    for namespace in namespaces:
      key_ranges.extend(
          cls._split_input_from_namespace(app,
                                          namespace,
                                          entity_kind_name,
                                          shard_count))

    # Divide the KeyRanges into shard_count shards. The KeyRanges for different
    # namespaces might be very different in size so the assignment of KeyRanges
    # to shards is done round-robin.
    shared_ranges = [[] for _ in range(shard_count)]
    for i, k_range in enumerate(key_ranges):
      shared_ranges[i % shard_count].append(k_range)
    batch_size = int(params.get(cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE))

    return [cls(entity_kind_name,
                key_ranges=key_ranges,
                ns_range=None,
                batch_size=batch_size)
            for key_ranges in shared_ranges if key_ranges]
1044368
def _load_text(handle, split=False, encoding="utf-8"):
    """"""
    string = handle.read().decode(encoding)
    return string.splitlines() if split else string
228842
def split_input(args):
    """"""
    args['files'] = []
    args['urls'] = []
    for arg in args['query']:
        if os.path.isfile(arg):
            args['files'].append(arg)
        else:
            args['urls'].append(arg.strip('/'))
669239
def inputReadCallback(self, *args, **kwargs):
        
        b_status    = True
        filesRead   = 0

        for k, v in kwargs.items():
            if k == 'l_file':   l_file      = v
            if k == 'path':     str_path    = v

        if len(args):
            at_data         = args[0]
            str_path        = at_data[0]
            l_file          = at_data[1]

        self.dp.qprint("reading (in path %s):\n%s" % 
                            (str_path, 
                            self.pp.pformat(l_file)), 
                            level = 5)
        filesRead   = len(l_file)

        if not len(l_file): b_status = False

        return {
            'status':           b_status,
            'l_file':           l_file,
            'str_path':         str_path,
            'filesRead':        filesRead
        }
864742
private static Reader _getReader(InputStream is, Charset charset) throws IOException {
	if (charset == null) charset = SystemUtil.getCharset();
	return new BufferedReader(new InputStreamReader(is, charset));
    }
1056983
def load_inputs(self):
        """"""
        for f in self.args.files:
            if os.path.isfile(f):
                fparts = str(f).split('.')
                if fparts[-1] == 'gz':
                    if self.args.unzip:
                        fullpath = os.path.abspath(str(f))
                        self.input_files.append(fullpath)
                    else:
                        return 0
                elif fparts[-1] == 'bz2' or fparts[-1] == 'zip':
                    return 0
                else:
                    fullpath = os.path.abspath(str(f))
                    self.input_files.append(fullpath)
            else:
                print('File '+ f + ' not found')
                return 1
576391
def split(attrs, inputs, proto_obj):
    """"""
    split_list = attrs.get('split') if 'split' in attrs else []
    new_attrs = translation_utils._fix_attribute_names(attrs,
                                                       {'split' : 'num_outputs'})
    if 'axis' not in attrs:
        new_attrs = translation_utils._add_extra_attributes(new_attrs, {'axis': 0})

    if not split_list:
        num_outputs = len(proto_obj.model_metadata.get('output_tensor_data'))
    else:
        if len(set(split_list)) == 1:
            num_outputs = len(split_list)
        else:
            raise NotImplementedError("Operator {} in MXNet does not support variable splits."
                                      "Tracking the issue to support variable split here: "
                                      "https://github.com/apache/incubator-mxnet/issues/11594"
                                      .format('split'))

    new_attrs['num_outputs'] = num_outputs
    return 'split', new_attrs, inputs
457153
def _get_data(self, read_size):
        """"""
        if NIX:
            return super(Keyboard, self)._get_data(read_size)
        return self._pipe.recv_bytes()
1341764
def split_input(val, mapper=None):
    '''
    
    '''
    if mapper is None:
        mapper = lambda x: x
    if isinstance(val, list):
        return list(map(mapper, val))
    try:
        return list(map(mapper, [x.strip() for x in val.split(',')]))
    except AttributeError:
        return list(map(mapper, [x.strip() for x in six.text_type(val).split(',')]))
1025871
def get_inputs(self, _visited=None):
        
        if _visited is None:
            _visited = set()

        _visited.add(self)

        for i in self.inputs:
            if i not in _visited:
                i.get_inputs(_visited)

        return _visited
551589
public static InputReader getInstance(Reader in, char[] shared)
    {
        Set<ParserFeature> features = NO_FEATURES;
        return new ReadableInput(getFeaturedReader(in, shared.length, features), shared, features);
    }
53404
public Stream<JacksonHandle> split(Reader input) throws Exception  { 

        if(input == null) {
            throw new IllegalArgumentException("Input cannot be null.");
        }
        return configureInput(configureObjReader().readValues(input));
    }
535637
def reader(stream):
    """"""
    string = stream.read()
    decoder = json.JSONDecoder().raw_decode
    index = START.match(string, 0).end()

    while index < len(string):
        obj, end = decoder(string, index)
        item = Item()
        item.primitive = obj
        yield item
        index = END.match(string, end).end()
193429
def _read_field(self):
        '''
        
        '''
        ftype = self._input[self._pos]
        self._pos += 1

        reader = self.field_type_map.get(ftype)
        if reader:
            return reader(self)

        raise Reader.FieldError('Unknown field type %s', ftype)
1060926
public String[] split(PushbackReader in, int bufferSize, int limit) throws IOException
    {
        InputReader reader = Input.getInstance(in, bufferSize);
        List<String> list = split(reader, limit);
        return list.toArray(new String[list.size()]);
    }
1149468
def to_chunks(stream_or_generator):
    

    if isinstance(stream_or_generator, types.GeneratorType):
        yield from stream_or_generator
    elif hasattr(stream_or_generator, 'read'):
        while True:
            chunk = stream_or_generator.read(CHUNK_SIZE)
            if not chunk:
                break  # no more data

            yield chunk

    else:
        raise TypeError('Input must be either readable or generator.')
766595
def read_input_data(filename):
    """"""
    logging.info('Opening file %s for reading input', filename)
    input_file = open(filename, 'r')
    data = []
    labels = []
    for line in input_file:
        tokens = line.split(',', 1)
        labels.append(tokens[0].strip())
        data.append(tokens[1].strip())
    return labels, data