Downloads all data for a given type, calls the supplied Pandata::Parser
 method and removes any duplicates.
 @param data_type [Symbol]
 @param parser_method [Symbol] method to be sent to the Parser instance
 @return [Array]
335341
def scrape_for(data_type, parser_method)
      results = []

      url = get_url(data_type)
      download_all_data(url) do |html, next_data_indices|
        new_data = @parser.public_send(parser_method, html)

        if new_data.kind_of?(Array)
          results.concat(new_data)
        else
          results.push(new_data)
        end

        if @download_cb
          break if @download_cb[new_data] == :stop
        end

        get_url(data_type, next_data_indices) if next_data_indices
      end

      # Pandora data often contains duplicates--get rid of them.
      results.uniq
    end
274845
def search(search_type, klass, query, options = false)
      header = {}

      # Required Data
      data = {
        'SearchType' => search_type,
        'Class'      => klass,
        'Query'      => query,
        'QueryType'  => 'DMQL2',
        'Format'     => format,
        'Count'      => '0'
      }

      # Options
      #--
      # We might want to switch this to merge!, but I've kept it like this for now because it
      # explicitly casts each value as a string prior to performing the search, so we find out now
      # if can't force a value into the string context. I suppose it doesn't really matter when
      # that happens, though...
      #++
      options.each { |k,v| data[k] = v.to_s } if options

      response = request(@urls.search, data, header)

      # TODO: make parser configurable
      results = RETS4R::Client::CompactNokogiriParser.new(response.body)

      if block_given?
        results.each {|result| yield result}
      else
        return results.to_a
      end
    end
660783
def data_type(self, data_type):
        
        allowed_values = ["string", "number", "date", "color"]
        if data_type is not None and data_type not in allowed_values:
            raise ValueError(
                "Invalid value for `data_type` ({0}), must be one of {1}"
                .format(data_type, allowed_values)
            )

        self._data_type = data_type
611839
public <R> R getData(Class<R> type) {
        return GSON.fromJson(data, type);
    }
1176048
def astype(self, data_type):
        

        data_type = types.validate_data_type(data_type)

        if data_type == self._data_type:
            return self

        attr_dict = dict()
        attr_dict['_data_type'] = data_type
        attr_dict['_source_data_type'] = self._source_data_type
        attr_dict['_input'] = self

        new_sequence = AsTypedSequenceExpr(**attr_dict)

        return new_sequence
1206417
def add(type, *data)
      df = DataFrame.new({x: data[0], y: data[1], z: data[2]})
      return add_with_df(df, type, :x, :y, :z)
    end
94062
private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) {
        List<Consumes> consumes = findAll(method, Consumes.class);
        List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class);

        if (consumes.isEmpty() && consumeTypes.isEmpty()) {
            consumes = findAll(clazz, Consumes.class);
            consumeTypes = findAll(clazz, ConsumeType.class);
        }

        final List<MediaType> types =
                Stream.concat(consumes.stream().map(Consumes::value),
                              consumeTypes.stream().map(ConsumeType::value))
                      .map(MediaType::parse)
                      .collect(toImmutableList());
        return ensureUniqueTypes(types, Consumes.class);
    }
56354
def parse_data(data, type, **kwargs):
    
    suffixes = {
        'xml': '.osm',
        'pbf': '.pbf',
    }
    try:
        suffix = suffixes[type]
    except KeyError:
        raise ValueError('Unknown data type "%s"' % type)

    fd, filename = tempfile.mkstemp(suffix=suffix)
    try:
        os.write(fd, data)
        os.close(fd)
        return parse_file(filename, **kwargs)
    finally:
        os.remove(filename)
828121
def serialize_function_from_method(meth)
          if pry?
            meth = Pry::Method.new(meth)
          end

          {type: 'method', name: meth.name, content: meth.source}
        rescue
          raise Spark::SerializeError, 'Method can not be serialized. Use full path or Proc.'
        end
1337988
def feed_parser(self, data):
        
        assert isinstance(data, bytes)
        self.parser.feed(data)
1047664
private function selectDataParser()
    {
        /* @var ContentTypeParser $selected */
        $selected = null;

        //Has content?
        if (!empty($this->getContentType())) {

            //Search trough the registered parsers
            foreach (self::$registeredParsers as $parser) {
                /* @var ContentTypeParser $parser */
                if ($parser->canHandle($this->getContentType())) {
                    $selected = $parser;
                    break;
                }
            }
        }

        //If no one was found, pick GenericParser
        if (is_null($selected)) {
            $selected = new GenericParser();
        }

        $selected->setRequest($this);
        $this->parser = $selected;
    }
918130
def rpc(rpc_method, attrs={}, req_opts=nil)
      body = Encoding.encode_json(attrs)

      resp = self.class.make_http_request(@conn, @service_full_name, rpc_method, Encoding::JSON, req_opts, body)
      if resp.status != 200
        return ClientResp.new(nil, self.class.error_from_response(resp))
      end

      data = Encoding.decode_json(resp.body)
      return ClientResp.new(data, nil)
    end
575781
public <T> T get(int row, int col, DataType dataType)
	{
		List<String> rowList = row(row);
		
		if(rowList == null || rowList.isEmpty() || col >= rowList.size())
			return nullFor(dataType);
		
	
		String cell = rowList.get(col);
		
		
		
		T results = toType(cell,dataType);
		return results;
	}
1139315
def getData(self, type: str) -> str:
        
        return self.__data.get(normalize_type(type), '')
863798
def parse_to_type(self,**kwargs):
        """"""
        indexes = self.selectedIndexes()
        if not indexes: return
        for index in indexes:
            self.model().parse_data_type(index, **kwargs)
761648
public static <O> Function<Object, O> getParseFunction(Class<O> type) {
        return new StructBehavior<Function<Object, O>>(type) {

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> booleanIf() {
                return (Function<Object, O>) TO_BOOLEAN; 
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> byteIf() {
                return (Function<Object, O>) TO_BYTE;
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> characterIf() {
                return (Function<Object, O>) TO_CHARACTER;
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> doubleIf() {
                return (Function<Object, O>) TO_DOUBLE;
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> floatIf() {
                return (Function<Object, O>) TO_FLOAT;
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> integerIf() {
                return (Function<Object, O>) TO_INTEGER;
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> longIf() {
                return (Function<Object, O>) TO_LONG;
            }

            @SuppressWarnings("unchecked")
            @Override protected Function<Object, O> shortIf() {
                return (Function<Object, O>) TO_SHORT;
            }

            @Override protected Function<Object, O> nullIf() {
                return null;
            }

            @Override protected Function<Object, O> noneMatched() {
                return new ValueBehaviorAdapter<Function<Object, O>>(delegate) {
                    
                    @SuppressWarnings("unchecked")
                    @Override protected Function<Object, O> dateIf(Date resolvedP) {
                        return (Function<Object, O>) TO_DATE;
                    }

                    @SuppressWarnings("unchecked")
                    @Override protected Function<Object, O> bigDecimalIf(BigDecimal resolvedP) {
                        return (Function<Object, O>) TO_BIGDECIMAL;
                    }

                    @SuppressWarnings("unchecked")
                    @Override protected Function<Object, O> bigIntegerIf(BigInteger resolvedP) {
                        return (Function<Object, O>) TO_BIGINTEGER;
                    }

                    @Override protected Function<Object, O> defaultBehavior() {
                        return null;
                    }
                }.doDetect();
            }
        }.doDetect();
    }
234915
def download(to_date = nil)
      url = to_date ? @url + "?to=#{to_date.strftime('%Y-%m-%d')}" : @url
      res = Curl::Easy.perform(url)
      code = res.response_code
      raise("Failed loading data from GitHub: #{url} #{code}") if code != 200
      html = Nokogiri::HTML(res.body_str)
      html.css('.day').map do |x|
        x.attributes.values_at('data-date', 'data-count').map(&:value)
      end
    end