-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draft: sketched out SO interface CI workflow. #798
base: main
Are you sure you want to change the base?
Conversation
I just sketched out how this could work, but this could be a project for Andy. |
} | ||
freeze = {} | ||
|
||
with open('tests/ci/frozen_functions.py', 'r') as fh: #opens file "fname", in read mode 'r', to be used in code as "fh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is going to be stored in this file? Is it a pseudo-python representation of the objects/methods structure that define the interface?
return True | ||
|
||
if __name__ == "__main__": #if this is the main thing being run | ||
for fname, spec in interface.items(): #loop over file names "fname" as keys and "spec" as values in dictionary called "interface" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently interface
is not defined
for meth in spec[key]: #iterating over methods specified in spec[key] | ||
assert meth in tree[key] | ||
assert _compare_args(spec[key][meth], tree[key][meth]) | ||
notfound = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines don't need to be in the context manager
notfound = [] | ||
found = {} | ||
dump = ast.dump(tree) | ||
for node in ast.walk(tree): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the first layer in the tree is usually going to be made up of ClassDef
objects (though not always), which in turn contain FunctionDef
's. The original sketch had a check for this.
@@ -104,49 +130,50 @@ | |||
for node in ast.walk(frozen): | |||
if isinstance(node, ast.FunctionDef) and node.name in spec_args.keys(): | |||
freeze.update({node.name: node}) | |||
print("FROZEN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of these print checks I put along the way to debug, and visualize the flow of my code. I haven't deleted them yet because I wanted to keep them in here to remember good places/dictionaries and lists to check in my code for future debugging. A final version of this code will definitely have these removed.
Description
Draft of github CI workflow to enforce compliance with the SO interface document here.
This is just a sketch and the code needs to be fleshed out, tested and documented.