Skip to content

Commit

Permalink
Merge pull request #24 from GetStream/ruff
Browse files Browse the repository at this point in the history
Use ruff instead of black
  • Loading branch information
tbarbugli authored Apr 25, 2024
2 parents 0616713 + 0aaf83d commit be3d334
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 120 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
continue-on-error: false
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -30,9 +32,6 @@ jobs:
cache: 'poetry'
- name: Install deps
run: poetry install
- name: Black
run: poetry run black getstream/ tests/
continue-on-error: false
- name: Run tests
env:
STREAM_BASE_URL: ${{ vars.STREAM_BASE_URL }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ poetry run pytest tests/ getstream/
Before pushing changes make sure to run the linter:

```sh
poetry run black getstream/ tests/
poetry run ruff format getstream/ tests/
```

## License
Expand Down
5 changes: 0 additions & 5 deletions getstream/chat/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class ChatRestClient(BaseClient):

def __init__(self, api_key: str, base_url: str, timeout: float, token: str):
"""
Initializes ChatClient with BaseClient instance
Expand All @@ -22,7 +21,6 @@ def __init__(self, api_key: str, base_url: str, timeout: float, token: str):
)

def list_block_lists(self) -> StreamResponse[ListBlockListResponse]:

return self.get("/api/v2/chat/blocklists", ListBlockListResponse)

def create_block_list(
Expand Down Expand Up @@ -524,7 +522,6 @@ def mark_unread(
)

def list_channel_types(self) -> StreamResponse[ListChannelTypesResponse]:

return self.get("/api/v2/chat/channeltypes", ListChannelTypesResponse)

def create_channel_type(
Expand Down Expand Up @@ -673,7 +670,6 @@ def update_channel_type(
)

def list_commands(self) -> StreamResponse[ListCommandsResponse]:

return self.get("/api/v2/chat/commands", ListCommandsResponse)

def create_command(
Expand Down Expand Up @@ -1493,7 +1489,6 @@ def update_thread_partial(
)

def unread_counts(self) -> StreamResponse[WrappedUnreadCountsResponse]:

return self.get("/api/v2/chat/unread", WrappedUnreadCountsResponse)

def unread_counts_batch(
Expand Down
6 changes: 0 additions & 6 deletions getstream/common/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class CommonRestClient(BaseClient):

def __init__(self, api_key: str, base_url: str, timeout: float, token: str):
"""
Initializes CommonClient with BaseClient instance
Expand All @@ -22,7 +21,6 @@ def __init__(self, api_key: str, base_url: str, timeout: float, token: str):
)

def get_app(self) -> StreamResponse[GetApplicationResponse]:

return self.get("/api/v2/app", GetApplicationResponse)

def update_app(
Expand Down Expand Up @@ -215,7 +213,6 @@ def create_import_url(
return self.post("/api/v2/import_urls", CreateImportURLResponse, json=json)

def list_imports(self) -> StreamResponse[ListImportsResponse]:

return self.get("/api/v2/imports", ListImportsResponse)

def create_import(
Expand All @@ -240,7 +237,6 @@ def get_og(self, url: str) -> StreamResponse[GetOGResponse]:
return self.get("/api/v2/og", GetOGResponse, query_params=query_params)

def list_permissions(self) -> StreamResponse[ListPermissionsResponse]:

return self.get("/api/v2/permissions", ListPermissionsResponse)

def get_permission(self, id: str) -> StreamResponse[GetCustomPermissionResponse]:
Expand All @@ -255,7 +251,6 @@ def get_permission(self, id: str) -> StreamResponse[GetCustomPermissionResponse]
)

def list_push_providers(self) -> StreamResponse[ListPushProvidersResponse]:

return self.get("/api/v2/push_providers", ListPushProvidersResponse)

def upsert_push_provider(
Expand Down Expand Up @@ -298,7 +293,6 @@ def get_rate_limits(
)

def list_roles(self) -> StreamResponse[ListRolesResponse]:

return self.get("/api/v2/roles", ListRolesResponse)

def create_role(self, name: str) -> StreamResponse[CreateRoleResponse]:
Expand Down
1 change: 0 additions & 1 deletion getstream/video/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Call:

def __init__(
self, client, call_type: str, call_id: str = None, custom_data: Dict = None
):
Expand Down
4 changes: 0 additions & 4 deletions getstream/video/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class VideoRestClient(BaseClient):

def __init__(self, api_key: str, base_url: str, timeout: float, token: str):
"""
Initializes VideoClient with BaseClient instance
Expand Down Expand Up @@ -538,7 +537,6 @@ def query_calls(
)

def list_call_types(self) -> StreamResponse[ListCallTypeResponse]:

return self.get("/api/v2/video/calltypes", ListCallTypeResponse)

def create_call_type(
Expand Down Expand Up @@ -605,11 +603,9 @@ def update_call_type(
)

def get_edges(self) -> StreamResponse[GetEdgesResponse]:

return self.get("/api/v2/video/edges", GetEdgesResponse)

def list_external_storage(self) -> StreamResponse[ListExternalStorageResponse]:

return self.get("/api/v2/video/external_storage", ListExternalStorageResponse)

def create_external_storage(
Expand Down
115 changes: 27 additions & 88 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ flake8 = "^6.0.0"

[tool.poetry.group.dev-dependencies.dependencies]
python-dotenv = "^1.0.1"
black = "^24.4.0"
ruff = "^0.4.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff.lint]
ignore = ["F405", "F403"]
24 changes: 13 additions & 11 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,22 @@ def test_custom_recording_style_css(self, client: Stream):
)

def test_custom_recording_website(self, client: Stream):
client.video.update_call_type(
CALL_TYPE_NAME,
settings=CallSettingsRequest(
recording=RecordSettingsRequest(
mode="available",
audio_only=False,
quality="1080p",
layout=LayoutSettingsRequest(
name="custom",
external_app_url="https://path/to/layout/app",
(
client.video.update_call_type(
CALL_TYPE_NAME,
settings=CallSettingsRequest(
recording=RecordSettingsRequest(
mode="available",
audio_only=False,
quality="1080p",
layout=LayoutSettingsRequest(
name="custom",
external_app_url="https://path/to/layout/app",
),
),
),
),
),
)

def test_delete_call_type(self, client: Stream):
try:
Expand Down

0 comments on commit be3d334

Please sign in to comment.