<commit_before>"""Asset is the general term for any component of an infrastructure system

The set of assets defines the state of the infrastructure system.

This module needs to support:
- initialisation of set of assets from model config (e.g. set of text files;
database)
  - hold generic list of key/values
- creation of new assets by decision logic (rule-based/optimisation solver)
  - maintain or derive set of possible assets
    - hence distinction between known-ahead values and build-time values. At
    least location and date are specified at build time, possibly also cost,
    capacity as functions of time and location.
- serialisation for passing to models
  - ease of access to full generic data structure
- output list of assets for reporting
  - write out with legible or traceable keys and units for verification and understanding
"""
import hashlib
import json

class Asset(object):
    """An asset.

    An asset's data is set up to be a flexible, plain data structure.
    """
    def __init__(self, asset_type="", data={}):
        if asset_type == "" and "asset_type" in data:
            # allow data to set asset_type if none given
            asset_type = data["asset_type"]
        else:
            # otherwise rely on asset_type arg
            data["asset_type"] = asset_type
<commit_msg>fix dictionary default argument<commit_after>"""Asset is the general term for any component of an infrastructure system

The set of assets defines the state of the infrastructure system.

This module needs to support:
- initialisation of set of assets from model config (e.g. set of text files;
database)
  - hold generic list of key/values
- creation of new assets by decision logic (rule-based/optimisation solver)
  - maintain or derive set of possible assets
    - hence distinction between known-ahead values and build-time values. At
    least location and date are specified at build time, possibly also cost,
    capacity as functions of time and location.
- serialisation for passing to models
  - ease of access to full generic data structure
- output list of assets for reporting
  - write out with legible or traceable keys and units for verification and understanding
"""
import hashlib
import json

class Asset(object):
    """An asset.

    An asset's data is set up to be a flexible, plain data structure.
    """
    def __init__(self, asset_type="", data=None):
        if data is None:
            data = {}

        if asset_type == "" and "asset_type" in data:
            # allow data to set asset_type if none given
            asset_type = data["asset_type"]
        else:
            # otherwise rely on asset_type arg
            data["asset_type"] = asset_type

{'fraction_non_alphanumeric': 0.05982274741506647, 'fraction_numerical': 0.0, 'mean_word_length': 3.1045454545454545, 'pattern_counts': {'":': 0, '<': 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': '599788', 'n_tokens_mistral': 671, 'n_tokens_neox': 659, 'n_words': 352}