Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
alice: cli: please: contribute: recommended community standards: read…
Browse files Browse the repository at this point in the history
…me: Reuse rctx and overlay git

Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny committed Jul 28, 2022
1 parent b405cfc commit 4ee87b4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,26 +207,30 @@ class OverlayREADME:
ReadmePRBody = NewType("github.pr.body", str)

# async def cli_run_on_repo(self, repo: "CLIRunOnRepo"):
async def alice_contribute_readme(
self, repo: AliceGitRepo
) -> ReadmeGitRepo:
async def alice_contribute_readme(self, repo: AliceGitRepo) -> ReadmeGitRepo:
# TODO Clean this up once SystemContext refactor complete
overlay_readme_dataflow = dffml.DataFlow(
readme_dataflow_cls_upstream = OverlayREADME
readme_dataflow_cls_overlays = dffml.Overlay.load(
entrypoint="dffml.overlays.alice.please.contribute.recommended_community_standards.overlay.readme"
)
readme_dataflow_upstream = dffml.DataFlow(
*dffml.object_to_operations(readme_dataflow_cls_upstream)
)
# auto_flow with overlays
readme_dataflow = dffml.DataFlow(
*itertools.chain(
*[
dffml.object_to_operations(cls)
for cls in [
OverlayREADME,
*dffml.Overlay.load(
entrypoint="dffml.overlays.alice.please.contribute.recommended_community_standards.overlay.readme"
),
readme_dataflow_cls_upstream,
*readme_dataflow_cls_overlays,
]
]
)
)
async with dffml.run_dataflow.imp(
# dataflow=self.octx.config.dataflow,
dataflow=overlay_readme_dataflow,
dataflow=readme_dataflow,
input_set_context_cls=AliceGitRepoInputSetContext,
) as custom_run_dataflow:
# Copy all inputs from parent context into child. We eventually
Expand All @@ -236,14 +240,16 @@ async def alice_contribute_readme(
self.ctx, self.octx
) as custom_run_dataflow_ctx:
async with self.octx.ictx.definitions(self.ctx) as definitions:
# Only add / forward inputs to this flow (the base flow,
# _upstream in this case)
custom_run_dataflow.config.dataflow.seed = (
custom_run_dataflow.config.dataflow.seed
+ [
item
async for item in definitions.inputs()
if (
item.definition
in custom_run_dataflow.config.dataflow.definitions.values()
in readme_dataflow_upstream.definitions.values()
and item.definition
not in self.parent.op.inputs.values()
)
Expand All @@ -258,6 +264,7 @@ async def alice_contribute_readme(
inputs={input_key: definition},
outputs={},
)
# TODO Optionally support forward subflow
await dffml.run_dataflow.run_custom(
custom_run_dataflow_ctx,
{
Expand Down
3 changes: 3 additions & 0 deletions entities/alice/entry_points.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ OverlayGit = alice.please.contribute.recomme
OverlayGitHub = alice.please.contribute.recommended_community_standards.recommended_community_standards:OverlayGitHub
OverlayREADME = alice.please.contribute.recommended_community_standards.recommended_community_standards:OverlayREADME
OverlayMetaIssue = alice.please.contribute.recommended_community_standards.recommended_community_standards:OverlayMetaIssue

[dffml.overlays.alice.please.contribute.recommended_community_standards.overlay.readme]
OverlayGit = alice.please.contribute.recommended_community_standards.recommended_community_standards:OverlayGit

0 comments on commit 4ee87b4

Please sign in to comment.