-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
How to use parse_files for filling the values of the keys in the dictionary #29
Comments
Sorry, but transforming one dictionary to another is out of scope of this project. |
So for encoding or decoding we have to pass some integer or string value to dictionaries which we create right,how it is done |
You have to be more specific. It's impossible to understand what you want to achieve. |
Parse_files function will create a dictionary which will have members ,and type of members may be string or integer etc ,Now with respect to my understanding for encoding or decoding to happen we give the members with value such as 1,2 etc which is integer datatype,So my question was that is there way to give values to the members |
I still don't understand what you want to achieve, sorry. |
How can we assign values to the members of the dictionary which your module is creating. |
Can the value for the members be assigned through the program itself. |
Now it looks OK since there are only two members inside Question schema but consider a scenario where i need to assign value for member3 with value 4 which is under schema of schema of schema.Then to encode you need to do something like this encoded = foo.encode('Random', {'member1': {member2:{member3:4}}}) Is there a way where you give value for member3=4 and it itself creates the dictionary of dictionaries format for encoding based on hierarchy got from asn1tools.parse_files('tests/files/foo.asn') |
No, there is no support in asn1tools for using the dictionary created by |
Ok currently I have to handle schema whose members may be again schemas which might extrend upto n levels,Now my task is to create a dictionary of dictionaries for any schema,and value for its members i will fill through an excel sheet, and then later use that dictionary for encoding .I was confused whether I can utilize your asn1tools.parse_files('tests/files/foo.asn') which is returning a dictionary showing the hierarchy of parent dictionary and its child members, and then utilize that hierarchy to fill the values to create the dictionary needed for encoding. |
Ok, as that functionality is not supported I suggest closing this issue. |
My requirement is to create a dictionary based on the asn file and then fill the key's value using an excel sheet, and then later encode/decode .Currently I'm manually creating the desired output and filling its values from the excel sheet, Now for the below schema, Is the Parsed output and desired output both same?if both are same how do we fill values for the keys inside a dictionary? If not how to make the parser output equivalent to desired output?Any recommendations would be highly helpful.
Module-order DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
Order ::= SEQUENCE {
header Order-header
}
Order-header ::= SEQUENCE {
reference NumericString (SIZE (12)),
date NumericString (SIZE (8)) -- MMDDYYYY --
}END
Parser Output
{'Module-order': {'extensibility-implied': False, 'tags': 'AUTOMATIC', 'imports': {}, 'object-sets': {}, 'values': {}, 'object-classes': {}, 'types': {'Order': {'type': 'SEQUENCE', 'members': [{'type': 'Order-header', 'name': 'header'}]}, 'Order-header': {'type': 'SEQUENCE', 'members': [{'type': 'NumericString', 'name': 'reference', 'size': [12]}, {'type': 'NumericString', 'name': 'date', 'size': [8]}]}}}}
{header:{reference:NumericString (SIZE (12)),date NumericString (SIZE (8)) -- MMDDYYYY --}}
Desired Output
{'header':{'reference': NumericString,'date':NumericString}}
The text was updated successfully, but these errors were encountered: