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

fix(compatability): match-case syntax only compatible with Python3.10 #2096

Open
PantherHawk opened this issue May 2, 2024 · 4 comments
Open

Comments

@PantherHawk
Copy link

PantherHawk commented May 2, 2024

what's the problem
Match case syntax is not compatible with earlier Python versions.

match model_provider:
case "hf":
hf = HuggingFace()
hf.load_config(model_provider_parameters)
hf.download_model_and_tokenizer()
case _:
return "This is the default case"
def dataset_factory(dataset_provider, dataset_provider_parameters):
match dataset_provider:
case "s3":
s3 = S3()
s3.load_config(dataset_provider_parameters)
s3.download_dataset()
case "hf":
hf = HuggingFaceDataset()
hf.load_config(dataset_provider_parameters)
hf.download_dataset()
case _:
return "This is the default case"

what's the fix?
Use if-else instead.

@tenzen-y
Copy link
Member

tenzen-y commented May 7, 2024

Thank you for reporting this!

That makes sense. We should replace the match with if-else, and then we should cherry-pick it to the latest release-branch.

@tenzen-y
Copy link
Member

tenzen-y commented May 7, 2024

cc: @andreyvelich @johnugeorge

@tenzen-y
Copy link
Member

tenzen-y commented May 7, 2024

It seems that PR already has been created: #2099

@akhilsaivenkata
Copy link
Contributor

Hi @tenzen-y , I think the contributor of PR #2099 has been inactive for 2 weeks. Will it be fine If I take this up and create a new PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants