<commit_before>module Influxdb
  module Api
    module Namespaces
      class Series < WithDatabase
        resource_path '/series'

        undef_method(:create) if method_defined?(:create)

        def all
          raw_execute('list series').map{|s| s['name']}
        end

        def write(*series)
          series = if series.first.is_a?(String) || series.first.is_a?(Symbol)
            { series.shift => series.shift }
          else
            series.shift
          end

          series = series.map{|name, points| writing_block(name, Array.wrap(points)) }
          perform_writing(series)<commit_msg>0.8.3 version have changed format of results 'list series' query<commit_after>module Influxdb
  module Api
    module Namespaces
      class Series < WithDatabase
        resource_path '/series'

        undef_method(:create) if method_defined?(:create)

        def all
          raw_execute('SELECT * FROM /.*/ LIMIT 1').map{|s| s['name']}
        rescue Client::Errors::BadRequest => e
          []
        end

        def write(*series)
          series = if series.first.is_a?(String) || series.first.is_a?(Symbol)
            { series.shift => series.shift }
          else
            series.shift
          end

          series = series.map{|name, points| writing_block(name, Array.wrap(points)) }
          perform_writing(series)
{'fraction_non_alphanumeric': 0.1084070796460177, 'fraction_numerical': 0.0029498525073746312, 'mean_word_length': 2.1412037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7304255', 'n_tokens_mistral': 383, 'n_tokens_neox': 372, 'n_words': 87}