Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ name: Test code quality

on:
push:
branches:
- dev
- main
pull_request:
branches:
- "*"

Expand Down
2 changes: 1 addition & 1 deletion src/aleph/chains/avalanche.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

LOGGER = logging.getLogger("chains.avalanche")
CHAIN_NAME = "AVAX"
MESSAGE_TEMPLATE = b"\x1AAvalanche Signed Message:\n%b"
MESSAGE_TEMPLATE = b"\x1aAvalanche Signed Message:\n%b"


async def pack_message(message):
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/chains/nuls_aleph_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

LOGGER = logging.getLogger(__name__)

PLACE_HOLDER = b"\xFF\xFF\xFF\xFF"
PLACE_HOLDER = b"\xff\xff\xff\xff"
B58_DIGITS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
MESSAGE_TEMPLATE = "\x18NULS Signed Message:\n{}"

Expand Down
4 changes: 3 additions & 1 deletion src/aleph/db/accessors/peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@


def get_all_addresses_by_peer_type(
session: DbSession, peer_type: PeerType, last_seen: Optional[dt.datetime] = None,
session: DbSession,
peer_type: PeerType,
last_seen: Optional[dt.datetime] = None,
) -> Sequence[str]:
"""
Fetches all peer addresses filtered by peer type and optionally by the last_seen
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/jobs/reconnect_ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


async def reconnect_ipfs_job(
config: Config, session_factory: DbSessionFactory, ipfs_service: IpfsService
config: Config, session_factory: DbSessionFactory, ipfs_service: IpfsService
):
from aleph.services.utils import get_IP

Expand Down
2 changes: 1 addition & 1 deletion src/aleph/services/p2p/http.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" While our own streamer libp2p protocol is still unstable, use direct
"""While our own streamer libp2p protocol is still unstable, use direct
HTTP connection to standard rest API.
"""

Expand Down
3 changes: 2 additions & 1 deletion src/aleph/services/p2p/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
from aleph.db.accessors.peers import get_all_addresses_by_peer_type
from aleph.db.models import PeerType
from aleph.types.db_session import DbSessionFactory

from ..cache.node_cache import NodeCache
from .http import api_get_request
from .peers import connect_peer
from ..cache.node_cache import NodeCache


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/services/pricing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


def build_pricing_model_from_aggregate(
aggregate_content: Dict[Union[ProductPriceType, str], dict]
aggregate_content: Dict[Union[ProductPriceType, str], dict],
) -> Dict[ProductPriceType, ProductPricing]:
"""
Build a complete pricing model from an aggregate content dictionary.
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Storage module for Aleph.
"""Storage module for Aleph.
Basically manages the IPFS storage.
"""

Expand Down
2 changes: 1 addition & 1 deletion src/aleph/toolkit/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def timestamp_to_datetime(timestamp: float) -> dt.datetime:


def coerce_to_datetime(
datetime_or_timestamp: Optional[Union[float, dt.datetime]]
datetime_or_timestamp: Optional[Union[float, dt.datetime]],
) -> Optional[dt.datetime]:
# None for datetimes or 0 for timestamps results in returning None
if datetime_or_timestamp is None or not datetime_or_timestamp:
Expand Down
2 changes: 1 addition & 1 deletion tests/api/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def post_with_refs_and_tags() -> Tuple[MessageDb, PostDb, MessageStatusDb]:

@pytest.fixture
def amended_post_with_refs_and_tags(
post_with_refs_and_tags: Tuple[MessageDb, PostDb, MessageStatusDb]
post_with_refs_and_tags: Tuple[MessageDb, PostDb, MessageStatusDb],
):
original_message, original_post, _ = post_with_refs_and_tags

Expand Down
5 changes: 3 additions & 2 deletions tests/db/test_peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ async def test_get_all_addresses_by_peer_type(session_factory: DbSessionFactory)
session=session, peer_type=PeerType.P2P, last_seen=last_seen
)
old_p2p_entries = get_all_addresses_by_peer_type(
session=session, peer_type=PeerType.P2P, last_seen=last_seen + dt.timedelta(days=1)
session=session,
peer_type=PeerType.P2P,
last_seen=last_seen + dt.timedelta(days=1),
)
assert recent_p2p_entries == [p2p_entry.address]
assert old_p2p_entries == []



@pytest.mark.asyncio
@pytest.mark.parametrize("peer_type", (PeerType.HTTP, PeerType.P2P, PeerType.IPFS))
async def test_get_all_addresses_by_peer_type_no_match(
Expand Down
Loading