<commit_before># The Hazard Library
# Copyright (C) 2012-2021 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
Module :mod:`openquake.hazardlib.source.multi_fault`
defines :class:`MultiFaultSource`.
"""

import numpy as np
from typing import Mapping
from openquake.hazardlib.geo.mesh import Mesh
from openquake.hazardlib.source.rupture import (
        NonParametricProbabilisticRupture)
from openquake.hazardlib.geo.surface.multi import MultiSurface
from openquake.hazardlib.source.base import BaseSeismicSource

F32 = np.float32


class FaultSection():
    """
    A class to define a fault section, that is the geometry definition of a
    portion of a fault.

    :param sec_id:
        A unique identifier
    :param surface:
        An instance of
        :class:`openquake.hazardlib.geo.surface.base.BaseSurface` which
        describes the 3D geometry of a part of a fault system.
    """

    def __init__(self, sec_id: str, surface):
        self.sec_id = sec_id
        self.surface = surface


class MultiFaultSource(BaseSeismicSource):
    """
    The multi-fault source is a source typology specifiically support the
    calculation of hazard using fault models with segments participating to
    multiple ruptures.

    :param source_id:
        A unique identifier for the source
    :param name:
        The name of the fault
    :param tectonic_region_type:
        A string that defines the TRT of the fault source
    :param sections:
        A list of :class:`openquake.hazardlib.source.multi_fault.FaultSection`
        instances. The cardinality of this list is N.
    :param rupture_idxs:
        A list of lists. Each element contains the IDs of the sections
        participating to a rupture. The cardinality of this list is N.
    :param occurrence_probs:
        A list with cardinality N with instances of the class
        :class:`openquake.hazardlib.pmf.PMF`. Each element specifies the
        occurrence of 0, 1 ... occurrences of a rupture in the investigation
        time.
    :param magnitudes:
        An iterable with cardinality N containing the magnitudes of the
        ruptures
    :param rakes:
        An iterable with cardinality N containing the rake of each
        rupture
    """

    code = b'X'
    MODIFICATIONS = {}

    def __init__(self, source_id: str, name: str, tectonic_region_type: str,<commit_msg>Cleanup<commit_after># The Hazard Library
# Copyright (C) 2012-2021 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
Module :mod:`openquake.hazardlib.source.multi_fault`
defines :class:`MultiFaultSource`.
"""

import numpy as np
from typing import Mapping
from openquake.hazardlib.geo.mesh import Mesh
from openquake.hazardlib.source.rupture import (
        NonParametricProbabilisticRupture)
from openquake.hazardlib.geo.surface.multi import MultiSurface
from openquake.hazardlib.source.base import BaseSeismicSource

F32 = np.float32


class FaultSection():
    """
    A class to define a fault section, that is the geometry definition of a
    portion of a fault.

    :param sec_id:
        A unique identifier
    :param surface:
        An instance of
        :class:`openquake.hazardlib.geo.surface.base.BaseSurface` which
        describes the 3D geometry of a part of a fault system.
    """

    def __init__(self, sec_id: str, surface):
        self.sec_id = sec_id
        self.surface = surface


class MultiFaultSource(BaseSeismicSource):
    """
    The multi-fault source is a source typology specifiically support the
    calculation of hazard using fault models with segments participating to
    multiple ruptures.

    :param source_id:
        A unique identifier for the source
    :param name:
        The name of the fault
    :param tectonic_region_type:
        A string that defines the TRT of the fault source
    :param sections:
        A list of :class:`openquake.hazardlib.source.multi_fault.FaultSection`
        instances. The cardinality of this list is N.
    :param rupture_idxs:
        A list of lists. Each element contains the IDs of the sections
        participating to a rupture. The cardinality of this list is N.
    :param occurrence_probs:
        A list with cardinality N with instances of the class
        :class:`openquake.hazardlib.pmf.PMF`. Each element specifies the
        occurrence of 0, 1 ... occurrences of a rupture in the investigation
        time.
    :param magnitudes:
        An iterable with cardinality N containing the magnitudes of the
        ruptures
    :param rakes:
        An iterable with cardinality N containing the rake of each
        rupture
    """

    code = b'F'
    MODIFICATIONS = {}

    def __init__(self, source_id: str, name: str, tectonic_region_type: str,
{'fraction_non_alphanumeric': 0.060656836461126004, 'fraction_numerical': 0.005361930294906166, 'mean_word_length': 3.165387299371947, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '920554', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1607, 'n_words': 697}