Skip to content

Commit

Permalink
Add packages, including namespace package antares
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Leclerc <[email protected]>
  • Loading branch information
sylvlecl committed Jul 28, 2024
1 parent dcc8da0 commit 03912d3
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 133 deletions.
2 changes: 2 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ mypy_path = src
files = src
disallow_untyped_defs = true
disallow_untyped_calls = true
namespace_packages = true
explicit_package_bases = true
Empty file added src/antares/tsgen/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np

from ts_generator import ProbabilityLaw, ThermalCluster
from .ts_generator import ProbabilityLaw, ThermalCluster


def import_thermal_cluster(path: Path, days_per_year: int = 365) -> ThermalCluster:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import pandas as pd

from cluster_parsing import InputCluster
from ts_generator import ProbabilityLaw, ThermalCluster
from .cluster_parsing import InputCluster
from .ts_generator import ProbabilityLaw, ThermalCluster


def resolve_thermal_cluster(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import numpy as np

from random_generator import RNG
from .random_generator import RNG


class ProbabilityLaw(Enum):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from abc import ABC, abstractmethod
from typing import Optional

from mersenne_twister import MersenneTwister
from .mersenne_twister import MersenneTwister


class RNG(ABC):
Expand Down
6 changes: 3 additions & 3 deletions src/ts_generator.py → src/antares/tsgen/ts_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from typing import List

import numpy as np
import pandas as pd
import numpy.typing as npt

from duration_generator import ProbabilityLaw, make_duration_generator
from random_generator import RNG, MersenneTwisterRNG
from antares.tsgen.duration_generator import ProbabilityLaw, make_duration_generator
from antares.tsgen.random_generator import RNG, MersenneTwisterRNG

# probabilities above FAILURE_RATE_EQ_1 are considered certain (equal to 1)
FAILURE_RATE_EQ_1 = 0.999
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import pytest

from random_generator import RNG, MersenneTwisterRNG
from antares.tsgen.random_generator import RNG, MersenneTwisterRNG


@pytest.fixture
Expand Down
Binary file modified tests/output/geometric_law_distrib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
204 changes: 102 additions & 102 deletions tests/output/test_100_unit_cluster.csv

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions tests/output/test_one_unit_cluster.csv

Large diffs are not rendered by default.

Binary file modified tests/output/uniform_law_distrib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
# This file is part of the Antares project.

import csv
from pathlib import Path

import pytest

from cluster_import import import_thermal_cluster
from ts_generator import ThermalCluster, ThermalDataGenerator
from antares.tsgen.cluster_import import import_thermal_cluster
from antares.tsgen.ts_generator import ThermalCluster, ThermalDataGenerator


@pytest.fixture
Expand Down
5 changes: 2 additions & 3 deletions tests/test_duration_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of the Antares project.
from unittest import expectedFailure

import matplotlib.pyplot as plt
import pytest

from duration_generator import (
from antares.tsgen.duration_generator import (
GeometricDurationGenerator,
ProbabilityLaw,
UniformDurationGenerator,
make_duration_generator,
)
from random_generator import MersenneTwisterRNG
from antares.tsgen.random_generator import MersenneTwisterRNG


@pytest.mark.parametrize(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import pytest

from cluster_parsing import parse_cluster_ts, parse_yaml_cluster
from cluster_resolve import resolve_thermal_cluster
from ts_generator import ProbabilityLaw, ThermalCluster, ThermalDataGenerator
from antares.tsgen.cluster_parsing import parse_cluster_ts, parse_yaml_cluster
from antares.tsgen.cluster_resolve import resolve_thermal_cluster
from antares.tsgen.ts_generator import ProbabilityLaw, ThermalCluster

NB_OF_DAY = 10

Expand Down
2 changes: 1 addition & 1 deletion tests/test_random_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# This file is part of the Antares project.
import random

from random_generator import MersenneTwisterRNG, PythonRNG
from antares.tsgen.random_generator import MersenneTwisterRNG, PythonRNG


def test_python_rng():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ts_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import pytest

from cluster_import import import_thermal_cluster
from ts_generator import ThermalCluster, ThermalDataGenerator
from antares.tsgen.cluster_import import import_thermal_cluster
from antares.tsgen.ts_generator import ThermalCluster, ThermalDataGenerator


@pytest.fixture
Expand Down
9 changes: 5 additions & 4 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of the Antares project.
import cProfile
import random
from pstats import SortKey

import numpy as np
import numpy.testing as npt

from ts_generator import ProbabilityLaw, ThermalCluster, ThermalDataGenerator
from antares.tsgen.ts_generator import (
ProbabilityLaw,
ThermalCluster,
ThermalDataGenerator,
)


def test_forced_outages(rng):
Expand Down

0 comments on commit 03912d3

Please sign in to comment.