Code Monkey home page Code Monkey logo

Comments (12)

eerimoq avatar eerimoq commented on July 29, 2024

Sorry, but transforming one dictionary to another is out of scope of this project.

from asn1tools.

ashwin2701 avatar ashwin2701 commented on July 29, 2024

So for encoding or decoding we have to pass some integer or string value to dictionaries which we create right,how it is done

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

You have to be more specific. It's impossible to understand what you want to achieve.

from asn1tools.

ashwin2701 avatar ashwin2701 commented on July 29, 2024

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

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

See https://github.com/eerimoq/asn1tools#scripting

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

I still don't understand what you want to achieve, sorry.

from asn1tools.

ashwin2701 avatar ashwin2701 commented on July 29, 2024

How can we assign values to the members of the dictionary which your module is creating.

from asn1tools.

ashwin2701 avatar ashwin2701 commented on July 29, 2024

Can the value for the members be assigned through the program itself.

from asn1tools.

ashwin2701 avatar ashwin2701 commented on July 29, 2024

import asn1tools
foo = asn1tools.compile_files('tests/files/foo.asn')
encoded = foo.encode('Question', {'id': 1, 'question': 'Is 1+1=3?'})
encoded
bytearray(b'0\x0e\x02\x01\x01\x16\x09Is 1+1=3?')
foo.decode('Question', encoded)
{'id': 1, 'question': 'Is 1+1=3?'}

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')

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

No, there is no support in asn1tools for using the dictionary created by parse_files() to generate dictionaries with data to encode with foo.encode(). Why do you need that?

from asn1tools.

ashwin2701 avatar ashwin2701 commented on July 29, 2024

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.

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

Ok, as that functionality is not supported I suggest closing this issue.

from asn1tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.