<commit_before>"""
Functions described here are for python 2/3 compability and other tasks.
"""

from .compat import urlparse, urlencode, urljoin, parse_qsl

import json


def read_config(config_file, parser):
    with open(config_file, 'r', encoding='utf-8') as f:
        values = json.load(f)

    return values['options'], values['arguments']


def write_config(config_file, options, arguments):
    with open(config_file, 'w+', encoding='utf-8') as f:
        json.dump({"options": options.__dict__, "arguments": arguments}, f)


def modify_parameter(parameter, target_name, value):
    parameter[target_name] = value
    return parameter


def change_parameter(url, parameter, new_value):
    """ Returns a new url where the parameter is changed. """
    url_query = urlparse(url).query
    query = dict(parse_qsl(url_query))
<commit_msg>[config] Fix in Python 2<commit_after>"""
Functions described here are for python 2/3 compability and other tasks.
"""

from .compat import urlparse, urlencode, urljoin, parse_qsl

import io
import json


def read_config(config_file, parser):
    with io.open(config_file, 'r', encoding='utf-8') as f:
        values = json.load(f)

    return values['options'], values['arguments']


def write_config(config_file, options, arguments):
    with io.open(config_file, 'w+', encoding='utf-8') as f:
        json.dump({"options": options.__dict__, "arguments": arguments}, f)


def modify_parameter(parameter, target_name, value):
    parameter[target_name] = value
    return parameter


def change_parameter(url, parameter, new_value):
    """ Returns a new url where the parameter is changed. """
    url_query = urlparse(url).query
    query = dict(parse_qsl(url_query))

{'fraction_non_alphanumeric': 0.12244897959183673, 'fraction_numerical': 0.0052478134110787176, 'mean_word_length': 4.517684887459807, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, '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': '2718130', 'n_tokens_mistral': 523, 'n_tokens_neox': 508, 'n_words': 156}