From 9f3398de6914e7ef64639d59f57602bc550094c3 Mon Sep 17 00:00:00 2001 From: Arjan Zijderveld <5286904+arjanz@users.noreply.github.com> Date: Wed, 7 Jun 2023 14:48:49 +0200 Subject: [PATCH] Renamed extension --- .github/workflows/test.yml | 40 ---------------------- README.md | 10 +++--- substrateinterface_polkascan/extensions.py | 2 +- test/test_extension.py | 4 +-- 4 files changed, 8 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 0b62e7a..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Run unit tests - -on: - push: - branches: [main, develop] - pull_request: - # The branches below must be a subset of the branches above - branches: [main, develop] - schedule: - - cron: '0 7 * * *' - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Lint with flake8 - run: | - pip install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pip install pytest - pytest diff --git a/README.md b/README.md index b3c7c3e..d24b07b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Python Substrate Polkascan Extension +# Python Substrate Interface: Polkascan Extension [![Latest Version](https://img.shields.io/pypi/v/substrate-interface-polkascan.svg)](https://pypi.org/project/substrate-interface-polkascan/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/substrate-interface-polkascan.svg)](https://pypi.org/project/substrate-interface/) @@ -6,7 +6,7 @@ ## Description -This extension enables [Substrate Interface](https://github.com/polkascan/py-substrate-interface) to use indexes provided by [Polkascan Explorer API](https://github.com/polkascan/explorer#explorer-api-component) +This extension enables [Substrate Interface](https://github.com/polkascan/py-substrate-interface) to use indexes provided by the [Polkascan Explorer API](https://github.com/polkascan/explorer#explorer-api-component) ## Installation ```bash @@ -16,12 +16,12 @@ pip install substrate-interface-polkascan ## Initialization ```python -from substrateinterface import SubstrateInterface -from substrateinterface_polkascan.extensions import PolkascanSearchExtension +from substrateinterface import SubstrateInterface +from substrateinterface_polkascan.extensions import PolkascanExtension substrate = SubstrateInterface(url="ws://127.0.0.1:9944") -substrate.register_extension(PolkascanSearchExtension(url='http://127.0.0.1:8000/graphql/')) +substrate.register_extension(PolkascanExtension(url='http://127.0.0.1:8000/graphql/')) ``` ## Usage diff --git a/substrateinterface_polkascan/extensions.py b/substrateinterface_polkascan/extensions.py index c16bb2a..4dfda33 100644 --- a/substrateinterface_polkascan/extensions.py +++ b/substrateinterface_polkascan/extensions.py @@ -20,7 +20,7 @@ from gql.transport.aiohttp import AIOHTTPTransport -class PolkascanSearchExtension(SearchExtension): +class PolkascanExtension(SearchExtension): def __init__(self, url: str): self.url = url diff --git a/test/test_extension.py b/test/test_extension.py index 0561d29..dd0f798 100644 --- a/test/test_extension.py +++ b/test/test_extension.py @@ -19,7 +19,7 @@ from os import environ from substrateinterface import SubstrateInterface -from substrateinterface_polkascan.extensions import PolkascanSearchExtension +from substrateinterface_polkascan.extensions import PolkascanExtension POLKADOT_NODE_URL = environ.get('SUBSTRATE_NODE_URL_POLKADOT') or 'ws://127.0.0.1:9944' POLKASCAN_API_URL = environ.get('POLKASCAN_API_URL') or 'http://127.0.0.1:8000/graphql/' @@ -30,7 +30,7 @@ class TestExtension(unittest.TestCase): @classmethod def setUpClass(cls): cls.substrate = SubstrateInterface(url=POLKADOT_NODE_URL) - cls.substrate.register_extension(PolkascanSearchExtension(url=POLKASCAN_API_URL)) + cls.substrate.register_extension(PolkascanExtension(url=POLKASCAN_API_URL)) def test_filter_events(self):