gritql icon indicating copy to clipboard operation
gritql copied to clipboard

Hanging commas after removing kwargs in Python

Open MartinBernstorff opened this issue 1 year ago • 6 comments
trafficstars

Continuing from Discord message.

`TaskMetadata($args)` where {
    $args <: any {
        contains `n_samples=$_` as $ns_kwarg where {
            $ns_kwarg <: `n_samples = $ns_val` => .
        },
        contains keyword_argument(name="avg_character_length") as $avg_kwarg where {
            $avg_kwarg <: `avg_character_length = $avg_val` => `stats=GeneralDescriptiveStats(n_samples=$ns_val, avg_character_length=$avg_val)`
        },
    },
}
from pydantic import BaseModel


class TaskMetadata(BaseModel):
    n_samples: dict[str, int]
    avg_character_length: dict[str, float]


if __name__ == "__main__":
    TaskMetadata(
        name="TbilisiCityHallBitextMining",
        dataset={
            "path": "jupyterjazz/tbilisi-city-hall-titles",
            "revision": "798bb599140565cca2dab8473035fa167e5ee602",
        },
        description="Parallel news titles from the Tbilisi City Hall website (https://tbilisi.gov.ge/).",
        type="BitextMining",
        category="s2s",
        eval_splits=[_EVAL_SPLIT],
        eval_langs=_EVAL_LANGS,
        main_score="f1",
        domains=["News"],
        text_creation="created",
        n_samples={_EVAL_SPLIT: 1820},
        reference="https://huggingface.co/datasets/jupyterjazz/tbilisi-city-hall-titles",
        date=("2024-05-02", "2024-05-03"),
        form=["written"],
        task_subtypes=[],
        license="Not specified",
        socioeconomic_status="mixed",
        annotations_creators="derived",
        dialect=[],
        bibtex_citation="",
        avg_character_length={_EVAL_SPLIT: 78},
    )

Morgante suggested it might be a bug somewhere around here.

Results in a dangling comma: image copy

MartinBernstorff avatar Jul 11 '24 18:07 MartinBernstorff

Thanks a ton for the work you do! The DSL is super interesting, albeit/because it is a challenge to wrap my head around. Love it being open source!

MartinBernstorff avatar Jul 11 '24 18:07 MartinBernstorff

Thanks a ton for the work you do! The DSL is super interesting, albeit/because it is a challenge to wrap my head around. Love it being open source!

Thank you! Please also do provide feedback on areas we could improve the documentation for.

For this issue, the fix will involve our comma algorithm. Happy to accept a PR if someone fixes this case.

morgante avatar Jul 11 '24 19:07 morgante

/bounty $50

morgante avatar Jul 11 '24 19:07 morgante

💎 $50 bounty • Grit

Steps to solve:

  1. Start working: Comment /attempt #416 with your implementation plan
  2. Submit work: Create a pull request including /claim #416 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to getgrit/gritql!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @abhishek818 Jul 13, 2024, 9:04:54 AM #418
🟢 @Alex-ley-scrub Oct 26, 2024, 10:30:58 PM #566

algora-pbc[bot] avatar Jul 11 '24 19:07 algora-pbc[bot]

💡 @abhishek818 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Jul 13 '24 08:07 algora-pbc[bot]

/attempt #416

Algora profile Completed bounties Tech Active attempts Options
@abhishek818 13 bounties from 6 projects
JavaScript, TypeScript
Cancel attempt

abhishek818 avatar Jul 13 '24 09:07 abhishek818

/attempt #416

Algora profile Completed bounties Tech Active attempts Options
@Alex-ley-scrub 3 grit bounties
Rust
Cancel attempt

Alex-ley-scrub avatar Oct 26 '24 22:10 Alex-ley-scrub

💡 @Alex-ley-scrub submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Oct 26 '24 22:10 algora-pbc[bot]

🎉🎈 @Alex-ley-scrub has been awarded $50! 🎈🎊

algora-pbc[bot] avatar Oct 26 '24 22:10 algora-pbc[bot]