Git Product home page Git Product logo

Comments (2)

snake-biscuits avatar snake-biscuits commented on July 3, 2024

Oops, looks like the parser does already cover this

if key not in ent:
ent[key] = value
else: # don't override duplicate keys, share a list instead
# generally duplicate keys are ouputs
if isinstance(ent[key], list): # more than 2 of this key
ent[key].append(value)
else: # second occurance of key
ent[key] = [ent[key], value]

We still need to test for this case and make sure the list conversion behaviour is well documented
Not to mention reversing into string data

Updating the parser would still be nice to allow for using any object as a value (so long as it has an appropriate __repr__ method)

And we still need to explicitly test for this to make sure we don't assume it's a major bug!

from bsp_tool.

snake-biscuits avatar snake-biscuits commented on July 3, 2024

A rewrite would be quite costly and means we lose a lot of the benefits of using a dict (e.g. easy searches), an alternate Entity class more compatible with pySourceSDK would definitely be nice

the behaviour around lists and clear warnings about unexpected types should certainly be looked into, but for now the current entity system doesnโ€™t need a huge overhaul

from bsp_tool.

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.