Skip to content

Commit

Permalink
Drop ampel-core dependency (#83)
Browse files Browse the repository at this point in the history
* Drop dependency on ampel-core

* Bump version to 0.10.1a0

* ci: don't need mongo

* ci: renovate with poetry
  • Loading branch information
jvansanten authored Dec 5, 2024
1 parent c41cf16 commit 8c94957
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 633 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jobs:
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
mongo: true
mongo: false
lint: true
# renovate: datasource=conda depName=conda-forge/python
python-version: "3.13.1"
# renovate: datasource=pypi depName=poetry versioning=pep440
poetry-version: "1.8.4"
# renovate: datasource=pypi depName=ruff
ruff-version: "0.8.1"
20 changes: 17 additions & 3 deletions ampel/t1/T1PhotoRetroCombiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
# Last Modified Date: 25.05.2021
# Last Modified By: valery brinnel <[email protected]>

from collections.abc import Generator
from collections.abc import Generator, Iterable

from ampel.abstract.AbsT1RetroCombineUnit import AbsT1RetroCombineUnit
from ampel.content.DataPoint import DataPoint
from ampel.t1.T1SimpleRetroCombiner import T1SimpleRetroCombiner
from ampel.struct.T1CombineResult import T1CombineResult
from ampel.types import DataPointId


class T1PhotoRetroCombiner(T1SimpleRetroCombiner):
class T1PhotoRetroCombiner(AbsT1RetroCombineUnit):
"""
combine(
[
Expand All @@ -29,6 +30,19 @@ class T1PhotoRetroCombiner(T1SimpleRetroCombiner):
]
"""

def combine(self, datapoints: Iterable[DataPoint]) -> list[T1CombineResult]:
"""
:param datapoints: dict instances representing datapoints
"""

chan = self.channel
dps = [
dp for dp in datapoints
if not("excl" in dp and chan in dp['excl'])
]

return [T1CombineResult(dps=el) for el in reversed(list(self.generate_retro_sequences(dps)))]

def generate_retro_sequences(self, datapoints: list[DataPoint]) -> Generator[list[DataPointId], None, None]:
while datapoints:
yield [dp["id"] for dp in datapoints]
Expand Down
Loading

0 comments on commit 8c94957

Please sign in to comment.