PyCharm asdf regex examples #479
CagtayFabry
started this conversation in
Show and tell
Replies: 1 comment
-
These might also come in handy when converting old weldx files or similar @vhirtham @marscher :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I will start listing some useful regex find/replace patterns for ASDF URIs that work in PyCharm here
For now see comments in #467
notes
(?:\d+.\d+.\d+)|(\*)|(\d+.\*)|(\d+.\d+.\*)
should map to valid version patterns like1.2.3
,*
,1.*
,1.2.*
. (Though I'm not sure if we should allow*
in our schemas)regex
legacy -> new
These pairs convert old style tags and schemas to the new URI pattern and keep the object name and version intact.
new -> legacy
If needed the following pairs can convert back to the old style namings
replace
!weldx!
tag handleBy default the tag prefix
!weldx!
will get set. When creating examples to put into asdf schema files this can be a bit unpractical because we cannot define the tag handle in that context. The following pattern builds the correct tag format from the handle.replace tag objects in examples
Here is an example updated all
timedelta
objects in the examples from anobject/taggedDict
tostring/taggedString
oneOf tag validators
For compatibility, single
tag
validations in schemas should be valid for both old and new styles so this pattern replaces single tag validators with aoneOf
structure (and hopefully the right indentation)replace
oneOf
with a single linehere is an example replacing two
oneOf
tag options with a single tag validator (preserving indentation)Beta Was this translation helpful? Give feedback.
All reactions