Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanging commas after removing kwargs in Python #416

Open
MartinBernstorff opened this issue Jul 11, 2024 · 6 comments · May be fixed by #418
Open

Hanging commas after removing kwargs in Python #416

MartinBernstorff opened this issue Jul 11, 2024 · 6 comments · May be fixed by #418

Comments

@MartinBernstorff
Copy link

MartinBernstorff commented Jul 11, 2024

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
Copy link
Author

MartinBernstorff commented Jul 11, 2024

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!

@morgante
Copy link
Contributor

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
Copy link
Contributor

/bounty $50

Copy link

algora-pbc bot commented Jul 11, 2024

💎 $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
🟢 @varshith257 #417

abhishek818 added a commit to abhishek818/gritql that referenced this issue Jul 13, 2024
@abhishek818 abhishek818 linked a pull request Jul 13, 2024 that will close this issue
Copy link

algora-pbc bot commented Jul 13, 2024

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

@abhishek818
Copy link
Contributor

abhishek818 commented Jul 13, 2024

/attempt #416

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

abhishek818 added a commit to abhishek818/gritql that referenced this issue Jul 13, 2024
Signed-off-by: Abhishek Kumar Gupta <[email protected]>
abhishek818 added a commit to abhishek818/gritql that referenced this issue Jul 15, 2024
abhishek818 added a commit to abhishek818/gritql that referenced this issue Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants