id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
22,900 | test_rest_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/restapi/test_rest_endpoint.py | from ipv8.test.base import TestBase
from tribler.core.restapi.rest_endpoint import (
HTTP_INTERNAL_SERVER_ERROR,
RESTEndpoint,
RESTResponse,
RootEndpoint,
return_handled_exception,
)
from tribler.core.restapi.rest_manager import error_middleware
from tribler.test_unit.base_restapi import response_t... | 3,192 | Python | .py | 70 | 37.814286 | 107 | 0.668708 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,901 | test_ipv8_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/restapi/test_ipv8_endpoint.py | from ipv8.test.base import TestBase
from tribler.core.restapi.ipv8_endpoint import IPv8RootEndpoint
class TestIPv8RootEndpoint(TestBase):
"""
Tests for the IPv8RootEndpoint class.
"""
def test_binding(self) -> None:
"""
Test if all the IPv8 endpoint paths exist.
"""
e... | 927 | Python | .py | 22 | 34.727273 | 63 | 0.682222 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,902 | test_shutdown_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/restapi/test_shutdown_endpoint.py | from ipv8.test.base import TestBase
from tribler.core.restapi.shutdown_endpoint import ShutdownEndpoint
from tribler.test_unit.base_restapi import MockRequest, response_to_json
class ShutdownRequest(MockRequest):
"""
A MockRequest that mimics ShutdownRequests.
"""
def __init__(self) -> None:
... | 965 | Python | .py | 26 | 30.538462 | 76 | 0.667742 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,903 | test_settings_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/restapi/test_settings_endpoint.py | from unittest.mock import Mock, call
from ipv8.test.base import TestBase
from tribler.core.restapi.settings_endpoint import SettingsEndpoint
from tribler.test_unit.base_restapi import MockRequest, response_to_json
from tribler.tribler_config import TriblerConfigManager
class GetSettingsRequest(MockRequest):
"""... | 3,056 | Python | .py | 75 | 33.413333 | 98 | 0.664638 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,904 | test_events_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/restapi/test_events_endpoint.py | from asyncio import Future, ensure_future, sleep
from aiohttp.abc import AbstractStreamWriter
from ipv8.test.base import TestBase
from multidict import CIMultiDict
from tribler.core.notifier import Notification, Notifier
from tribler.core.restapi.events_endpoint import EventsEndpoint
from tribler.test_unit.base_resta... | 8,764 | Python | .py | 196 | 35.331633 | 114 | 0.629621 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,905 | test_manager.py | Tribler_tribler/src/tribler/test_unit/core/versioning/test_manager.py | from importlib.metadata import PackageNotFoundError
from unittest.mock import AsyncMock, Mock, patch
from ipv8.taskmanager import TaskManager
from ipv8.test.base import TestBase
import tribler
from tribler.core.versioning.manager import VersioningManager
from tribler.tribler_config import TriblerConfigManager
from tr... | 7,279 | Python | .py | 152 | 38.467105 | 119 | 0.622128 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,906 | test_versioning_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/versioning/restapi/test_versioning_endpoint.py | from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, Mock, call
from ipv8.test.base import TestBase
from tribler.core.restapi.rest_endpoint import HTTP_BAD_REQUEST
from tribler.core.versioning.restapi.versioning_endpoint import VersioningEndpoint
from tribler.test_... | 6,954 | Python | .py | 148 | 39.182432 | 104 | 0.664743 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,907 | test_discovery.py | Tribler_tribler/src/tribler/test_unit/core/tunnel/test_discovery.py | from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import Mock
from ipv8.community import Community, CommunitySettings
from ipv8.messaging.anonymization.tunnel import PEER_FLAG_EXIT_BT
from ipv8.test.base import TestBase
from tribler.core.tunnel.discovery import GoldenRatioStrateg... | 3,249 | Python | .py | 80 | 33.1875 | 109 | 0.654909 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,908 | test_community.py | Tribler_tribler/src/tribler/test_unit/core/tunnel/test_community.py | from __future__ import annotations
from asyncio import TimeoutError as AsyncTimeoutError
from asyncio import gather, sleep, wait_for
from collections import defaultdict
from io import BytesIO
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, Mock, call, patch
from ipv8.keyvault.public.libnaclkey i... | 18,630 | Python | .py | 350 | 42.745714 | 120 | 0.637313 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,909 | test_dispatcher.py | Tribler_tribler/src/tribler/test_unit/core/tunnel/test_dispatcher.py | import asyncio
from asyncio import Future
from unittest.mock import Mock, call
from ipv8.messaging.anonymization.tunnel import CIRCUIT_STATE_READY, Circuit
from ipv8.test.base import TestBase
from ipv8.util import succeed
from tribler.core.tunnel.dispatcher import TunnelDispatcher
class TestTunnelDispatcher(TestBas... | 9,117 | Python | .py | 171 | 43.263158 | 114 | 0.642689 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,910 | test_caches.py | Tribler_tribler/src/tribler/test_unit/core/tunnel/test_caches.py | from asyncio import sleep
from unittest.mock import Mock
from ipv8.requestcache import RequestCache
from ipv8.test.base import TestBase
from tribler.core.tunnel.caches import HTTPRequestCache
from tribler.core.tunnel.payload import HTTPResponsePayload
class TestHTTPRequestCache(TestBase):
"""
Tests for the ... | 2,424 | Python | .py | 54 | 37.037037 | 103 | 0.680815 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,911 | test_payload.py | Tribler_tribler/src/tribler/test_unit/core/tunnel/test_payload.py | from __future__ import annotations
from ipv8.test.base import TestBase
from tribler.core.tunnel.payload import HTTPRequestPayload, HTTPResponsePayload
class TestHTTPPayloads(TestBase):
"""
Tests for the various payloads of the TriblerTunnelCommunity.
"""
def test_http_request_payload(self) -> None:... | 1,158 | Python | .py | 28 | 33.928571 | 79 | 0.666667 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,912 | test_cache.py | Tribler_tribler/src/tribler/test_unit/core/content_discovery/test_cache.py | from asyncio import sleep
from ipv8.keyvault.private.libnaclkey import LibNaCLSK
from ipv8.peer import Peer
from ipv8.requestcache import RequestCache
from ipv8.test.base import TestBase
from tribler.core.content_discovery.cache import SelectRequest
class TestSelectRequest(TestBase):
"""
Tests for the Selec... | 1,399 | Python | .py | 32 | 35 | 100 | 0.665929 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,913 | test_community.py | Tribler_tribler/src/tribler/test_unit/core/content_discovery/test_community.py | from __future__ import annotations
import os
import sys
from binascii import hexlify
from typing import TYPE_CHECKING, cast
from unittest import skipIf
from unittest.mock import AsyncMock, Mock, patch
from ipv8.messaging.payload import IntroductionRequestPayload, NewIntroductionRequestPayload
from ipv8.test.base impo... | 16,003 | Python | .py | 313 | 42.073482 | 115 | 0.659987 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,914 | test_payload.py | Tribler_tribler/src/tribler/test_unit/core/content_discovery/test_payload.py | from __future__ import annotations
from ipv8.test.base import TestBase
from tribler.core.content_discovery.payload import (
PopularTorrentsRequest,
RemoteSelectPayload,
SelectResponsePayload,
TorrentInfoFormat,
TorrentsHealthPayload,
VersionRequest,
VersionResponse,
)
from tribler.core.tor... | 5,217 | Python | .py | 117 | 35.205128 | 119 | 0.635074 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,915 | test_search_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/content_discovery/restapi/test_search_endpoint.py | from __future__ import annotations
from uuid import UUID
from ipv8.keyvault.private.libnaclkey import LibNaCLSK
from ipv8.peer import Peer
from ipv8.peerdiscovery.network import Network
from ipv8.test.base import TestBase
from ipv8.test.mocking.endpoint import AutoMockEndpoint
from tribler.core.content_discovery.com... | 2,522 | Python | .py | 57 | 37.877193 | 110 | 0.697998 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,916 | test_manager.py | Tribler_tribler/src/tribler/test_unit/core/recommender/test_manager.py | from __future__ import annotations
from ipv8.test.base import TestBase
from tribler.core.recommender.manager import Manager
class TestManager(TestBase):
"""
Tests for the database manager.
"""
def setUp(self) -> None:
"""
Create a new memory-based manager.
"""... | 1,190 | Python | .py | 32 | 28.25 | 57 | 0.59331 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,917 | test_community.py | Tribler_tribler/src/tribler/test_unit/core/recommender/test_community.py | from __future__ import annotations
import dataclasses
import json
from typing import cast
from unittest.mock import patch
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.peer import Peer
from ipv8.test.base import TestBase
from ipv8.test.mocking.ipv8 import MockIPv8
from tribler.core.recommen... | 9,631 | Python | .py | 189 | 39.206349 | 125 | 0.581715 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,918 | test_payload.py | Tribler_tribler/src/tribler/test_unit/core/recommender/test_payload.py | from __future__ import annotations
import json
from ipv8.messaging.serialization import default_serializer
from ipv8.test.base import TestBase
from tribler.core.recommender.payload import Crawl, CrawlInfo, CrawlResponse
class TestContentDiscoveryPayloads(TestBase):
"""
Tests for the various pay... | 2,801 | Python | .py | 64 | 34.546875 | 92 | 0.602664 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,919 | test_tracker_manager.py | Tribler_tribler/src/tribler/test_unit/core/torrent_checker/test_tracker_manager.py | from __future__ import annotations
from pathlib import Path
from unittest.mock import Mock
from ipv8.test.base import TestBase
from tribler.core.libtorrent.trackers import get_uniformed_tracker_url
from tribler.core.torrent_checker.tracker_manager import TrackerManager
from tribler.test_unit.core.torrent_checker.moc... | 5,537 | Python | .py | 115 | 40.191304 | 114 | 0.671058 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,920 | test_torrent_checker.py | Tribler_tribler/src/tribler/test_unit/core/torrent_checker/test_torrent_checker.py | from __future__ import annotations
import random
import secrets
import time
from binascii import unhexlify
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, Mock, patch
from ipv8.test.base import TestBase
from ipv8.util import succeed
import tribler
from tribler.core.notifier import Notificati... | 16,018 | Python | .py | 276 | 43.623188 | 119 | 0.608626 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,921 | mocks.py | Tribler_tribler/src/tribler/test_unit/core/torrent_checker/mocks.py | from __future__ import annotations
from typing import TYPE_CHECKING, Callable, Iterator, Set
from tribler.core.torrent_checker.dataclasses import HealthInfo
if TYPE_CHECKING:
from typing_extensions import Self
class DBResult(list):
"""
Mock a Pony ORM result.
"""
def order_by(self, _: int) -> ... | 4,655 | Python | .py | 126 | 28.238095 | 120 | 0.585556 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,922 | test_dataclasses.py | Tribler_tribler/src/tribler/test_unit/core/torrent_checker/test_dataclasses.py | import sys
from ipv8.test.base import TestBase
from tribler.core.torrent_checker.dataclasses import HealthInfo
class TestHealthInfo(TestBase):
"""
Tests for the HealthInfo class.
"""
def test_is_valid_no_seeders(self) -> None:
"""
Test if health info with negative seeders is invalid... | 4,690 | Python | .py | 104 | 36.75 | 112 | 0.618242 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,923 | test_torrentchecker_session.py | Tribler_tribler/src/tribler/test_unit/core/torrent_checker/test_torrentchecker_session.py | import struct
from asyncio import CancelledError, Future, ensure_future, sleep
from unittest.mock import Mock, patch
from aiohttp.web_exceptions import HTTPBadRequest
from ipv8.test.base import TestBase
from ipv8.util import succeed
from libtorrent import bencode
from tribler.core.torrent_checker.dataclasses import H... | 16,494 | Python | .py | 320 | 41.478125 | 126 | 0.639731 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,924 | test_client.py | Tribler_tribler/src/tribler/test_unit/core/socks5/test_client.py | from __future__ import annotations
from asyncio import sleep
from unittest.mock import Mock, call
from ipv8.test.base import TestBase
from tribler.core.socks5.client import Socks5Client, Socks5ClientUDPConnection, Socks5Error
class MockSocks5Client(Socks5Client):
"""
A Mocked Socks5Client that does not pul... | 5,379 | Python | .py | 133 | 31.93985 | 93 | 0.638916 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,925 | test_aiohttp_connector.py | Tribler_tribler/src/tribler/test_unit/core/socks5/test_aiohttp_connector.py | from __future__ import annotations
import asyncio
import socket
import sys
from unittest.mock import Mock, patch
from aiohttp import ClientRequest, ClientTimeout
from ipv8.test.base import TestBase
from yarl import URL
from tribler.core.socks5.client import Socks5Client
class MockSocks5Client(Socks5Client):
""... | 3,660 | Python | .py | 82 | 35.060976 | 110 | 0.633146 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,926 | test_server.py | Tribler_tribler/src/tribler/test_unit/core/socks5/test_server.py | from __future__ import annotations
import socket
from asyncio import Transport, get_event_loop, sleep
from asyncio.base_events import Server
from typing import Callable
from unittest.mock import Mock, patch
from ipv8.test.base import TestBase
from tribler.core.socks5.client import Socks5Client, Socks5Error
from trib... | 7,399 | Python | .py | 161 | 35.677019 | 119 | 0.604383 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,927 | test_connection.py | Tribler_tribler/src/tribler/test_unit/core/socks5/test_connection.py | from asyncio import sleep
from unittest.mock import Mock, call
from ipv8.test.base import TestBase
from tribler.core.socks5.connection import ConnectionState, Socks5Connection
class TestSocks5Connection(TestBase):
"""
Tests for the Socks5Connection class.
"""
def test_connection_made(self) -> None:... | 6,010 | Python | .py | 112 | 44.571429 | 119 | 0.674284 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,928 | test_conversion.py | Tribler_tribler/src/tribler/test_unit/core/socks5/test_conversion.py | import struct
from ipv8.messaging.interfaces.udp.endpoint import DomainAddress
from ipv8.messaging.serialization import PackError
from ipv8.test.base import TestBase
from tribler.core.socks5.conversion import (
CommandRequest,
CommandResponse,
UdpPacket,
socks5_serializer,
)
class TestConversion(Tes... | 3,757 | Python | .py | 76 | 41.526316 | 112 | 0.689138 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,929 | test_udp_connection.py | Tribler_tribler/src/tribler/test_unit/core/socks5/test_udp_connection.py | from asyncio import get_event_loop
from unittest.mock import AsyncMock, Mock, call, patch
from ipv8.messaging.interfaces.udp.endpoint import DomainAddress
from ipv8.test.base import TestBase
from tribler.core.socks5.udp_connection import RustUDPConnection, SocksUDPConnection
class MockSocksUDPConnection(SocksUDPCon... | 6,570 | Python | .py | 137 | 39.620438 | 113 | 0.672247 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,930 | test_community.py | Tribler_tribler/src/tribler/test_unit/core/knowledge/test_community.py | from __future__ import annotations
import dataclasses
from datetime import datetime, timezone
from random import sample
from typing import TYPE_CHECKING
from unittest.mock import Mock
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.test.base import TestBase
from pony.orm import db_session
from tribler.co... | 8,315 | Python | .py | 209 | 31.507177 | 118 | 0.645129 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,931 | test_content_bundling.py | Tribler_tribler/src/tribler/test_unit/core/knowledge/test_content_bundling.py | from ipv8.test.base import TestBase
from tribler.core.knowledge.content_bundling import _create_name, calculate_diversity, group_content_by_number
class TestContentBundling(TestBase):
"""
Tests for content bundling functionality.
"""
def test_group_content_by_number_empty_list(self) -> Non... | 6,218 | Python | .py | 114 | 42.842105 | 120 | 0.600236 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,932 | test_operations_requests.py | Tribler_tribler/src/tribler/test_unit/core/knowledge/test_operations_requests.py | from ipv8.test.base import TestBase
from tribler.core.knowledge.operations_requests import OperationsRequests
class TestOperationsRequests(TestBase):
"""
Tests for the OperationsRequests class.
"""
def setUp(self) -> None:
"""
Create a new OperationsRequests to test with.
"""... | 1,899 | Python | .py | 46 | 33.086957 | 78 | 0.65506 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,933 | test_payload.py | Tribler_tribler/src/tribler/test_unit/core/knowledge/test_payload.py | from __future__ import annotations
from ipv8.test.base import TestBase
from tribler.core.knowledge.payload import (
RawStatementOperationMessage,
RequestStatementOperationMessage,
StatementOperation,
StatementOperationMessage,
StatementOperationSignature,
)
class TestHTTPPayloads(TestBase):
... | 2,141 | Python | .py | 54 | 32.092593 | 71 | 0.677279 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,934 | test_knowledge_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/knowledge/restapi/test_knowledge_endpoint.py | from unittest.mock import Mock
from aiohttp.web_urldispatcher import UrlMappingMatchInfo
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.peer import Peer
from ipv8.peerdiscovery.network import Network
from ipv8.test.base import TestBase
from ipv8.test.mocking.endpoint import AutoMockEndpoint
from tribler.... | 8,004 | Python | .py | 165 | 38.115152 | 114 | 0.631619 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,935 | test_store.py | Tribler_tribler/src/tribler/test_unit/core/database/test_store.py | from __future__ import annotations
from ipv8.community import Community, CommunitySettings
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.test.base import TestBase
from ipv8.test.mocking.ipv8 import MockIPv8
from pony.orm import db_session
from tribler.core.database.orm_bindings.torrent_metadata import e... | 10,555 | Python | .py | 191 | 44.926702 | 119 | 0.64359 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,936 | test_ranks.py | Tribler_tribler/src/tribler/test_unit/core/database/test_ranks.py | from __future__ import annotations
from collections import deque
from ipv8.test.base import TestBase
from tribler.core.database.ranks import (
find_word_and_rotate_title,
freshness_rank,
seeders_rank,
title_rank,
torrent_rank,
)
class TestRanks(TestBase):
"""
Tests for the ranking logic... | 7,361 | Python | .py | 164 | 36.664634 | 94 | 0.62107 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,937 | test_tribler_database.py | Tribler_tribler/src/tribler/test_unit/core/database/test_tribler_database.py | from ipv8.test.base import TestBase
from pony.orm import db_session
from tribler.core.database.tribler_database import TriblerDatabase
class TestTriblerDatabase(TestBase):
"""
Tests for the TriblerDatabase class.
"""
def setUp(self) -> None:
"""
Create a database instance.
""... | 1,762 | Python | .py | 49 | 28.44898 | 83 | 0.622797 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,938 | test_serialization.py | Tribler_tribler/src/tribler/test_unit/core/database/test_serialization.py | from __future__ import annotations
from datetime import datetime, timezone
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.test.base import TestBase
from tribler.core.database.serialization import (
REGULAR_TORRENT,
HealthItemsPayload,
SignedPayload,
TorrentMetadataPayload,
UnknownBlo... | 8,658 | Python | .py | 153 | 46.477124 | 115 | 0.668753 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,939 | test_database_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/database/restapi/test_database_endpoint.py | from __future__ import annotations
from asyncio import sleep
from typing import TYPE_CHECKING, Callable
from unittest.mock import AsyncMock, Mock, call
from aiohttp.web_urldispatcher import UrlMappingMatchInfo
from ipv8.test.base import TestBase
from multidict import MultiDict, MultiDictProxy
from tribler.core.datab... | 15,222 | Python | .py | 282 | 44.397163 | 120 | 0.647079 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,940 | test_health.py | Tribler_tribler/src/tribler/test_unit/core/database/layers/test_health.py | from __future__ import annotations
from types import SimpleNamespace
from typing import TYPE_CHECKING
from ipv8.test.base import TestBase
from tribler.core.database.layers.health import HealthDataAccessLayer, ResourceType
from tribler.core.torrent_checker.dataclasses import HealthInfo, Source
if TYPE_CHECKING:
... | 3,102 | Python | .py | 83 | 30.542169 | 95 | 0.660649 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,941 | test_knowledge.py | Tribler_tribler/src/tribler/test_unit/core/database/layers/test_knowledge.py | from __future__ import annotations
from types import SimpleNamespace
from typing import TYPE_CHECKING
from ipv8.test.base import TestBase
from tribler.core.database.layers.health import ResourceType
from tribler.core.database.layers.knowledge import KnowledgeDataAccessLayer, Operation
from tribler.core.knowledge.pay... | 10,653 | Python | .py | 233 | 36.643777 | 119 | 0.63875 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,942 | test_layer.py | Tribler_tribler/src/tribler/test_unit/core/database/layers/test_layer.py | from __future__ import annotations
from typing import TYPE_CHECKING
from ipv8.test.base import TestBase
from tribler.core.database.layers.layer import Layer
if TYPE_CHECKING:
from typing_extensions import Self
class MockEntity:
"""
A mocked-up database entity.
"""
def __init__(self, /, **kwar... | 2,675 | Python | .py | 76 | 27.723684 | 83 | 0.620381 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,943 | test_torrent_metadata.py | Tribler_tribler/src/tribler/test_unit/core/database/orm_bindings/test_torrent_metadata.py | from __future__ import annotations
from ipv8.test.base import TestBase
from tribler.core.database.orm_bindings.torrent_metadata import entries_to_chunk, infohash_to_id, tdef_to_metadata_dict
from tribler.core.libtorrent.torrentdef import TorrentDefNoMetainfo
class MockTorrentMetadata:
"""
Mocked torrent met... | 2,979 | Python | .py | 69 | 35.391304 | 119 | 0.638408 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,944 | test_trackers.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/test_trackers.py | from ipv8.test.base import TestBase
from tribler.core.libtorrent.trackers import (
MalformedTrackerURLException,
add_url_params,
get_uniformed_tracker_url,
is_valid_url,
parse_tracker_url,
)
class TestTrackers(TestBase):
"""
Tests for the tracker-related functionality.
"""
def te... | 11,563 | Python | .py | 252 | 37.313492 | 108 | 0.633871 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,945 | test_torrentdef.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/test_torrentdef.py | from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import libtorrent
from aiohttp import ClientResponseError
from ipv8.test.base import TestBase
from tribler.core.libtorrent.torrentdef import TorrentDef, TorrentDefNoMetainfo
from tribler.test_unit.core.libtorrent.mocks import TORRENT_WITH_DIRS,... | 17,801 | Python | .py | 378 | 37.343915 | 117 | 0.602795 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,946 | test_torrent_file_tree.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/test_torrent_file_tree.py | from pathlib import Path
from ipv8.test.base import TestBase
from tribler.core.libtorrent.torrent_file_tree import TorrentFileTree
from tribler.test_unit.core.libtorrent.mocks import TORRENT_UBUNTU_FILE, TORRENT_WITH_DIRS
class TestTorrentFileTree(TestBase):
"""
Tests for the TorrentFileTree class.
"""
... | 20,759 | Python | .py | 408 | 42.164216 | 106 | 0.622309 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,947 | mocks.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/mocks.py | import libtorrent
TORRENT_WITH_DIRS_CONTENT = (
b'd'
b'7:comment16:Test description'
b'10:created by27:Tribler version: 7.10.0-GIT'
b'13:creation datei1634911081e'
b'4:infod'
b'5:filesl'
b'd'
b'6:lengthi6e'
b'4:path... | 3,100 | Python | .py | 103 | 17.660194 | 94 | 0.443924 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,948 | test_uris.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/test_uris.py | from pathlib import PurePosixPath, PureWindowsPath
from unittest.mock import AsyncMock, Mock, patch
from ipv8.test.base import TestBase
from multidict import istr
import tribler
from tribler.core.libtorrent.uris import unshorten, url_to_path
class TestURIs(TestBase):
"""
Tests for the URI-related functional... | 6,604 | Python | .py | 129 | 41.356589 | 115 | 0.608945 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,949 | test_torrents.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/test_torrents.py | from io import StringIO
from pathlib import Path
from unittest.mock import Mock
import libtorrent
from configobj import ConfigObj
from ipv8.test.base import TestBase
from tribler.core.libtorrent.download_manager.download import Download
from tribler.core.libtorrent.download_manager.download_config import SPEC_CONTENT... | 11,581 | Python | .py | 216 | 44.314815 | 115 | 0.643615 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,950 | test_torrentinfo_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/restapi/test_torrentinfo_endpoint.py | import json
from asyncio import TimeoutError
from binascii import unhexlify
from ssl import SSLError
from unittest.mock import AsyncMock, Mock, patch
from aiohttp import ClientConnectorCertificateError, ClientConnectorError, ClientResponseError, ServerConnectionError
from ipv8.test.base import TestBase
from ipv8.util ... | 31,742 | Python | .py | 468 | 54.423077 | 120 | 0.635889 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,951 | test_libtorrent_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/restapi/test_libtorrent_endpoint.py | from asyncio import Future, ensure_future, sleep
from binascii import hexlify
from unittest.mock import Mock
from ipv8.test.base import TestBase
from tribler.core.libtorrent.restapi.libtorrent_endpoint import LibTorrentEndpoint
from tribler.test_unit.base_restapi import MockRequest, response_to_json
class GetLibtor... | 5,814 | Python | .py | 116 | 42.112069 | 116 | 0.677493 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,952 | test_downloads_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/restapi/test_downloads_endpoint.py | """
Keep this text for the test_stream test.
"""
from __future__ import annotations
from binascii import hexlify
from io import StringIO
from pathlib import Path
from unittest.mock import AsyncMock, Mock, call, patch
from aiohttp.web_urldispatcher import UrlMappingMatchInfo
from configobj import ConfigObj
from ipv8.t... | 59,146 | Python | .py | 1,072 | 45.313433 | 119 | 0.649221 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,953 | test_create_torrent_endpoint.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/restapi/test_create_torrent_endpoint.py | import base64
from io import StringIO
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
from configobj import ConfigObj
from ipv8.test.base import TestBase
import tribler.core.libtorrent.restapi.create_torrent_endpoint as ep_module
from tribler.core.libtorrent.download_manager.download_config ... | 9,680 | Python | .py | 164 | 47.823171 | 116 | 0.639241 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,954 | test_dht_health_manager.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_dht_health_manager.py | from asyncio import Future
from binascii import unhexlify
from unittest.mock import Mock
from ipv8.test.base import TestBase
from tribler.core.libtorrent.download_manager.dht_health_manager import DHTHealthManager
class TestDHTHealthManager(TestBase):
"""
Tests for the DHTHealthManager class.
"""
b... | 4,381 | Python | .py | 90 | 38.222222 | 102 | 0.644866 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,955 | test_stream.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_stream.py | from __future__ import annotations
from io import BytesIO, StringIO
from pathlib import Path
from unittest.mock import AsyncMock, Mock, call
from configobj import ConfigObj
from ipv8.test.base import TestBase
from validate import Validator
from tribler.core.libtorrent.download_manager.download import Download
from t... | 16,460 | Python | .py | 364 | 36.491758 | 118 | 0.638358 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,956 | test_download_state.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_download_state.py | from io import StringIO
from pathlib import Path
from unittest.mock import Mock
import libtorrent
from configobj import ConfigObj
from ipv8.test.base import TestBase
from tribler.core.libtorrent.download_manager.download import Download
from tribler.core.libtorrent.download_manager.download_config import SPEC_CONTENT... | 11,705 | Python | .py | 178 | 52.898876 | 117 | 0.636498 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,957 | test_download_config.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_download_config.py | from io import StringIO
from pathlib import Path
from unittest.mock import Mock, call, patch
from configobj import ConfigObj
from ipv8.test.base import TestBase
from validate import Validator
from tribler.core.libtorrent.download_manager.download_config import SPEC_CONTENT, DownloadConfig
class TestDownloadConfig(T... | 2,860 | Python | .py | 72 | 31.916667 | 97 | 0.648228 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,958 | test_download.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_download.py | from asyncio import Future, ensure_future, sleep
from binascii import hexlify
from io import StringIO
from pathlib import Path
from unittest.mock import Mock, call, patch
import libtorrent
from configobj import ConfigObj
from ipv8.test.base import TestBase
from ipv8.util import succeed
from validate import Validator
... | 44,043 | Python | .py | 745 | 47.983893 | 120 | 0.646761 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,959 | test_download_manager.py | Tribler_tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_download_manager.py | import asyncio
import functools
from asyncio import Future, ensure_future, sleep
from binascii import hexlify
from io import StringIO
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, Mock, call, patch
from configobj import ConfigObj
from configobj.validate import Validator, VdtParamError
from i... | 23,984 | Python | .py | 418 | 46.093301 | 120 | 0.640666 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,960 | test_database.py | Tribler_tribler/src/tribler/test_unit/core/rendezvous/test_database.py | from ipv8.keyvault.crypto import default_eccrypto
from ipv8.peer import Peer
from ipv8.test.base import TestBase
from tribler.core.rendezvous.database import RendezvousDatabase
class TestRendezvousDatabase(TestBase):
"""
Tests for the RendezvousDatabase class.
"""
def setUp(self) -> None:
""... | 2,654 | Python | .py | 58 | 37.793103 | 102 | 0.665504 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,961 | test_community.py | Tribler_tribler/src/tribler/test_unit/core/rendezvous/test_community.py | from __future__ import annotations
import os
import socket
from typing import TYPE_CHECKING
from ipv8.test.base import TestBase
from ipv8.test.mocking.endpoint import MockEndpointListener
from tribler.core.rendezvous.community import RendezvousCommunity, RendezvousSettings
from tribler.core.rendezvous.database impor... | 3,577 | Python | .py | 76 | 38.289474 | 108 | 0.657192 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,962 | test_rendezvous_hook.py | Tribler_tribler/src/tribler/test_unit/core/rendezvous/test_rendezvous_hook.py | from __future__ import annotations
from ipv8.keyvault.crypto import default_eccrypto
from ipv8.peer import Peer
from ipv8.peerdiscovery.network import Network
from ipv8.test.base import TestBase
from tribler.core.rendezvous.database import RendezvousDatabase
from tribler.core.rendezvous.rendezvous_hook import Rendezv... | 3,270 | Python | .py | 82 | 32.170732 | 115 | 0.648768 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,963 | components.py | Tribler_tribler/src/tribler/core/components.py | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Type, cast
from ipv8.bootstrapping.dispersy.bootstrapper import DispersyBootstrapper
from ipv8.community import Community
from ipv8.configuration import DISPERSY_BOOTSTRAPPER
from ipv8.loader import CommunityLauncher, after,... | 14,598 | Python | .py | 309 | 39.252427 | 112 | 0.678252 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,964 | notifier.py | Tribler_tribler/src/tribler/core/notifier.py | from __future__ import annotations
import typing
from collections import defaultdict
from enum import Enum
from typing import Callable
from ipv8.messaging.anonymization.tunnel import Circuit
class Desc(typing.NamedTuple):
"""
A Notification callback descriptor.
"""
name: str
fields: list[str]
... | 3,787 | Python | .py | 70 | 45 | 116 | 0.618521 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,965 | __init__.py | Tribler_tribler/src/tribler/core/__init__.py | """
Tribler is a privacy enhanced BitTorrent client with P2P content discovery.
"""
| 84 | Python | .py | 3 | 27 | 75 | 0.790123 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,966 | session.py | Tribler_tribler/src/tribler/core/session.py | from __future__ import annotations
import asyncio
import logging
import sys
from asyncio import AbstractEventLoop, Event
from contextlib import contextmanager
from traceback import format_exception
from typing import TYPE_CHECKING, Any, Generator, Type, cast
import aiohttp
from ipv8.loader import IPv8CommunityLoader
... | 11,271 | Python | .py | 222 | 41.720721 | 120 | 0.68683 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,967 | events_endpoint.py | Tribler_tribler/src/tribler/core/restapi/events_endpoint.py | from __future__ import annotations
import json
import time
from asyncio import CancelledError, Event, Future, Queue
from contextlib import suppress
from importlib.metadata import PackageNotFoundError, version
from traceback import format_exception
from typing import TYPE_CHECKING, TypedDict
import marshmallow.fields
... | 10,307 | Python | .py | 227 | 35.176211 | 118 | 0.62642 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,968 | shutdown_endpoint.py | Tribler_tribler/src/tribler/core/restapi/shutdown_endpoint.py | from typing import Callable
from aiohttp import web
from aiohttp_apispec import docs
from ipv8.REST.schema import schema
from marshmallow.fields import Boolean
from tribler.core.restapi.rest_endpoint import RESTEndpoint, RESTResponse
class ShutdownEndpoint(RESTEndpoint):
"""
With this endpoint you can shut ... | 1,173 | Python | .py | 36 | 24.833333 | 73 | 0.613274 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,969 | settings_endpoint.py | Tribler_tribler/src/tribler/core/restapi/settings_endpoint.py | from aiohttp import web
from aiohttp_apispec import docs, json_schema
from ipv8.REST.schema import schema
from marshmallow.fields import Boolean
from tribler.core.libtorrent.download_manager.download_manager import DownloadManager
from tribler.core.restapi.rest_endpoint import RESTEndpoint, RESTResponse
from tribler.t... | 3,150 | Python | .py | 74 | 33.405405 | 119 | 0.630016 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,970 | rest_endpoint.py | Tribler_tribler/src/tribler/core/restapi/rest_endpoint.py | from __future__ import annotations
import json
import logging
from typing import TYPE_CHECKING, Dict
from aiohttp import web
from ipv8.taskmanager import TaskManager
if TYPE_CHECKING:
from ipv8.REST.root_endpoint import RootEndpoint as IPV8RootEndpoint
HTTP_BAD_REQUEST = 400
HTTP_UNAUTHORIZED = 401
HTTP_NOT_FO... | 2,813 | Python | .py | 71 | 33.225352 | 112 | 0.654779 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,971 | rest_manager.py | Tribler_tribler/src/tribler/core/restapi/rest_manager.py | from __future__ import annotations
import logging
import ssl
import traceback
from asyncio.base_events import Server
from functools import wraps
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
from typing import TYPE_CHECKING, Awaitable, Callable, Generic, TypeVar, cast
from aioh... | 11,467 | Python | .py | 249 | 37.726908 | 118 | 0.647054 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,972 | file_endpoint.py | Tribler_tribler/src/tribler/core/restapi/file_endpoint.py | import contextlib
import logging
import platform
from pathlib import Path
from aiohttp import web
from tribler.core.restapi.rest_endpoint import HTTP_NOT_FOUND, RESTEndpoint, RESTResponse
if platform.system() == 'Windows':
import win32api
class FileEndpoint(RESTEndpoint):
"""
This endpoint allows clien... | 3,070 | Python | .py | 74 | 30.108108 | 102 | 0.543318 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,973 | statistics_endpoint.py | Tribler_tribler/src/tribler/core/restapi/statistics_endpoint.py | from __future__ import annotations
from typing import TYPE_CHECKING
from aiohttp import web
from aiohttp_apispec import docs
from ipv8.REST.schema import schema
from marshmallow.fields import Integer, String
from tribler.core.restapi.rest_endpoint import MAX_REQUEST_SIZE, RESTEndpoint, RESTResponse
if TYPE_CHECKING... | 3,015 | Python | .py | 80 | 25.025 | 97 | 0.522081 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,974 | ipv8_endpoint.py | Tribler_tribler/src/tribler/core/restapi/ipv8_endpoint.py | from ipv8.REST.root_endpoint import RootEndpoint
from tribler.core.restapi.rest_endpoint import RESTEndpoint
class IPv8RootEndpoint(RootEndpoint, RESTEndpoint):
"""
Make the IPv8 REST endpoint Tribler-compatible.
"""
path = "/api/ipv8"
def __init__(self) -> None:
"""
Create a ne... | 422 | Python | .py | 13 | 26.384615 | 59 | 0.662531 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,975 | webui_endpoint.py | Tribler_tribler/src/tribler/core/restapi/webui_endpoint.py | from __future__ import annotations
import logging
import mimetypes
from aiohttp import ClientSession, web
import tribler
from tribler.core.restapi.rest_endpoint import RESTEndpoint, RESTResponse
class WebUIEndpoint(RESTEndpoint):
"""
This endpoint serves files used by the web UI.
"""
path = '/ui'
... | 1,901 | Python | .py | 46 | 32.521739 | 113 | 0.62039 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,976 | manager.py | Tribler_tribler/src/tribler/core/versioning/manager.py | from __future__ import annotations
import logging
import os
import platform
import shutil
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
from typing import TYPE_CHECKING
from aiohttp import ClientSession
from packaging.version import Version
from tribler.tribler_config import T... | 4,430 | Python | .py | 95 | 36.294737 | 116 | 0.614226 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,977 | versioning_endpoint.py | Tribler_tribler/src/tribler/core/versioning/restapi/versioning_endpoint.py | from __future__ import annotations
from typing import TYPE_CHECKING
from aiohttp import web
from aiohttp_apispec import docs
from ipv8.REST.schema import schema
from marshmallow.fields import Bool, List, String
from tribler.core.restapi.rest_endpoint import HTTP_BAD_REQUEST, MAX_REQUEST_SIZE, RESTEndpoint, RESTRespo... | 5,769 | Python | .py | 148 | 29.993243 | 109 | 0.606104 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,978 | community.py | Tribler_tribler/src/tribler/core/tunnel/community.py | from __future__ import annotations
import hashlib
import math
import time
from asyncio import Future, open_connection
from asyncio import TimeoutError as AsyncTimeoutError
from binascii import hexlify, unhexlify
from collections import Counter
from typing import TYPE_CHECKING, Awaitable
import async_timeout
from ipv8... | 23,511 | Python | .py | 435 | 42.473563 | 120 | 0.636043 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,979 | caches.py | Tribler_tribler/src/tribler/core/tunnel/caches.py | from __future__ import annotations
from asyncio import Future
from typing import TYPE_CHECKING
from ipv8.requestcache import RandomNumberCache
if TYPE_CHECKING:
from tribler.core.tunnel.community import TriblerTunnelCommunity
from tribler.core.tunnel.payload import HTTPResponsePayload
class HTTPRequestCach... | 1,360 | Python | .py | 33 | 34.151515 | 100 | 0.670963 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,980 | payload.py | Tribler_tribler/src/tribler/core/tunnel/payload.py | from __future__ import annotations
from ipv8.messaging.anonymization.payload import CellablePayload
from ipv8.messaging.lazy_payload import vp_compile
@vp_compile
class HTTPRequestPayload(CellablePayload):
"""
A request to an HTTP address.
"""
msg_id = 28
format_list = ["I", "I", "address", "var... | 826 | Python | .py | 28 | 25.178571 | 69 | 0.669202 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,981 | dispatcher.py | Tribler_tribler/src/tribler/core/tunnel/dispatcher.py | from __future__ import annotations
import random
from collections import defaultdict
from typing import TYPE_CHECKING
from ipv8.messaging.anonymization.tunnel import (
CIRCUIT_ID_PORT,
CIRCUIT_STATE_READY,
CIRCUIT_TYPE_DATA,
CIRCUIT_TYPE_RP_DOWNLOADER,
CIRCUIT_TYPE_RP_SEEDER,
Circuit,
)
from i... | 9,214 | Python | .py | 172 | 42.645349 | 119 | 0.646425 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,982 | discovery.py | Tribler_tribler/src/tribler/core/tunnel/discovery.py | from __future__ import annotations
import time
from random import choice
from typing import TYPE_CHECKING
from ipv8.messaging.anonymization.tunnel import PEER_FLAG_EXIT_BT
from ipv8.peerdiscovery.discovery import DiscoveryStrategy
if TYPE_CHECKING:
from ipv8.types import Peer
from tribler.core.tunnel.commun... | 3,009 | Python | .py | 57 | 42.789474 | 118 | 0.64852 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,983 | community.py | Tribler_tribler/src/tribler/core/content_discovery/community.py | from __future__ import annotations
import json
import random
import sys
import time
import uuid
from binascii import hexlify, unhexlify
from importlib.metadata import PackageNotFoundError, version
from itertools import count
from typing import TYPE_CHECKING, Any, Callable, Sequence
from ipv8.community import Communit... | 19,109 | Python | .py | 364 | 42.598901 | 118 | 0.661346 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,984 | cache.py | Tribler_tribler/src/tribler/core/content_discovery/cache.py | from __future__ import annotations
from binascii import hexlify
from typing import TYPE_CHECKING, Callable
from ipv8.requestcache import RandomNumberCache, RequestCache
from typing_extensions import Self
if TYPE_CHECKING:
from ipv8.types import Peer
from tribler.core.database.store import ProcessingResult
... | 1,644 | Python | .py | 35 | 39.457143 | 99 | 0.68793 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,985 | payload.py | Tribler_tribler/src/tribler/core/content_discovery/payload.py | from __future__ import annotations
from typing import TYPE_CHECKING
from ipv8.messaging.lazy_payload import VariablePayload, vp_compile
from ipv8.messaging.serialization import default_serializer
from typing_extensions import Self
if TYPE_CHECKING:
from tribler.core.torrent_checker.dataclasses import HealthInfo
... | 5,683 | Python | .py | 143 | 32.748252 | 113 | 0.653573 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,986 | search_endpoint.py | Tribler_tribler/src/tribler/core/content_discovery/restapi/search_endpoint.py | from __future__ import annotations
from binascii import hexlify
from typing import TYPE_CHECKING
from aiohttp import web
from aiohttp_apispec import docs, querystring_schema
from ipv8.REST.schema import schema
from marshmallow.fields import Integer, List, String
from typing_extensions import TypeAlias
from tribler.c... | 3,680 | Python | .py | 76 | 39.697368 | 112 | 0.664065 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,987 | community.py | Tribler_tribler/src/tribler/core/recommender/community.py | from __future__ import annotations
import json
import os
from binascii import hexlify, unhexlify
from typing import TYPE_CHECKING, TypedDict, cast
from ipv8.community import Community, CommunitySettings
from ipv8.lazy_community import lazy_wrapper
from ipv8.requestcache import NumberCache, RequestCache
from tribler.... | 14,330 | Python | .py | 347 | 32.270893 | 121 | 0.599899 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,988 | manager.py | Tribler_tribler/src/tribler/core/recommender/manager.py | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from pony.orm import Database, db_session
from pony.orm import max as pony_max
from tribler.core.recommender.orm_query import define_binding
if TYPE_CHECKING:
from tribler.core.recommender.orm_query import Query
class... | 1,601 | Python | .py | 44 | 28.636364 | 100 | 0.623057 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,989 | payload.py | Tribler_tribler/src/tribler/core/recommender/payload.py | import json
from typing import Any
from ipv8.messaging.lazy_payload import VariablePayloadWID, vp_compile
@vp_compile
class CrawlInfo(VariablePayloadWID):
"""
A request for crawlable information.
"""
msg_id = 0
format_list = ["20s", "raw"]
names = ["mid", "unknown"]
mid: bytes
unkn... | 967 | Python | .py | 39 | 19.974359 | 70 | 0.646542 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,990 | orm_query.py | Tribler_tribler/src/tribler/core/recommender/orm_query.py | from __future__ import annotations
from typing import TYPE_CHECKING
from pony import orm
if TYPE_CHECKING:
from dataclasses import dataclass
from typing import Iterator
from pony.orm import Database
from pony.orm.core import Entity
class IterQuery(type): # noqa: D101
def __iter__(cls... | 1,116 | Python | .py | 38 | 21.868421 | 74 | 0.595484 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,991 | endpoint.py | Tribler_tribler/src/tribler/core/recommender/restapi/endpoint.py | from __future__ import annotations
from typing import TYPE_CHECKING
from aiohttp import web
from aiohttp_apispec import docs, json_schema
from ipv8.REST.schema import schema
from marshmallow.fields import Boolean, Integer, List, Nested, String
from tribler.core.restapi.rest_endpoint import MAX_REQUEST_SIZE, RESTEndp... | 2,683 | Python | .py | 63 | 32.634921 | 115 | 0.609063 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,992 | torrent_checker.py | Tribler_tribler/src/tribler/core/torrent_checker/torrent_checker.py | from __future__ import annotations
import asyncio
import logging
import random
import time
from asyncio import CancelledError, DatagramTransport
from binascii import hexlify
from collections import defaultdict
from typing import TYPE_CHECKING, Any, Dict, List, Tuple, cast
from ipv8.taskmanager import TaskManager
from... | 20,264 | Python | .py | 378 | 43.002646 | 119 | 0.646519 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,993 | torrentchecker_session.py | Tribler_tribler/src/tribler/core/torrent_checker/torrentchecker_session.py | from __future__ import annotations
import logging
import random
import socket
import struct
import time
from abc import ABCMeta, abstractmethod
from asyncio import DatagramProtocol, Future, TimeoutError, ensure_future, get_event_loop
from typing import TYPE_CHECKING, Any, List, NoReturn, cast
import async_timeout
imp... | 21,279 | Python | .py | 431 | 39.324826 | 117 | 0.63374 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,994 | tracker_manager.py | Tribler_tribler/src/tribler/core/torrent_checker/tracker_manager.py | from __future__ import annotations
import logging
import time
from pathlib import Path
from typing import TYPE_CHECKING
from pony.orm import count, db_session
from tribler.core.libtorrent.trackers import get_uniformed_tracker_url
if TYPE_CHECKING:
from tribler.core.database.store import MetadataStore
MAX_TRACK... | 5,687 | Python | .py | 122 | 36.016393 | 120 | 0.611091 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,995 | dataclasses.py | Tribler_tribler/src/tribler/core/torrent_checker/dataclasses.py | from __future__ import annotations
import time
from dataclasses import dataclass, field
from enum import IntEnum
MINUTE = 60
HOUR = MINUTE * 60
TOLERABLE_TIME_DRIFT = MINUTE # When receiving health from another peer, how far the timestamp can be in the future?
TORRENT_CHECK_WINDOW = MINUTE # When asking multiple tr... | 3,497 | Python | .py | 82 | 35.329268 | 119 | 0.65812 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,996 | client.py | Tribler_tribler/src/tribler/core/socks5/client.py | from __future__ import annotations
import ipaddress
import logging
import socket
from asyncio import BaseTransport, DatagramProtocol, DatagramTransport, Protocol, Queue, WriteTransport, get_event_loop
from typing import Callable, cast
from ipv8.messaging.interfaces.udp.endpoint import DomainAddress
from ipv8.messagin... | 8,162 | Python | .py | 196 | 33.066327 | 119 | 0.641262 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,997 | udp_connection.py | Tribler_tribler/src/tribler/core/socks5/udp_connection.py | from __future__ import annotations
import logging
from asyncio import DatagramProtocol, DatagramTransport, get_event_loop
from typing import TYPE_CHECKING, cast
from ipv8.messaging.serialization import PackError
from tribler.core.socks5.conversion import UdpPacket, socks5_serializer
if TYPE_CHECKING:
from ipv8.... | 5,036 | Python | .py | 123 | 32.056911 | 118 | 0.62697 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,998 | __init__.py | Tribler_tribler/src/tribler/core/socks5/__init__.py | """
The Socks5 package contains a basic SOCKS5 server is included which reserves
circuits for its client connections and tunnels UDP packets over them back and forth.
"""
| 171 | Python | .py | 4 | 41.75 | 85 | 0.814371 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |
22,999 | conversion.py | Tribler_tribler/src/tribler/core/socks5/conversion.py | from __future__ import annotations
import logging
import socket
import struct
from typing import Any, Union
from ipv8.messaging.interfaces.udp.endpoint import DomainAddress, UDPv4Address
from ipv8.messaging.lazy_payload import VariablePayload, vp_compile
from ipv8.messaging.serialization import DefaultStruct, ListOf,... | 4,919 | Python | .py | 141 | 28.907801 | 110 | 0.654983 | Tribler/tribler | 4,768 | 443 | 131 | GPL-3.0 | 9/5/2024, 5:13:26 PM (Europe/Amsterdam) |