Skip to content

Commit

Permalink
[SDK] fix: remove IM integration from sdk and fix worker statistics o…
Browse files Browse the repository at this point in the history
…n subgraph (#1010)

* remove IM integration from sdk and fix worker statistics on subgraph

* remove temporary comments

* add class to python statistics

* fix datetime import

* fix python sdk test failing
  • Loading branch information
leric7 authored Oct 9, 2023
1 parent 3196295 commit c423414
Show file tree
Hide file tree
Showing 17 changed files with 443 additions and 694 deletions.
3 changes: 3 additions & 0 deletions packages/sdk/python/human-protocol-sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ dist
# ABIs
artifacts
contracts

# Hypothesis
.hypothesis
13 changes: 0 additions & 13 deletions packages/sdk/python/human-protocol-sdk/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ def get_escrow_statistics(statistics_client: StatisticsClient):
)


def get_task_statistics(statistics_client: StatisticsClient):
print(statistics_client.get_task_statistics())
print(
statistics_client.get_task_statistics(
StatisticsParam(
date_from=datetime.datetime(2023, 5, 8),
date_to=datetime.datetime(2023, 6, 8),
)
)
)


def get_worker_statistics(statistics_client: StatisticsClient):
print(statistics_client.get_worker_statistics())
print(
Expand Down Expand Up @@ -124,7 +112,6 @@ def agreeement_example():

# Run single example while testing, and remove comments before commit

get_task_statistics(statistics_client)
get_escrow_statistics(statistics_client)
get_worker_statistics(statistics_client)
get_payment_statistics(statistics_client)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

from datetime import datetime
import logging
import os
from decimal import Decimal
Expand Down Expand Up @@ -95,7 +96,7 @@ def __init__(
self.manifest_url = manifest_url
self.hash = hash


class EscrowFilter:
"""
A class used to filter escrow requests.
Expand All @@ -109,8 +110,8 @@ def __init__(
recording_oracle: Optional[str] = None,
exchange_oracle: Optional[str] = None,
status: Optional[Status] = None,
date_from: Optional[datetime.datetime] = None,
date_to: Optional[datetime.datetime] = None,
date_from: Optional[datetime] = None,
date_to: Optional[datetime] = None,
):
"""
Initializes a EscrowFilter instance.
Expand All @@ -122,8 +123,8 @@ def __init__(
recording_oracle (Optional[str]): Recording oracle address
exchange_oracle (Optional[str]): Exchange oracle address
status (Optional[Status]): Escrow status
date_from (Optional[datetime.datetime]): Created from date
date_to (Optional[datetime.datetime]): Created to date
date_from (Optional[datetime]): Created from date
date_to (Optional[datetime]): Created to date
"""

if not networks or any(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

import datetime
from datetime import datetime

from typing import List, Optional

Expand Down Expand Up @@ -31,8 +31,8 @@ def __init__(
exchange_oracle: Optional[str] = None,
job_requester_id: Optional[str] = None,
status: Optional[Status] = None,
date_from: Optional[datetime.datetime] = None,
date_to: Optional[datetime.datetime] = None,
date_from: Optional[datetime] = None,
date_to: Optional[datetime] = None,
):
"""
Initializes a EscrowFilter instance.
Expand All @@ -45,8 +45,8 @@ def __init__(
exchange_oracle (Optional[str]): Exchange oracle address
job_requester_id (Optional[str]): Job requester id
status (Optional[Status]): Escrow status
date_from (Optional[datetime.datetime]): Created from date
date_to (Optional[datetime.datetime]): Created to date
date_from (Optional[datetime]): Created from date
date_to (Optional[datetime]): Created to date
"""

if not networks or any(
Expand Down Expand Up @@ -92,17 +92,17 @@ def __init__(
self,
escrow_address: Optional[str] = None,
recipient: Optional[str] = None,
date_from: Optional[datetime.datetime] = None,
date_to: Optional[datetime.datetime] = None,
date_from: Optional[datetime] = None,
date_to: Optional[datetime] = None,
):
"""
Initializes a PayoutFilter instance.
Args:
escrow_address (Optional[str]): Escrow address
recipient (Optional[str]): Recipient address
date_from (Optional[datetime.datetime]): Created from date
date_to (Optional[datetime.datetime]): Created to date
date_from (Optional[datetime]): Created from date
date_to (Optional[datetime]): Created to date
"""

if escrow_address and not Web3.is_address(escrow_address):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ def __init__(
Args:
role (Optional[str]): Leader role
reputation_oracle (Optional[str]): Reputation oracle address
recording_oracle (Optional[str]): Recording oracle address
status (Optional[Status]): Escrow status
date_from (Optional[datetime.datetime]): Created from date
date_to (Optional[datetime.datetime]): Created to date
"""

self.role = role
Expand Down
Loading

0 comments on commit c423414

Please sign in to comment.