Skip to content

Commit f1bbabb

Browse files
committed
feat: use 'black' to unify formatting
1 parent 4caec34 commit f1bbabb

134 files changed

Lines changed: 3196 additions & 2486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/api/create_endpoint.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
try:
99

1010
new_template = runpod.create_template(
11-
name="test",
12-
image_name="runpod/base:0.4.4",
13-
is_serverless=True
11+
name="test", image_name="runpod/base:0.4.4", is_serverless=True
1412
)
1513

1614
print(new_template)
@@ -21,7 +19,7 @@
2119
gpu_ids="AMPERE_16",
2220
workers_min=0,
2321
workers_max=1,
24-
flashboot=True
22+
flashboot=True,
2523
)
2624

2725
print(new_endpoint)

examples/api/create_template.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88
try:
99

10-
new_template = runpod.create_template(
11-
name="test",
12-
image_name="runpod/base:0.1.0"
13-
)
10+
new_template = runpod.create_template(name="test", image_name="runpod/base:0.1.0")
1411

1512
print(new_template)
1613

examples/api/get_endpoints.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
""" Get all endpoints from the API """
22

3-
43
import runpod
54

65
endpoints = runpod.get_endpoints()

examples/endpoints/asyncio_job_request.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
import runpod
88
from runpod import http_client, AsyncioEndpoint, AsyncioJob
99

10-
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # For Windows Users
10+
asyncio.set_event_loop_policy(
11+
asyncio.WindowsSelectorEventLoopPolicy()
12+
) # For Windows Users
1113

1214
runpod.api_key = "YOUR_API_KEY"
1315

1416

1517
async def main():
16-
'''
18+
"""
1719
Function to run the example.
18-
'''
20+
"""
1921
async with http_client.AsyncClientSession() as session:
2022
# Invoke API
2123
payload = {}
@@ -34,4 +36,5 @@ async def main():
3436
# Print output
3537
print(output)
3638

39+
3740
asyncio.run(main())

examples/endpoints/run.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'''
1+
"""
22
Example of calling an endpoint using the RunPod Python Language Library.
3-
'''
3+
"""
44

55
import runpod
66

@@ -9,11 +9,9 @@
99

1010
endpoint = runpod.Endpoint("sdxl") # Where "sdxl" is the endpoint ID
1111

12-
run_request = endpoint.run({
13-
"input": {
14-
"prompt": "a photo of a horse the size of a Boeing 787"
15-
}
16-
})
12+
run_request = endpoint.run(
13+
{"input": {"prompt": "a photo of a horse the size of a Boeing 787"}}
14+
)
1715

1816
# Check the status of the run request
1917
print(run_request.status())

examples/endpoints/run_sync.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'''
1+
"""
22
Example of calling an endpoint using the RunPod Python Language Library.
3-
'''
3+
"""
44

55
import runpod
66

@@ -12,12 +12,8 @@
1212
try:
1313
# Run the endpoint synchronously, blocking until the endpoint run is complete.
1414
run_request = endpoint.run_sync(
15-
{
16-
"input": {
17-
"prompt": "a photo of a horse the size of a Boeing 787"
18-
}
19-
},
20-
timeout=60 # Seconds
15+
{"input": {"prompt": "a photo of a horse the size of a Boeing 787"}},
16+
timeout=60, # Seconds
2117
)
2218

2319
print(run_request)

examples/endpoints/streaming.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
endpoint = runpod.Endpoint("gwp4kx5yd3nur1")
99

10-
run_request = endpoint.run({
11-
"input": {
12-
"mock_return": ["a", "b", "c", "d", "e", "f", "g"],
13-
"mock_delay": 1,
10+
run_request = endpoint.run(
11+
{
12+
"input": {
13+
"mock_return": ["a", "b", "c", "d", "e", "f", "g"],
14+
"mock_delay": 1,
15+
}
1416
}
15-
})
17+
)
1618

1719
for output in run_request.stream():
1820
print(output)

examples/graphql_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
''''
1+
"""'
22
GraphQL wrapper for the RunPod API
3-
'''
3+
"""
44

55
import time
66
import runpod

examples/serverless/concurrent_handler.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
# ---------------------------------- Handler --------------------------------- #
77
async def async_generator_handler(job):
8-
'''
8+
"""
99
Async generator type handler.
10-
'''
10+
"""
1111
return job
1212

1313

14-
runpod.serverless.start({
15-
"handler": async_generator_handler,
16-
})
14+
runpod.serverless.start(
15+
{
16+
"handler": async_generator_handler,
17+
}
18+
)

examples/serverless/logger.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
""" Example of using the RunPodLogger class. """""
1+
""" Example of using the RunPodLogger class. """ ""
22

33
import runpod
44

5-
JOB_ID = '1234567890'
5+
JOB_ID = "1234567890"
66
log = runpod.RunPodLogger()
77

88

9-
log.debug('A debug message')
10-
log.info('An info message')
11-
log.warn('A warning message')
12-
log.error('An error message')
9+
log.debug("A debug message")
10+
log.info("An info message")
11+
log.warn("A warning message")
12+
log.error("An error message")
1313

1414
# Output:
1515
# DEBUG | A debug message
@@ -18,10 +18,10 @@
1818
# ERROR | An error message
1919

2020

21-
log.debug('A debug message', request_id=JOB_ID)
22-
log.info('An info message', request_id=JOB_ID)
23-
log.warn('A warning message', request_id=JOB_ID)
24-
log.error('An error message', request_id=JOB_ID)
21+
log.debug("A debug message", request_id=JOB_ID)
22+
log.info("An info message", request_id=JOB_ID)
23+
log.warn("A warning message", request_id=JOB_ID)
24+
log.error("An error message", request_id=JOB_ID)
2525

2626
# Output:
2727
# {"requestId": "1234567890", "message": "A debug message", "level": "DEBUG"}

0 commit comments

Comments
 (0)