Skip to content

Hermanzdosilovic/kwargs #5

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

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add kwargs in sync_execute and async_execute
  • Loading branch information
hermanzdosilovic committed Nov 11, 2024
commit b2ba9dac8e16a1ac7b117125c078b1cafb48d14a
3 changes: 3 additions & 0 deletions examples/0004_hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import judge0
result = judge0.run(source_code="print('Hello Judge0')")
print(result.stdout)
20 changes: 20 additions & 0 deletions src/judge0/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ def async_execute(
*,
client: Optional[Union[Client, Flavor]] = None,
submissions: Optional[Union[Submission, list[Submission]]] = None,
source_code: Optional[str] = None,
**kwargs,
) -> Union[Submission, list[Submission]]:
if submissions is not None and source_code is not None:
raise ValueError(
"source_code argument cannot be provided if submissions argument is provided."
)

if source_code is not None:
submissions = Submission(source_code=source_code, **kwargs)

# Check the edge cases if client is not provided.
if client is None:
if submissions is None:
Expand All @@ -119,7 +129,17 @@ def sync_execute(
*,
client: Optional[Union[Client, Flavor]] = None,
submissions: Optional[Union[Submission, list[Submission]]] = None,
source_code: Optional[str] = None,
**kwargs,
) -> Union[Submission, list[Submission]]:
if submissions is not None and source_code is not None:
raise ValueError(
"source_code argument cannot be provided if submissions argument is provided."
)

if source_code is not None:
submissions = Submission(source_code=source_code, **kwargs)

# Check the edge cases if client is not provided.
if client is None:
if submissions is None:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy