Skip to content

Commit 90fcdab

Browse files
committed
Merge remote-tracking branch 'origin/main' into modifying_databundle_and_associates
2 parents 986f10b + 062e6ae commit 90fcdab

19 files changed

+283
-186
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503, F403, F401, F405
3+
max-line-length = 120
4+
max-complexity = 18
5+
select = C,E,F,W,B,B950

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ repos:
2222
rev: 6.0.0
2323
hooks:
2424
- id: flake8
25+
args: [--config=.flake8]

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,5 @@
8585
+ r".*",
8686
# attempted fix of '406 Client Error: Not Acceptable for url'
8787
# https://github.com/sphinx-doc/sphinx/issues/1331
88-
join(project_meta["project"]["urls"]["repository"], "commit", r"[0-9a-fA-F]+")
88+
join(project_meta["project"]["urls"]["repository"], "commit", r"[0-9a-fA-F]+"),
8989
]

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
attrs
2-
dask
32
entrypoints
43
matplotlib
54
numpy
@@ -8,6 +7,6 @@ h5py
87
pint
98
pytest
109
stamina
11-
tiled
1210
tox
1311
scipy
12+
uncertainties

src/modacor/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# -*- coding: utf-8 -*-
22
# __init__.py
33

4-
__version__ = '0.0.0'
4+
__version__ = "0.0.0"
55

66
from pint import UnitRegistry, set_application_registry
7-
ureg = UnitRegistry(system='SI')
7+
8+
ureg = UnitRegistry(system="SI")
89
Q_ = ureg.Quantity
9-
# recommended for pickling and unpickling:
10+
# recommended for pickling and unpickling:
1011
set_application_registry(ureg)
1112
ureg.formatter.default_format = "~P"
1213
ureg.setup_matplotlib(True)

src/modacor/dataclasses/messagehandler.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# # -*- coding: utf-8 -*-
33

44
import logging
5+
56
logger = logging.getLogger(__name__)
67

78

@@ -13,7 +14,8 @@ class MessageHandler:
1314
Args:
1415
level (int): The logging level to use. Defaults to logging.INFO.
1516
"""
16-
def __init__(self, level: int = logging.INFO, name: str = 'MoDaCor', **kwargs):
17+
18+
def __init__(self, level: int = logging.INFO, name: str = "MoDaCor", **kwargs):
1719
self.level = level
1820
self.name = name
1921

@@ -23,7 +25,7 @@ def __init__(self, level: int = logging.INFO, name: str = 'MoDaCor', **kwargs):
2325
self.consoleLogHandler = logging.StreamHandler()
2426
self.consoleLogHandler.setLevel(level)
2527

26-
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
28+
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
2729
self.consoleLogHandler.setFormatter(formatter)
2830
self.logger.addHandler(self.consoleLogHandler)
2931

@@ -33,20 +35,20 @@ def log(self, message: str, level: int = None, name: str = None):
3335

3436
if name is None:
3537
name = self.name
36-
38+
3739
self.logger(message, level=level, name=name)
3840

3941
def info(self, message: str):
40-
self.log(message, level=logging.INFO, name='MoDaCor')
42+
self.log(message, level=logging.INFO, name="MoDaCor")
4143

4244
def warning(self, message: str):
43-
self.log(message, level=logging.WARNING, name='MoDaCor')
45+
self.log(message, level=logging.WARNING, name="MoDaCor")
4446

4547
def error(self, message: str):
46-
self.log(message, level=logging.ERROR, name='MoDaCor')
48+
self.log(message, level=logging.ERROR, name="MoDaCor")
4749

4850
def critical(self, message: str):
49-
self.log(message, level=logging.CRITICAL, name='MoDaCor')
50-
51+
self.log(message, level=logging.CRITICAL, name="MoDaCor")
52+
5153
def debug(self, message: str):
52-
self.log(message, level=logging.DEBUG, name='MoDaCor')
54+
self.log(message, level=logging.DEBUG, name="MoDaCor")

src/modacor/dataclasses/pipelinedata.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/modacor/dataclasses/process_step.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
__all__ = ["ProcessStep"]
55
__license__ = "BSD-3-Clause"
6+
__version__ = "0.0.1"
67

78

89
from abc import abstractmethod
910
from numbers import Integral
11+
from pathlib import Path
1012
from typing import Any
1113

1214
from attrs import define, field
@@ -26,7 +28,12 @@ class ProcessStep:
2628
io_sources: IoSources = field()
2729

2830
# class attribute for a machine-readable description of the process step
29-
documentation: ProcessStepDescriber
31+
documentation = ProcessStepDescriber(
32+
calling_name="Generic Process step",
33+
calling_id=None,
34+
calling_module_path=Path(__file__),
35+
calling_version=__version__,
36+
)
3037

3138
# dynamic instance configuration
3239
configuration: dict = field(factory=dict, validator=v.instance_of(dict))
@@ -45,9 +52,8 @@ class ProcessStep:
4552
default=MessageHandler(), validator=v.instance_of(MessageHandler)
4653
)
4754

48-
# a list of data keys that are modified by this process
49-
def __attrs_post_init__(self):
50-
self.__prepared = False
55+
# internal variables:
56+
__prepared: bool = field(default=False, validator=v.instance_of(bool))
5157

5258
def prepare_execution(self):
5359
"""
@@ -94,5 +100,5 @@ def modify_config(self, key: str, value: Any):
94100
if key in self.configuration:
95101
self.configuration[key] = value
96102
else:
97-
raise KeyError(f"Key {key} not found in configuration")
103+
raise KeyError(f"Key {key} not found in configuration") # noqa
98104
self.__prepared = False

src/modacor/dataclasses/validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from numbers import Integral
6-
from typing import Any
6+
from typing import Any, Type
77

88
import pint
99

@@ -19,7 +19,7 @@
1919
]
2020

2121

22-
def is_list_of_ints(value: Any):
22+
def is_list_of_ints(instance: Type, attribute: str, value: Any):
2323
"""
2424
Check if the value is a list of integers.
2525
"""

src/modacor/io/hdf/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,3 @@
2525
__license__ = "BSD-3-Clause"
2626
__copyright__ = "Copyright 2025 MoDaCor Authors"
2727
__status__ = "Alpha"
28-
29-
30-
from ..io_source import IoSource
31-
from ..io_sources import IoSources

0 commit comments

Comments
 (0)