-
Notifications
You must be signed in to change notification settings - Fork 138
Alice is Here #1399
Alice is Here #1399
Conversation
b33bd92
to
46f4d1e
Compare
diff --git a/scripts/dump_discussion.py b/scripts/dump_discussion.py
index d93f68cef..33daba2f3 100644
--- a/scripts/dump_discussion.py
+++ b/scripts/dump_discussion.py
@@ -169,7 +169,25 @@ def output_markdown(
print(path, repr(text[:100] + "..."))
if not path.parent.is_dir():
path.parent.mkdir(parents=True)
- path.write_text(text)
+ if not comment_node["userContentEdits"]:
+ path.write_text(text)
+ else:
+ # TODO
+ # TODO
+ # TODO
+ # TODO
+ # TODO
+ # TODO(alice, 2022-06-22 Next step)
+ #
+ # Commit on every change to userCOntentEdits, else commit
+ # singlefile change
+ # TODO
+ # TODO
+ # TODO
+ # TODO
+ # TODO
+ # TODO
+ pass
replys = []
# Output a file for the reply
for j, reply_node in enumerate(comment_node["replies"]["nodes"]): |
TODO
diff --git a/dffml/overlay/overlay.py b/dffml/overlay/overlay.py
index 13a50d9c1..0900b7655 100644
--- a/dffml/overlay/overlay.py
+++ b/dffml/overlay/overlay.py
@@ -369,3 +369,117 @@ class Overlay(DataFlow, Entrypoint):
# type matching system context within that an open architecutre
# within that with a dataflow within that.
return results["overlayed"]
+
+
+# To suggest that an overlay be applied via DFFML_DEFAULT_INSTALLED_OVERLAYS:
+# For entrypoint registration
+# @overlay("alice.scripts.dump.discussion")
+# For class -> entrypoint registration
+# @overlay(alice.scripts.dump.discussion.AliceScriptsDumpDiscussion)
+
+# For files / Modules
+# @overlay("alice/scripts/dump/discussion.py")
+# @overlay(alice.scripts.dump.discussion)
+
+# Within entry_points.txt works the same as @overlay(pathlib.Path.write_text)
+# This says, when overlays.apply, apply this one (= right) to that (left =).
+#
+# [dffml.overlays]
+# pathlib.Path.write_text = alice.scripts.dump.discussion:write_text_git
+
+# @overlay("alice.please.contribute")
+
+import dffml.noasync
+
+import functools
+import inspect
+import contextlib
+
+
+# Everything is a system context.
+# For installed within python,
+# When we install overlays, we add them to the overlays to the overlay
+# property of the system context being overlayed. The default installed
+# overlay which applies default installed appliacable flows will be run
+# when overlays are being applied, aka the function will be run within a
+# dataflow / system context as an upstream with no overlays, if none are
+# installed (and it's within the scope of an overlays.apply or
+# with overlays.applied).
+
+
+class Overlays:
+ def apply(self, obj):
+ """
+ Decorator which says to activate any overlays
+ """
+ pass
+ # TODO Use unittest.mock.patch
+
+ @contextlib.contextmanager
+ def applied(self, obj):
+ """
+ Activate any overlays for use as context manager. Run ob
+ """
+ pass
+
+ def after(self, obj_having_overlays_applied_to_it):
+ if inspect.isfunction(obj_having_overlays_applied_to_it):
+ # TODO(alice) Extend to wrap more callables, reference the old dataset
+ # source wrapper code.
+ @functools.wraps(obj_having_overlays_applied_to_it)
+ def wrapper(overlay_to_apply):
+ # Grab signature and map args into kwargs of named paramters,
+ # then **kwargs expand
+ parameters = inspect.signature(
+ obj_having_overlays_applied_to_it
+ ).parameters
+ from pprint import pprint
+
+ print()
+ print(parameters.keys())
+ print()
+ print(list(zip(args, parameters.keys())))
+ print()
+ pprint(kwargs)
+ print()
+ pprint(kwargs)
+ print()
+ kwargs.update(zip(args, parameters.keys()))
+ print()
+ pprint(kwargs)
+ print()
+ return
+ obj_having_overlays_applied_to_it
+ for ctx, results in dffml.noasync.run(
+ dffml.DataFlow(
+ # Function we want to wrap currently requires type hints to make
+ # operation
+ obj_having_overlays_applied_to_it,
+ kwargs,
+ )
+ ):
+ return results
+
+ return wrapper
+ # TODO Implement overlay registration on dataflows / classes / files /
+ # system contexts / other. This can be done by checking if a system
+ # context's overlay value is set to something other than none. If it is set
+ # to OverlaySet and has InstalledOverlaySet then add to the inner set.
+ raise NotImplementedError(obj_having_overlays_applied_to_it)
+
+
+overlays = Overlays()
+
+
+# @overlays.past(pathlib.Path.write_text)
+# @overlays.present(pathlib.Path.write_text)
+# @overlays.future(pathlib.Path.write_text)
+
+# @overlays.before(pathlib.Path.write_text)
+# @overlays.during(pathlib.Path.write_text)
+
+overlay = overlays.during
+
+@overlays.after(pathlib.Path.write_text)
+def dump_discussion_root_path() -> RootPath:
+ return ROOT_PATH
diff --git a/scripts/dump_discussion.py b/scripts/dump_discussion.py
index 154fc0e5a..596f8d83d 100644
--- a/scripts/dump_discussion.py
+++ b/scripts/dump_discussion.py
@@ -130,129 +130,18 @@ def current_volume(text):
return text.split(": Volume")[1].split(":")[0]
-# To suggest that an overlay be applied via DFFML_DEFAULT_INSTALLED_OVERLAYS:
-# For entrypoint registration
-# @overlay("alice.scripts.dump.discussion")
-# For class -> entrypoint registration
-# @overlay(alice.scripts.dump.discussion.AliceScriptsDumpDiscussion)
-
-# For files / Modules
-# @overlay("alice/scripts/dump/discussion.py")
-# @overlay(alice.scripts.dump.discussion)
-
-# Within entry_points.txt works the same as @overlay(pathlib.Path.write_text)
-# This says, when overlays.apply, apply this one (= right) to that (left =).
-#
-# [dffml.overlays]
-# pathlib.Path.write_text = alice.scripts.dump.discussion:write_text_git
-
-# @overlay("alice.please.contribute")
-
-import dffml.noasync
-
-import functools
-import inspect
-import contextlib
-
-
-# Everything is a system context.
-# For installed within python,
-# When we install overlays, we add them to the overlays to the overlay
-# property of the system context being overlayed. The default installed
-# overlay which applies default installed appliacable flows will be run
-# when overlays are being applied, aka the function will be run within a
-# dataflow / system context as an upstream with no overlays, if none are
-# installed (and it's within the scope of an overlays.apply or
-# with overlays.applied).
-
-
-class Overlays:
- def apply(self, obj):
- """
- Decorator which says to activate any overlays
- """
- pass
- # TODO Use unittest.mock.patch
-
- @contextlib.contextmanager
- def applied(self, obj):
- """
- Activate any overlays for use as context manager. Run ob
- """
- pass
-
- def after(self, obj_having_overlays_applied_to_it):
- if inspect.isfunction(obj_having_overlays_applied_to_it):
- # TODO(alice) Extend to wrap more callables, reference the old dataset
- # source wrapper code.
- @functools.wraps(obj_having_overlays_applied_to_it)
- def wrapper(overlay_to_apply):
- # Grab signature and map args into kwargs of named paramters,
- # then **kwargs expand
- parameters = inspect.signature(
- obj_having_overlays_applied_to_it
- ).parameters
- from pprint import pprint
-
- print()
- print(parameters.keys())
- print()
- print(list(zip(args, parameters.keys())))
- print()
- pprint(kwargs)
- print()
- pprint(kwargs)
- print()
- kwargs.update(zip(args, parameters.keys()))
- print()
- pprint(kwargs)
- print()
- return
- obj_having_overlays_applied_to_it
- for ctx, results in dffml.noasync.run(
- dffml.DataFlow(
- # Function we want to wrap currently requires type hints to make
- # operation
- obj_having_overlays_applied_to_it,
- kwargs,
- )
- ):
- return results
-
- return wrapper
- # TODO Implement overlay registration on dataflows / classes / files /
- # system contexts / other. This can be done by checking if a system
- # context's overlay value is set to something other than none. If it is set
- # to OverlaySet and has InstalledOverlaySet then add to the inner set.
- raise NotImplementedError(obj_having_overlays_applied_to_it)
-
-
-overlays = Overlays()
-
-
-# @overlays.past(pathlib.Path.write_text)
-# @overlays.present(pathlib.Path.write_text)
-# @overlays.future(pathlib.Path.write_text)
-
-# @overlays.before(pathlib.Path.write_text)
-# @overlays.during(pathlib.Path.write_text)
-@overlays.after(pathlib.Path.write_text)
-def dump_discussion_root_path() -> RootPath:
- return ROOT_PATH
-
-
-@overlays.after(pathlib.Path.write_text)
-def commit_on_write(
- path: pathlib.Path, root_path: RootPath, # self when bound method
+def commit_file(
+ path: pathlib.Path
+ edited_at: str,
):
- relative_path = path.relative_to(root_path)
+ relative_path = path.relative_to(ROOT_PATH)
for cmd in [
["git", "add", str(relative_path),],
[
"git",
"commit",
"-sm",
- ": ".join(list(relative_path.parts) + [edit["editedAt"]]),
+ ": ".join(list(relative_path.parts) + [edited_at]),
],
]:
subprocess.check_call(cmd, cwd=root_path)
@@ -262,7 +151,6 @@ def commit_on_write(
# overlays.
# Could also do something like
# @overlays.apply_after(pathlib.Path.write_text, commit_on_write, dump_discussion_root_path)
-@overlays.apply(pathlib.Path.write_text)
def output_markdown(
graphql_query_output: dict, output_directory: pathlib.Path
):
@@ -293,6 +181,7 @@ def output_markdown(
if not edit["diff"]:
continue
path.write_text(edit["diff"].replace("\r", ""))
+ commit_file(path, edit["editedAt"])
path.write_text(text)
for i, comment_node in enumerate(
discussion_node["discussion"]["comments"]["nodes"], start=1
@@ -319,6 +208,7 @@ def output_markdown(
if not edit["diff"]:
continue
path.write_text(edit["diff"].replace("\r", ""))
+ commit_file(path, edit["editedAt"])
path.write_text(text)
replys = []
# Output a file for the reply
@@ -338,6 +228,7 @@ def output_markdown(
if not edit["diff"]:
continue
path.write_text(edit["diff"].replace("\r", ""))
+ commit_file(path, edit["editedAt"])
path.write_text(text)
|
Related: intel#1399 (comment) Signed-off-by: John Andersen <[email protected]>
ci: docs: Remove webui build |
alice: please: contribute: Successful creation of PR for readme |
alice: please: contribute: recommended community standards: overlay: github: pull request: Force push in case of existing branch |
1 similar comment
alice: please: contribute: recommended community standards: overlay: github: pull request: Force push in case of existing branch |
alice: please: contribute: recommended community standards: overlay: github: pull request: Force push in case of existing branch |
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
Signed-off-by: John Andersen <[email protected]>
1040380
to
00ddfb2
Compare
Merged as 7acbe1e |
Original Thread
π©βπ¨π¨βπ¨π¨
State of the Art: 00ddfb2
ADRs: https://github.com/intel/dffml/blob/00ddfb2ee64471309f754aa18dd14b5c33f8ff16/docs/arch/alice/discussion/0000/index.md