Skip to content
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

Fix discovery lint err #6867

Merged
merged 2 commits into from
Dec 6, 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
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ def test_get_personal_route_metrics_week(app):
AggregateDailyTotalUsersMetrics(
count=4, personal_count=4, timestamp=yesterday - timedelta(days=1)
),
AggregateDailyTotalUsersMetrics(count=6, personal_count=5, timestamp=yesterday),
AggregateDailyTotalUsersMetrics(count=8, personal_count=8, timestamp=today),
AggregateDailyTotalUsersMetrics(
count=6, personal_count=5, timestamp=yesterday
),
AggregateDailyTotalUsersMetrics(
count=8, personal_count=8, timestamp=today
),
]
)

Expand Down Expand Up @@ -84,8 +88,12 @@ def test_get_personal_route_metrics_month_daily_bucket(app):
AggregateDailyTotalUsersMetrics(
count=4, personal_count=3, timestamp=today - timedelta(days=8)
),
AggregateDailyTotalUsersMetrics(count=6, personal_count=6, timestamp=yesterday),
AggregateDailyTotalUsersMetrics(count=8, personal_count=5, timestamp=today),
AggregateDailyTotalUsersMetrics(
count=6, personal_count=6, timestamp=yesterday
),
AggregateDailyTotalUsersMetrics(
count=8, personal_count=5, timestamp=today
),
]
)

Expand Down Expand Up @@ -123,8 +131,12 @@ def test_get_personal_route_metrics_month_weekly_bucket(app):
AggregateDailyTotalUsersMetrics(
count=4, personal_count=3, timestamp=today - timedelta(days=8)
),
AggregateDailyTotalUsersMetrics(count=6, personal_count=6, timestamp=yesterday),
AggregateDailyTotalUsersMetrics(count=8, personal_count=7, timestamp=today),
AggregateDailyTotalUsersMetrics(
count=6, personal_count=6, timestamp=yesterday
),
AggregateDailyTotalUsersMetrics(
count=8, personal_count=7, timestamp=today
),
]
)

Expand Down Expand Up @@ -159,7 +171,9 @@ def test_get_personal_route_metrics_all_time_monthly_bucket(app):
AggregateMonthlyTotalUsersMetric(
count=4, personal_count=3, timestamp=today - timedelta(days=100)
),
AggregateMonthlyTotalUsersMetric(count=6, personal_count=4, timestamp=today),
AggregateMonthlyTotalUsersMetric(
count=6, personal_count=4, timestamp=today
),
]
)

Expand Down Expand Up @@ -191,8 +205,12 @@ def test_get_personal_route_metrics_all_time_weekly_bucket(app):
AggregateDailyTotalUsersMetrics(
count=2, personal_count=1, timestamp=today - timedelta(days=367)
),
AggregateDailyTotalUsersMetrics(count=4, personal_count=3, timestamp=yesterday),
AggregateDailyTotalUsersMetrics(count=6, personal_count=6, timestamp=today),
AggregateDailyTotalUsersMetrics(
count=4, personal_count=3, timestamp=yesterday
),
AggregateDailyTotalUsersMetrics(
count=6, personal_count=6, timestamp=today
),
]
)

Expand Down
4 changes: 3 additions & 1 deletion packages/discovery-provider/integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def populate_mock_db(db, entities, block_offset=None):
remix_of=track_meta.get("remix_of", None),
updated_at=track_meta.get("updated_at", track_created_at),
created_at=track_meta.get("created_at", track_created_at),
release_date=str(track_meta.get("release_date")) if track_meta.get("release_date") else None,
release_date=str(track_meta.get("release_date"))
if track_meta.get("release_date")
else None,
is_unlisted=track_meta.get("is_unlisted", False),
is_premium=track_meta.get("is_premium", False),
premium_conditions=track_meta.get("premium_conditions", None),
Expand Down
2 changes: 1 addition & 1 deletion packages/discovery-provider/src/api/v1/root_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def specs_url(self):
@bp.route("", methods=["GET"])
def redirect_protocol_dashboard():
base_url = request.base_url
if base_url.endswith('/'):
if base_url.endswith("/"):
base_url = base_url[:-1]
proto_dash = f"/dashboard/#/services/discovery-node?endpoint={base_url}"
return redirect(proto_dash, code=302)
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ def _get_account_info(client: Client, index):
"solana_client_manager.py | get_account_info | All requests failed to fetch",
)

def get_account_info_json_parsed(self, account: Pubkey, retries=DEFAULT_MAX_RETRIES):
def get_account_info_json_parsed(
self, account: Pubkey, retries=DEFAULT_MAX_RETRIES
):
def _get_account_info_json_parsed(client: Client, index):
endpoint = self.endpoints[index]
num_retries = retries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def correct_delist_discrepancies(session: Session, redis: Redis):
for row in track_delist_discrepancies:
track_id = row["track_id"]
delisted = row["delisted"]
tracks_to_update = query_tracks_by_track_ids(session, [track_id])
tracks_to_update = query_tracks_by_track_ids(session, set([track_id]))
for track_to_update in tracks_to_update:
if delisted:
# Delist available tracks that have been delisted
Expand Down Expand Up @@ -437,7 +437,7 @@ def correct_delist_discrepancies(session: Session, redis: Redis):
for row in user_delist_discrepancies:
user_id = row["user_id"]
delisted = row["delisted"]
users_to_update = query_users_by_user_ids(session, [user_id])
users_to_update = query_users_by_user_ids(session, set([user_id]))
for user_to_update in users_to_update:
if delisted:
logger.info(
Expand Down