Merge pull request #180 from mhchia/fix/include-all-pkgs-setuptools

Change `packages` in `setup`
This commit is contained in:
Kevin Mai-Husan Chia 2019-07-20 22:39:57 +08:00 committed by GitHub
commit 4422888f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 16 additions and 20 deletions

View File

@ -11,7 +11,7 @@ ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The # Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths. # regex matches against base names, not paths.
ignore-patterns= ignore-patterns=.*_pb2.*.py
# Python code to execute, usually for sys.path manipulation such as # Python code to execute, usually for sys.path manipulation such as
# pygtk.require(). # pygtk.require().

View File

@ -1,8 +1,8 @@
import asyncio import asyncio
import multiaddr
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
from libp2p.security.insecure_security import InsecureTransport
from .security.insecure_security import InsecureTransport
from .peer.peerstore import PeerStore from .peer.peerstore import PeerStore
from .peer.id import id_from_public_key from .peer.id import id_from_public_key
from .network.swarm import Swarm from .network.swarm import Swarm

View File

View File

View File

@ -11,11 +11,9 @@ class KadmeliaContentRouter(IContentRouting):
""" """
# the DHT finds the closest peers to `key` using the `FIND_NODE` RPC # the DHT finds the closest peers to `key` using the `FIND_NODE` RPC
# then sends a `ADD_PROVIDER` RPC with its own `PeerInfo` to each of these peers. # then sends a `ADD_PROVIDER` RPC with its own `PeerInfo` to each of these peers.
pass
def find_provider_iter(self, cid, count): def find_provider_iter(self, cid, count):
""" """
Search for peers who are able to provide a given key Search for peers who are able to provide a given key
returns an iterator of peer.PeerInfo returns an iterator of peer.PeerInfo
""" """
pass

View File

@ -4,10 +4,10 @@ from abc import ABC, abstractmethod
class IListener(ABC): class IListener(ABC):
@abstractmethod @abstractmethod
def listen(self, multiaddr): def listen(self, maddr):
""" """
put listener in listening mode and wait for incoming connections put listener in listening mode and wait for incoming connections
:param multiaddr: multiaddr of peer :param maddr: multiaddr of peer
:return: return True if successful :return: return True if successful
""" """

View File

View File

@ -21,13 +21,13 @@ class TCP(ITransport):
self.server = None self.server = None
self.handler = handler_function self.handler = handler_function
async def listen(self, multiaddr): async def listen(self, maddr):
""" """
put listener in listening mode and wait for incoming connections put listener in listening mode and wait for incoming connections
:param multiaddr: multiaddr of peer :param maddr: maddr of peer
:return: return True if successful :return: return True if successful
""" """
_multiaddr = multiaddr _multiaddr = maddr
_multiaddr = _multiaddr.decapsulate('/p2p') _multiaddr = _multiaddr.decapsulate('/p2p')
coroutine = asyncio.start_server(self.handler, coroutine = asyncio.start_server(self.handler,
@ -64,16 +64,16 @@ class TCP(ITransport):
self.server = None self.server = None
return True return True
async def dial(self, multiaddr, self_id, options=None): async def dial(self, maddr, self_id, options=None):
""" """
dial a transport to peer listening on multiaddr dial a transport to peer listening on multiaddr
:param multiaddr: multiaddr of peer :param maddr: multiaddr of peer
:param self_id: peer_id of the dialer (to send to receiver) :param self_id: peer_id of the dialer (to send to receiver)
:param options: optional object :param options: optional object
:return: True if successful :return: True if successful
""" """
host = multiaddr.value_for_protocol('ip4') host = maddr.value_for_protocol('ip4')
port = int(multiaddr.value_for_protocol('tcp')) port = int(maddr.value_for_protocol('tcp'))
reader, writer = await asyncio.open_connection(host, port) reader, writer = await asyncio.open_connection(host, port)

View File

@ -4,7 +4,7 @@ from abc import ABC, abstractmethod
class ITransport(ABC): class ITransport(ABC):
@abstractmethod @abstractmethod
def dial(self, multiaddr, self_id, options=None): def dial(self, maddr, self_id, options=None):
""" """
dial a transport to peer listening on multiaddr dial a transport to peer listening on multiaddr
:param multiaddr: multiaddr of peer :param multiaddr: multiaddr of peer

View File

@ -2,9 +2,7 @@ import setuptools
classifiers = [ classifiers = [
( f"Programming Language :: Python :: {version}"
"Programming Language :: Python :: %s" % version
)
for version in ["3.7"] for version in ["3.7"]
] ]
@ -28,6 +26,6 @@ setuptools.setup(
"lru-dict>=1.1.6", "lru-dict>=1.1.6",
"aio_timers" "aio_timers"
], ],
packages=["libp2p"], packages=setuptools.find_packages(exclude=["tests", "tests.*"]),
zip_safe=False, zip_safe=False,
) )