Giter VIP home page Giter VIP logo

Comments (2)

hchasestevens avatar hchasestevens commented on May 10, 2024

Hi @langston-barrett ,

Thanks for raising! bellybutton relies on the first characters of the expr being //, to know to parse the value as an XPath expression. I will not close this ticket, since you (rightly) point out the annoyance of not being able to use the standard YAML multi-line syntax, however, I think you should be able to instead do:

  filter_by:
    description: Use SQLAlchemy's filter_by for concision
    expr:
      //Call[ ./func/Attribute[ @attr='filter'
                                and ./value/Call[./func/Attribute[@attr='query']
                                and ./args[count(child::*) = 1]]
                              ]
             and ./args[count(child::*) = 1]
             and ./args/Compare[ ./ops/Eq
                                 and ./left/Attribute[ @attr != 'attributes'
                                                       and ./value/Name
                                                     ]
                               ]
            ]
    example: |
      session.query(Model).filter(Model.attr == baz)
    instead: |
      session.query(Model).filter_by(attr = baz)
    settings: *all_files

and have it work (or, at least, this is how I typically format my .bellybutton.yml files). Please let me know if this helps!

  • Chase

from bellybutton.

langston-barrett avatar langston-barrett commented on May 10, 2024

@hchasestevens Thanks for the quick reply! That works perfectly. Feel free to keep open if you feel like supporting YAML multi-line string syntax, but I'm satisfied as long as I can write the rules readably.

from bellybutton.

Related Issues (14)

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.