Giter Site home page Giter Site logo

Comments (2)

niknetniko avatar niknetniko commented on June 22, 2024

An alternative is using YAML anchors and merge keys:

- unit: 'Sum of three cubes'
  definitions:
    sum_of_three: &sum_of_three
      oracle: 'custom_check'
      language: 'python'
      name: 'sum_of_three_cubes'
      file: 'oracle.py'
  testcases:
    - stdin: '3'
      stdout:
        <<: *sum_of_three
        data: |
          1
          1
          1
    - stdin: '33'
      stdout: |
        8866128975287528
        -8778405442862239
        -2736111468807040
    - stdin: '42'
    - stdout:
        <<: *sum_of_three
        data: |
          -80538738812075974
          80435758145817515
          12602123297335631

I think this has some advantages:

  • It is very explicit that the oracle config comes from something else.
  • It is opt-in for all cases (no implicit inheritance)
  • It is very flexible

As a disadvantage:

  • It is more verbose, as you need to specify it everywhere.

This requires minimal changes to our JSON Schema, and no changes to our implementation, as this happens in the YAML parser.

from universal-judge.

niknetniko avatar niknetniko commented on June 22, 2024

If we should decide to use this (I am in favour), I would propose to also remove the existing configuration inheritance mechanism and always use YAML merge tags.

Another disavantage is that YAML merge tags are technically not part of YAML 1.2 or later, only 1.1 (but our Python YAML parser only supports 1.1, so I'm not sure it is a big disadvantage: this construct is used in the wild, so it won't disappear quickly).

from universal-judge.

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.