Skip to content

PBE-111 #141

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 7 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @ferhatelmas
* @JimmyPettersson85 @xernobyl @yaziine
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
max-parallel: 1
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,9 @@ secrets.*sh
.python-version

.venv
.venv3.7
.venv3.8
.venv3.9
.venv3.10
.venv3.11
.envrc
2 changes: 1 addition & 1 deletion dotgit/hooks/pre-commit-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if ! black stream --check -q; then
exit 1
fi

if ! flake8 --ignore=E501,E225,W293,W503 stream; then
if ! flake8 --ignore=E501,E225,W293,W503,F401 stream; then
echo
echo "commit is aborted because there are some error prone issues in your changes as printed above"
echo "your changes are still staged, you can accept formatting changes with git add or ignore them by adding --no-verify to git commit"
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from stream import __version__, __maintainer__, __email__, __license__

install_requires = [
"requests>=2.3.0,<3",
"pyjwt>=2.0.0,<3",
"pytz>=2019.3",
"aiohttp>=3.6.0",
"requests>=2.28.0,<3",
"pyjwt>=2.6.0,<3",
"pytz>=2022.7.1",
"aiohttp>=3.8.4",
]
tests_require = ["pytest", "pytest-cov", "python-dateutil", "pytest-asyncio"]
ci_require = ["black", "flake8", "pytest-cov"]
Expand Down Expand Up @@ -52,6 +52,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
3 changes: 0 additions & 3 deletions stream/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def activity_partial_update(
return self.activities_partial_update(updates=[data])

def activities_partial_update(self, updates=None):

auth_token = self.create_jwt_token("activities", "*", feed_id="*")

data = {"changes": updates or []}
Expand All @@ -195,7 +194,6 @@ def create_redirect_url(self, target_url, user_id, events):
return prepared_request.url

def track_engagements(self, engagements):

auth_token = self.create_jwt_token("*", "*", feed_id="*")
self.post(
"engagement/",
Expand All @@ -205,7 +203,6 @@ def track_engagements(self, engagements):
)

def track_impressions(self, impressions):

auth_token = self.create_jwt_token("*", "*", feed_id="*")
self.post("impression/", auth_token, data=impressions, service_name="analytics")

Expand Down
1 change: 0 additions & 1 deletion stream/collections/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def delete(self, collection_name, id):


class BaseCollection(AbstractCollection, ABC):

URL = "collections/"
SERVICE_NAME = "api"

Expand Down
1 change: 0 additions & 1 deletion stream/personalization/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def delete(self, resource, **params):


class BasePersonalization(AbstractPersonalization, ABC):

SERVICE_NAME = "personalization"

def __init__(self, client, token):
Expand Down
1 change: 0 additions & 1 deletion stream/reactions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def filter(self, **params):


class BaseReactions(AbstractReactions, ABC):

API_ENDPOINT = "reaction/"
SERVICE_NAME = "api"

Expand Down
18 changes: 9 additions & 9 deletions stream/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import asyncio
import os
import sys
import pytest_asyncio
from uuid import uuid4

import pytest

from stream import connect

Expand All @@ -17,15 +17,15 @@ async def _parse_response(*args, **kwargs):
return _parse_response


@pytest.fixture(scope="module")
@pytest_asyncio.fixture(scope="module")
def event_loop():
"""Create an instance of the default event loop for each test case."""
loop = asyncio.get_event_loop_policy().new_event_loop()
yield loop
loop.close()


@pytest.fixture
@pytest_asyncio.fixture
async def async_client():
key = os.getenv("STREAM_KEY")
secret = os.getenv("STREAM_SECRET")
Expand All @@ -44,31 +44,31 @@ async def async_client():
yield client


@pytest.fixture
@pytest_asyncio.fixture
def user1(async_client):
return async_client.feed("user", f"1-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def user2(async_client):
return async_client.feed("user", f"2-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def aggregated2(async_client):
return async_client.feed("aggregated", f"2-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def aggregated3(async_client):
return async_client.feed("aggregated", f"3-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def topic(async_client):
return async_client.feed("topic", f"1-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def flat3(async_client):
return async_client.feed("flat", f"3-{uuid4()}")
1 change: 0 additions & 1 deletion stream/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,6 @@ def test_activity_partial_update(self):
self.assertEqual(updated, expected)

def test_activities_partial_update(self):

feed = self.c.feed("user", uuid4())
feed.add_activities(
[
Expand Down
1 change: 0 additions & 1 deletion stream/users/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def delete(self, user_id):


class BaseUsers(AbstractUsers, ABC):

API_ENDPOINT = "user/"
SERVICE_NAME = "api"

Expand Down