<commit_before># -*- coding: utf-8 -*-
"""
Created on Wed Apr 07 23:11:39 2015

@author: <NAME>
"""
from __future__ import print_function

def main():
    import argparse
    parser = argparse.ArgumentParser(
        prog='ircelsos',
        description='Download air quality data from the SOS of IRCEL - CELINE.')

    parser.add_argument('pollutant',
                        help='The pollutant')
    parser.add_argument('--station', '-s', nargs=1,
                        help='Station number. If no provided, use all available'
                        ' stations for that pollutant')
    parser.add_argument('--period', '-p', type=str, nargs=2,
                        help='Period of the measurements given as "start stop"')
    args = parser.parse_args()

    from .query_ircelsos import query_ircelsos
    from .parser import get_observations, parse_observation

    print("SOS of IRCEL - CELINE")
    print("Downloading ...")

    pollutant = args.pollutant
    if args.station:
        station = args.station[0]
    else:
        station = None
    response = query_ircelsos(pollutant, station, args.period[0],
                              args.period[1])
    observations = get_observations(response)
    if not observations:
        print('No observations found')
        import sys
        sys.exit()

    for obs in observations:
        st_info, raw_data = parse_observation(obs)

    filename = '{0}_{1}.csv'.format(pollutant, st_info['name'])
    print("Writing file '{}'".format(filename))
    with open(filename, 'w') as f:
        f.writelines(raw_data.replace(';', '\n'))<commit_msg>Fix main: writing of multiple stations if None is specified<commit_after># -*- coding: utf-8 -*-
"""
Created on Wed Apr 07 23:11:39 2015

@author: <NAME>
"""
from __future__ import print_function

def main():
    import argparse
    parser = argparse.ArgumentParser(
        prog='ircelsos',
        description='Download air quality data from the SOS of IRCEL - CELINE.')

    parser.add_argument('pollutant',
                        help='The pollutant')
    parser.add_argument('--station', '-s', nargs=1,
                        help='Station number. If no provided, use all available'
                        ' stations for that pollutant')
    parser.add_argument('--period', '-p', type=str, nargs=2,
                        help='Period of the measurements given as "start stop"')
    args = parser.parse_args()

    from .query_ircelsos import query_ircelsos
    from .parser import get_observations, parse_observation

    print("SOS of IRCEL - CELINE")
    print("Downloading ...")

    pollutant = args.pollutant
    if args.station:
        station = args.station[0]
    else:
        station = None
    response = query_ircelsos(pollutant, station, args.period[0],
                              args.period[1])
    observations = get_observations(response)
    if not observations:
        print('No observations found')
        import sys
        sys.exit()

    for obs in observations:
        st_info, raw_data = parse_observation(obs)

        filename = '{0}_{1}.csv'.format(pollutant, st_info['name'])
        print("Writing file '{}'".format(filename))
        with open(filename, 'w') as f:
            f.writelines(raw_data.replace(';', '\n'))
{'fraction_non_alphanumeric': 0.11896024464831804, 'fraction_numerical': 0.012232415902140673, 'mean_word_length': 2.435924369747899, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1726901', 'n_tokens_mistral': 985, 'n_tokens_neox': 924, 'n_words': 256}