-
Notifications
You must be signed in to change notification settings - Fork 0
chore: implement golang generation options and JSON serialization runtime #2
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
Conversation
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.
Can you explain what is in exported_flat
?
} | ||
|
||
RESERVED_WORDS = { | ||
"package" |
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.
Why is "package" dealt with separately?
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.
it's a reserved word in go
, no matter what, we can't output a lowercase name of package
|
||
|
||
def gofmt(code): | ||
try: | ||
proc = subprocess.Popen(["gofmt"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, text=True) |
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.
You could just use subprocess.run(["gofmt"], capture_output=true)
. It's thread safe.
These were left over from a previous implementation and are not needed
If a (concrete) object had a required property that was an abstract class, it would not be able to be initialized because the abstract class could not be created on initialization. To fix this, rework the way abstract detection is done, and make ObjectProp() initialize the property to None if the class is abstract
Fixes a bug where ObjectSet.foreach_type() would not iterate over objects that were derived from an abstract type.
Optimizes the way properties are looked up in the generated python code: 1. Directly access "_obj_" properties using self.__dict__. This allow the expensive(*) startswith() to be removed from __getattr__() and __setattr__() 2. Move the property lookup first in __getattr__(). This is the most common operation, so have it occur first can help will lookup speed 3. Intern the python name and IRI of all properties * startswith() is expensive because it can't be interned
If a named individual is shortened by the context, it may not be a valid IRI. Add explicit matches for all of the context-renamed named individuals that could be used in place of an object. Note that only context manipulated named individuals need to be checked, since full IRI name individuals are the same as any other IRI reference.
If a named individual is shortened by the context it need to be correctly mapped when encoding and decoding
Extensible abstract classes are a little strange, but it basically means that the type of the class can be anything _except_ the specific extensible parent type. Implement this in python and jsonschema
SHACL validation of the roundtip file wasn't actually occurring because the JSON-LD context file was incorrect. Fix many bugs discovered when making the SHACL model validate and also add a test to validate that the context is correct
The way that contexts were dealt with was incorrect in a lot of ways, particularly when dealing with global named individuals. Correct all of these problems and add better test cases for context expansion and compaction. The new test suite uses `jsonld-cli` from `npm` to validate the expansion and compaction, which is the same code used by the official JSON-LD documentation in the JSON-LD playground. This makes it so that named individuals can be correctly handled, as long as the property that needs to reference them is `"@type": "@vocab"` in the context.
The upstream for this module appears dead, and it is broken with the latest version of python due to [1], so remove it and implement the functionality locally [1]: man-group/pytest-plugins#224
Co-authored-by: Nisha Kumar <nisha.kumar@oracle.com> Signed-off-by: Keith Zantow <kzantow@gmail.com>
f6872db
to
8c53ed7
Compare
As discussed, I opened a new PR for this since I will have to iterate on it, it makes more sense not to have a requirement for you to continually merge my changes: JPEWdev#21 |
This PR cleans up the code a bit and the generated code is close to proper go format.