Skip to content

Commit 975f385

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 511dd61 commit 975f385

File tree

9 files changed

+73
-138
lines changed

9 files changed

+73
-138
lines changed

Diff for: alembic/env.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
# Import your models and Base
1717
from paste.database import Base
18+
1819
# Import all your models here
19-
from paste.models import Paste
2020
# this is the Alembic Config object
2121
config = context.config
2222

@@ -46,6 +46,7 @@ def run_migrations_offline() -> None:
4646
with context.begin_transaction():
4747
context.run_migrations()
4848

49+
4950
def run_migrations_online() -> None:
5051
connectable = engine_from_config(
5152
config.get_section(config.config_ini_section, {}),
@@ -54,14 +55,13 @@ def run_migrations_online() -> None:
5455
)
5556

5657
with connectable.connect() as connection:
57-
context.configure(
58-
connection=connection, target_metadata=target_metadata
59-
)
58+
context.configure(connection=connection, target_metadata=target_metadata)
6059

6160
with context.begin_transaction():
6261
context.run_migrations()
6362

63+
6464
if context.is_offline_mode():
6565
run_migrations_offline()
6666
else:
67-
run_migrations_online()
67+
run_migrations_online()

Diff for: alembic/versions/9513acd42747_initial_migration.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
"""Initial migration
22
33
Revision ID: 9513acd42747
4-
Revises:
4+
Revises:
55
Create Date: 2025-02-09 02:54:48.803960
66
77
"""
8+
89
from typing import Sequence, Union
910

1011
from alembic import op
1112
import sqlalchemy as sa
1213

1314

1415
# revision identifiers, used by Alembic.
15-
revision: str = '9513acd42747'
16+
revision: str = "9513acd42747"
1617
down_revision: Union[str, None] = None
1718
branch_labels: Union[str, Sequence[str], None] = None
1819
depends_on: Union[str, Sequence[str], None] = None
1920

2021

2122
def upgrade() -> None:
2223
# ### commands auto generated by Alembic - please adjust! ###
23-
op.create_table('pastes',
24-
sa.Column('pasteID', sa.String(length=4), nullable=False),
25-
sa.Column('content', sa.Text(), nullable=True),
26-
sa.Column('extension', sa.String(length=50), nullable=True),
27-
sa.Column('s3_link', sa.String(length=500), nullable=True),
28-
sa.Column('created_at', sa.DateTime(), nullable=True),
29-
sa.Column('expiresat', sa.DateTime(), nullable=True),
30-
sa.PrimaryKeyConstraint('pasteID')
24+
op.create_table(
25+
"pastes",
26+
sa.Column("pasteID", sa.String(length=4), nullable=False),
27+
sa.Column("content", sa.Text(), nullable=True),
28+
sa.Column("extension", sa.String(length=50), nullable=True),
29+
sa.Column("s3_link", sa.String(length=500), nullable=True),
30+
sa.Column("created_at", sa.DateTime(), nullable=True),
31+
sa.Column("expiresat", sa.DateTime(), nullable=True),
32+
sa.PrimaryKeyConstraint("pasteID"),
3133
)
3234
# ### end Alembic commands ###
3335

3436

3537
def downgrade() -> None:
3638
# ### commands auto generated by Alembic - please adjust! ###
37-
op.drop_table('pastes')
39+
op.drop_table("pastes")
3840
# ### end Alembic commands ###

Diff for: sdk/example.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from sdk.module import PasteBinSDK
22

3+
34
def test_pastebin_sdk():
45
sdk = PasteBinSDK()
56

@@ -23,5 +24,6 @@ def test_pastebin_sdk():
2324
except RuntimeError as e:
2425
print(f"An error occurred: {e}")
2526

27+
2628
if __name__ == "__main__":
27-
test_pastebin_sdk()
29+
test_pastebin_sdk()

Diff for: sdk/sdk/module.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import requests
2-
from typing import Optional, Union
2+
from typing import Union
33
from pathlib import Path
44

5+
56
class PasteBinSDK:
67
def __init__(self, base_url: str = "https://paste.fosscu.org"):
78
self.base_url = base_url
@@ -15,17 +16,14 @@ def create_paste(self, content: Union[str, Path], file_extension: str) -> str:
1516
"""
1617
try:
1718
if isinstance(content, Path):
18-
with open(content, 'r', encoding='utf-8') as f:
19+
with open(content, "r", encoding="utf-8") as f:
1920
content = f.read()
2021

21-
data = {
22-
'content': content,
23-
'extension': file_extension
24-
}
22+
data = {"content": content, "extension": file_extension}
2523
response = requests.post(f"{self.base_url}/api/paste", json=data)
2624
response.raise_for_status()
2725
result = response.json()
28-
return result['uuid']
26+
return result["uuid"]
2927
except requests.RequestException as e:
3028
raise RuntimeError(f"Error creating paste: {str(e)}")
3129

@@ -65,4 +63,4 @@ def get_languages(self) -> dict:
6563
response.raise_for_status()
6664
return response.json()
6765
except requests.RequestException as e:
68-
raise RuntimeError(f"Error fetching languages: {str(e)}")
66+
raise RuntimeError(f"Error fetching languages: {str(e)}")

0 commit comments

Comments
 (0)