diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4d372ede9d..29267cdb2c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -8,38 +8,40 @@ on: pull_request: jobs: - common_checks_1: + python_code_quality_checks: continue-on-error: False - runs-on: ubuntu-latest - timeout-minutes: 10 + runs-on: '${{ matrix.os }}' + strategy: + matrix: + os: + - ubuntu-latest + python-version: + - '3.8' + tox-job: + - check_plugins_code_consistency + - check_go_code_consistency + - bandit + - safety + - black-check + - isort-check + - flake8 + - darglint + - vulture + - mypy + - pylint + timeout-minutes: 30 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: 3.8 - - name: Install dependencies (ubuntu-latest) + python-version: '${{ matrix.python-version }}' + - name: Install dependencies + run: pip install tox==3.25.1 + - name: 'Run check ${{ matrix.tox-job }}' run: | - sudo apt-get update --fix-missing - sudo apt-get install libmbedtls-dev - sudo apt-get autoremove - sudo apt-get autoclean - sudo pip install pipenv - - name: Check plugin consistency - run: | - # these two files should not be different; - # we vendorize main "cosmos.py" module in fetchai crypto plugin package - diff plugins/aea-ledger-cosmos/aea_ledger_cosmos/cosmos.py plugins/aea-ledger-fetchai/aea_ledger_fetchai/_cosmos.py - - # check diff between plugins' LICENSE and main LICENSE - diff LICENSE plugins/aea-ledger-cosmos/LICENSE - diff LICENSE plugins/aea-ledger-ethereum/LICENSE - diff LICENSE plugins/aea-ledger-fetchai/LICENSE - - name: Check go code consistency - run: | - # check diff between go code in libs and packages - diff libs/go/libp2p_node packages/fetchai/connections/p2p_libp2p/libp2p_node -r + tox -e ${{ matrix.tox-job }} - common_checks_2: + go_code_checks: continue-on-error: False runs-on: ubuntu-latest timeout-minutes: 20 @@ -50,29 +52,13 @@ jobs: python-version: 3.8 - uses: actions/setup-go@v3 with: - go-version: '^1.17.0' + go-version: "^1.17.0" - name: Install dependencies (ubuntu-latest) run: | sudo apt-get update --fix-missing sudo apt-get install libmbedtls-dev sudo apt-get autoremove sudo apt-get autoclean - pip install tox - - name: Security Check - run: tox -e bandit - - name: Safety Check - run: tox -e safety - - name: Code style check - run: | - tox -e black-check - tox -e isort-check - tox -e flake8 - - name: Docstring check - run: tox -e darglint - - name: Unused code check - run: tox -e vulture - - name: Static type check - run: tox -e mypy - name: Golang code style check (libp2p_node) uses: golangci/golangci-lint-action@v3.1.0 env: @@ -88,27 +74,55 @@ jobs: version: v1.48.0 working-directory: libs/go/aealite - common_checks_3: - continue-on-error: False + misc_checks: runs-on: ubuntu-latest + continue-on-error: False timeout-minutes: 10 + strategy: + matrix: + python-version: + - '3.8' + tox-job: + - liccheck + - copyright_check + - hash_check -- --timeout 40.0 + - package_version_checks + - package_dependencies_checks + - check_generate_all_protocols + - docs steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: '${{ matrix.python-version }}' + - uses: actions/setup-go@v3 + with: + go-version: "^1.17.0" - name: Install dependencies (ubuntu-latest) run: | sudo apt-get update --fix-missing sudo apt-get install libmbedtls-dev sudo apt-get autoremove sudo apt-get autoclean - pip install tox - - name: Pylint check + pip install --user --upgrade setuptools + # install Protobuf compiler + wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip + unzip protoc-3.19.4-linux-x86_64.zip -d protoc + sudo mv protoc/bin/protoc /usr/local/bin/protoc + # install IPFS + sudo apt-get install -y wget + wget -O ./go-ipfs.tar.gz https://dist.ipfs.io/go-ipfs/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz + tar xvfz go-ipfs.tar.gz + sudo mv go-ipfs/ipfs /usr/local/bin/ipfs + ipfs init + make protolint_install + - name: Install dependencies + run: pip install tox==3.25.1 + - name: 'Run check ${{ matrix.tox-job }}' run: | - tox -e pylint - - common_checks_4: + tox -e ${{ matrix.tox-job }} + + misc_checks_extra: continue-on-error: False runs-on: ubuntu-latest timeout-minutes: 10 @@ -119,7 +133,7 @@ jobs: python-version: 3.8 - uses: actions/setup-go@v3 with: - go-version: '^1.17.0' + go-version: "^1.17.0" - name: Install dependencies (ubuntu-latest) run: | sudo apt-get update --fix-missing @@ -127,43 +141,16 @@ jobs: sudo apt-get autoremove sudo apt-get autoclean pip install tox - pip install --user --upgrade setuptools - # install Protobuf compiler - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip - unzip protoc-3.19.4-linux-x86_64.zip -d protoc - sudo mv protoc/bin/protoc /usr/local/bin/protoc - # install IPFS - sudo apt-get install -y wget - wget -O ./go-ipfs.tar.gz https://dist.ipfs.io/go-ipfs/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz - tar xvfz go-ipfs.tar.gz - sudo mv go-ipfs/ipfs /usr/local/bin/ipfs - ipfs init - make protolint_install - - name: License Check - run: tox -e liccheck - - name: Copyright Check - run: tox -e copyright_check - - name: AEA Package Hashes Check - run: tox -e hash_check -- --timeout 40.0 - - name: Check package versions in documentation - run: tox -e package_version_checks - - name: Check package dependencies - run: tox -e package_dependencies_checks - - name: Check generate protocols - run: tox -e check_generate_all_protocols - - name: Generate Documentation - run: tox -e docs - name: Check copyright year is up to date run: | ./scripts/bump_year.sh $(date +%Y) git diff --quiet||(echo "Some files have the incorrect year in their copyright header. Run ./scripts/bump_year.sh!"; exit 1) echo "all good" - common_checks_5: + docs_check: continue-on-error: False runs-on: ubuntu-latest timeout-minutes: 10 - if: github.base_ref == 'main' steps: - uses: actions/checkout@master - uses: actions/setup-python@v3 @@ -194,9 +181,9 @@ jobs: strategy: matrix: sys: - - { os: windows-latest, shell: 'msys2 {0}' } - - { os: ubuntu-latest, shell: bash } - - { os: macos-latest, shell: bash } + - { os: windows-latest, shell: "msys2 {0}" } + - { os: ubuntu-latest, shell: bash } + - { os: macos-latest, shell: bash } python_version: [3.8] timeout-minutes: 10 steps: @@ -214,19 +201,19 @@ jobs: sudo apt-get autoremove sudo apt-get autoclean - name: Install tox - run : | + run: | pip install tox - name: Check plugin aea-ledger-cosmos - run : | + run: | tox -r -e plugins_env -- sh -c "pip install ./plugins/aea-ledger-cosmos && aea generate-key cosmos && echo aea-ledger-cosmos checked!" - name: Check plugin aea-ledger-ethereum - run : | + run: | tox -r -e plugins_env -- sh -c "pip install ./plugins/aea-ledger-ethereum && aea generate-key ethereum && echo aea-ledger-ethereum checked!" - name: Check plugin aea-ledger-fetchai - run : | + run: | tox -r -e plugins_env -- sh -c "pip install ./plugins/aea-ledger-fetchai && aea generate-key fetchai && echo aea-ledger-fetchai checked!" - name: Check plugin aea-cli-ipfs - run : | + run: | tox -r -e plugins_env -- sh -c "pip install ./plugins/aea-cli-ipfs && aea ipfs --help && echo aea-cli-ipfs checked!" protolint: @@ -240,7 +227,7 @@ jobs: python-version: 3.8 - uses: actions/setup-go@v3 with: - go-version: '^1.17.0' + go-version: "^1.17.0" - name: Install protolint (ubuntu-latest) run: | sudo apt-get update --fix-missing @@ -254,56 +241,56 @@ jobs: integration_checks: continue-on-error: True needs: - - common_checks_1 - - common_checks_2 - - common_checks_3 - - common_checks_4 - - plugins_install_check + - python_code_quality_checks + - go_code_checks + - misc_checks + - misc_checks_extra + - plugins_install_check runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 - with: - python-version: 3.8 - - uses: actions/setup-go@v3 - with: - go-version: '^1.17.0' - - name: Setup GCloud - production - uses: google-github-actions/setup-gcloud@v0 - with: + - uses: actions/checkout@master + - uses: actions/setup-python@v3 + with: + python-version: 3.8 + - uses: actions/setup-go@v3 + with: + go-version: "^1.17.0" + - name: Setup GCloud - production + uses: google-github-actions/setup-gcloud@v0 + with: project_id: ${{ secrets.GCLOUD_FETCH_AI_PROD_PROJECT }} service_account_key: ${{ secrets.GCLOUD_FETCH_AI_PROD_KEY }} - - name: Install dependencies (ubuntu-latest) - run: | - sudo apt-get update --fix-missing - sudo apt-get install libmbedtls-dev - sudo apt-get autoremove - sudo apt-get autoclean - pip install tox - # install Protobuf compiler - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip - unzip protoc-3.19.4-linux-x86_64.zip -d protoc - sudo mv protoc/bin/protoc /usr/local/bin/protoc - - name: Configure Docker - run: | - gcloud auth configure-docker - - name: Pull SOEF Image - run: | - docker pull gcr.io/fetch-ai-images/soef:9e78611 # change this to latest tag - - name: Sync AEA loop integration tests - run: | - tox -e py3.8 -- -m 'sync' # --aea-loop sync - - name: Async integration tests - run: tox -e py3.8 -- -m 'integration and not unstable and not ledger' + - name: Install dependencies (ubuntu-latest) + run: | + sudo apt-get update --fix-missing + sudo apt-get install libmbedtls-dev + sudo apt-get autoremove + sudo apt-get autoclean + pip install tox + # install Protobuf compiler + wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip + unzip protoc-3.19.4-linux-x86_64.zip -d protoc + sudo mv protoc/bin/protoc /usr/local/bin/protoc + - name: Configure Docker + run: | + gcloud auth configure-docker + - name: Pull SOEF Image + run: | + docker pull gcr.io/fetch-ai-images/soef:9e78611 # change this to latest tag + - name: Sync AEA loop integration tests + run: | + tox -e py3.8 -- -m 'sync' # --aea-loop sync + - name: Async integration tests + run: tox -e py3.8 -- -m 'integration and not unstable and not ledger' integration_checks_ledger: continue-on-error: True needs: - - common_checks_1 - - common_checks_2 - - common_checks_3 - - common_checks_4 + - python_code_quality_checks + - go_code_checks + - misc_checks + - misc_checks_extra - plugins_install_check runs-on: ubuntu-latest timeout-minutes: 60 @@ -315,8 +302,8 @@ jobs: - name: Setup GCloud - production uses: google-github-actions/setup-gcloud@v0 with: - project_id: ${{ secrets.GCLOUD_FETCH_AI_PROD_PROJECT }} - service_account_key: ${{ secrets.GCLOUD_FETCH_AI_PROD_KEY }} + project_id: ${{ secrets.GCLOUD_FETCH_AI_PROD_PROJECT }} + service_account_key: ${{ secrets.GCLOUD_FETCH_AI_PROD_KEY }} - name: Install dependencies (ubuntu-latest) run: | sudo apt-get update --fix-missing @@ -325,7 +312,7 @@ jobs: pip install tox - name: Configure Docker run: | - gcloud auth configure-docker + gcloud auth configure-docker - name: Pull SOEF Image run: | docker pull gcr.io/fetch-ai-images/soef:9e78611 # change this to latest tag @@ -335,152 +322,151 @@ jobs: platform_checks: continue-on-error: True needs: - - common_checks_1 - - common_checks_2 - - common_checks_3 - - common_checks_4 - - plugins_install_check + - python_code_quality_checks + - go_code_checks + - misc_checks + - misc_checks_extra + - plugins_install_check runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python_version: [3.8, 3.9, '3.10'] + python_version: [3.8, 3.9, "3.10"] timeout-minutes: 90 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python_version }} - - uses: actions/setup-go@v3 - with: - go-version: '^1.17.0' - - if: matrix.os == 'ubuntu-latest' - name: Install dependencies (ubuntu-latest) - run: | - sudo apt-get update --fix-missing - sudo apt-get install libmbedtls-dev - sudo apt-get autoremove - sudo apt-get autoclean - pip install tox - # install Protobuf compiler - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip - unzip protoc-3.19.4-linux-x86_64.zip -d protoc - sudo mv protoc/bin/protoc /usr/local/bin/protoc - make protolint_install - # sudo apt-get install -y protobuf-compiler - # use sudo rm /var/lib/apt/lists/lock above in line above update if dependency install failures persist - # use sudo apt-get dist-upgrade above in line below update if dependency install failures persist - - if: matrix.os == 'macos-latest' - name: Install dependencies (macos-latest) - run: | - pip install tox - brew install gcc - # brew install protobuf - # brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/72457f0166d5619a83f508f2345b22d0617b5021/Formula/protobuf.rb - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip - unzip protoc-3.19.4-osx-x86_64.zip -d protoc - sudo mv protoc/bin/protoc /usr/local/bin/protoc - brew tap yoheimuta/protolint - brew install protolint - - if: matrix.os == 'windows-latest' - name: Install dependencies (windows-latest) - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - run: | - python -m pip install -U pip - echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64" - choco install protoc --version 3.19.4 - choco install mingw -y - choco install make -y - # to check make was installed - make --version - pip install tox - # wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win64.zip - # unzip protoc-3.19.4-win64.zip -d protoc - # sudo mv protoc/bin/protoc /usr/local/bin/protoc - python scripts/update_symlinks_cross_platform.py - make protolint_install_win - # just check protolint runs - protolint version - - if: True - name: Unit tests - run: | - tox -e py${{ matrix.python_version }} -- -m 'not integration and not unstable' - - name: Plugin tests - run: | - tox -e plugins-py${{ matrix.python_version }} -- -m 'not integration and not unstable' + - uses: actions/checkout@master + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python_version }} + - uses: actions/setup-go@v3 + with: + go-version: "^1.17.0" + - if: matrix.os == 'ubuntu-latest' + name: Install dependencies (ubuntu-latest) + run: | + sudo apt-get update --fix-missing + sudo apt-get install libmbedtls-dev + sudo apt-get autoremove + sudo apt-get autoclean + pip install tox + # install Protobuf compiler + wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip + unzip protoc-3.19.4-linux-x86_64.zip -d protoc + sudo mv protoc/bin/protoc /usr/local/bin/protoc + make protolint_install + # sudo apt-get install -y protobuf-compiler + # use sudo rm /var/lib/apt/lists/lock above in line above update if dependency install failures persist + # use sudo apt-get dist-upgrade above in line below update if dependency install failures persist + - if: matrix.os == 'macos-latest' + name: Install dependencies (macos-latest) + run: | + pip install tox + brew install gcc + # brew install protobuf + # brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/72457f0166d5619a83f508f2345b22d0617b5021/Formula/protobuf.rb + wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip + unzip protoc-3.19.4-osx-x86_64.zip -d protoc + sudo mv protoc/bin/protoc /usr/local/bin/protoc + brew tap yoheimuta/protolint + brew install protolint + - if: matrix.os == 'windows-latest' + name: Install dependencies (windows-latest) + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: | + python -m pip install -U pip + echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64" + choco install protoc --version 3.19.4 + choco install mingw -y + choco install make -y + # to check make was installed + make --version + pip install tox + # wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win64.zip + # unzip protoc-3.19.4-win64.zip -d protoc + # sudo mv protoc/bin/protoc /usr/local/bin/protoc + python scripts/update_symlinks_cross_platform.py + make protolint_install_win + # just check protolint runs + protolint version + - if: True + name: Unit tests + run: | + tox -e py${{ matrix.python_version }} -- -m 'not integration and not unstable' + - name: Plugin tests + run: | + tox -e plugins-py${{ matrix.python_version }} -- -m 'not integration and not unstable' platform_checks_sync_aea_loop: continue-on-error: True needs: - - common_checks_1 - - common_checks_2 - - common_checks_3 - - common_checks_4 - - plugins_install_check + - python_code_quality_checks + - go_code_checks + - misc_checks + - misc_checks_extra + - plugins_install_check runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 - with: - python-version: 3.8 - - uses: actions/setup-go@v3 - with: - go-version: '^1.17.0' - - name: Install dependencies (ubuntu-latest) - run: | - sudo apt-get update --fix-missing - sudo apt-get install libmbedtls-dev - sudo apt-get autoremove - sudo apt-get autoclean - pip install tox - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip - unzip protoc-3.19.4-linux-x86_64.zip -d protoc - sudo mv protoc/bin/protoc /usr/local/bin/protoc - make protolint_install - - name: Unit tests with sync agent loop - run: | - tox -e py3.8 -- --aea-loop sync -m 'not integration and not unstable' + - uses: actions/checkout@master + - uses: actions/setup-python@v3 + with: + python-version: 3.8 + - uses: actions/setup-go@v3 + with: + go-version: "^1.17.0" + - name: Install dependencies (ubuntu-latest) + run: | + sudo apt-get update --fix-missing + sudo apt-get install libmbedtls-dev + sudo apt-get autoremove + sudo apt-get autoclean + pip install tox + wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip + unzip protoc-3.19.4-linux-x86_64.zip -d protoc + sudo mv protoc/bin/protoc /usr/local/bin/protoc + make protolint_install + - name: Unit tests with sync agent loop + run: | + tox -e py3.8 -- --aea-loop sync -m 'not integration and not unstable' golang_checks: continue-on-error: True needs: - - common_checks_1 - - common_checks_2 - - common_checks_3 - - common_checks_4 - - plugins_install_check + - go_code_checks runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: + - ubuntu-latest + - macos-latest + - windows-latest python-version: [3.8] timeout-minutes: 45 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/setup-go@v3 - with: - go-version: '^1.17.0' - - if: matrix.os == 'macos-latest' - working-directory: ./libs/go/libp2p_node - run: | - export LINKPATH=`go env GOTOOLDIR`/link - echo $LINKPATH - sudo cp $LINKPATH ${LINKPATH}_orig - sudo cp link $LINKPATH - sudo chmod a+x $LINKPATH - - if: matrix.python-version == '3.8' - name: Golang unit tests (libp2p_node) - working-directory: ./libs/go/libp2p_node - run: make test - - if: matrix.python-version == '3.8' - name: Golang unit tests (aealite) - working-directory: ./libs/go/aealite - run: go test -p 1 -timeout 0 -count 1 -v ./... + - uses: actions/checkout@master + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/setup-go@v3 + with: + go-version: "^1.17.0" + - if: matrix.os == 'macos-latest' + working-directory: ./libs/go/libp2p_node + run: | + export LINKPATH=`go env GOTOOLDIR`/link + echo $LINKPATH + sudo cp $LINKPATH ${LINKPATH}_orig + sudo cp link $LINKPATH + sudo chmod a+x $LINKPATH + - if: matrix.python-version == '3.8' + name: Golang unit tests (libp2p_node) + working-directory: ./libs/go/libp2p_node + run: make test + - if: matrix.python-version == '3.8' + name: Golang unit tests (aealite) + working-directory: ./libs/go/aealite + run: go test -p 1 -timeout 0 -count 1 -v ./... libp2p_coverage: name: libp2p_coverage runs-on: ubuntu-latest @@ -514,47 +500,48 @@ jobs: coverage_checks: continue-on-error: True needs: - - integration_checks - - integration_checks_ledger - - platform_checks -# - platform_checks_sync_aea_loop + - python_code_quality_checks + - go_code_checks + - misc_checks + - misc_checks_extra + - docs_check + - plugins_install_check runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@master - - uses: actions/setup-python@v3 - with: - python-version: 3.8 - - uses: actions/setup-go@v3 - with: - go-version: '^1.17.0' - - name: Install dependencies (ubuntu-latest) - run: | - sudo apt-get update --fix-missing - sudo apt-get install libmbedtls-dev - sudo apt-get autoremove - sudo apt-get autoclean - pip install tox - pip install coverage - # install Protobuf compiler - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip - unzip protoc-3.19.4-linux-x86_64.zip -d protoc - sudo mv protoc/bin/protoc /usr/local/bin/protoc - make protolint_install - # sudo apt-get install -y protobuf-compiler - - name: Run all tests - run: | - tox -e py3.8-cov -- --ignore=tests/test_docs --ignore=tests/test_examples --ignore=tests/test_packages/test_skills_integration -m 'not unstable' - tox -e plugins-py3.8-cov -- --cov-append -m 'not unstable' - continue-on-error: true - - name: Show full coverage report - run: | - coverage report -m -i - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - fail_ci_if_error: false + - uses: actions/checkout@master + - uses: actions/setup-python@v3 + with: + python-version: 3.8 + - uses: actions/setup-go@v3 + with: + go-version: "^1.17.0" + - name: Install dependencies (ubuntu-latest) + run: | + sudo apt-get update --fix-missing + sudo apt-get install libmbedtls-dev + sudo apt-get autoremove + sudo apt-get autoclean + pip install tox + pip install coverage + # install Protobuf compiler + wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip + unzip protoc-3.19.4-linux-x86_64.zip -d protoc + sudo mv protoc/bin/protoc /usr/local/bin/protoc + make protolint_install + - name: Run all tests + run: | + tox -e py3.8-cov -- --ignore=tests/test_docs --ignore=tests/test_examples --ignore=tests/test_packages/test_skills_integration -m 'not unstable' + tox -e plugins-py3.8-cov -- --cov-append -m 'not unstable' + continue-on-error: true + - name: Show full coverage report + run: | + coverage report -m -i + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false diff --git a/.pylintrc b/.pylintrc index fb79c313ac..a5cadf23ad 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,7 +2,7 @@ ignore-patterns=__main__.py,.*_pb2.py,tac.sh,tac_local.sh [MESSAGES CONTROL] -disable=C0103,C0201,C0301,C0302,W0105,W0707,W1202,W1203,R0801 +disable=C0103,C0201,C0301,C0302,W0105,W0707,W1202,W1203,R0801,C0209,R1735 # See here for more options: https://www.codeac.io/documentation/pylint-configuration.html ## Eventually resolve these: @@ -19,6 +19,8 @@ disable=C0103,C0201,C0301,C0302,W0105,W0707,W1202,W1203,R0801 # C0302: http://pylint-messages.wikidot.com/messages:c0302 > Too many lines in module (%s) , # kept as no harm # W0105: pointless-string-statement, # kept as no harm # R0801: similar lines, # too granular +# C0209: Formatting a regular string which could be a f-string (consider-using-f-string) # to many usage atm +# R1735: Consider using {} instead of dict() (use-dict-literal) [IMPORTS] ignored-modules=bech32,ecdsa,lru,eth_typing,eth_keys,eth_account,ipfshttpclient,werkzeug,openapi_spec_validator,aiohttp,multidict,yoti_python_sdk,defusedxml,gym,fetch,matplotlib,memory_profiler,numpy,oef,openapi_core,psutil,tensorflow,temper,skimage,web3,aioprometheus,pyaes,Crypto,asn1crypto,cosmpy,google diff --git a/HISTORY.md b/HISTORY.md index b6c7ec7e4f..6cf817ad87 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,7 +1,22 @@ # Release History -## 1.2.1 (2022-10-17) +## 1.2.3(2022-11-03) + +AEA: +- core and development are dependencies updated. +- ci improvements +- cosmpy updated to 0.6.0 +- Small code format improvements and better linting + +Plugins: +- Small code format improvements +- cosmpy updated to 0.6.0 + +Packages: +- Small code format improvements + +## 1.2.2 (2022-10-17) AEA: - Dependency management switched from pipenv to poetry. diff --git a/aea/__version__.py b/aea/__version__.py index 98d9936f18..3abd5eabb6 100644 --- a/aea/__version__.py +++ b/aea/__version__.py @@ -22,7 +22,7 @@ __title__ = "aea" __description__ = "Autonomous Economic Agent framework" __url__ = "https://github.com/fetchai/agents-aea.git" -__version__ = "1.2.2" +__version__ = "1.2.3" __author__ = "Fetch.AI Limited" __license__ = "Apache-2.0" __copyright__ = "2022 Fetch.AI Limited" diff --git a/aea/abstract_agent.py b/aea/abstract_agent.py index 78c328f466..eee8f6adaa 100644 --- a/aea/abstract_agent.py +++ b/aea/abstract_agent.py @@ -18,7 +18,7 @@ # ------------------------------------------------------------------------------ """This module contains the interface definition of the abstract agent.""" import datetime -from abc import ABC, abstractmethod, abstractproperty +from abc import ABC, abstractmethod from typing import Any, Callable, Dict, List, Optional, Tuple from aea.mail.base import Envelope @@ -27,11 +27,13 @@ class AbstractAgent(ABC): """This class provides an abstract base interface for an agent.""" - @abstractproperty + @property + @abstractmethod def name(self) -> str: """Get agent's name.""" - @abstractproperty + @property + @abstractmethod def storage_uri(self) -> Optional[str]: """Return storage uri.""" diff --git a/aea/aea_builder.py b/aea/aea_builder.py index 1c4d240a11..4e9d4cc41f 100644 --- a/aea/aea_builder.py +++ b/aea/aea_builder.py @@ -415,7 +415,11 @@ def _reset(self, is_full_reset: bool = False) -> None: def _remove_components_from_dependency_manager(self) -> None: """Remove components added via 'add_component' from the dependency manager.""" - for component_type in self._component_instances.keys(): + for ( + component_type + ) in ( + self._component_instances.keys() + ): # pylint: disable=consider-using-dict-items for component_config in self._component_instances[component_type].keys(): self._package_dependency_manager.remove_component( component_config.component_id diff --git a/aea/agent.py b/aea/agent.py index b16d6127a2..e65a3e788c 100644 --- a/aea/agent.py +++ b/aea/agent.py @@ -215,7 +215,7 @@ def start(self) -> None: if was_started: self.runtime.wait_completed(sync=True) - else: #  pragma: nocover + else: # pragma: nocover raise AEAException("Failed to start runtime! Was it already started?") def handle_envelope(self, envelope: Envelope) -> None: diff --git a/aea/agent_loop.py b/aea/agent_loop.py index 50294b07f3..dc2ebb4dcb 100644 --- a/aea/agent_loop.py +++ b/aea/agent_loop.py @@ -110,12 +110,12 @@ def set_loop(self, loop: AbstractEventLoop) -> None: """Set event loop and all event loop related objects.""" self._loop: AbstractEventLoop = loop - def _setup(self) -> None: # pylint: disable=no-self-use + def _setup(self) -> None: """Set up agent loop before started.""" # start and stop methods are classmethods cause one instance shared across multiple threads ExecTimeoutThreadGuard.start() - def _teardown(self) -> None: # pylint: disable=no-self-use + def _teardown(self) -> None: """Tear down loop on stop.""" # start and stop methods are classmethods cause one instance shared across multiple threads ExecTimeoutThreadGuard.stop() @@ -295,10 +295,11 @@ def _execution_control( if self.agent.exception_handler(e, fn) is True: self._state.set(AgentLoopStates.error) raise - except Exception as e: + except Exception as e2: self._state.set(AgentLoopStates.error) - self._exceptions.append(e) + self._exceptions.append(e2) raise + return None def _register_periodic_task( self, diff --git a/aea/cli/config.py b/aea/cli/config.py index e76d4aee5d..def41754be 100644 --- a/aea/cli/config.py +++ b/aea/cli/config.py @@ -49,7 +49,7 @@ def get(ctx: Context, json_path: str) -> None: agent_config_manager = AgentConfigManager.load(ctx.cwd) value = agent_config_manager.get_variable(json_path) except (ValueError, AEAException) as e: - raise ClickException(*e.args) + raise ClickException(str(e.args[0])) if isinstance(value, dict): # turn it to json compatible string, not dict str representation @@ -101,4 +101,4 @@ def set_command( except ExtraPropertiesError as e: # pragma: nocover raise ClickException(f"Attribute `{e.args[0][0]}` is not allowed to change!") except (ValueError, AEAException) as e: - raise ClickException(*e.args) + raise ClickException(str(e.args[0])) diff --git a/aea/cli/fetch.py b/aea/cli/fetch.py index a86ed9c863..a9b060b7c5 100644 --- a/aea/cli/fetch.py +++ b/aea/cli/fetch.py @@ -18,8 +18,8 @@ # ------------------------------------------------------------------------------ """Implementation of the 'aea fetch' subcommand.""" import os -from distutils.dir_util import copy_tree from pathlib import Path +from shutil import copytree as copy_tree from typing import Optional, cast import click @@ -169,7 +169,7 @@ def fetch_agent_locally( os.makedirs(target_path) # pragma: nocover ctx.clean_paths.append(target_path) - copy_tree(source_path, target_path) + copy_tree(source_path, target_path, dirs_exist_ok=True) # type: ignore ctx.cwd = target_path try_to_load_agent_config(ctx) diff --git a/aea/cli/init.py b/aea/cli/init.py index 77f015aeda..c2d6d7c1dd 100644 --- a/aea/cli/init.py +++ b/aea/cli/init.py @@ -36,14 +36,16 @@ @click.command() @click.option("--author", type=str, required=False) @click.option("--reset", is_flag=True, help="To reset the initialization.") -@click.option("--local", is_flag=True, help="For init AEA locally.") +@click.option( + "--register", is_flag=True, help="To register the author in the AEA registry." +) @click.option("--no-subscribe", is_flag=True, help="For developers subscription.") @pass_ctx def init( # pylint: disable=unused-argument - ctx: Context, author: str, reset: bool, local: bool, no_subscribe: bool + ctx: Context, author: str, reset: bool, register: bool, no_subscribe: bool ) -> None: """Initialize your AEA configurations.""" - do_init(author, reset, not local, no_subscribe) + do_init(author, reset, register, no_subscribe) def do_init(author: str, reset: bool, registry: bool, no_subscribe: bool) -> None: diff --git a/aea/cli/registry/publish.py b/aea/cli/registry/publish.py index ab37670797..31493d9091 100644 --- a/aea/cli/registry/publish.py +++ b/aea/cli/registry/publish.py @@ -87,9 +87,11 @@ def publish_agent(ctx: Context) -> None: files = {} try: - files["file"] = open(output_tar, "rb") + files["file"] = open(output_tar, "rb") # pylint: disable=consider-using-with if is_readme_present(readme_source_path): - files["readme"] = open(readme_source_path, "rb") + files["readme"] = open( # pylint: disable=consider-using-with + readme_source_path, "rb" + ) path = "/agents/create" logger.debug("Publishing agent {} to Registry ...".format(name)) resp = cast( diff --git a/aea/cli/registry/push.py b/aea/cli/registry/push.py index b97bbdce43..82f06823e6 100644 --- a/aea/cli/registry/push.py +++ b/aea/cli/registry/push.py @@ -160,10 +160,14 @@ def push_item(ctx: Context, item_type: str, item_id: PublicId) -> None: click.echo(f"Error: Cannot find {package_type} {package_id} in registry!") raise click.ClickException("Found missing dependencies! Push canceled!") try: - files = {"file": open(output_filepath, "rb")} + files = { + "file": open(output_filepath, "rb") # pylint: disable=consider-using-with + } readme_path = os.path.join(item_path, DEFAULT_README_FILE) if is_readme_present(readme_path): - files["readme"] = open(readme_path, "rb") + files["readme"] = open( # pylint: disable=consider-using-with + readme_path, "rb" + ) path = "/{}/create".format(item_type_plural) logger.debug("Pushing {} {} to Registry ...".format(item_id.name, item_type)) diff --git a/aea/cli/registry/utils.py b/aea/cli/registry/utils.py index d747448202..c6843dc570 100644 --- a/aea/cli/registry/utils.py +++ b/aea/cli/registry/utils.py @@ -96,7 +96,7 @@ def request_api( logger.debug("Successfully created!") elif resp.status_code == 403: raise click.ClickException( - "You are not authenticated. " 'Please sign in with "aea login" command.' + """You are not authenticated. 'Please sign in with "aea login" command.""" ) elif resp.status_code == 500: raise click.ClickException( @@ -182,7 +182,7 @@ def extract(source: str, target: str) -> None: :param target: str path to target directory. """ if source.endswith("tar.gz"): - tar = tarfile.open(source, "r:gz") + tar = tarfile.open(source, "r:gz") # pylint: disable=consider-using-with tar.extractall(path=target) tar.close() else: diff --git a/aea/cli/remove.py b/aea/cli/remove.py index d9b55f06d5..0806fcdb56 100644 --- a/aea/cli/remove.py +++ b/aea/cli/remove.py @@ -253,7 +253,7 @@ def check_remove( item, package_id ) can_be_removed = set() - can_not_be_removed = dict() + can_not_be_removed = {} for dep_key, deps in item_deps.items(): if agent_deps[dep_key] == deps: diff --git a/aea/cli/run.py b/aea/cli/run.py index 72037bb946..fc16c7849a 100644 --- a/aea/cli/run.py +++ b/aea/cli/run.py @@ -166,7 +166,7 @@ def _profiling_context(period: int) -> Generator: import os # pylint: disable=import-outside-toplevel import sys # pylint: disable=import-outside-toplevel - sys.stderr = open(os.devnull, "w") + sys.stderr = open(os.devnull, "w", encoding="utf-8") def run_aea( diff --git a/aea/cli/scaffold.py b/aea/cli/scaffold.py index 093780c2d8..6853734f27 100644 --- a/aea/cli/scaffold.py +++ b/aea/cli/scaffold.py @@ -192,8 +192,12 @@ def scaffold_item(ctx: Context, item_type: str, item_name: str) -> None: if not file_path.exists(): continue py_file = Path(file_path) - py_file.write_text( - re.sub(SCAFFOLD_PUBLIC_ID, str(new_public_id), py_file.read_text()) + py_file.write_text( # pylint: disable=unspecified-encoding + re.sub( + SCAFFOLD_PUBLIC_ID, + str(new_public_id), + py_file.read_text(), # pylint: disable=unspecified-encoding + ) ) # fingerprint item. @@ -274,7 +278,9 @@ def _scaffold_non_package_item( ) ctx.agent_loader.dump( ctx.agent_config, - open_file(os.path.join(ctx.cwd, DEFAULT_AEA_CONFIG_FILE), "w"), + open_file( + os.path.join(ctx.cwd, DEFAULT_AEA_CONFIG_FILE), "w", encoding="utf-8" + ), ) except Exception as e: diff --git a/aea/cli/upgrade.py b/aea/cli/upgrade.py index a1c87a2fdc..74c2899028 100644 --- a/aea/cli/upgrade.py +++ b/aea/cli/upgrade.py @@ -658,7 +658,7 @@ def _compute_replacements( """Compute replacements from old component ids to new components ids.""" agent_config = load_item_config(PackageType.AGENT.value, Path(ctx.cwd)) new_component_ids = list(agent_config.package_dependencies) - replacements: Dict[ComponentId, ComponentId] = dict() + replacements: Dict[ComponentId, ComponentId] = {} for old_component_id in old_component_ids: same_prefix = list(filter(old_component_id.same_prefix, new_component_ids)) enforce(len(same_prefix) < 2, "More than one component id found.") diff --git a/aea/cli/utils/click_utils.py b/aea/cli/utils/click_utils.py index a1737fc0b1..ecac72e051 100644 --- a/aea/cli/utils/click_utils.py +++ b/aea/cli/utils/click_utils.py @@ -88,7 +88,9 @@ def get_metavar(self, param: Any) -> str: """Return the metavar default for this param if it provides one.""" return "PUBLIC_ID" - def convert(self, value: str, param: Any, ctx: Optional[click.Context]) -> PublicId: + def convert( # pylint: disable=inconsistent-return-statements + self, value: str, param: Any, ctx: Optional[click.Context] + ) -> PublicId: """Convert the value. This is not invoked for values that are `None` (the missing value).""" try: return PublicId.from_str(value) diff --git a/aea/cli/utils/context.py b/aea/cli/utils/context.py index 2773972b2a..69dc41dc41 100644 --- a/aea/cli/utils/context.py +++ b/aea/cli/utils/context.py @@ -50,7 +50,7 @@ class Context: def __init__(self, cwd: str, verbosity: str, registry_path: Optional[str]) -> None: """Init the context.""" - self.config = dict() # type: Dict + self.config = {} # type: Dict self.cwd = cwd self.verbosity = verbosity self.clean_paths: List = [] @@ -193,5 +193,7 @@ def get_dependencies(self) -> Dependencies: def dump_agent_config(self) -> None: """Dump the current agent configuration.""" - with open(os.path.join(self.cwd, DEFAULT_AEA_CONFIG_FILE), "w") as f: + with open( + os.path.join(self.cwd, DEFAULT_AEA_CONFIG_FILE), "w", encoding="utf-8" + ) as f: self.agent_loader.dump(self.agent_config, f) diff --git a/aea/components/loader.py b/aea/components/loader.py index 33870a3d60..30386e2b71 100644 --- a/aea/components/loader.py +++ b/aea/components/loader.py @@ -52,7 +52,7 @@ def component_type_to_class(component_type: ComponentType) -> Type[Component]: return type_to_class[component_type] -def load_component_from_config( # type: ignore +def load_component_from_config( # type: ignore # pylint: disable=inconsistent-return-statements #pylint mistake configuration: ComponentConfiguration, *args, **kwargs ) -> Component: """ diff --git a/aea/configurations/base.py b/aea/configurations/base.py index 463ba5fab7..579a40b46e 100644 --- a/aea/configurations/base.py +++ b/aea/configurations/base.py @@ -447,7 +447,7 @@ def _apply_params_to_instance( if instance is None: instance = cls(**params) else: - instance.__init__(**params) # type: ignore + instance.__init__(**params) # type: ignore # pylint: disable=unnecessary-dunder-call if directory and not instance.directory: instance.directory = directory @@ -930,7 +930,7 @@ def _apply_params_to_instance( if instance is None: instance = cls(**params) else: # pragma: nocover - instance.__init__(**params) # type: ignore + instance.__init__(**params) # type: ignore # pylint: disable=unnecessary-dunder-call return instance diff --git a/aea/configurations/data_types.py b/aea/configurations/data_types.py index 601e886f34..5212ff7737 100644 --- a/aea/configurations/data_types.py +++ b/aea/configurations/data_types.py @@ -71,6 +71,7 @@ def json(self) -> Dict: """Compute the JSON representation.""" @classmethod + @abstractmethod def from_json(cls, obj: Dict) -> "JSONSerializable": """Build from a JSON object.""" diff --git a/aea/configurations/validation.py b/aea/configurations/validation.py index d901fd061f..c8147cc6f6 100644 --- a/aea/configurations/validation.py +++ b/aea/configurations/validation.py @@ -237,7 +237,10 @@ def _validate(self, instance: Dict) -> None: @staticmethod def _build_message_from_errors(errors: List[jsonschema.ValidationError]) -> str: """Build an error message from validation errors.""" - path = lambda error: ".".join(list(error.path)) # noqa # type: ignore + + def path(error): # type: ignore + return ".".join(list(error.path)) + result = [f"{path(error)}: {error.message}" for error in errors] return "The following errors occurred during validation:\n - " + "\n - ".join( result diff --git a/aea/crypto/registries/base.py b/aea/crypto/registries/base.py index 60eb33de6a..fac7342bce 100644 --- a/aea/crypto/registries/base.py +++ b/aea/crypto/registries/base.py @@ -80,7 +80,7 @@ def __init__(self, seq: Union["EntryPoint", str]) -> None: if match is None: # actual match done in base class - raise ValueError("No match found!") #  pragma: nocover + raise ValueError("No match found!") # pragma: nocover self._import_path = match.group(1) self._class_name = match.group(2) diff --git a/aea/decision_maker/base.py b/aea/decision_maker/base.py index bc0f79746c..10811c32ae 100644 --- a/aea/decision_maker/base.py +++ b/aea/decision_maker/base.py @@ -154,7 +154,7 @@ def __init__(self, access_code: str) -> None: super().__init__() self._access_code_hash = _hash(access_code) - def put( # pylint: disable=arguments-differ + def put( # pylint: disable=arguments-differ,arguments-renamed self, internal_message: Optional[Message], block: bool = True, @@ -180,7 +180,7 @@ def put( # pylint: disable=arguments-differ raise ValueError("Only messages are allowed!") super().put(internal_message, block=True, timeout=None) - def put_nowait( # pylint: disable=arguments-differ + def put_nowait( # pylint: disable=arguments-differ,arguments-renamed self, internal_message: Optional[Message] ) -> None: """ diff --git a/aea/decision_maker/gop.py b/aea/decision_maker/gop.py index dbeb703d30..826da8fbaf 100644 --- a/aea/decision_maker/gop.py +++ b/aea/decision_maker/gop.py @@ -94,7 +94,7 @@ def __init__(self) -> None: self._amount_by_currency_id = None # type: Optional[CurrencyHoldings] self._quantities_by_good_id = None # type: Optional[GoodHoldings] - def set( # pylint: disable=arguments-differ + def set( # pylint: disable=arguments-differ,arguments-renamed self, amount_by_currency_id: CurrencyHoldings = None, quantities_by_good_id: GoodHoldings = None, @@ -119,7 +119,7 @@ def set( # pylint: disable=arguments-differ self._amount_by_currency_id = copy.copy(amount_by_currency_id) self._quantities_by_good_id = copy.copy(quantities_by_good_id) - def apply_delta( # pylint: disable=arguments-differ + def apply_delta( # pylint: disable=arguments-differ,arguments-renamed self, delta_amount_by_currency_id: Dict[str, int] = None, delta_quantities_by_good_id: Dict[str, int] = None, @@ -144,19 +144,19 @@ def apply_delta( # pylint: disable=arguments-differ ) enforce( all( - [ + ( key in self._amount_by_currency_id for key in delta_amount_by_currency_id.keys() - ] + ) ), "Invalid keys present in delta_amount_by_currency_id.", ) enforce( all( - [ + ( key in self._quantities_by_good_id for key in delta_quantities_by_good_id.keys() - ] + ) ), "Invalid keys present in delta_quantities_by_good_id.", ) @@ -288,7 +288,7 @@ def __init__(self) -> None: self._exchange_params_by_currency_id = None # type: Optional[ExchangeParams] self._utility_params_by_good_id = None # type: Optional[UtilityParams] - def set( # pylint: disable=arguments-differ + def set( # pylint: disable=arguments-differ,arguments-renamed self, exchange_params_by_currency_id: ExchangeParams = None, utility_params_by_good_id: UtilityParams = None, @@ -383,7 +383,7 @@ def utility( score = goods_score + currency_score return score - def marginal_utility( # pylint: disable=arguments-differ + def marginal_utility( # pylint: disable=arguments-differ,arguments-renamed self, ownership_state: BaseOwnershipState, delta_quantities_by_good_id: Optional[GoodHoldings] = None, diff --git a/aea/helpers/async_utils.py b/aea/helpers/async_utils.py index 8c6db9c710..265a4f0129 100644 --- a/aea/helpers/async_utils.py +++ b/aea/helpers/async_utils.py @@ -420,9 +420,10 @@ def start(self) -> bool: if self._threaded: self._thread = Thread( - target=self._thread_target, name=self.__class__.__name__ # type: ignore # loop was set in set_loop + target=self._thread_target, + name=self.__class__.__name__, # type: ignore # loop was set in set_loop + daemon=True, ) - self._thread.setDaemon(True) self._thread.start() self._stop_called = 0 return True diff --git a/aea/helpers/base.py b/aea/helpers/base.py index b51330d25b..453ef3b5d4 100644 --- a/aea/helpers/base.py +++ b/aea/helpers/base.py @@ -395,7 +395,7 @@ def _is_dict_like(obj: Any) -> bool: :param obj: the object to test. :return: True if the object is dict-like, False otherwise. """ - return type(obj) in {dict, OrderedDict} + return type(obj) in (dict, OrderedDict) def recursive_update( @@ -822,7 +822,7 @@ def public_key_or_identifier(self) -> str: result = self.key_identifier return result - def get_message(self, public_key: str) -> bytes: # pylint: disable=no-self-use + def get_message(self, public_key: str) -> bytes: """Get the message to sign.""" message = self.construct_message( public_key, diff --git a/aea/helpers/install_dependency.py b/aea/helpers/install_dependency.py index a66541dbba..4d9d91523a 100644 --- a/aea/helpers/install_dependency.py +++ b/aea/helpers/install_dependency.py @@ -109,13 +109,6 @@ def run_install_subprocess( :param install_timeout: timeout to wait pip to install :return: the return code of the subprocess """ - try: - subp = subprocess.Popen(install_command) # nosec + with subprocess.Popen(install_command) as subp: # nosec subp.wait(install_timeout) - return_code = subp.returncode - finally: - poll = subp.poll() - if poll is None: # pragma: no cover - subp.terminate() - subp.wait(30) - return return_code + return subp.returncode diff --git a/aea/helpers/profiling.py b/aea/helpers/profiling.py index 03e0959394..3a401cb457 100644 --- a/aea/helpers/profiling.py +++ b/aea/helpers/profiling.py @@ -110,10 +110,11 @@ def set_counters(self) -> None: def make_fn(obj: Any) -> Callable: orig_new = obj.__new__ # pylint: disable=protected-access # type: ignore + obj_copy = obj @wraps(orig_new) def new(*args: Any, **kwargs: Any) -> Callable: - self._counter[obj] += 1 + self._counter[obj_copy] += 1 if orig_new is object.__new__: return orig_new(args[0]) # pragma: nocover return orig_new(*args, **kwargs) # pragma: nocover @@ -179,8 +180,7 @@ def get_objects_instances(self) -> Dict: """Return dict with counted object instances present now.""" result: Dict = Counter() - lock.acquire() - try: + with lock: for obj_type in self._objects_instances_to_count: result[obj_type.__name__] += 0 @@ -188,8 +188,6 @@ def get_objects_instances(self) -> Dict: for obj_type in self._objects_instances_to_count: if isinstance(obj, obj_type): result[obj_type.__name__] += 1 - finally: - lock.release() return result def get_objecst_created(self) -> Dict: diff --git a/aea/helpers/search/models.py b/aea/helpers/search/models.py index b7bffa1922..34ab644f91 100644 --- a/aea/helpers/search/models.py +++ b/aea/helpers/search/models.py @@ -37,8 +37,8 @@ cast, ) -import aea.helpers.search.models_pb2 as models_pb2 from aea.exceptions import enforce +from aea.helpers.search import models_pb2 _default_logger = logging.getLogger(__name__) @@ -833,13 +833,13 @@ def encode(self) -> Optional[Any]: """ encoding: Optional[Any] = None - if ( - self.type == ConstraintTypes.EQUAL - or self.type == ConstraintTypes.NOT_EQUAL - or self.type == ConstraintTypes.LESS_THAN - or self.type == ConstraintTypes.LESS_THAN_EQ - or self.type == ConstraintTypes.GREATER_THAN - or self.type == ConstraintTypes.GREATER_THAN_EQ + if self.type in ( + ConstraintTypes.EQUAL, + ConstraintTypes.NOT_EQUAL, + ConstraintTypes.LESS_THAN, + ConstraintTypes.LESS_THAN_EQ, + ConstraintTypes.GREATER_THAN, + ConstraintTypes.GREATER_THAN_EQ, ): relation = models_pb2.Query.Relation() # type: ignore @@ -890,7 +890,7 @@ def encode(self) -> Optional[Any]: range_.double_pair.CopyFrom(values) encoding = range_ - elif self.type == ConstraintTypes.IN or self.type == ConstraintTypes.NOT_IN: + elif self.type in (ConstraintTypes.IN, ConstraintTypes.NOT_IN): set_ = models_pb2.Query.Set() # type: ignore if self.type == ConstraintTypes.IN: @@ -1069,7 +1069,9 @@ def is_valid(self, data_model: DataModel) -> bool: :return: ``True`` if the constraint expression is valid wrt the data model, ``False`` otherwise. """ - def check_validity(self) -> None: # pylint: disable=no-self-use # pragma: nocover + def check_validity( # noqa: B027 + self, + ) -> None: # pragma: nocover """ Check whether a Constraint Expression satisfies some basic requirements. @@ -1455,21 +1457,18 @@ def encode(self) -> models_pb2.Query.ConstraintExpr.Constraint: # type: ignore constraint = models_pb2.Query.ConstraintExpr.Constraint() # type: ignore constraint.attribute_name = self.attribute_name - if ( - self.constraint_type.type == ConstraintTypes.EQUAL - or self.constraint_type.type == ConstraintTypes.NOT_EQUAL - or self.constraint_type.type == ConstraintTypes.LESS_THAN - or self.constraint_type.type == ConstraintTypes.LESS_THAN_EQ - or self.constraint_type.type == ConstraintTypes.GREATER_THAN - or self.constraint_type.type == ConstraintTypes.GREATER_THAN_EQ + if self.constraint_type.type in ( + ConstraintTypes.EQUAL, + ConstraintTypes.NOT_EQUAL, + ConstraintTypes.LESS_THAN, + ConstraintTypes.LESS_THAN_EQ, + ConstraintTypes.GREATER_THAN, + ConstraintTypes.GREATER_THAN_EQ, ): constraint.relation.CopyFrom(self.constraint_type.encode()) elif self.constraint_type.type == ConstraintTypes.WITHIN: constraint.range_.CopyFrom(self.constraint_type.encode()) - elif ( - self.constraint_type.type == ConstraintTypes.IN - or self.constraint_type.type == ConstraintTypes.NOT_IN - ): + elif self.constraint_type.type in (ConstraintTypes.IN, ConstraintTypes.NOT_IN): constraint.set_.CopyFrom(self.constraint_type.encode()) elif self.constraint_type.type == ConstraintTypes.DISTANCE: constraint.distance.CopyFrom(self.constraint_type.encode()) diff --git a/aea/helpers/serializers.py b/aea/helpers/serializers.py index 28bd0c8a45..80acb2132b 100644 --- a/aea/helpers/serializers.py +++ b/aea/helpers/serializers.py @@ -73,7 +73,7 @@ def _str_to_bytes(cls, value: str) -> bytes: @classmethod def _patch_dict(cls, dictionnary: Dict[str, Any]) -> None: - need_patch: Dict[str, bool] = dict() + need_patch: Dict[str, bool] = {} for key, value in dictionnary.items(): new_value, patch_needed = cls._patch_value(value) if patch_needed: diff --git a/aea/helpers/transaction/base.py b/aea/helpers/transaction/base.py index 7c54d958b8..235085072c 100644 --- a/aea/helpers/transaction/base.py +++ b/aea/helpers/transaction/base.py @@ -572,20 +572,20 @@ def _check_consistency(self) -> None: enforce( isinstance(self._amount_by_currency_id, dict) and all( - [ + ( isinstance(key, str) and isinstance(value, int) for key, value in self._amount_by_currency_id.items() - ] + ) ), "amount_by_currency_id must be a dictionary with str keys and int values.", ) enforce( isinstance(self._quantities_by_good_id, dict) and all( - [ + ( isinstance(key, str) and isinstance(value, int) for key, value in self._quantities_by_good_id.items() - ] + ) ), "quantities_by_good_id must be a dictionary with str keys and int values.", ) @@ -599,35 +599,35 @@ def _check_consistency(self) -> None: or ( isinstance(self._fee_by_currency_id, dict) and all( - [ + ( isinstance(key, str) and isinstance(value, int) and value >= 0 for key, value in self._fee_by_currency_id.items() - ] + ) ) ), "fee must be None or Dict[str, int] with positive fees only.", ) enforce( all( - [ + ( key in self._amount_by_currency_id for key in self._fee_by_currency_id.keys() - ] + ) ), "Fee dictionary has keys which are not present in amount dictionary.", ) if self._is_strict: is_pos_amounts = all( - [amount >= 0 for amount in self._amount_by_currency_id.values()] + (amount >= 0 for amount in self._amount_by_currency_id.values()) ) is_neg_amounts = all( - [amount <= 0 for amount in self._amount_by_currency_id.values()] + (amount <= 0 for amount in self._amount_by_currency_id.values()) ) is_pos_quantities = all( - [quantity >= 0 for quantity in self._quantities_by_good_id.values()] + (quantity >= 0 for quantity in self._quantities_by_good_id.values()) ) is_neg_quantities = all( - [quantity <= 0 for quantity in self._quantities_by_good_id.values()] + (quantity <= 0 for quantity in self._quantities_by_good_id.values()) ) enforce( (is_pos_amounts and is_neg_quantities) diff --git a/aea/launcher.py b/aea/launcher.py index 18ca7adc45..289c2c2129 100644 --- a/aea/launcher.py +++ b/aea/launcher.py @@ -236,7 +236,7 @@ def start(self) -> Tuple[Callable, Sequence[Any]]: def stop(self) -> None: """Stop task.""" - if not self._future: #  pragma: nocover + if not self._future: # pragma: nocover _default_logger.debug("Stop called, but no future set.") return if self._future.done(): diff --git a/aea/multiplexer.py b/aea/multiplexer.py index 77885be587..2453b4455b 100644 --- a/aea/multiplexer.py +++ b/aea/multiplexer.py @@ -380,7 +380,7 @@ async def _stop_receive_send_loops(self) -> None: def _check_and_set_disconnected_state(self) -> None: """Check every connection is disconnected and set disconnected state.""" - if all([c.is_disconnected for c in self.connections]): + if all((c.is_disconnected for c in self.connections)): self.connection_status.set(ConnectionStates.disconnected) else: connections_left = [ diff --git a/aea/protocols/base.py b/aea/protocols/base.py index c6dc38e871..f3606cd1c4 100644 --- a/aea/protocols/base.py +++ b/aea/protocols/base.py @@ -230,7 +230,7 @@ def _update_slots_from_dict(self, data: dict) -> None: for key, value in data.items(): self.set(key, value) - def _is_consistent(self) -> bool: # pylint: disable=no-self-use + def _is_consistent(self) -> bool: """Check that the data is consistent.""" return True diff --git a/aea/protocols/dialogue/base.py b/aea/protocols/dialogue/base.py index 34ed71cd6f..2e77ae71e5 100644 --- a/aea/protocols/dialogue/base.py +++ b/aea/protocols/dialogue/base.py @@ -963,7 +963,7 @@ def _update_dialogue_label(self, final_dialogue_label: DialogueLabel) -> None: ) self._dialogue_label = final_dialogue_label - def _custom_validation( # pylint: disable=no-self-use,unused-argument + def _custom_validation( # pylint: disable=unused-argument self, message: Message ) -> Tuple[bool, str]: """ @@ -1802,9 +1802,8 @@ def _complete_dialogue_reference(self, message: Message) -> None: """ complete_dialogue_reference = message.dialogue_reference enforce( - complete_dialogue_reference[0] != Dialogue.UNASSIGNED_DIALOGUE_REFERENCE - and complete_dialogue_reference[1] - != Dialogue.UNASSIGNED_DIALOGUE_REFERENCE, + Dialogue.UNASSIGNED_DIALOGUE_REFERENCE + not in (complete_dialogue_reference[0], complete_dialogue_reference[1]), "Only complete dialogue references allowed.", ) diff --git a/aea/protocols/generator/base.py b/aea/protocols/generator/base.py index 1b0aad019f..5e0b28cdc9 100644 --- a/aea/protocols/generator/base.py +++ b/aea/protocols/generator/base.py @@ -471,7 +471,7 @@ def _check_content_type_str(self, content_name: str, content_type: str) -> str: self._change_indent(1) check_str += self.indent + "enforce(\n" self._change_indent(1) - dict_key_value_types = dict() + dict_key_value_types = {} for element_type in element_types: if element_type.startswith("Dict"): dict_key_value_types[ @@ -1784,9 +1784,7 @@ def _serialization_class_str(self) -> str: self.protocol_specification_in_camel_case ) ) - cls_str += ( - self.indent + "performative_content = dict() # type: Dict[str, Any]\n" - ) + cls_str += self.indent + "performative_content = {} # type: Dict[str, Any]\n" counter = 1 for performative, contents in self.spec.speech_acts.items(): if counter == 1: diff --git a/aea/protocols/generator/common.py b/aea/protocols/generator/common.py index 888c44caaf..c81b32cbf8 100644 --- a/aea/protocols/generator/common.py +++ b/aea/protocols/generator/common.py @@ -174,7 +174,7 @@ def _get_sub_types_of_compositional_types(compositional_type: str) -> Tuple[str, :param compositional_type: the compositional type string whose sub-types are to be extracted. :return: tuple containing all extracted sub-types. """ - sub_types_list = list() + sub_types_list = [] for valid_compositional_type in ( SPECIFICATION_COMPOSITIONAL_TYPES + PYTHON_COMPOSITIONAL_TYPES ): diff --git a/aea/protocols/generator/extract_specification.py b/aea/protocols/generator/extract_specification.py index 2e934b7da7..c9e856efdb 100644 --- a/aea/protocols/generator/extract_specification.py +++ b/aea/protocols/generator/extract_specification.py @@ -148,18 +148,18 @@ class PythonicProtocolSpecification: # pylint: disable=too-few-public-methods def __init__(self) -> None: """Instantiate a Pythonic protocol specification.""" - self.speech_acts = dict() # type: Dict[str, Dict[str, str]] - self.all_performatives = list() # type: List[str] - self.all_unique_contents = dict() # type: Dict[str, str] - self.all_custom_types = list() # type: List[str] - self.custom_custom_types = dict() # type: Dict[str, str] + self.speech_acts = {} # type: Dict[str, Dict[str, str]] + self.all_performatives = [] # type: List[str] + self.all_unique_contents = {} # type: Dict[str, str] + self.all_custom_types = [] # type: List[str] + self.custom_custom_types = {} # type: Dict[str, str] # dialogue config - self.initial_performatives = list() # type: List[str] - self.reply = dict() # type: Dict[str, List[str]] - self.terminal_performatives = list() # type: List[str] - self.roles = list() # type: List[str] - self.end_states = list() # type: List[str] + self.initial_performatives = [] # type: List[str] + self.reply = {} # type: Dict[str, List[str]] + self.terminal_performatives = [] # type: List[str] + self.roles = [] # type: List[str] + self.end_states = [] # type: List[str] self.keep_terminal_state_dialogues = False # type: bool self.typing_imports = { diff --git a/aea/protocols/generator/validate.py b/aea/protocols/generator/validate.py index 27d5417150..2c79314a58 100644 --- a/aea/protocols/generator/validate.py +++ b/aea/protocols/generator/validate.py @@ -394,7 +394,7 @@ def _validate_speech_acts_section( custom_types_set = set() performatives_set = set() - content_names_types: Dict[str, Tuple[str, str]] = dict() + content_names_types: Dict[str, Tuple[str, str]] = {} # check that speech-acts definition is not empty if len(protocol_specification.speech_acts.read_all()) == 0: diff --git a/aea/registries/base.py b/aea/registries/base.py index 20b50a64df..2955f44c88 100644 --- a/aea/registries/base.py +++ b/aea/registries/base.py @@ -129,7 +129,7 @@ def __init__(self) -> None: super().__init__() self._public_id_to_item: Dict[PublicId, Item] = {} - def register( # pylint: disable=arguments-differ,unused-argument + def register( # pylint: disable=arguments-differ,unused-argument,arguments-renamed self, public_id: PublicId, item: Item, is_dynamically_added: bool = False ) -> None: """Register an item.""" @@ -141,7 +141,7 @@ def register( # pylint: disable=arguments-differ,unused-argument raise ValueError(f"Item already registered with item id '{public_id}'") self._public_id_to_item[public_id] = item - def unregister( # pylint: disable=arguments-differ + def unregister( # pylint: disable=arguments-differ,arguments-renamed self, public_id: PublicId ) -> Item: """Unregister an item.""" @@ -150,7 +150,7 @@ def unregister( # pylint: disable=arguments-differ item = self._public_id_to_item.pop(public_id) return item - def fetch( # pylint: disable=arguments-differ + def fetch( # pylint: disable=arguments-differ,arguments-renamed self, public_id: PublicId ) -> Optional[Item]: """ @@ -201,7 +201,7 @@ def __init__(self, **kwargs: Any) -> None: self._components_by_type: Dict[ComponentType, Dict[PublicId, Component]] = {} self._registered_keys: Set[ComponentId] = set() - def register( # pylint: disable=arguments-differ,unused-argument + def register( # pylint: disable=arguments-differ,unused-argument,arguments-renamed self, component_id: ComponentId, component: Component, @@ -255,7 +255,7 @@ def _unregister(self, component_id: ComponentId) -> Optional[Component]: ) return item - def unregister( # pylint: disable=arguments-differ + def unregister( # pylint: disable=arguments-differ,arguments-renamed self, component_id: ComponentId ) -> Optional[Component]: """ @@ -270,7 +270,7 @@ def unregister( # pylint: disable=arguments-differ ) return self._unregister(component_id) - def fetch( # pylint: disable=arguments-differ + def fetch( # pylint: disable=arguments-differ,arguments-renamed self, component_id: ComponentId ) -> Optional[Component]: """ diff --git a/aea/runtime.py b/aea/runtime.py index 27d91577ff..6b2269ebc9 100644 --- a/aea/runtime.py +++ b/aea/runtime.py @@ -227,7 +227,7 @@ def decision_maker(self) -> DecisionMaker: def _set_task(self) -> None: """Set task.""" if self._loop is None: - raise ValueError("Loop not set!") #  pragma: nocover + raise ValueError("Loop not set!") # pragma: nocover self._task = self._loop.create_task(self._run_wrapper()) diff --git a/aea/skills/base.py b/aea/skills/base.py index 793c4ef7fa..2fbd6f4b18 100644 --- a/aea/skills/base.py +++ b/aea/skills/base.py @@ -412,7 +412,7 @@ def act(self) -> None: :return: None """ - def is_done(self) -> bool: # pylint: disable=no-self-use + def is_done(self) -> bool: """Return True if the behaviour is terminated, False otherwise.""" return False @@ -429,7 +429,7 @@ def act_wrapper(self) -> None: ) @classmethod - def parse_module( # pylint: disable=arguments-differ + def parse_module( # pylint: disable=arguments-differ,arguments-renamed cls, path: str, behaviour_configs: Dict[str, SkillComponentConfiguration], @@ -488,7 +488,7 @@ def handle_wrapper(self, message: Message) -> None: ) @classmethod - def parse_module( # pylint: disable=arguments-differ + def parse_module( # pylint: disable=arguments-differ,arguments-renamed cls, path: str, handler_configs: Dict[str, SkillComponentConfiguration], @@ -544,7 +544,7 @@ def teardown(self) -> None: super_obj.teardown() # type: ignore # pylint: disable=no-member @classmethod - def parse_module( # pylint: disable=arguments-differ + def parse_module( # pylint: disable=arguments-differ,arguments-renamed cls, path: str, model_configs: Dict[str, SkillComponentConfiguration], diff --git a/aea/test_tools/test_cases.py b/aea/test_tools/test_cases.py index 9f192a71cb..823b084edb 100644 --- a/aea/test_tools/test_cases.py +++ b/aea/test_tools/test_cases.py @@ -204,7 +204,7 @@ def _run_python_subprocess(cls, *args: str, cwd: str = ".") -> subprocess.Popen: ) kwargs.update(win_popen_kwargs()) - process = subprocess.Popen( # type: ignore # nosec # mypy fails on **kwargs + process = subprocess.Popen( # type: ignore # nosec # mypy fails on **kwargs # pylint: disable=consider-using-with [sys.executable, *args], **kwargs, ) @@ -325,10 +325,10 @@ def is_allowed_diff_in_agent_config( "required_ledgers", ] result = all( - [key in allowed_diff_keys for key in content1_agentconfig.keys()] + (key in allowed_diff_keys for key in content1_agentconfig.keys()) ) result = result and all( - [key in allowed_diff_keys for key in content2_agentconfig.keys()] + (key in allowed_diff_keys for key in content2_agentconfig.keys()) ) if not result: return result, content1_agentconfig, content2_agentconfig @@ -460,13 +460,13 @@ def is_successfully_terminated(cls, *subprocesses: subprocess.Popen) -> bool: if not subprocesses: subprocesses = tuple(cls.subprocesses) - all_terminated = all([process.returncode == 0 for process in subprocesses]) + all_terminated = all((process.returncode == 0 for process in subprocesses)) return all_terminated @classmethod def initialize_aea(cls, author: str) -> None: """Initialize AEA locally with author name.""" - cls.run_cli_command("init", "--local", "--author", author, cwd=cls._get_cwd()) + cls.run_cli_command("init", "--author", author, cwd=cls._get_cwd()) @classmethod def add_item(cls, item_type: str, public_id: str, local: bool = True) -> Result: diff --git a/aea/test_tools/test_skill.py b/aea/test_tools/test_skill.py index afbf3514e3..f24efd7637 100644 --- a/aea/test_tools/test_skill.py +++ b/aea/test_tools/test_skill.py @@ -182,7 +182,7 @@ def build_incoming_message( if is_agent_to_agent_messages else COUNTERPARTY_SKILL_ADDRESS ) - message_attributes = dict() # type: Dict[str, Any] + message_attributes = {} # type: Dict[str, Any] default_dialogue_reference = Dialogues.new_self_initiated_dialogue_reference() dialogue_reference = ( diff --git a/benchmark/cases/react_multi_agents_fake_connection.py b/benchmark/cases/react_multi_agents_fake_connection.py index 9df8941e68..a37b1e4109 100644 --- a/benchmark/cases/react_multi_agents_fake_connection.py +++ b/benchmark/cases/react_multi_agents_fake_connection.py @@ -91,11 +91,11 @@ def react_speed_in_loop( try: # wait all messages are pushed to inboxes - while sum([i.is_messages_in_fake_connection() for i in wrappers]): + while sum(i.is_messages_in_fake_connection() for i in wrappers): time.sleep(0.01) # wait all messages are consumed from inboxes - while sum([not i.is_inbox_empty() for i in wrappers]): + while sum(not i.is_inbox_empty() for i in wrappers): time.sleep(0.01) finally: for aea_test_wrapper in wrappers: diff --git a/benchmark/cases/react_speed_multi_agents.py b/benchmark/cases/react_speed_multi_agents.py index 78ed74132e..fcb69cd1ce 100644 --- a/benchmark/cases/react_speed_multi_agents.py +++ b/benchmark/cases/react_speed_multi_agents.py @@ -84,12 +84,12 @@ def react_speed_in_loop( aea_test_wrapper.start_loop() try: - while sum([not i.is_inbox_empty() for i in aea_test_wrappers]): + while sum((not i.is_inbox_empty() for i in aea_test_wrappers)): time.sleep(0.1) finally: # wait to start, Race condition in case no messages to process - while sum([not i.is_running() for i in aea_test_wrappers]): + while sum(not i.is_running() for i in aea_test_wrappers): pass for aea_test_wrapper in aea_test_wrappers: aea_test_wrapper.stop_loop() diff --git a/benchmark/checks/check_multiagent.py b/benchmark/checks/check_multiagent.py index 193ae09875..d8ae22666a 100755 --- a/benchmark/checks/check_multiagent.py +++ b/benchmark/checks/check_multiagent.py @@ -159,7 +159,13 @@ def run( runner.start(threaded=True) for agent in agents: - wait_for_condition(lambda: agent.is_running, timeout=5) + wait_for_condition( + ( # pylint: disable=unnecessary-direct-lambda-call + lambda agnt: lambda: agnt.is_running + )(agent), + timeout=5, + ) + wait_for_condition(lambda: runner.is_running, timeout=5) time.sleep(1) @@ -177,28 +183,25 @@ def run( runner.stop(timeout=5) total_messages = sum( - [cast(TestHandler, skill.handlers["test"]).count for skill in skills] + cast(TestHandler, skill.handlers["test"]).count for skill in skills ) rate = total_messages / duration rtt_total_time = sum( - [cast(TestHandler, skill.handlers["test"]).rtt_total_time for skill in skills] + cast(TestHandler, skill.handlers["test"]).rtt_total_time for skill in skills ) rtt_count = sum( - [cast(TestHandler, skill.handlers["test"]).rtt_count for skill in skills] + cast(TestHandler, skill.handlers["test"]).rtt_count for skill in skills ) if rtt_count == 0: rtt_count = -1 latency_total_time = sum( - [ - cast(TestHandler, skill.handlers["test"]).latency_total_time - for skill in skills - ] + cast(TestHandler, skill.handlers["test"]).latency_total_time for skill in skills ) latency_count = sum( - [cast(TestHandler, skill.handlers["test"]).latency_count for skill in skills] + cast(TestHandler, skill.handlers["test"]).latency_count for skill in skills ) if latency_count == 0: diff --git a/benchmark/checks/check_multiagent_http_dialogues.py b/benchmark/checks/check_multiagent_http_dialogues.py index a32348ed3c..c1f83762a0 100755 --- a/benchmark/checks/check_multiagent_http_dialogues.py +++ b/benchmark/checks/check_multiagent_http_dialogues.py @@ -185,8 +185,15 @@ def run( runner = AEARunner(agents, runner_mode) runner.start(threaded=True) + for agent in agents: - wait_for_condition(lambda: agent.is_running, timeout=5) + wait_for_condition( + ( # pylint: disable=unnecessary-direct-lambda-call + lambda agnt: lambda: agnt.is_running + )(agent), + timeout=5, + ) + wait_for_condition(lambda: runner.is_running, timeout=5) time.sleep(1) @@ -202,40 +209,30 @@ def run( local_node.stop() runner.stop(timeout=5) total_messages = sum( - [ - cast(HttpPingPongHandler, skill.handlers[handler_name]).count - for skill in skills.values() - ] + cast(HttpPingPongHandler, skill.handlers[handler_name]).count + for skill in skills.values() ) rate = total_messages / duration rtt_total_time = sum( - [ - cast(HttpPingPongHandler, skill.handlers[handler_name]).rtt_total_time - for skill in skills.values() - ] + cast(HttpPingPongHandler, skill.handlers[handler_name]).rtt_total_time + for skill in skills.values() ) rtt_count = sum( - [ - cast(HttpPingPongHandler, skill.handlers[handler_name]).rtt_count - for skill in skills.values() - ] + cast(HttpPingPongHandler, skill.handlers[handler_name]).rtt_count + for skill in skills.values() ) if rtt_count == 0: rtt_count = -1 latency_total_time = sum( - [ - cast(HttpPingPongHandler, skill.handlers[handler_name]).latency_total_time - for skill in skills.values() - ] + cast(HttpPingPongHandler, skill.handlers[handler_name]).latency_total_time + for skill in skills.values() ) latency_count = sum( - [ - cast(HttpPingPongHandler, skill.handlers[handler_name]).latency_count - for skill in skills.values() - ] + cast(HttpPingPongHandler, skill.handlers[handler_name]).latency_count + for skill in skills.values() ) if latency_count == 0: diff --git a/benchmark/checks/check_reactive.py b/benchmark/checks/check_reactive.py index 3fde11a1a7..5a6720236f 100755 --- a/benchmark/checks/check_reactive.py +++ b/benchmark/checks/check_reactive.py @@ -51,17 +51,17 @@ class TestConnectionMixIn: def __init__(self, *args: Any, **kwargs: Any): """Init connection.""" super().__init__(*args, **kwargs) # type: ignore - self.sends: List[float] = list() - self.recvs: List[float] = list() + self.sends: List[float] = [] + self.recvs: List[float] = [] async def send(self, envelope: Envelope) -> None: """Handle incoming envelope.""" self.recvs.append(time.time()) - return await super().send(envelope) # type: ignore + return await super().send(envelope) # type: ignore # pylint: disable=no-member async def receive(self, *args: Any, **kwargs: Any) -> Optional[Envelope]: """Generate outgoing envelope.""" - envelope = await super().receive(*args, **kwargs) # type: ignore + envelope = await super().receive(*args, **kwargs) # type: ignore # pylint: disable=no-member self.sends.append(time.time()) return envelope diff --git a/benchmark/checks/utils.py b/benchmark/checks/utils.py index fb02f7d52d..6681c41aaa 100644 --- a/benchmark/checks/utils.py +++ b/benchmark/checks/utils.py @@ -267,9 +267,8 @@ def multi_run( multiprocessing.set_start_method("spawn") results = [] for _ in range(num_runs): - p = Pool(1) - results.append(p.apply(fn, tuple(args))) - p.terminate() + with Pool(1) as p: + results.append(p.apply(fn, tuple(args))) del p mean_values = map(mean, zip(*(map(lambda x: x[1], i) for i in results))) diff --git a/benchmark/framework/report_printer.py b/benchmark/framework/report_printer.py index 5e3d77ada3..282a0e1f76 100644 --- a/benchmark/framework/report_printer.py +++ b/benchmark/framework/report_printer.py @@ -168,8 +168,9 @@ def _count_resource( :return: (mean_value, standart_deviation) """ if not aggr_function: - aggr_function = lambda x: x # noqa: E731 - + aggr_function = ( + lambda x: x # pylint: disable=unnecessary-lambda-assignment + ) # noqa: E731 values = [aggr_function(getattr(i, attr_name)) for i in self.exec_reports] mean_value = mean(values) std_dev = stdev(values) if len(values) > 1 else 0 diff --git a/docs/aggregation-demo.md b/docs/aggregation-demo.md index 25331049ff..a8ba82d26d 100644 --- a/docs/aggregation-demo.md +++ b/docs/aggregation-demo.md @@ -19,7 +19,7 @@ Repeat the following process four times in four different terminals (for each {` Fetch the aggregator AEA: ``` bash agent_name="agg$i" -aea fetch fetchai/simple_aggregator:0.5.2 --alias $agent_name +aea fetch fetchai/simple_aggregator:0.5.3 --alias $agent_name cd $agent_name aea install aea build @@ -34,15 +34,15 @@ Create the AEA. agent_name="agg$i" aea create agent_name cd agent_name -aea add connection fetchai/http_client:0.24.3 -aea add connection fetchai/http_server:0.23.3 -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/prometheus:0.9.3 -aea add skill fetchai/advanced_data_request:0.7.3 -aea add skill fetchai/simple_aggregation:0.3.3 - -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea add connection fetchai/http_client:0.24.4 +aea add connection fetchai/http_server:0.23.4 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/prometheus:0.9.4 +aea add skill fetchai/advanced_data_request:0.7.4 +aea add skill fetchai/simple_aggregation:0.3.4 + +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea install aea build ``` @@ -126,8 +126,8 @@ aea config set vendor.fetchai.connections.http_server.config.port $((8000+i)) To publish the aggregated value to an oracle smart contract, add the ledger connection and simple oracle skill to one of the aggregators: ``` bash -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/simple_oracle:0.16.2 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/simple_oracle:0.16.3 ``` Configure the simple oracle skill for the `fetchai` ledger: diff --git a/docs/api/abstract_agent.md b/docs/api/abstract_agent.md index b74be9fc64..d8bfbd6539 100644 --- a/docs/api/abstract_agent.md +++ b/docs/api/abstract_agent.md @@ -1,9 +1,11 @@ - + + # aea.abstract`_`agent This module contains the interface definition of the abstract agent. - + + ## AbstractAgent Objects ```python @@ -12,32 +14,37 @@ class AbstractAgent(ABC) This class provides an abstract base interface for an agent. - + + #### name ```python - | @abstractproperty - | name() -> str +@property +@abstractmethod +def name() -> str ``` Get agent's name. - + + #### storage`_`uri ```python - | @abstractproperty - | storage_uri() -> Optional[str] +@property +@abstractmethod +def storage_uri() -> Optional[str] ``` Return storage uri. - + + #### start ```python - | @abstractmethod - | start() -> None +@abstractmethod +def start() -> None ``` Start the agent. @@ -46,12 +53,13 @@ Start the agent. None - + + #### stop ```python - | @abstractmethod - | stop() -> None +@abstractmethod +def stop() -> None ``` Stop the agent. @@ -60,12 +68,13 @@ Stop the agent. None - + + #### setup ```python - | @abstractmethod - | setup() -> None +@abstractmethod +def setup() -> None ``` Set up the agent. @@ -74,12 +83,13 @@ Set up the agent. None - + + #### act ```python - | @abstractmethod - | act() -> None +@abstractmethod +def act() -> None ``` Perform actions on period. @@ -88,12 +98,13 @@ Perform actions on period. None - + + #### handle`_`envelope ```python - | @abstractmethod - | handle_envelope(envelope: Envelope) -> None +@abstractmethod +def handle_envelope(envelope: Envelope) -> None ``` Handle an envelope. @@ -106,12 +117,14 @@ Handle an envelope. None - + + #### get`_`periodic`_`tasks ```python - | @abstractmethod - | get_periodic_tasks() -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]] +@abstractmethod +def get_periodic_tasks( +) -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]] ``` Get all periodic tasks for agent. @@ -120,12 +133,13 @@ Get all periodic tasks for agent. dict of callable with period specified - + + #### get`_`message`_`handlers ```python - | @abstractmethod - | get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]] +@abstractmethod +def get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]] ``` Get handlers with message getters. @@ -134,12 +148,14 @@ Get handlers with message getters. List of tuples of callables: handler and coroutine to get a message - + + #### exception`_`handler ```python - | @abstractmethod - | exception_handler(exception: Exception, function: Callable) -> Optional[bool] +@abstractmethod +def exception_handler(exception: Exception, + function: Callable) -> Optional[bool] ``` Handle exception raised during agent main loop execution. @@ -153,12 +169,13 @@ Handle exception raised during agent main loop execution. skip exception if True, otherwise re-raise it - + + #### teardown ```python - | @abstractmethod - | teardown() -> None +@abstractmethod +def teardown() -> None ``` Tear down the agent. diff --git a/docs/api/aea.md b/docs/api/aea.md index e2b2fd0fbb..13caf33f1c 100644 --- a/docs/api/aea.md +++ b/docs/api/aea.md @@ -1,9 +1,11 @@ - + + # aea.aea This module contains the implementation of an autonomous economic agent (AEA). - + + ## AEA Objects ```python @@ -12,11 +14,40 @@ class AEA(Agent) This class implements an autonomous economic agent. - + + #### `__`init`__` ```python - | __init__(identity: Identity, wallet: Wallet, resources: Resources, data_dir: str, loop: Optional[AbstractEventLoop] = None, period: float = 0.05, execution_timeout: float = 0, max_reactions: int = 20, error_handler_class: Optional[Type[AbstractErrorHandler]] = None, error_handler_config: Optional[Dict[str, Any]] = None, decision_maker_handler_class: Optional[Type[DecisionMakerHandler]] = None, decision_maker_handler_config: Optional[Dict[str, Any]] = None, skill_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate, connection_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate, loop_mode: Optional[str] = None, runtime_mode: Optional[str] = None, default_ledger: Optional[str] = None, currency_denominations: Optional[Dict[str, str]] = None, default_connection: Optional[PublicId] = None, default_routing: Optional[Dict[PublicId, PublicId]] = None, connection_ids: Optional[Collection[PublicId]] = None, search_service_address: str = DEFAULT_SEARCH_SERVICE_ADDRESS, storage_uri: Optional[str] = None, task_manager_mode: Optional[str] = None, **kwargs: Any, ,) -> None +def __init__( + identity: Identity, + wallet: Wallet, + resources: Resources, + data_dir: str, + loop: Optional[AbstractEventLoop] = None, + period: float = 0.05, + execution_timeout: float = 0, + max_reactions: int = 20, + error_handler_class: Optional[Type[AbstractErrorHandler]] = None, + error_handler_config: Optional[Dict[str, Any]] = None, + decision_maker_handler_class: Optional[ + Type[DecisionMakerHandler]] = None, + decision_maker_handler_config: Optional[Dict[str, Any]] = None, + skill_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum. + propagate, + connection_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum. + propagate, + loop_mode: Optional[str] = None, + runtime_mode: Optional[str] = None, + default_ledger: Optional[str] = None, + currency_denominations: Optional[Dict[str, str]] = None, + default_connection: Optional[PublicId] = None, + default_routing: Optional[Dict[PublicId, PublicId]] = None, + connection_ids: Optional[Collection[PublicId]] = None, + search_service_address: str = DEFAULT_SEARCH_SERVICE_ADDRESS, + storage_uri: Optional[str] = None, + task_manager_mode: Optional[str] = None, + **kwargs: Any) -> None ``` Instantiate the agent. @@ -49,93 +80,102 @@ Instantiate the agent. - `task_manager_mode`: task manager mode (threaded) to run tasks with. - `kwargs`: keyword arguments to be attached in the agent context namespace. - + + #### get`_`build`_`dir ```python - | @classmethod - | get_build_dir(cls) -> str +@classmethod +def get_build_dir(cls) -> str ``` Get agent build directory. - + + #### context ```python - | @property - | context() -> AgentContext +@property +def context() -> AgentContext ``` Get (agent) context. - + + #### resources ```python - | @property - | resources() -> Resources +@property +def resources() -> Resources ``` Get resources. - + + #### resources ```python - | @resources.setter - | resources(resources: "Resources") -> None +@resources.setter +def resources(resources: "Resources") -> None ``` Set resources. - + + #### filter ```python - | @property - | filter() -> Filter +@property +def filter() -> Filter ``` Get the filter. - + + #### active`_`behaviours ```python - | @property - | active_behaviours() -> List[Behaviour] +@property +def active_behaviours() -> List[Behaviour] ``` Get all active behaviours to use in act. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set up the agent. Calls setup() on the resources. - + + #### act ```python - | act() -> None +def act() -> None ``` Perform actions. Adds new handlers and behaviours for use/execution by the runtime. - + + #### handle`_`envelope ```python - | handle_envelope(envelope: Envelope) -> None +def handle_envelope(envelope: Envelope) -> None ``` Handle an envelope. @@ -156,11 +196,13 @@ Performs the following: None - + + #### get`_`periodic`_`tasks ```python - | get_periodic_tasks() -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]] +def get_periodic_tasks( +) -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]] ``` Get all periodic tasks for agent. @@ -169,11 +211,12 @@ Get all periodic tasks for agent. dict of callable with period specified - + + #### get`_`message`_`handlers ```python - | get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]] +def get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]] ``` Get handlers with message getters. @@ -182,11 +225,12 @@ Get handlers with message getters. List of tuples of callables: handler and coroutine to get a message - + + #### exception`_`handler ```python - | exception_handler(exception: Exception, function: Callable) -> bool +def exception_handler(exception: Exception, function: Callable) -> bool ``` Handle exception raised during agent main loop execution. @@ -200,11 +244,12 @@ Handle exception raised during agent main loop execution. bool, propagate exception if True otherwise skip it. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Tear down the agent. @@ -213,11 +258,12 @@ Performs the following: - tears down the resources. - + + #### get`_`task`_`result ```python - | get_task_result(task_id: int) -> AsyncResult +def get_task_result(task_id: int) -> AsyncResult ``` Get the result from a task. @@ -230,11 +276,14 @@ Get the result from a task. async result for task_id - + + #### enqueue`_`task ```python - | enqueue_task(func: Callable, args: Sequence = (), kwargs: Optional[Dict[str, Any]] = None) -> int +def enqueue_task(func: Callable, + args: Sequence = (), + kwargs: Optional[Dict[str, Any]] = None) -> int ``` Enqueue a task with the task manager. diff --git a/docs/api/aea_builder.md b/docs/api/aea_builder.md index 476d6d267f..1c587ed1c5 100644 --- a/docs/api/aea_builder.md +++ b/docs/api/aea_builder.md @@ -1,9 +1,11 @@ - + + # aea.aea`_`builder This module contains utilities for building an AEA. - + + ## `_`DependenciesManager Objects ```python @@ -12,89 +14,100 @@ class _DependenciesManager() Class to manage dependencies of agent packages. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Initialize the dependency graph. - + + #### all`_`dependencies ```python - | @property - | all_dependencies() -> Set[ComponentId] +@property +def all_dependencies() -> Set[ComponentId] ``` Get all dependencies. - + + #### dependencies`_`highest`_`version ```python - | @property - | dependencies_highest_version() -> Set[ComponentId] +@property +def dependencies_highest_version() -> Set[ComponentId] ``` Get the dependencies with highest version. - + + #### get`_`components`_`by`_`type ```python - | get_components_by_type(component_type: ComponentType) -> Dict[ComponentId, ComponentConfiguration] +def get_components_by_type( + component_type: ComponentType +) -> Dict[ComponentId, ComponentConfiguration] ``` Get the components by type. - + + #### protocols ```python - | @property - | protocols() -> Dict[ComponentId, ProtocolConfig] +@property +def protocols() -> Dict[ComponentId, ProtocolConfig] ``` Get the protocols. - + + #### connections ```python - | @property - | connections() -> Dict[ComponentId, ConnectionConfig] +@property +def connections() -> Dict[ComponentId, ConnectionConfig] ``` Get the connections. - + + #### skills ```python - | @property - | skills() -> Dict[ComponentId, SkillConfig] +@property +def skills() -> Dict[ComponentId, SkillConfig] ``` Get the skills. - + + #### contracts ```python - | @property - | contracts() -> Dict[ComponentId, ContractConfig] +@property +def contracts() -> Dict[ComponentId, ContractConfig] ``` Get the contracts. - + + #### add`_`component ```python - | add_component(configuration: ComponentConfiguration) -> None +def add_component(configuration: ComponentConfiguration) -> None ``` Add a component to the dependency manager. @@ -103,11 +116,12 @@ Add a component to the dependency manager. - `configuration`: the component configuration to add. - + + #### remove`_`component ```python - | remove_component(component_id: ComponentId) -> None +def remove_component(component_id: ComponentId) -> None ``` Remove a component. @@ -120,12 +134,13 @@ Remove a component. - `ValueError`: if some component depends on this package. - + + #### pypi`_`dependencies ```python - | @property - | pypi_dependencies() -> Dependencies +@property +def pypi_dependencies() -> Dependencies ``` Get all the PyPI dependencies. @@ -138,16 +153,18 @@ version field. the merged PyPI dependencies - + + #### install`_`dependencies ```python - | install_dependencies() -> None +def install_dependencies() -> None ``` Install extra dependencies for components. - + + ## AEABuilder Objects ```python @@ -198,11 +215,14 @@ builder.add_component_instance(...) # second call my_aea_2 = builder.builder() - + + #### `__`init`__` ```python - | __init__(with_default_packages: bool = True, registry_dir: str = DEFAULT_REGISTRY_NAME, build_dir_root: Optional[str] = None) -> None +def __init__(with_default_packages: bool = True, + registry_dir: str = DEFAULT_REGISTRY_NAME, + build_dir_root: Optional[str] = None) -> None ``` Initialize the builder. @@ -213,30 +233,32 @@ Initialize the builder. - `registry_dir`: the registry directory. - `build_dir_root`: the root of the build directory. - + + #### reset ```python - | reset(is_full_reset: bool = False) -> None +def reset(is_full_reset: bool = False) -> None ``` Reset the builder. A full reset causes a reset of all data on the builder. A partial reset only resets: -- name, -- private keys, and -- component instances + - name, + - private keys, and + - component instances **Arguments**: - `is_full_reset`: whether it is a full reset or not. - + + #### set`_`period ```python - | set_period(period: Optional[float]) -> "AEABuilder" +def set_period(period: Optional[float]) -> "AEABuilder" ``` Set agent act period. @@ -249,11 +271,12 @@ Set agent act period. self - + + #### set`_`execution`_`timeout ```python - | set_execution_timeout(execution_timeout: Optional[float]) -> "AEABuilder" +def set_execution_timeout(execution_timeout: Optional[float]) -> "AEABuilder" ``` Set agent execution timeout in seconds. @@ -266,11 +289,12 @@ Set agent execution timeout in seconds. self - + + #### set`_`max`_`reactions ```python - | set_max_reactions(max_reactions: Optional[int]) -> "AEABuilder" +def set_max_reactions(max_reactions: Optional[int]) -> "AEABuilder" ``` Set agent max reaction in one react. @@ -283,11 +307,14 @@ Set agent max reaction in one react. self - + + #### set`_`decision`_`maker`_`handler`_`details ```python - | set_decision_maker_handler_details(decision_maker_handler_dotted_path: str, file_path: str, config: Dict[str, Any]) -> "AEABuilder" +def set_decision_maker_handler_details(decision_maker_handler_dotted_path: str, + file_path: str, + config: Dict[str, Any]) -> "AEABuilder" ``` Set error handler details. @@ -302,11 +329,13 @@ Set error handler details. self - + + #### set`_`error`_`handler`_`details ```python - | set_error_handler_details(error_handler_dotted_path: str, file_path: str, config: Dict[str, Any]) -> "AEABuilder" +def set_error_handler_details(error_handler_dotted_path: str, file_path: str, + config: Dict[str, Any]) -> "AEABuilder" ``` Set error handler details. @@ -321,11 +350,13 @@ Set error handler details. self - + + #### set`_`skill`_`exception`_`policy ```python - | set_skill_exception_policy(skill_exception_policy: Optional[ExceptionPolicyEnum]) -> "AEABuilder" +def set_skill_exception_policy( + skill_exception_policy: Optional[ExceptionPolicyEnum]) -> "AEABuilder" ``` Set skill exception policy. @@ -338,11 +369,14 @@ Set skill exception policy. self - + + #### set`_`connection`_`exception`_`policy ```python - | set_connection_exception_policy(connection_exception_policy: Optional[ExceptionPolicyEnum]) -> "AEABuilder" +def set_connection_exception_policy( + connection_exception_policy: Optional[ExceptionPolicyEnum] +) -> "AEABuilder" ``` Set connection exception policy. @@ -355,11 +389,13 @@ Set connection exception policy. self - + + #### set`_`default`_`routing ```python - | set_default_routing(default_routing: Dict[PublicId, PublicId]) -> "AEABuilder" +def set_default_routing( + default_routing: Dict[PublicId, PublicId]) -> "AEABuilder" ``` Set default routing. @@ -374,11 +410,12 @@ This is a map from public ids (protocols) to public ids (connections). self - + + #### set`_`loop`_`mode ```python - | set_loop_mode(loop_mode: Optional[str]) -> "AEABuilder" +def set_loop_mode(loop_mode: Optional[str]) -> "AEABuilder" ``` Set the loop mode. @@ -391,11 +428,12 @@ Set the loop mode. self - + + #### set`_`runtime`_`mode ```python - | set_runtime_mode(runtime_mode: Optional[str]) -> "AEABuilder" +def set_runtime_mode(runtime_mode: Optional[str]) -> "AEABuilder" ``` Set the runtime mode. @@ -408,11 +446,12 @@ Set the runtime mode. self - + + #### set`_`task`_`manager`_`mode ```python - | set_task_manager_mode(task_manager_mode: Optional[str]) -> "AEABuilder" +def set_task_manager_mode(task_manager_mode: Optional[str]) -> "AEABuilder" ``` Set the task_manager_mode. @@ -425,11 +464,12 @@ Set the task_manager_mode. self - + + #### set`_`storage`_`uri ```python - | set_storage_uri(storage_uri: Optional[str]) -> "AEABuilder" +def set_storage_uri(storage_uri: Optional[str]) -> "AEABuilder" ``` Set the storage uri. @@ -442,11 +482,12 @@ Set the storage uri. self - + + #### set`_`data`_`dir ```python - | set_data_dir(data_dir: Optional[str]) -> "AEABuilder" +def set_data_dir(data_dir: Optional[str]) -> "AEABuilder" ``` Set the data directory. @@ -459,18 +500,19 @@ Set the data directory. self - + + #### set`_`logging`_`config ```python - | set_logging_config(logging_config: Dict) -> "AEABuilder" +def set_logging_config(logging_config: Dict) -> "AEABuilder" ``` Set the logging configurations. The dictionary must satisfy the following schema: -https://docs.python.org/3/library/logging.config.html#logging-config-dictschema + https://docs.python.org/3/library/logging.config.html#logging-config-dictschema **Arguments**: @@ -480,11 +522,12 @@ https://docs.python.org/3/library/logging.config.html#logging-config-dictschema self - + + #### set`_`search`_`service`_`address ```python - | set_search_service_address(search_service_address: str) -> "AEABuilder" +def set_search_service_address(search_service_address: str) -> "AEABuilder" ``` Set the search service address. @@ -497,11 +540,12 @@ Set the search service address. self - + + #### set`_`name ```python - | set_name(name: str) -> "AEABuilder" +def set_name(name: str) -> "AEABuilder" ``` Set the name of the agent. @@ -514,11 +558,13 @@ Set the name of the agent. the AEABuilder - + + #### set`_`default`_`connection ```python - | set_default_connection(public_id: Optional[PublicId] = None) -> "AEABuilder" +def set_default_connection( + public_id: Optional[PublicId] = None) -> "AEABuilder" ``` Set the default connection. @@ -531,11 +577,14 @@ Set the default connection. the AEABuilder - + + #### add`_`private`_`key ```python - | add_private_key(identifier: str, private_key_path: Optional[PathLike] = None, is_connection: bool = False) -> "AEABuilder" +def add_private_key(identifier: str, + private_key_path: Optional[PathLike] = None, + is_connection: bool = False) -> "AEABuilder" ``` Add a private key path. @@ -551,11 +600,13 @@ If None, the key will be created at build time. the AEABuilder - + + #### remove`_`private`_`key ```python - | remove_private_key(identifier: str, is_connection: bool = False) -> "AEABuilder" +def remove_private_key(identifier: str, + is_connection: bool = False) -> "AEABuilder" ``` Remove a private key path by identifier, if present. @@ -569,31 +620,34 @@ Remove a private key path by identifier, if present. the AEABuilder - + + #### private`_`key`_`paths ```python - | @property - | private_key_paths() -> Dict[str, Optional[str]] +@property +def private_key_paths() -> Dict[str, Optional[str]] ``` Get the private key paths. - + + #### connection`_`private`_`key`_`paths ```python - | @property - | connection_private_key_paths() -> Dict[str, Optional[str]] +@property +def connection_private_key_paths() -> Dict[str, Optional[str]] ``` Get the connection private key paths. - + + #### set`_`default`_`ledger ```python - | set_default_ledger(identifier: Optional[str]) -> "AEABuilder" +def set_default_ledger(identifier: Optional[str]) -> "AEABuilder" ``` Set a default ledger API to use. @@ -606,11 +660,13 @@ Set a default ledger API to use. the AEABuilder - + + #### set`_`required`_`ledgers ```python - | set_required_ledgers(required_ledgers: Optional[List[str]]) -> "AEABuilder" +def set_required_ledgers( + required_ledgers: Optional[List[str]]) -> "AEABuilder" ``` Set the required ledger identifiers. @@ -625,11 +681,12 @@ These are the ledgers for which the AEA requires a key pair. the AEABuilder. - + + #### set`_`build`_`entrypoint ```python - | set_build_entrypoint(build_entrypoint: Optional[str]) -> "AEABuilder" +def set_build_entrypoint(build_entrypoint: Optional[str]) -> "AEABuilder" ``` Set build entrypoint. @@ -642,11 +699,13 @@ Set build entrypoint. the AEABuilder - + + #### set`_`currency`_`denominations ```python - | set_currency_denominations(currency_denominations: Dict[str, str]) -> "AEABuilder" +def set_currency_denominations( + currency_denominations: Dict[str, str]) -> "AEABuilder" ``` Set the mapping from ledger ids to currency denominations. @@ -659,11 +718,14 @@ Set the mapping from ledger ids to currency denominations. the AEABuilder - + + #### add`_`component ```python - | add_component(component_type: ComponentType, directory: PathLike, skip_consistency_check: bool = False) -> "AEABuilder" +def add_component(component_type: ComponentType, + directory: PathLike, + skip_consistency_check: bool = False) -> "AEABuilder" ``` Add a component, given its type and the directory. @@ -683,11 +745,12 @@ Add a component, given its type and the directory. the AEABuilder - + + #### add`_`component`_`instance ```python - | add_component_instance(component: Component) -> "AEABuilder" +def add_component_instance(component: Component) -> "AEABuilder" ``` Add already initialized component object to resources or connections. @@ -705,20 +768,22 @@ You will have to `reset()` the builder before calling `build()` again. self - + + #### set`_`context`_`namespace ```python - | set_context_namespace(context_namespace: Dict[str, Any]) -> "AEABuilder" +def set_context_namespace(context_namespace: Dict[str, Any]) -> "AEABuilder" ``` Set the context namespace. - + + #### set`_`agent`_`pypi`_`dependencies ```python - | set_agent_pypi_dependencies(dependencies: Dependencies) -> "AEABuilder" +def set_agent_pypi_dependencies(dependencies: Dependencies) -> "AEABuilder" ``` Set agent PyPI dependencies. @@ -731,11 +796,12 @@ Set agent PyPI dependencies. the AEABuilder. - + + #### remove`_`component ```python - | remove_component(component_id: ComponentId) -> "AEABuilder" +def remove_component(component_id: ComponentId) -> "AEABuilder" ``` Remove a component. @@ -748,11 +814,12 @@ Remove a component. the AEABuilder - + + #### add`_`protocol ```python - | add_protocol(directory: PathLike) -> "AEABuilder" +def add_protocol(directory: PathLike) -> "AEABuilder" ``` Add a protocol to the agent. @@ -765,11 +832,12 @@ Add a protocol to the agent. the AEABuilder - + + #### remove`_`protocol ```python - | remove_protocol(public_id: PublicId) -> "AEABuilder" +def remove_protocol(public_id: PublicId) -> "AEABuilder" ``` Remove protocol. @@ -782,11 +850,12 @@ Remove protocol. the AEABuilder - + + #### add`_`connection ```python - | add_connection(directory: PathLike) -> "AEABuilder" +def add_connection(directory: PathLike) -> "AEABuilder" ``` Add a connection to the agent. @@ -799,11 +868,12 @@ Add a connection to the agent. the AEABuilder - + + #### remove`_`connection ```python - | remove_connection(public_id: PublicId) -> "AEABuilder" +def remove_connection(public_id: PublicId) -> "AEABuilder" ``` Remove a connection. @@ -816,11 +886,12 @@ Remove a connection. the AEABuilder - + + #### add`_`skill ```python - | add_skill(directory: PathLike) -> "AEABuilder" +def add_skill(directory: PathLike) -> "AEABuilder" ``` Add a skill to the agent. @@ -833,11 +904,12 @@ Add a skill to the agent. the AEABuilder - + + #### remove`_`skill ```python - | remove_skill(public_id: PublicId) -> "AEABuilder" +def remove_skill(public_id: PublicId) -> "AEABuilder" ``` Remove protocol. @@ -850,11 +922,12 @@ Remove protocol. the AEABuilder - + + #### add`_`contract ```python - | add_contract(directory: PathLike) -> "AEABuilder" +def add_contract(directory: PathLike) -> "AEABuilder" ``` Add a contract to the agent. @@ -867,11 +940,12 @@ Add a contract to the agent. the AEABuilder - + + #### remove`_`contract ```python - | remove_contract(public_id: PublicId) -> "AEABuilder" +def remove_contract(public_id: PublicId) -> "AEABuilder" ``` Remove protocol. @@ -884,48 +958,57 @@ Remove protocol. the AEABuilder - + + #### call`_`all`_`build`_`entrypoints ```python - | call_all_build_entrypoints() -> None +def call_all_build_entrypoints() -> None ``` Call all the build entrypoints. - + + #### get`_`build`_`root`_`directory ```python - | get_build_root_directory() -> str +def get_build_root_directory() -> str ``` Get build directory root. - + + #### run`_`build`_`for`_`component`_`configuration ```python - | @classmethod - | run_build_for_component_configuration(cls, config: ComponentConfiguration, logger: Optional[logging.Logger] = None) -> None +@classmethod +def run_build_for_component_configuration( + cls, + config: ComponentConfiguration, + logger: Optional[logging.Logger] = None) -> None ``` Run a build entrypoint script for component configuration. - + + #### install`_`pypi`_`dependencies ```python - | install_pypi_dependencies() -> None +def install_pypi_dependencies() -> None ``` Install components extra dependencies. - + + #### build ```python - | build(connection_ids: Optional[Collection[PublicId]] = None, password: Optional[str] = None) -> AEA +def build(connection_ids: Optional[Collection[PublicId]] = None, + password: Optional[str] = None) -> AEA ``` Build the AEA. @@ -946,11 +1029,12 @@ via 'add_component_instance' and the private keys. the AEA object. - + + #### get`_`default`_`ledger ```python - | get_default_ledger() -> str +def get_default_ledger() -> str ``` Return default ledger. @@ -959,11 +1043,12 @@ Return default ledger. the default ledger identifier. - + + #### get`_`required`_`ledgers ```python - | get_required_ledgers() -> List[str] +def get_required_ledgers() -> List[str] ``` Get the required ledger identifiers. @@ -974,21 +1059,26 @@ These are the ledgers for which the AEA requires a key pair. the list of required ledgers. - + + #### try`_`to`_`load`_`agent`_`configuration`_`file ```python - | @classmethod - | try_to_load_agent_configuration_file(cls, aea_project_path: Union[str, Path]) -> AgentConfig +@classmethod +def try_to_load_agent_configuration_file( + cls, aea_project_path: Union[str, Path]) -> AgentConfig ``` Try to load the agent configuration file.. - + + #### set`_`from`_`configuration ```python - | set_from_configuration(agent_configuration: AgentConfig, aea_project_path: Path, skip_consistency_check: bool = False) -> None +def set_from_configuration(agent_configuration: AgentConfig, + aea_project_path: Path, + skip_consistency_check: bool = False) -> None ``` Set builder variables from AgentConfig. @@ -999,12 +1089,16 @@ Set builder variables from AgentConfig. - `aea_project_path`: PathLike root directory of the agent project. - `skip_consistency_check`: if True, the consistency check are skipped. - + + #### from`_`aea`_`project ```python - | @classmethod - | from_aea_project(cls, aea_project_path: PathLike, skip_consistency_check: bool = False, password: Optional[str] = None) -> "AEABuilder" +@classmethod +def from_aea_project(cls, + aea_project_path: PathLike, + skip_consistency_check: bool = False, + password: Optional[str] = None) -> "AEABuilder" ``` Construct the builder from an AEA project. @@ -1026,21 +1120,24 @@ Construct the builder from an AEA project. an AEABuilder. - + + #### get`_`configuration`_`file`_`path ```python - | @staticmethod - | get_configuration_file_path(aea_project_path: Union[Path, str]) -> Path +@staticmethod +def get_configuration_file_path(aea_project_path: Union[Path, str]) -> Path ``` Return path to aea-config file for the given aea project path. - + + #### make`_`component`_`logger ```python -make_component_logger(configuration: ComponentConfiguration, agent_name: str) -> Optional[logging.Logger] +def make_component_logger(configuration: ComponentConfiguration, + agent_name: str) -> Optional[logging.Logger] ``` Make the logger for a component. diff --git a/docs/api/agent.md b/docs/api/agent.md index fbf7bc1044..bc0e56faac 100644 --- a/docs/api/agent.md +++ b/docs/api/agent.md @@ -1,22 +1,33 @@ - + + # aea.agent This module contains the implementation of a generic agent. - + + ## Agent Objects ```python -class Agent(AbstractAgent, WithLogger) +class Agent(AbstractAgent, WithLogger) ``` This class provides an abstract base class for a generic agent. - + + #### `__`init`__` ```python - | __init__(identity: Identity, connections: List[Connection], loop: Optional[AbstractEventLoop] = None, period: float = 1.0, loop_mode: Optional[str] = None, runtime_mode: Optional[str] = None, storage_uri: Optional[str] = None, logger: Logger = _default_logger, task_manager_mode: Optional[str] = None) -> None +def __init__(identity: Identity, + connections: List[Connection], + loop: Optional[AbstractEventLoop] = None, + period: float = 1.0, + loop_mode: Optional[str] = None, + runtime_mode: Optional[str] = None, + storage_uri: Optional[str] = None, + logger: Logger = _default_logger, + task_manager_mode: Optional[str] = None) -> None ``` Instantiate the agent. @@ -34,52 +45,57 @@ Instantiate the agent. - `logger`: the logger. - `task_manager_mode`: mode of the task manager. - + + #### storage`_`uri ```python - | @property - | storage_uri() -> Optional[str] +@property +def storage_uri() -> Optional[str] ``` Return storage uri. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Get running state of the runtime and agent. - + + #### is`_`stopped ```python - | @property - | is_stopped() -> bool +@property +def is_stopped() -> bool ``` Get running state of the runtime and agent. - + + #### identity ```python - | @property - | identity() -> Identity +@property +def identity() -> Identity ``` Get the identity. - + + #### inbox ```python - | @property - | inbox() -> InBox +@property +def inbox() -> InBox ``` Get the inbox. @@ -91,12 +107,13 @@ The agent can pick these messages for processing. InBox instance - + + #### outbox ```python - | @property - | outbox() -> OutBox +@property +def outbox() -> OutBox ``` Get the outbox. @@ -108,22 +125,24 @@ Envelopes placed in the Outbox are processed by the Multiplexer. OutBox instance - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the agent name. - + + #### tick ```python - | @property - | tick() -> int +@property +def tick() -> int ``` Get the tick or agent loop count. @@ -134,12 +153,13 @@ Each agent loop (one call to each one of act(), react(), update()) increments th tick count - + + #### state ```python - | @property - | state() -> RuntimeStates +@property +def state() -> RuntimeStates ``` Get state of the agent's runtime. @@ -148,40 +168,44 @@ Get state of the agent's runtime. RuntimeStates - + + #### period ```python - | @property - | period() -> float +@property +def period() -> float ``` Get a period to call act. - + + #### runtime ```python - | @property - | runtime() -> BaseRuntime +@property +def runtime() -> BaseRuntime ``` Get the runtime. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set up the agent. - + + #### start ```python - | start() -> None +def start() -> None ``` Start the agent. @@ -191,11 +215,12 @@ Performs the following: - calls start() on runtime. - waits for runtime to complete running (blocking) - + + #### handle`_`envelope ```python - | handle_envelope(envelope: Envelope) -> None +def handle_envelope(envelope: Envelope) -> None ``` Handle an envelope. @@ -204,20 +229,22 @@ Handle an envelope. - `envelope`: the envelope to handle. - + + #### act ```python - | act() -> None +def act() -> None ``` Perform actions on period. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop the agent. @@ -227,20 +254,23 @@ Performs the following: - calls stop() on runtime - waits for runtime to stop (blocking) - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Tear down the agent. - + + #### get`_`periodic`_`tasks ```python - | get_periodic_tasks() -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]] +def get_periodic_tasks( +) -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]] ``` Get all periodic tasks for agent. @@ -249,11 +279,12 @@ Get all periodic tasks for agent. dict of callable with period specified - + + #### get`_`message`_`handlers ```python - | get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]] +def get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]] ``` Get handlers with message getters. @@ -262,11 +293,12 @@ Get handlers with message getters. List of tuples of callables: handler and coroutine to get a message - + + #### exception`_`handler ```python - | exception_handler(exception: Exception, function: Callable) -> bool +def exception_handler(exception: Exception, function: Callable) -> bool ``` Handle exception raised during agent main loop execution. diff --git a/docs/api/agent_loop.md b/docs/api/agent_loop.md index 8047f61a6a..e53be3ab8f 100644 --- a/docs/api/agent_loop.md +++ b/docs/api/agent_loop.md @@ -1,9 +1,11 @@ - + + # aea.agent`_`loop This module contains the implementation of an agent loop using asyncio. - + + ## AgentLoopException Objects ```python @@ -12,7 +14,8 @@ class AgentLoopException(AEAException) Exception for agent loop runtime errors. - + + ## AgentLoopStates Objects ```python @@ -21,20 +24,24 @@ class AgentLoopStates(Enum) Internal agent loop states. - + + ## BaseAgentLoop Objects ```python -class BaseAgentLoop(Runnable, WithLogger, ABC) +class BaseAgentLoop(Runnable, WithLogger, ABC) ``` Base abstract agent loop class. - + + #### `__`init`__` ```python - | __init__(agent: AbstractAgent, loop: Optional[AbstractEventLoop] = None, threaded: bool = False) -> None +def __init__(agent: AbstractAgent, + loop: Optional[AbstractEventLoop] = None, + threaded: bool = False) -> None ``` Init loop. @@ -45,31 +52,35 @@ Init loop. - `loop`: optional asyncio event loop. if not specified a new loop will be created. - `threaded`: if True, run in threaded mode, else async - + + #### agent ```python - | @property - | agent() -> AbstractAgent +@property +def agent() -> AbstractAgent ``` Get agent. - + + #### state ```python - | @property - | state() -> AgentLoopStates +@property +def state() -> AgentLoopStates ``` Get current main loop state. - + + #### wait`_`state ```python - | async wait_state(state_or_states: Union[Any, Sequence[Any]]) -> Tuple[Any, Any] +async def wait_state( + state_or_states: Union[Any, Sequence[Any]]) -> Tuple[Any, Any] ``` Wait state to be set. @@ -82,40 +93,45 @@ Wait state to be set. tuple of previous state and new state. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Get running state of the loop. - + + #### set`_`loop ```python - | set_loop(loop: AbstractEventLoop) -> None +def set_loop(loop: AbstractEventLoop) -> None ``` Set event loop and all event loop related objects. - + + #### run ```python - | async run() -> None +async def run() -> None ``` Run agent loop. - + + #### send`_`to`_`skill ```python - | @abstractmethod - | send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None +@abstractmethod +def send_to_skill(message_or_envelope: Union[Message, Envelope], + context: Optional[EnvelopeContext] = None) -> None ``` Send message or envelope to another skill. @@ -127,18 +143,20 @@ If message passed it will be wrapped into envelope with optional envelope contex - `message_or_envelope`: envelope to send to another skill. - `context`: envelope context - + + #### skill2skill`_`queue ```python - | @property - | @abstractmethod - | skill2skill_queue() -> Queue +@property +@abstractmethod +def skill2skill_queue() -> Queue ``` Get skill to skill message queue. - + + ## AsyncAgentLoop Objects ```python @@ -147,11 +165,14 @@ class AsyncAgentLoop(BaseAgentLoop) Asyncio based agent loop suitable only for AEA. - + + #### `__`init`__` ```python - | __init__(agent: AbstractAgent, loop: AbstractEventLoop = None, threaded: bool = False) -> None +def __init__(agent: AbstractAgent, + loop: AbstractEventLoop = None, + threaded: bool = False) -> None ``` Init agent loop. @@ -162,21 +183,24 @@ Init agent loop. - `loop`: asyncio loop to use. optional - `threaded`: is a new thread to be started for the agent loop - + + #### skill2skill`_`queue ```python - | @property - | skill2skill_queue() -> Queue +@property +def skill2skill_queue() -> Queue ``` Get skill to skill message queue. - + + #### send`_`to`_`skill ```python - | send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None +def send_to_skill(message_or_envelope: Union[Message, Envelope], + context: Optional[EnvelopeContext] = None) -> None ``` Send message or envelope to another skill. diff --git a/docs/api/common.md b/docs/api/common.md index 144a00aeb7..034a99b836 100644 --- a/docs/api/common.md +++ b/docs/api/common.md @@ -1,4 +1,5 @@ - + + # aea.common This module contains the common types and interfaces used in the aea framework. diff --git a/docs/api/components/base.md b/docs/api/components/base.md index f2b215050f..14736135cc 100644 --- a/docs/api/components/base.md +++ b/docs/api/components/base.md @@ -1,22 +1,27 @@ - + + # aea.components.base This module contains definitions of agent components. - + + ## Component Objects ```python -class Component(ABC, WithLogger) +class Component(ABC, WithLogger) ``` Abstract class for an agent component. - + + #### `__`init`__` ```python - | __init__(configuration: Optional[ComponentConfiguration] = None, is_vendor: bool = False, **kwargs: Any, ,) -> None +def __init__(configuration: Optional[ComponentConfiguration] = None, + is_vendor: bool = False, + **kwargs: Any) -> None ``` Initialize a package. @@ -27,101 +32,111 @@ Initialize a package. - `is_vendor`: whether the package is vendorized. - `kwargs`: the keyword arguments for the logger. - + + #### component`_`type ```python - | @property - | component_type() -> ComponentType +@property +def component_type() -> ComponentType ``` Get the component type. - + + #### is`_`vendor ```python - | @property - | is_vendor() -> bool +@property +def is_vendor() -> bool ``` Get whether the component is vendorized or not. - + + #### prefix`_`import`_`path ```python - | @property - | prefix_import_path() -> str +@property +def prefix_import_path() -> str ``` Get the prefix import path for this component. - + + #### component`_`id ```python - | @property - | component_id() -> ComponentId +@property +def component_id() -> ComponentId ``` Ge the package id. - + + #### public`_`id ```python - | @property - | public_id() -> PublicId +@property +def public_id() -> PublicId ``` Get the public id. - + + #### configuration ```python - | @property - | configuration() -> ComponentConfiguration +@property +def configuration() -> ComponentConfiguration ``` Get the component configuration. - + + #### directory ```python - | @property - | directory() -> Path +@property +def directory() -> Path ``` Get the directory. Raise error if it has not been set yet. - + + #### directory ```python - | @directory.setter - | directory(path: Path) -> None +@directory.setter +def directory(path: Path) -> None ``` Set the directory. Raise error if already set. - + + #### build`_`directory ```python - | @property - | build_directory() -> Optional[str] +@property +def build_directory() -> Optional[str] ``` Get build directory for the component. - + + #### load`_`aea`_`package ```python -load_aea_package(configuration: ComponentConfiguration) -> None +def load_aea_package(configuration: ComponentConfiguration) -> None ``` Load the AEA package from configuration. @@ -132,11 +147,13 @@ It adds all the __init__.py modules into `sys.modules`. - `configuration`: the configuration object. - + + #### perform`_`load`_`aea`_`package ```python -perform_load_aea_package(dir_: Path, author: str, package_type_plural: str, package_name: str) -> None +def perform_load_aea_package(dir_: Path, author: str, package_type_plural: str, + package_name: str) -> None ``` Load the AEA package from values provided. diff --git a/docs/api/components/loader.md b/docs/api/components/loader.md index 11ace9c360..776d4c20eb 100644 --- a/docs/api/components/loader.md +++ b/docs/api/components/loader.md @@ -1,13 +1,15 @@ - + + # aea.components.loader This module contains utilities for loading components. - + + #### component`_`type`_`to`_`class ```python -component_type_to_class(component_type: ComponentType) -> Type[Component] +def component_type_to_class(component_type: ComponentType) -> Type[Component] ``` Get the component class from the component type. @@ -20,11 +22,13 @@ Get the component class from the component type. the component class - + + #### load`_`component`_`from`_`config ```python -load_component_from_config(configuration: ComponentConfiguration, *args, **kwargs) -> Component +def load_component_from_config(configuration: ComponentConfiguration, *args, + **kwargs) -> Component ``` Load a component from a directory. @@ -39,7 +43,8 @@ Load a component from a directory. the component instance. - + + ## AEAPackageNotFound Objects ```python diff --git a/docs/api/components/utils.md b/docs/api/components/utils.md index e36c5cd6e4..a9243c3789 100644 --- a/docs/api/components/utils.md +++ b/docs/api/components/utils.md @@ -1,4 +1,5 @@ - + + # aea.components.utils This module contains the component loading utils. diff --git a/docs/api/configurations/base.md b/docs/api/configurations/base.md index 7ab478177d..e69de29bb2 100644 --- a/docs/api/configurations/base.md +++ b/docs/api/configurations/base.md @@ -1,919 +0,0 @@ - -# aea.configurations.base - -Classes to handle AEA configurations. - - -#### dependencies`_`from`_`json - -```python -dependencies_from_json(obj: Dict[str, Dict]) -> Dependencies -``` - -Parse a JSON object to get an instance of Dependencies. - -**Arguments**: - -- `obj`: a dictionary whose keys are package names and values are dictionary with package specifications. - -**Returns**: - -a Dependencies object. - - -#### dependencies`_`to`_`json - -```python -dependencies_to_json(dependencies: Dependencies) -> Dict[str, Dict] -``` - -Transform a Dependencies object into a JSON object. - -**Arguments**: - -- `dependencies`: an instance of "Dependencies" type. - -**Returns**: - -a dictionary whose keys are package names and -values are the JSON version of a Dependency object. - - -## ProtocolSpecificationParseError Objects - -```python -class ProtocolSpecificationParseError(Exception) -``` - -Exception for parsing a protocol specification file. - - -## Configuration Objects - -```python -class Configuration(JSONSerializable, ABC) -``` - -Configuration class. - - -#### `__`init`__` - -```python - | __init__() -> None -``` - -Initialize a configuration object. - - -#### from`_`json - -```python - | @classmethod - | from_json(cls, obj: Dict) -> "Configuration" -``` - -Build from a JSON object. - - -#### ordered`_`json - -```python - | @property - | ordered_json() -> OrderedDict -``` - -Reorder the dictionary according to a key ordering. - -This method takes all the keys in the key_order list and -get the associated value in the dictionary (if present). -For the remaining keys not considered in the order, -it will use alphanumerical ordering. - -In particular, if key_order is an empty sequence, this reduces to -alphanumerical sorting. - -It does not do side-effect. - -**Returns**: - -the ordered dictionary. - - -## PackageConfiguration Objects - -```python -class PackageConfiguration(Configuration, ABC) -``` - -This class represent a package configuration. - -A package can be one of: -- agents -- protocols -- connections -- skills -- contracts - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None) -> None -``` - -Initialize a package configuration. - -**Arguments**: - -- `name`: the name of the package. -- `author`: the author of the package. -- `version`: the version of the package (SemVer format). -- `license_`: the license. -- `aea_version`: either a fixed version, or a set of specifiers describing the AEA versions allowed. (default: empty string - no constraint). The fixed version is interpreted with the specifier '=='. -- `fingerprint`: the fingerprint. -- `fingerprint_ignore_patterns`: a list of file patterns to ignore files to fingerprint. -- `build_entrypoint`: path to a script to execute at build time. - - -#### name - -```python - | @property - | name() -> str -``` - -Get the name. - - -#### name - -```python - | @name.setter - | name(value: SimpleIdOrStr) -> None -``` - -Set the name. - - -#### author - -```python - | @property - | author() -> str -``` - -Get the author. - - -#### author - -```python - | @author.setter - | author(value: SimpleIdOrStr) -> None -``` - -Set the author. - - -#### aea`_`version - -```python - | @property - | aea_version() -> str -``` - -Get the 'aea_version' attribute. - - -#### aea`_`version - -```python - | @aea_version.setter - | aea_version(new_aea_version: str) -> None -``` - -Set the 'aea_version' attribute. - - -#### check`_`aea`_`version - -```python - | check_aea_version() -> None -``` - -Check that the AEA version matches the specifier set. - -:raises ValueError if the version of the aea framework falls within a specifier. - - -#### directory - -```python - | @property - | directory() -> Optional[Path] -``` - -Get the path to the configuration file associated to this file, if any. - - -#### directory - -```python - | @directory.setter - | directory(directory: Path) -> None -``` - -Set directory if not already set. - - -#### package`_`id - -```python - | @property - | package_id() -> PackageId -``` - -Get package id. - - -#### parse`_`aea`_`version`_`specifier - -```python - | @staticmethod - | parse_aea_version_specifier(aea_version_specifiers: str) -> SpecifierSet -``` - -Parse an 'aea_version' field. - -If 'aea_version' is a version, then output the specifier set "==${version}" -Else, interpret it as specifier set. - -**Arguments**: - -- `aea_version_specifiers`: the AEA version, or a specifier set. - -**Returns**: - -A specifier set object. - - -#### aea`_`version`_`specifiers - -```python - | @property - | aea_version_specifiers() -> SpecifierSet -``` - -Get the AEA version set specifier. - - -#### public`_`id - -```python - | @property - | public_id() -> PublicId -``` - -Get the public id. - - -#### package`_`dependencies - -```python - | @property - | package_dependencies() -> Set[ComponentId] -``` - -Get the package dependencies. - - -#### update - -```python - | update(data: Dict, env_vars_friendly: bool = False) -> None -``` - -Update configuration with other data. - -**Arguments**: - -- `data`: the data to replace. -- `env_vars_friendly`: whether or not it is env vars friendly. - - -#### validate`_`config`_`data - -```python - | @classmethod - | validate_config_data(cls, json_data: Dict, env_vars_friendly: bool = False) -> None -``` - -Perform config validation. - - -#### from`_`json - -```python - | @classmethod - | from_json(cls, obj: Dict) -> "PackageConfiguration" -``` - -Initialize from a JSON object. - - -#### make`_`resulting`_`config`_`data - -```python - | make_resulting_config_data(overrides: Dict) -> Dict -``` - -Make config data with overrides applied. - -Does not update config, just creates json representation. - -**Arguments**: - -- `overrides`: the overrides - -**Returns**: - -config with overrides applied - - -#### check`_`overrides`_`valid - -```python - | check_overrides_valid(overrides: Dict, env_vars_friendly: bool = False) -> None -``` - -Check overrides is correct, return list of errors if present. - - -#### get`_`overridable - -```python - | get_overridable() -> dict -``` - -Get dictionary of values that can be updated for this config. - - -## ComponentConfiguration Objects - -```python -class ComponentConfiguration(PackageConfiguration, ABC) -``` - -Class to represent an agent component configuration. - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, dependencies: Optional[Dependencies] = None) -> None -``` - -Set component configuration. - - -#### build`_`directory - -```python - | @property - | build_directory() -> Optional[str] -``` - -Get the component type. - - -#### build`_`directory - -```python - | @build_directory.setter - | build_directory(value: Optional[str]) -> None -``` - -Get the component type. - - -#### component`_`type - -```python - | @property - | component_type() -> ComponentType -``` - -Get the component type. - - -#### component`_`id - -```python - | @property - | component_id() -> ComponentId -``` - -Get the component id. - - -#### prefix`_`import`_`path - -```python - | @property - | prefix_import_path() -> str -``` - -Get the prefix import path for this component. - - -#### is`_`abstract`_`component - -```python - | @property - | is_abstract_component() -> bool -``` - -Check whether the component is abstract. - - -#### check`_`fingerprint - -```python - | check_fingerprint(directory: Path) -> None -``` - -Check that the fingerprint are correct against a directory path. - -**Arguments**: - -- `directory`: the directory path. - -**Raises**: - -- `ValueError`: if -- the argument is not a valid package directory -- the fingerprints do not match. - - -#### check`_`public`_`id`_`consistency - -```python - | check_public_id_consistency(directory: Path) -> None -``` - -Check that the public ids in the init file match the config. - -**Arguments**: - -- `directory`: the directory path. - -**Raises**: - -- `ValueError`: if -- the argument is not a valid package directory -- the public ids do not match. - - -## ConnectionConfig Objects - -```python -class ConnectionConfig(ComponentConfiguration) -``` - -Handle connection configuration. - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr = "", author: SimpleIdOrStr = "", version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, class_name: str = "", protocols: Optional[Set[PublicId]] = None, connections: Optional[Set[PublicId]] = None, restricted_to_protocols: Optional[Set[PublicId]] = None, excluded_protocols: Optional[Set[PublicId]] = None, dependencies: Optional[Dependencies] = None, description: str = "", connection_id: Optional[PublicId] = None, is_abstract: bool = False, cert_requests: Optional[List[CertRequest]] = None, **config: Any, ,) -> None -``` - -Initialize a connection configuration object. - - -#### package`_`dependencies - -```python - | @property - | package_dependencies() -> Set[ComponentId] -``` - -Get the connection dependencies. - - -#### is`_`abstract`_`component - -```python - | @property - | is_abstract_component() -> bool -``` - -Check whether the component is abstract. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -## ProtocolConfig Objects - -```python -class ProtocolConfig(ComponentConfiguration) -``` - -Handle protocol configuration. - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, aea_version: str = "", dependencies: Optional[Dependencies] = None, description: str = "", protocol_specification_id: Optional[str] = None) -> None -``` - -Initialize a connection configuration object. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -## SkillComponentConfiguration Objects - -```python -class SkillComponentConfiguration() -``` - -This class represent a skill component configuration. - - -#### `__`init`__` - -```python - | __init__(class_name: str, file_path: Optional[str] = None, **args: Any) -> None -``` - -Initialize a skill component configuration. - -**Arguments**: - -- `class_name`: the class name of the component. -- `file_path`: the file path. -- `args`: keyword arguments. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -#### from`_`json - -```python - | @classmethod - | from_json(cls, obj: Dict) -> "SkillComponentConfiguration" -``` - -Initialize from a JSON object. - - -## SkillConfig Objects - -```python -class SkillConfig(ComponentConfiguration) -``` - -Class to represent a skill configuration file. - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, connections: Optional[Set[PublicId]] = None, protocols: Optional[Set[PublicId]] = None, contracts: Optional[Set[PublicId]] = None, skills: Optional[Set[PublicId]] = None, dependencies: Optional[Dependencies] = None, description: str = "", is_abstract: bool = False) -> None -``` - -Initialize a skill configuration. - - -#### package`_`dependencies - -```python - | @property - | package_dependencies() -> Set[ComponentId] -``` - -Get the skill dependencies. - - -#### is`_`abstract`_`component - -```python - | @property - | is_abstract_component() -> bool -``` - -Check whether the component is abstract. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -#### get`_`overridable - -```python - | get_overridable() -> dict -``` - -Get overridable configuration data. - - -## AgentConfig Objects - -```python -class AgentConfig(PackageConfiguration) -``` - -Class to represent the agent configuration file. - - -#### `__`init`__` - -```python - | __init__(agent_name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, description: str = "", logging_config: Optional[Dict] = None, period: Optional[float] = None, execution_timeout: Optional[float] = None, max_reactions: Optional[int] = None, error_handler: Optional[Dict] = None, decision_maker_handler: Optional[Dict] = None, skill_exception_policy: Optional[str] = None, connection_exception_policy: Optional[str] = None, default_ledger: Optional[str] = None, required_ledgers: Optional[List[str]] = None, currency_denominations: Optional[Dict[str, str]] = None, default_connection: Optional[str] = None, default_routing: Optional[Dict[str, str]] = None, loop_mode: Optional[str] = None, runtime_mode: Optional[str] = None, task_manager_mode: Optional[str] = None, storage_uri: Optional[str] = None, data_dir: Optional[str] = None, component_configurations: Optional[Dict[ComponentId, Dict]] = None, dependencies: Optional[Dependencies] = None) -> None -``` - -Instantiate the agent configuration object. - - -#### component`_`configurations - -```python - | @property - | component_configurations() -> Dict[ComponentId, Dict] -``` - -Get the custom component configurations. - - -#### component`_`configurations - -```python - | @component_configurations.setter - | component_configurations(d: Dict[ComponentId, Dict]) -> None -``` - -Set the component configurations. - - -#### package`_`dependencies - -```python - | @property - | package_dependencies() -> Set[ComponentId] -``` - -Get the package dependencies. - - -#### private`_`key`_`paths`_`dict - -```python - | @property - | private_key_paths_dict() -> Dict[str, str] -``` - -Get dictionary version of private key paths. - - -#### connection`_`private`_`key`_`paths`_`dict - -```python - | @property - | connection_private_key_paths_dict() -> Dict[str, str] -``` - -Get dictionary version of connection private key paths. - - -#### component`_`configurations`_`json - -```python - | component_configurations_json() -> List[OrderedDict] -``` - -Get the component configurations in JSON format. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -#### all`_`components`_`id - -```python - | @property - | all_components_id() -> List[ComponentId] -``` - -Get list of the all components for this agent config. - - -#### update - -```python - | update(data: Dict, env_vars_friendly: bool = False) -> None -``` - -Update configuration with other data. - -To update the component parts, populate the field "component_configurations" as a -mapping from ComponentId to configurations. - -**Arguments**: - -- `data`: the data to replace. -- `env_vars_friendly`: whether or not it is env vars friendly. - - -## SpeechActContentConfig Objects - -```python -class SpeechActContentConfig(Configuration) -``` - -Handle a speech_act content configuration. - - -#### `__`init`__` - -```python - | __init__(**args: Any) -> None -``` - -Initialize a speech_act content configuration. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -#### from`_`json - -```python - | @classmethod - | from_json(cls, obj: Dict) -> "SpeechActContentConfig" -``` - -Initialize from a JSON object. - - -## ProtocolSpecification Objects - -```python -class ProtocolSpecification(ProtocolConfig) -``` - -Handle protocol specification. - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", description: str = "", protocol_specification_id: Optional[str] = None) -> None -``` - -Initialize a protocol specification configuration object. - - -#### protobuf`_`snippets - -```python - | @property - | protobuf_snippets() -> Dict -``` - -Get the protobuf snippets. - - -#### protobuf`_`snippets - -```python - | @protobuf_snippets.setter - | protobuf_snippets(protobuf_snippets: Dict) -> None -``` - -Set the protobuf snippets. - - -#### dialogue`_`config - -```python - | @property - | dialogue_config() -> Dict -``` - -Get the dialogue config. - - -#### dialogue`_`config - -```python - | @dialogue_config.setter - | dialogue_config(dialogue_config: Dict) -> None -``` - -Set the dialogue config. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -## ContractConfig Objects - -```python -class ContractConfig(ComponentConfiguration) -``` - -Handle contract configuration. - - -#### `__`init`__` - -```python - | __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, dependencies: Optional[Dependencies] = None, description: str = "", contract_interface_paths: Optional[Dict[str, str]] = None, class_name: str = "") -> None -``` - -Initialize a protocol configuration object. - - -#### json - -```python - | @property - | json() -> Dict -``` - -Return the JSON representation. - - -## AEAVersionError Objects - -```python -class AEAVersionError(ValueError) -``` - -Special Exception for version error. - - -#### `__`init`__` - -```python - | __init__(package_id: PublicId, aea_version_specifiers: SpecifierSet) -> None -``` - -Init exception. - diff --git a/docs/api/configurations/constants.md b/docs/api/configurations/constants.md index a7b0d0c8c0..d1fff859e4 100644 --- a/docs/api/configurations/constants.md +++ b/docs/api/configurations/constants.md @@ -1,4 +1,5 @@ - + + # aea.configurations.constants Module to declare constants. diff --git a/docs/api/configurations/data_types.md b/docs/api/configurations/data_types.md index 38f3f2e859..c87f2092a8 100644 --- a/docs/api/configurations/data_types.md +++ b/docs/api/configurations/data_types.md @@ -1,9 +1,11 @@ - + + # aea.configurations.data`_`types Base config data types. - + + ## JSONSerializable Objects ```python @@ -12,28 +14,32 @@ class JSONSerializable(ABC) Interface for JSON-serializable objects. - + + #### json ```python - | @property - | @abstractmethod - | json() -> Dict +@property +@abstractmethod +def json() -> Dict ``` Compute the JSON representation. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, obj: Dict) -> "JSONSerializable" +@classmethod +@abstractmethod +def from_json(cls, obj: Dict) -> "JSONSerializable" ``` Build from a JSON object. - + + ## PackageVersion Objects ```python @@ -43,11 +49,12 @@ class PackageVersion() A package version. - + + #### `__`init`__` ```python - | __init__(version_like: PackageVersionLike) -> None +def __init__(version_like: PackageVersionLike) -> None ``` Initialize a package version. @@ -56,44 +63,49 @@ Initialize a package version. - `version_like`: a string, os a semver.VersionInfo object. - + + #### is`_`latest ```python - | @property - | is_latest() -> bool +@property +def is_latest() -> bool ``` Check whether the version is 'latest'. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`lt`__` ```python - | __lt__(other: Any) -> bool +def __lt__(other: Any) -> bool ``` Compare with another object. - + + ## PackageType Objects ```python @@ -102,11 +114,12 @@ class PackageType(Enum) Package types. - + + #### to`_`plural ```python - | to_plural() -> str +def to_plural() -> str ``` Get the plural name. @@ -126,16 +139,18 @@ Get the plural name. pluralised package type - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Convert to string. - + + ## ComponentType Objects ```python @@ -144,21 +159,23 @@ class ComponentType(Enum) Enum of component types supported. - + + #### to`_`package`_`type ```python - | to_package_type() -> PackageType +def to_package_type() -> PackageType ``` Get package type for component type. - + + #### plurals ```python - | @staticmethod - | plurals() -> Collection[str] +@staticmethod +def plurals() -> Collection[str] ``` Get the collection of type names, plural. @@ -170,11 +187,12 @@ Get the collection of type names, plural. list of all pluralised component types - + + #### to`_`plural ```python - | to_plural() -> str +def to_plural() -> str ``` Get the plural version of the component type. @@ -192,16 +210,18 @@ Get the plural version of the component type. pluralised component type - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + ## PublicId Objects ```python @@ -232,88 +252,99 @@ The concatenation of those three elements gives the public identifier: >>> latest_public_id.package_version.is_latest True - + + #### `__`init`__` ```python - | __init__(author: SimpleIdOrStr, name: SimpleIdOrStr, version: Optional[PackageVersionLike] = None) -> None +def __init__(author: SimpleIdOrStr, + name: SimpleIdOrStr, + version: Optional[PackageVersionLike] = None) -> None ``` Initialize the public identifier. - + + #### author ```python - | @property - | author() -> str +@property +def author() -> str ``` Get the author. - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the name. - + + #### version ```python - | @property - | version() -> str +@property +def version() -> str ``` Get the version string. - + + #### package`_`version ```python - | @property - | package_version() -> PackageVersion +@property +def package_version() -> PackageVersion ``` Get the package version object. - + + #### to`_`any ```python - | to_any() -> "PublicId" +def to_any() -> "PublicId" ``` Return the same public id, but with any version. - + + #### same`_`prefix ```python - | same_prefix(other: "PublicId") -> bool +def same_prefix(other: "PublicId") -> bool ``` Check if the other public id has the same author and name of this. - + + #### to`_`latest ```python - | to_latest() -> "PublicId" +def to_latest() -> "PublicId" ``` Return the same public id, but with latest version. - + + #### is`_`valid`_`str ```python - | @classmethod - | is_valid_str(cls, public_id_string: str) -> bool +@classmethod +def is_valid_str(cls, public_id_string: str) -> bool ``` Check if a string is a public id. @@ -326,12 +357,13 @@ Check if a string is a public id. bool indicating validity - + + #### from`_`str ```python - | @classmethod - | from_str(cls, public_id_string: str) -> "PublicId" +@classmethod +def from_str(cls, public_id_string: str) -> "PublicId" ``` Initialize the public id from the string. @@ -349,20 +381,21 @@ ValueError: Input 'bad/formatted:input' is not well formatted. - `public_id_string`: the public id in string format. +**Raises**: + +- `ValueError`: if the string in input is not well formatted. + **Returns**: the public id object. -**Raises**: - -- `ValueError`: if the string in input is not well formatted. + - #### try`_`from`_`str ```python - | @classmethod - | try_from_str(cls, public_id_string: str) -> Optional["PublicId"] +@classmethod +def try_from_str(cls, public_id_string: str) -> Optional["PublicId"] ``` Safely try to get public id from string. @@ -375,12 +408,13 @@ Safely try to get public id from string. the public id object or None - + + #### from`_`uri`_`path ```python - | @classmethod - | from_uri_path(cls, public_id_uri_path: str) -> "PublicId" +@classmethod +def from_uri_path(cls, public_id_uri_path: str) -> "PublicId" ``` Initialize the public id from the string. @@ -398,20 +432,21 @@ ValueError: Input 'bad/formatted:input' is not well formatted. - `public_id_uri_path`: the public id in uri path string format. +**Raises**: + +- `ValueError`: if the string in input is not well formatted. + **Returns**: the public id object. -**Raises**: + -- `ValueError`: if the string in input is not well formatted. - - #### to`_`uri`_`path ```python - | @property - | to_uri_path() -> str +@property +def to_uri_path() -> str ``` Turn the public id into a uri path string. @@ -420,67 +455,74 @@ Turn the public id into a uri path string. uri path string - + + #### json ```python - | @property - | json() -> Dict +@property +def json() -> Dict ``` Compute the JSON representation. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, obj: Dict) -> "PublicId" +@classmethod +def from_json(cls, obj: Dict) -> "PublicId" ``` Build from a JSON object. - + + #### `__`hash`__` ```python - | __hash__() -> int +def __hash__() -> int ``` Get the hash. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get the representation. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + #### `__`lt`__` ```python - | __lt__(other: Any) -> bool +def __lt__(other: Any) -> bool ``` Compare two public ids. @@ -510,7 +552,8 @@ ValueError: The public IDs author_1/name_1:0.1.0 and author_1/name_2:0.1.0 canno whether or not the inequality is satisfied - + + ## PackageId Objects ```python @@ -519,11 +562,13 @@ class PackageId() A package identifier. - + + #### `__`init`__` ```python - | __init__(package_type: Union[PackageType, str], public_id: PublicId) -> None +def __init__(package_type: Union[PackageType, str], + public_id: PublicId) -> None ``` Initialize the package id. @@ -533,72 +578,79 @@ Initialize the package id. - `package_type`: the package type. - `public_id`: the public id. - + + #### package`_`type ```python - | @property - | package_type() -> PackageType +@property +def package_type() -> PackageType ``` Get the package type. - + + #### public`_`id ```python - | @property - | public_id() -> PublicId +@property +def public_id() -> PublicId ``` Get the public id. - + + #### author ```python - | @property - | author() -> str +@property +def author() -> str ``` Get the author of the package. - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the name of the package. - + + #### version ```python - | @property - | version() -> str +@property +def version() -> str ``` Get the version of the package. - + + #### package`_`prefix ```python - | @property - | package_prefix() -> Tuple[PackageType, str, str] +@property +def package_prefix() -> Tuple[PackageType, str, str] ``` Get the package identifier without the version. - + + #### from`_`uri`_`path ```python - | @classmethod - | from_uri_path(cls, package_id_uri_path: str) -> "PackageId" +@classmethod +def from_uri_path(cls, package_id_uri_path: str) -> "PackageId" ``` Initialize the package id from the string. @@ -616,20 +668,21 @@ ValueError: Input 'very/bad/formatted:input' is not well formatted. - `package_id_uri_path`: the package id in uri path string format. +**Raises**: + +- `ValueError`: if the string in input is not well formatted. + **Returns**: the package id object. -**Raises**: - -- `ValueError`: if the string in input is not well formatted. + - #### to`_`uri`_`path ```python - | @property - | to_uri_path() -> str +@property +def to_uri_path() -> str ``` Turn the package id into a uri path string. @@ -638,52 +691,58 @@ Turn the package id into a uri path string. uri path string - + + #### `__`hash`__` ```python - | __hash__() -> int +def __hash__() -> int ``` Get the hash. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get the object representation in string. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + #### `__`lt`__` ```python - | __lt__(other: Any) -> bool +def __lt__(other: Any) -> bool ``` Compare two public ids. - + + ## ComponentId Objects ```python @@ -702,11 +761,13 @@ True >>> pacakge_id == component_id2 False - + + #### `__`init`__` ```python - | __init__(component_type: Union[ComponentType, str], public_id: PublicId) -> None +def __init__(component_type: Union[ComponentType, str], + public_id: PublicId) -> None ``` Initialize the component id. @@ -716,66 +777,73 @@ Initialize the component id. - `component_type`: the component type. - `public_id`: the public id. - + + #### component`_`type ```python - | @property - | component_type() -> ComponentType +@property +def component_type() -> ComponentType ``` Get the component type. - + + #### component`_`prefix ```python - | @property - | component_prefix() -> PackageIdPrefix +@property +def component_prefix() -> PackageIdPrefix ``` Get the component identifier without the version. - + + #### same`_`prefix ```python - | same_prefix(other: "ComponentId") -> bool +def same_prefix(other: "ComponentId") -> bool ``` Check if the other component id has the same type, author and name of this. - + + #### prefix`_`import`_`path ```python - | @property - | prefix_import_path() -> str +@property +def prefix_import_path() -> str ``` Get the prefix import path for this component. - + + #### json ```python - | @property - | json() -> Dict +@property +def json() -> Dict ``` Get the JSON representation. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, json_data: Dict) -> "ComponentId" +@classmethod +def from_json(cls, json_data: Dict) -> "ComponentId" ``` Create component id from json data. - + + ## PyPIPackageName Objects ```python @@ -784,7 +852,8 @@ class PyPIPackageName(RegexConstrainedString) A PyPI Package name. - + + ## GitRef Objects ```python @@ -795,7 +864,8 @@ A Git reference. It can be a branch name, a commit hash or a tag. - + + ## Dependency Objects ```python @@ -813,11 +883,16 @@ It contains the following information: If the 'git' field is set, the 'version' field will be ignored. These fields will be forwarded to the 'pip' command. - + + #### `__`init`__` ```python - | __init__(name: Union[PyPIPackageName, str], version: Union[str, SpecifierSet] = "", index: Optional[str] = None, git: Optional[str] = None, ref: Optional[Union[GitRef, str]] = None) -> None +def __init__(name: Union[PyPIPackageName, str], + version: Union[str, SpecifierSet] = "", + index: Optional[str] = None, + git: Optional[str] = None, + ref: Optional[Union[GitRef, str]] = None) -> None ``` Initialize a PyPI dependency. @@ -830,103 +905,114 @@ Initialize a PyPI dependency. - `git`: the URL to a git repository. - `ref`: the Git reference (branch/commit/tag). - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the name. - + + #### version ```python - | @property - | version() -> str +@property +def version() -> str ``` Get the version. - + + #### index ```python - | @property - | index() -> Optional[str] +@property +def index() -> Optional[str] ``` Get the index. - + + #### git ```python - | @property - | git() -> Optional[str] +@property +def git() -> Optional[str] ``` Get the git. - + + #### ref ```python - | @property - | ref() -> Optional[str] +@property +def ref() -> Optional[str] ``` Get the ref. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, obj: Dict[str, Dict[str, str]]) -> "Dependency" +@classmethod +def from_json(cls, obj: Dict[str, Dict[str, str]]) -> "Dependency" ``` Parse a dependency object from a dictionary. - + + #### to`_`json ```python - | to_json() -> Dict[str, Dict[str, str]] +def to_json() -> Dict[str, Dict[str, str]] ``` Transform the object to JSON. - + + #### get`_`pip`_`install`_`args ```python - | get_pip_install_args() -> List[str] +def get_pip_install_args() -> List[str] ``` Get 'pip install' arguments. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + #### Dependencies A dictionary from package name to dependency data structure (see above). @@ -935,7 +1021,8 @@ The package name must satisfy + + ## CRUDCollection Objects ```python @@ -944,20 +1031,22 @@ class CRUDCollection(Generic[T]) Interface of a CRUD collection. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Instantiate a CRUD collection. - + + #### create ```python - | create(item_id: str, item: T) -> None +def create(item_id: str, item: T) -> None ``` Add an item. @@ -971,11 +1060,12 @@ Add an item. - `ValueError`: if the item with the same id is already in the collection. - + + #### read ```python - | read(item_id: str) -> Optional[T] +def read(item_id: str) -> Optional[T] ``` Get an item by its name. @@ -988,11 +1078,12 @@ Get an item by its name. the associated item, or None if the item id is not present. - + + #### update ```python - | update(item_id: str, item: T) -> None +def update(item_id: str, item: T) -> None ``` Update an existing item. @@ -1002,29 +1093,32 @@ Update an existing item. - `item_id`: the item id. - `item`: the item to be added. - + + #### delete ```python - | delete(item_id: str) -> None +def delete(item_id: str) -> None ``` Delete an item. - + + #### read`_`all ```python - | read_all() -> List[Tuple[str, T]] +def read_all() -> List[Tuple[str, T]] ``` Read all the items. - + + #### keys ```python - | keys() -> Set[str] +def keys() -> Set[str] ``` Get the set of keys. diff --git a/docs/api/configurations/loader.md b/docs/api/configurations/loader.md index da5d6fbfd3..e69de29bb2 100644 --- a/docs/api/configurations/loader.md +++ b/docs/api/configurations/loader.md @@ -1,268 +0,0 @@ - -# aea.configurations.loader - -Implementation of the parser for configuration file. - - -## BaseConfigLoader Objects - -```python -class BaseConfigLoader() -``` - -Base class for configuration loader classes. - - -#### `__`init`__` - -```python - | __init__(schema_filename: str) -> None -``` - -Initialize the parser for configuration files. - -**Arguments**: - -- `schema_filename`: the path to the JSON-schema file in 'aea/configurations/schemas'. - - -#### validator - -```python - | @property - | validator() -> ConfigValidator -``` - -Get the json schema validator. - - -#### validate - -```python - | validate(json_data: Dict) -> None -``` - -Validate a JSON object. - -**Arguments**: - -- `json_data`: the JSON data. - - -#### required`_`fields - -```python - | @property - | required_fields() -> List[str] -``` - -Get the required fields. - -**Returns**: - -list of required fields. - - -## ConfigLoader Objects - -```python -class ConfigLoader(Generic[T], BaseConfigLoader) -``` - -Parsing, serialization and validation for package configuration files. - - -#### `__`init`__` - -```python - | __init__(schema_filename: str, configuration_class: Type[T], skip_aea_validation: bool = True) -> None -``` - -Initialize the parser for configuration files. - -**Arguments**: - -- `schema_filename`: the path to the JSON-schema file in 'aea/configurations/schemas'. -- `configuration_class`: the configuration class (e.g. AgentConfig, SkillConfig etc.) -- `skip_aea_validation`: if True, the validation of the AEA version is skipped. - - -#### configuration`_`class - -```python - | @property - | configuration_class() -> Type[T] -``` - -Get the configuration class of the loader. - - -#### validate - -```python - | validate(json_data: Dict) -> None -``` - -Validate a JSON representation of an AEA package. - -First, checks whether the AEA version is compatible with the configuration file. -Then, validates the JSON object against the specific schema. - -**Arguments**: - -- `json_data`: the JSON data. - - -#### load`_`protocol`_`specification - -```python - | load_protocol_specification(file_pointer: TextIO) -> ProtocolSpecification -``` - -Load an agent configuration file. - -**Arguments**: - -- `file_pointer`: the file pointer to the configuration file - -**Returns**: - -the configuration object. -:raises - - -#### load - -```python - | load(file_pointer: TextIO) -> T -``` - -Load a configuration file. - -**Arguments**: - -- `file_pointer`: the file pointer to the configuration file - -**Returns**: - -the configuration object. - - -#### dump - -```python - | dump(configuration: T, file_pointer: TextIO) -> None -``` - -Dump a configuration. - -**Arguments**: - -- `configuration`: the configuration to be dumped. -- `file_pointer`: the file pointer to the configuration file - - -#### from`_`configuration`_`type - -```python - | @classmethod - | from_configuration_type(cls, configuration_type: Union[PackageType, str], **kwargs: Any) -> "ConfigLoader" -``` - -Get the configuration loader from the type. - -**Arguments**: - -- `configuration_type`: the type of configuration -- `kwargs`: keyword arguments to the configuration loader constructor. - -**Returns**: - -the configuration loader - - -#### load`_`agent`_`config`_`from`_`json - -```python - | load_agent_config_from_json(configuration_json: List[Dict], validate: bool = True) -> AgentConfig -``` - -Load agent configuration from configuration json data. - -**Arguments**: - -- `configuration_json`: list of dicts with aea configuration -- `validate`: whether or not to validate - -**Returns**: - -AgentConfig instance - - -## ConfigLoaders Objects - -```python -class ConfigLoaders() -``` - -Configuration Loader class to load any package type. - - -#### from`_`package`_`type - -```python - | @classmethod - | from_package_type(cls, configuration_type: Union[PackageType, str], **kwargs: Any) -> "ConfigLoader" -``` - -Get a config loader from the configuration type. - -**Arguments**: - -- `configuration_type`: the configuration type. -- `kwargs`: keyword arguments to the configuration loader constructor. - -**Returns**: - -configuration loader - - -#### load`_`component`_`configuration - -```python -load_component_configuration(component_type: ComponentType, directory: Path, skip_consistency_check: bool = False, skip_aea_validation: bool = True) -> ComponentConfiguration -``` - -Load configuration and check that it is consistent against the directory. - -**Arguments**: - -- `component_type`: the component type. -- `directory`: the root of the package -- `skip_consistency_check`: if True, the consistency check are skipped. -- `skip_aea_validation`: if True, the validation of the AEA version is skipped. - -**Returns**: - -the configuration object. - - -#### load`_`package`_`configuration - -```python -load_package_configuration(package_type: PackageType, directory: Path, skip_consistency_check: bool = False, skip_aea_validation: bool = True) -> PackageConfiguration -``` - -Load configuration and check that it is consistent against the directory. - -**Arguments**: - -- `package_type`: the package type. -- `directory`: the root of the package -- `skip_consistency_check`: if True, the consistency check are skipped. -- `skip_aea_validation`: if True, the validation of the AEA version is skipped. - -**Returns**: - -the configuration object. - diff --git a/docs/api/configurations/manager.md b/docs/api/configurations/manager.md index 4423523366..08f20e2f07 100644 --- a/docs/api/configurations/manager.md +++ b/docs/api/configurations/manager.md @@ -1,9 +1,11 @@ - + + # aea.configurations.manager Implementation of the AgentConfigManager. - + + ## VariableDoesNotExist Objects ```python @@ -12,22 +14,27 @@ class VariableDoesNotExist(ValueError) Variable does not exist in a config exception. - + + #### handle`_`dotted`_`path ```python -handle_dotted_path(value: str, author: str, aea_project_path: Union[str, Path] = ".") -> Tuple[List[str], Path, ConfigLoader, Optional[ComponentId]] +def handle_dotted_path( + value: str, + author: str, + aea_project_path: Union[str, Path] = "." +) -> Tuple[List[str], Path, ConfigLoader, Optional[ComponentId]] ``` Separate the path between path to resource and json path to attribute. Allowed values: -'agent.an_attribute_name' -'protocols.my_protocol.an_attribute_name' -'connections.my_connection.an_attribute_name' -'contracts.my_contract.an_attribute_name' -'skills.my_skill.an_attribute_name' -'vendor.author.[protocols|contracts|connections|skills].package_name.attribute_name + 'agent.an_attribute_name' + 'protocols.my_protocol.an_attribute_name' + 'connections.my_connection.an_attribute_name' + 'contracts.my_contract.an_attribute_name' + 'skills.my_skill.an_attribute_name' + 'vendor.author.[protocols|contracts|connections|skills].package_name.attribute_name We also return the component id to retrieve the configuration of a specific component. Notice that at this point we don't know the version, @@ -44,16 +51,19 @@ we will filter with only the component prefix (i.e. the triple type, author and Tuple[list of settings dict keys, filepath, config loader, component id]. - + + #### find`_`component`_`directory`_`from`_`component`_`id ```python -find_component_directory_from_component_id(aea_project_directory: Path, component_id: ComponentId) -> Path +def find_component_directory_from_component_id( + aea_project_directory: Path, component_id: ComponentId) -> Path ``` Find a component directory from component id. - + + ## AgentConfigManager Objects ```python @@ -62,11 +72,14 @@ class AgentConfigManager() AeaConfig manager. - + + #### `__`init`__` ```python - | __init__(agent_config: AgentConfig, aea_project_directory: Union[str, Path], env_vars_friendly: bool = False) -> None +def __init__(agent_config: AgentConfig, + aea_project_directory: Union[str, Path], + env_vars_friendly: bool = False) -> None ``` Init manager. @@ -77,11 +90,14 @@ Init manager. - `aea_project_directory`: directory where project for agent_config placed. - `env_vars_friendly`: whether or not it is env vars friendly - + + #### load`_`component`_`configuration ```python - | load_component_configuration(component_id: ComponentId, skip_consistency_check: bool = True) -> ComponentConfiguration +def load_component_configuration( + component_id: ComponentId, + skip_consistency_check: bool = True) -> ComponentConfiguration ``` Load component configuration from the project directory. @@ -95,31 +111,36 @@ Load component configuration from the project directory. ComponentConfiguration - + + #### agent`_`config`_`file`_`path ```python - | @property - | agent_config_file_path() -> Path +@property +def agent_config_file_path() -> Path ``` Return agent config file path. - + + #### load ```python - | @classmethod - | load(cls, aea_project_path: Union[Path, str], substitude_env_vars: bool = False) -> "AgentConfigManager" +@classmethod +def load(cls, + aea_project_path: Union[Path, str], + substitude_env_vars: bool = False) -> "AgentConfigManager" ``` Create AgentConfigManager instance from agent project path. - + + #### set`_`variable ```python - | set_variable(path: VariablePath, value: JSON_TYPES) -> None +def set_variable(path: VariablePath, value: JSON_TYPES) -> None ``` Set config variable. @@ -129,11 +150,12 @@ Set config variable. - `path`: str dotted path or List[Union[ComponentId, str]] - `value`: one of the json friendly objects. - + + #### get`_`variable ```python - | get_variable(path: VariablePath) -> JSON_TYPES +def get_variable(path: VariablePath) -> JSON_TYPES ``` Set config variable. @@ -146,11 +168,12 @@ Set config variable. json friendly value. - + + #### update`_`config ```python - | update_config(overrides: Dict) -> None +def update_config(overrides: Dict) -> None ``` Apply overrides for agent config. @@ -166,40 +189,49 @@ Does not save it on the disc! None - + + #### validate`_`current`_`config ```python - | validate_current_config() -> None +def validate_current_config() -> None ``` Check is current config valid. - + + #### json ```python - | @property - | json() -> Dict +@property +def json() -> Dict ``` Return current agent config json representation. - + + #### dump`_`config ```python - | dump_config() -> None +def dump_config() -> None ``` Save agent config on the disc. - + + #### verify`_`private`_`keys ```python - | @classmethod - | verify_private_keys(cls, aea_project_path: Union[Path, str], private_key_helper: Callable[[AgentConfig, Path, Optional[str]], None], substitude_env_vars: bool = False, password: Optional[str] = None) -> "AgentConfigManager" +@classmethod +def verify_private_keys( + cls, + aea_project_path: Union[Path, str], + private_key_helper: Callable[[AgentConfig, Path, Optional[str]], None], + substitude_env_vars: bool = False, + password: Optional[str] = None) -> "AgentConfigManager" ``` Verify private keys. @@ -217,11 +249,12 @@ Does not saves the config! Use AgentConfigManager.dump_config() the agent configuration manager. - + + #### get`_`overridables ```python - | get_overridables() -> Tuple[Dict, Dict[ComponentId, Dict]] +def get_overridables() -> Tuple[Dict, Dict[ComponentId, Dict]] ``` Get config overridables. diff --git a/docs/api/configurations/pypi.md b/docs/api/configurations/pypi.md index 03303720c7..0d4a91f176 100644 --- a/docs/api/configurations/pypi.md +++ b/docs/api/configurations/pypi.md @@ -1,22 +1,25 @@ - + + # aea.configurations.pypi This module contains a checker for PyPI version consistency. - + + #### and`_` ```python -and_(s1: SpecifierSet, s2: SpecifierSet) -> SpecifierSet +def and_(s1: SpecifierSet, s2: SpecifierSet) -> SpecifierSet ``` Do the and between two specifier sets. - + + #### is`_`satisfiable ```python -is_satisfiable(specifier_set: SpecifierSet) -> bool +def is_satisfiable(specifier_set: SpecifierSet) -> bool ``` Check if the specifier set is satisfiable. @@ -45,7 +48,7 @@ False For other details, please refer to PEP440: -https://www.python.org/dev/peps/pep-0440 + https://www.python.org/dev/peps/pep-0440 **Arguments**: @@ -55,11 +58,12 @@ https://www.python.org/dev/peps/pep-0440 False if the constraints are surely non-satisfiable, True if we don't know. - + + #### is`_`simple`_`dep ```python -is_simple_dep(dep: Dependency) -> bool +def is_simple_dep(dep: Dependency) -> bool ``` Check if it is a simple dependency. @@ -74,27 +78,29 @@ Namely, if it has no field specified, or only the 'version' field set. whether it is a simple dependency or not - + + #### to`_`set`_`specifier ```python -to_set_specifier(dep: Dependency) -> SpecifierSet +def to_set_specifier(dep: Dependency) -> SpecifierSet ``` Get the set specifier. It assumes to be a simple dependency (see above). - + + #### merge`_`dependencies ```python -merge_dependencies(dep1: Dependencies, dep2: Dependencies) -> Dependencies +def merge_dependencies(dep1: Dependencies, dep2: Dependencies) -> Dependencies ``` Merge two groups of dependencies. If some of them are not "simple" (see above), and there is no risk -of conflict because there is no other package with the same name, -we leave them; otherwise we raise an error. + of conflict because there is no other package with the same name, + we leave them; otherwise we raise an error. **Arguments**: @@ -105,11 +111,12 @@ we leave them; otherwise we raise an error. the merged dependencies. - + + #### merge`_`dependencies`_`list ```python -merge_dependencies_list(*deps: Dependencies) -> Dependencies +def merge_dependencies_list(*deps: Dependencies) -> Dependencies ``` Merge a list of dependencies. diff --git a/docs/api/configurations/utils.md b/docs/api/configurations/utils.md index 0f8158cf9d..5ed699e5af 100644 --- a/docs/api/configurations/utils.md +++ b/docs/api/configurations/utils.md @@ -1,26 +1,32 @@ - + + # aea.configurations.utils AEA configuration utils. - + + #### replace`_`component`_`ids ```python @singledispatch -replace_component_ids(_arg: PackageConfiguration, _replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None +def replace_component_ids( + _arg: PackageConfiguration, + _replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None ``` Update public id references in a package configuration. This depends on the actual configuration being considered. - + + #### `_` ```python @replace_component_ids.register(AgentConfig) # type: ignore -_(arg: AgentConfig, replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None +def _(arg: AgentConfig, replacements: Dict[ComponentType, + Dict[PublicId, PublicId]]) -> None ``` Replace references in agent configuration. @@ -36,51 +42,62 @@ It breaks down in: - `arg`: the agent configuration. - `replacements`: the replacement mapping. - + + #### `_` ```python @replace_component_ids.register(ProtocolConfig) # type: ignore -_(_arg: ProtocolConfig, _replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None +def _(_arg: ProtocolConfig, + _replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None ``` Do nothing - protocols have no references. - + + #### `_` ```python @replace_component_ids.register(ConnectionConfig) # type: ignore -_(arg: ConnectionConfig, replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None +def _(arg: ConnectionConfig, + replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None ``` Replace references in a connection configuration. - + + #### `_` ```python @replace_component_ids.register(ContractConfig) # type: ignore -_(_arg: ContractConfig, _replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None +def _(_arg: ContractConfig, + _replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None ``` Do nothing - contracts have no references. - + + #### `_` ```python @replace_component_ids.register(SkillConfig) # type: ignore -_(arg: SkillConfig, replacements: Dict[ComponentType, Dict[PublicId, PublicId]]) -> None +def _(arg: SkillConfig, replacements: Dict[ComponentType, + Dict[PublicId, PublicId]]) -> None ``` Replace references in a skill configuration. - + + #### get`_`latest`_`component`_`id`_`from`_`prefix ```python -get_latest_component_id_from_prefix(agent_config: AgentConfig, component_prefix: PackageIdPrefix) -> Optional[ComponentId] +def get_latest_component_id_from_prefix( + agent_config: AgentConfig, + component_prefix: PackageIdPrefix) -> Optional[ComponentId] ``` Get component id with the greatest version in an agent configuration given its prefix. diff --git a/docs/api/configurations/validation.md b/docs/api/configurations/validation.md index 92bf4cb824..2d615dff7f 100644 --- a/docs/api/configurations/validation.md +++ b/docs/api/configurations/validation.md @@ -1,13 +1,15 @@ - + + # aea.configurations.validation Implementation of the configuration validation. - + + #### make`_`jsonschema`_`base`_`uri ```python -make_jsonschema_base_uri(base_uri_path: Path) -> str +def make_jsonschema_base_uri(base_uri_path: Path) -> str ``` Make the JSONSchema base URI, cross-platform. @@ -20,7 +22,8 @@ Make the JSONSchema base URI, cross-platform. the string in URI form. - + + ## ExtraPropertiesError Objects ```python @@ -29,25 +32,28 @@ class ExtraPropertiesError(ValueError) Extra properties exception. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation of the object. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get string representation of the object. - + + ## CustomTypeChecker Objects ```python @@ -56,25 +62,28 @@ class CustomTypeChecker(TypeChecker) Custom type checker to handle env variables. - + + #### is`_`type ```python - | is_type(instance, type) -> bool +def is_type(instance, type) -> bool ``` Check is instance of type. - + + #### own`_`additional`_`properties ```python -own_additional_properties(validator, aP, instance, schema) -> Iterator +def own_additional_properties(validator, aP, instance, schema) -> Iterator ``` Additional properties validator. - + + ## ConfigValidator Objects ```python @@ -83,11 +92,12 @@ class ConfigValidator() Configuration validator implementation. - + + #### `__`init`__` ```python - | __init__(schema_filename: str, env_vars_friendly: bool = False) -> None +def __init__(schema_filename: str, env_vars_friendly: bool = False) -> None ``` Initialize the parser for configuration files. @@ -97,12 +107,15 @@ Initialize the parser for configuration files. - `schema_filename`: the path to the JSON-schema file in 'aea/configurations/schemas'. - `env_vars_friendly`: whether or not it is env var friendly. - + + #### split`_`component`_`id`_`and`_`config ```python - | @staticmethod - | split_component_id_and_config(component_index: int, component_configuration_json: Dict) -> ComponentId +@staticmethod +def split_component_id_and_config( + component_index: int, + component_configuration_json: Dict) -> ComponentId ``` Split component id and configuration. @@ -112,20 +125,24 @@ Split component id and configuration. - `component_index`: the position of the component configuration in the agent config file.. - `component_configuration_json`: the JSON object to process. +**Raises**: + +- `ValueError`: if the component id cannot be extracted. + **Returns**: the component id and the configuration object. -**Raises**: - -- `ValueError`: if the component id cannot be extracted. + - #### validate`_`component`_`configuration ```python - | @classmethod - | validate_component_configuration(cls, component_id: ComponentId, configuration: Dict, env_vars_friendly: bool = False) -> None +@classmethod +def validate_component_configuration(cls, + component_id: ComponentId, + configuration: Dict, + env_vars_friendly: bool = False) -> None ``` Validate the component configuration of an agent configuration file. @@ -142,11 +159,12 @@ This check is to detect inconsistencies in the specified fields. - `ValueError`: if the configuration is not valid. - + + #### validate ```python - | validate(json_data: Dict) -> None +def validate(json_data: Dict) -> None ``` Validate a JSON object against the right JSON schema. @@ -155,11 +173,13 @@ Validate a JSON object against the right JSON schema. - `json_data`: the JSON data. - + + #### validate`_`agent`_`components`_`configuration ```python - | validate_agent_components_configuration(component_configurations: Dict) -> None +def validate_agent_components_configuration( + component_configurations: Dict) -> None ``` Validate agent component configurations overrides. @@ -168,12 +188,13 @@ Validate agent component configurations overrides. - `component_configurations`: the component configurations to validate. - + + #### required`_`fields ```python - | @property - | required_fields() -> List[str] +@property +def required_fields() -> List[str] ``` Get the required fields. @@ -182,11 +203,15 @@ Get the required fields. list of required fields. - + + #### validate`_`data`_`with`_`pattern ```python -validate_data_with_pattern(data: dict, pattern: dict, excludes: Optional[List[Tuple[str]]] = None, skip_env_vars: bool = False) -> List[str] +def validate_data_with_pattern(data: dict, + pattern: dict, + excludes: Optional[List[Tuple[str]]] = None, + skip_env_vars: bool = False) -> List[str] ``` Validate data dict with pattern dict for attributes present and type match. @@ -202,11 +227,12 @@ Validate data dict with pattern dict for attributes present and type match. list of str with error descriptions - + + #### filter`_`data ```python -filter_data(base: Any, updates: Any) -> Any +def filter_data(base: Any, updates: Any) -> Any ``` Return difference in values or `SAME_MARK` object if values are the same. diff --git a/docs/api/connections/base.md b/docs/api/connections/base.md index 88e1e33f88..9ace44b542 100644 --- a/docs/api/connections/base.md +++ b/docs/api/connections/base.md @@ -1,9 +1,11 @@ - + + # aea.connections.base The base connection package. - + + ## ConnectionStates Objects ```python @@ -12,20 +14,28 @@ class ConnectionStates(Enum) Connection states enum. - + + ## Connection Objects ```python -class Connection(Component, ABC) +class Connection(Component, ABC) ``` Abstract definition of a connection. - + + #### `__`init`__` ```python - | __init__(configuration: ConnectionConfig, data_dir: str, identity: Optional[Identity] = None, crypto_store: Optional[CryptoStore] = None, restricted_to_protocols: Optional[Set[PublicId]] = None, excluded_protocols: Optional[Set[PublicId]] = None, **kwargs: Any, ,) -> None +def __init__(configuration: ConnectionConfig, + data_dir: str, + identity: Optional[Identity] = None, + crypto_store: Optional[CryptoStore] = None, + restricted_to_protocols: Optional[Set[PublicId]] = None, + excluded_protocols: Optional[Set[PublicId]] = None, + **kwargs: Any) -> None ``` Initialize the connection. @@ -43,142 +53,156 @@ parameters are None: connection_id, excluded_protocols or restricted_to_protocol - `excluded_protocols`: the set of protocols ids that we want to exclude for this connection. - `kwargs`: keyword arguments passed to component base - + + #### loop ```python - | @property - | loop() -> asyncio.AbstractEventLoop +@property +def loop() -> asyncio.AbstractEventLoop ``` Get the event loop. - + + #### address ```python - | @property - | address() -> "Address" +@property +def address() -> "Address" ``` Get the address. - + + #### crypto`_`store ```python - | @property - | crypto_store() -> CryptoStore +@property +def crypto_store() -> CryptoStore ``` Get the crypto store. - + + #### has`_`crypto`_`store ```python - | @property - | has_crypto_store() -> bool +@property +def has_crypto_store() -> bool ``` Check if the connection has the crypto store. - + + #### data`_`dir ```python - | @property - | data_dir() -> str +@property +def data_dir() -> str ``` Get the data directory. - + + #### component`_`type ```python - | @property - | component_type() -> ComponentType +@property +def component_type() -> ComponentType ``` Get the component type. - + + #### configuration ```python - | @property - | configuration() -> ConnectionConfig +@property +def configuration() -> ConnectionConfig ``` Get the connection configuration. - + + #### restricted`_`to`_`protocols ```python - | @property - | restricted_to_protocols() -> Set[PublicId] +@property +def restricted_to_protocols() -> Set[PublicId] ``` Get the ids of the protocols this connection is restricted to. - + + #### excluded`_`protocols ```python - | @property - | excluded_protocols() -> Set[PublicId] +@property +def excluded_protocols() -> Set[PublicId] ``` Get the ids of the excluded protocols for this connection. - + + #### state ```python - | @property - | state() -> ConnectionStates +@property +def state() -> ConnectionStates ``` Get the connection status. - + + #### state ```python - | @state.setter - | state(value: ConnectionStates) -> None +@state.setter +def state(value: ConnectionStates) -> None ``` Set the connection status. - + + #### connect ```python - | @abstractmethod - | async connect() -> None +@abstractmethod +async def connect() -> None ``` Set up the connection. - + + #### disconnect ```python - | @abstractmethod - | async disconnect() -> None +@abstractmethod +async def disconnect() -> None ``` Tear down the connection. - + + #### send ```python - | @abstractmethod - | async send(envelope: "Envelope") -> None +@abstractmethod +async def send(envelope: "Envelope") -> None ``` Send an envelope. @@ -191,12 +215,13 @@ Send an envelope. None - + + #### receive ```python - | @abstractmethod - | async receive(*args: Any, **kwargs: Any) -> Optional["Envelope"] +@abstractmethod +async def receive(*args: Any, **kwargs: Any) -> Optional["Envelope"] ``` Receive an envelope. @@ -210,12 +235,15 @@ Receive an envelope. the received envelope, or None if an error occurred. - + + #### from`_`dir ```python - | @classmethod - | from_dir(cls, directory: str, identity: Identity, crypto_store: CryptoStore, data_dir: str, **kwargs: Any, ,) -> "Connection" +@classmethod +def from_dir(cls, directory: str, identity: Identity, + crypto_store: CryptoStore, data_dir: str, + **kwargs: Any) -> "Connection" ``` Load the connection from a directory. @@ -232,12 +260,15 @@ Load the connection from a directory. the connection object. - + + #### from`_`config ```python - | @classmethod - | from_config(cls, configuration: ConnectionConfig, identity: Identity, crypto_store: CryptoStore, data_dir: str, **kwargs: Any, ,) -> "Connection" +@classmethod +def from_config(cls, configuration: ConnectionConfig, identity: Identity, + crypto_store: CryptoStore, data_dir: str, + **kwargs: Any) -> "Connection" ``` Load a connection from a configuration. @@ -254,37 +285,41 @@ Load a connection from a configuration. an instance of the concrete connection class. - + + #### is`_`connected ```python - | @property - | is_connected() -> bool +@property +def is_connected() -> bool ``` Return is connected state. - + + #### is`_`connecting ```python - | @property - | is_connecting() -> bool +@property +def is_connecting() -> bool ``` Return is connecting state. - + + #### is`_`disconnected ```python - | @property - | is_disconnected() -> bool +@property +def is_disconnected() -> bool ``` Return is disconnected state. - + + ## BaseSyncConnection Objects ```python @@ -293,11 +328,18 @@ class BaseSyncConnection(Connection) Base sync connection class to write connections with sync code. - + + #### `__`init`__` ```python - | __init__(configuration: ConnectionConfig, data_dir: str, identity: Optional[Identity] = None, crypto_store: Optional[CryptoStore] = None, restricted_to_protocols: Optional[Set[PublicId]] = None, excluded_protocols: Optional[Set[PublicId]] = None, **kwargs: Any, ,) -> None +def __init__(configuration: ConnectionConfig, + data_dir: str, + identity: Optional[Identity] = None, + crypto_store: Optional[CryptoStore] = None, + restricted_to_protocols: Optional[Set[PublicId]] = None, + excluded_protocols: Optional[Set[PublicId]] = None, + **kwargs: Any) -> None ``` Initialize the connection. @@ -315,95 +357,105 @@ parameters are None: connection_id, excluded_protocols or restricted_to_protocol - `excluded_protocols`: the set of protocols ids that we want to exclude for this connection. - `kwargs`: keyword arguments passed to connection base - + + #### put`_`envelope ```python - | put_envelope(envelope: Optional["Envelope"]) -> None +def put_envelope(envelope: Optional["Envelope"]) -> None ``` Put envelope in to the incoming queue. - + + #### connect ```python - | async connect() -> None +async def connect() -> None ``` Connect connection. - + + #### disconnect ```python - | async disconnect() -> None +async def disconnect() -> None ``` Disconnect connection. - + + #### send ```python - | async send(envelope: "Envelope") -> None +async def send(envelope: "Envelope") -> None ``` Send envelope to connection. - + + #### receive ```python - | async receive(*args: Any, **kwargs: Any) -> Optional["Envelope"] +async def receive(*args: Any, **kwargs: Any) -> Optional["Envelope"] ``` Get an envelope from the connection. - + + #### start`_`main ```python - | start_main() -> None +def start_main() -> None ``` Start main function of the connection. - + + #### main ```python - | main() -> None +def main() -> None ``` Run main body of the connection in dedicated thread. - + + #### on`_`connect ```python - | @abstractmethod - | on_connect() -> None +@abstractmethod +def on_connect() -> None ``` Run on connect method called. - + + #### on`_`disconnect ```python - | @abstractmethod - | on_disconnect() -> None +@abstractmethod +def on_disconnect() -> None ``` Run on disconnect method called. - + + #### on`_`send ```python - | @abstractmethod - | on_send(envelope: "Envelope") -> None +@abstractmethod +def on_send(envelope: "Envelope") -> None ``` Run on send method called. diff --git a/docs/api/context/base.md b/docs/api/context/base.md index b1587a2e4a..4f09460e3f 100644 --- a/docs/api/context/base.md +++ b/docs/api/context/base.md @@ -1,9 +1,11 @@ - + + # aea.context.base This module contains the agent context class. - + + ## AgentContext Objects ```python @@ -12,11 +14,27 @@ class AgentContext() Provide read access to relevant objects of the agent for the skills. - + + #### `__`init`__` ```python - | __init__(identity: Identity, connection_status: MultiplexerStatus, outbox: OutBox, decision_maker_message_queue: Queue, decision_maker_handler_context: SimpleNamespace, task_manager: TaskManager, default_ledger_id: str, currency_denominations: Dict[str, str], default_connection: Optional[PublicId], default_routing: Dict[PublicId, PublicId], search_service_address: Address, decision_maker_address: Address, data_dir: str, storage_callable: Callable[[], Optional[Storage]] = lambda: None, send_to_skill: Optional[Callable] = None, **kwargs: Any, ,) -> None +def __init__(identity: Identity, + connection_status: MultiplexerStatus, + outbox: OutBox, + decision_maker_message_queue: Queue, + decision_maker_handler_context: SimpleNamespace, + task_manager: TaskManager, + default_ledger_id: str, + currency_denominations: Dict[str, str], + default_connection: Optional[PublicId], + default_routing: Dict[PublicId, PublicId], + search_service_address: Address, + decision_maker_address: Address, + data_dir: str, + storage_callable: Callable[[], Optional[Storage]] = lambda: None, + send_to_skill: Optional[Callable] = None, + **kwargs: Any) -> None ``` Initialize an agent context. @@ -40,11 +58,13 @@ Initialize an agent context. - `send_to_skill`: callable for sending envelopes to skills. - `kwargs`: keyword arguments to be attached in the agent context namespace. - + + #### send`_`to`_`skill ```python - | send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None +def send_to_skill(message_or_envelope: Union[Message, Envelope], + context: Optional[EnvelopeContext] = None) -> None ``` Send message or envelope to another skill. @@ -56,32 +76,35 @@ If message passed it will be wrapped into envelope with optional envelope contex - `message_or_envelope`: envelope to send to another skill. - `context`: the optional envelope context - + + #### storage ```python - | @property - | storage() -> Optional[Storage] +@property +def storage() -> Optional[Storage] ``` Return storage instance if enabled in AEA. - + + #### data`_`dir ```python - | @property - | data_dir() -> str +@property +def data_dir() -> str ``` Return assets directory. - + + #### shared`_`state ```python - | @property - | shared_state() -> Dict[str, Any] +@property +def shared_state() -> Dict[str, Any] ``` Get the shared state dictionary. @@ -94,182 +117,200 @@ all skills. dictionary of the shared state. - + + #### identity ```python - | @property - | identity() -> Identity +@property +def identity() -> Identity ``` Get the identity. - + + #### agent`_`name ```python - | @property - | agent_name() -> str +@property +def agent_name() -> str ``` Get agent name. - + + #### addresses ```python - | @property - | addresses() -> Dict[str, Address] +@property +def addresses() -> Dict[str, Address] ``` Get addresses. - + + #### public`_`keys ```python - | @property - | public_keys() -> Dict[str, str] +@property +def public_keys() -> Dict[str, str] ``` Get public keys. - + + #### address ```python - | @property - | address() -> Address +@property +def address() -> Address ``` Get the default address. - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Get the default public key. - + + #### connection`_`status ```python - | @property - | connection_status() -> MultiplexerStatus +@property +def connection_status() -> MultiplexerStatus ``` Get connection status of the multiplexer. - + + #### outbox ```python - | @property - | outbox() -> OutBox +@property +def outbox() -> OutBox ``` Get outbox. - + + #### decision`_`maker`_`message`_`queue ```python - | @property - | decision_maker_message_queue() -> Queue +@property +def decision_maker_message_queue() -> Queue ``` Get decision maker queue. - + + #### decision`_`maker`_`handler`_`context ```python - | @property - | decision_maker_handler_context() -> SimpleNamespace +@property +def decision_maker_handler_context() -> SimpleNamespace ``` Get the decision maker handler context. - + + #### task`_`manager ```python - | @property - | task_manager() -> TaskManager +@property +def task_manager() -> TaskManager ``` Get the task manager. - + + #### search`_`service`_`address ```python - | @property - | search_service_address() -> Address +@property +def search_service_address() -> Address ``` Get the address of the search service. - + + #### decision`_`maker`_`address ```python - | @property - | decision_maker_address() -> Address +@property +def decision_maker_address() -> Address ``` Get the address of the decision maker. - + + #### default`_`ledger`_`id ```python - | @property - | default_ledger_id() -> str +@property +def default_ledger_id() -> str ``` Get the default ledger id. - + + #### currency`_`denominations ```python - | @property - | currency_denominations() -> Dict[str, str] +@property +def currency_denominations() -> Dict[str, str] ``` Get a dictionary mapping ledger ids to currency denominations. - + + #### default`_`connection ```python - | @property - | default_connection() -> Optional[PublicId] +@property +def default_connection() -> Optional[PublicId] ``` Get the default connection. - + + #### default`_`routing ```python - | @property - | default_routing() -> Dict[PublicId, PublicId] +@property +def default_routing() -> Dict[PublicId, PublicId] ``` Get the default routing. - + + #### namespace ```python - | @property - | namespace() -> SimpleNamespace +@property +def namespace() -> SimpleNamespace ``` Get the agent context namespace. diff --git a/docs/api/contracts/base.md b/docs/api/contracts/base.md index b0000c1167..7f9333a246 100644 --- a/docs/api/contracts/base.md +++ b/docs/api/contracts/base.md @@ -1,9 +1,11 @@ - + + # aea.contracts.base The base contract. - + + ## Contract Objects ```python @@ -12,11 +14,12 @@ class Contract(Component) Abstract definition of a contract. - + + #### `__`init`__` ```python - | __init__(contract_config: ContractConfig, **kwargs: Any) -> None +def __init__(contract_config: ContractConfig, **kwargs: Any) -> None ``` Initialize the contract. @@ -26,32 +29,37 @@ Initialize the contract. - `contract_config`: the contract configurations. - `kwargs`: the keyword arguments. - + + #### id ```python - | @property - | id() -> PublicId +@property +def id() -> PublicId ``` Get the name. - + + #### configuration ```python - | @property - | configuration() -> ContractConfig +@property +def configuration() -> ContractConfig ``` Get the configuration. - + + #### get`_`instance ```python - | @classmethod - | get_instance(cls, ledger_api: LedgerApi, contract_address: Optional[str] = None) -> Any +@classmethod +def get_instance(cls, + ledger_api: LedgerApi, + contract_address: Optional[str] = None) -> Any ``` Get the instance. @@ -65,12 +73,13 @@ Get the instance. the contract instance - + + #### from`_`dir ```python - | @classmethod - | from_dir(cls, directory: str, **kwargs: Any) -> "Contract" +@classmethod +def from_dir(cls, directory: str, **kwargs: Any) -> "Contract" ``` Load the protocol from a directory. @@ -84,12 +93,14 @@ Load the protocol from a directory. the contract object. - + + #### from`_`config ```python - | @classmethod - | from_config(cls, configuration: ContractConfig, **kwargs: Any) -> "Contract" +@classmethod +def from_config(cls, configuration: ContractConfig, + **kwargs: Any) -> "Contract" ``` Load contract from configuration. @@ -103,12 +114,14 @@ Load contract from configuration. the contract object. - + + #### get`_`deploy`_`transaction ```python - | @classmethod - | get_deploy_transaction(cls, ledger_api: LedgerApi, deployer_address: str, **kwargs: Any) -> Optional[JSONLike] +@classmethod +def get_deploy_transaction(cls, ledger_api: LedgerApi, deployer_address: str, + **kwargs: Any) -> Optional[JSONLike] ``` Handler method for the 'GET_DEPLOY_TRANSACTION' requests. @@ -126,12 +139,14 @@ to handle the contract requests manually. the tx - + + #### get`_`raw`_`transaction ```python - | @classmethod - | get_raw_transaction(cls, ledger_api: LedgerApi, contract_address: str, **kwargs: Any) -> Optional[JSONLike] +@classmethod +def get_raw_transaction(cls, ledger_api: LedgerApi, contract_address: str, + **kwargs: Any) -> Optional[JSONLike] ``` Handler method for the 'GET_RAW_TRANSACTION' requests. @@ -149,12 +164,14 @@ to handle the contract requests manually. the tx # noqa: DAR202 - + + #### get`_`raw`_`message ```python - | @classmethod - | get_raw_message(cls, ledger_api: LedgerApi, contract_address: str, **kwargs: Any) -> Optional[bytes] +@classmethod +def get_raw_message(cls, ledger_api: LedgerApi, contract_address: str, + **kwargs: Any) -> Optional[bytes] ``` Handler method for the 'GET_RAW_MESSAGE' requests. @@ -172,12 +189,14 @@ to handle the contract requests manually. the tx # noqa: DAR202 - + + #### get`_`state ```python - | @classmethod - | get_state(cls, ledger_api: LedgerApi, contract_address: str, **kwargs: Any) -> Optional[JSONLike] +@classmethod +def get_state(cls, ledger_api: LedgerApi, contract_address: str, + **kwargs: Any) -> Optional[JSONLike] ``` Handler method for the 'GET_STATE' requests. diff --git a/docs/api/crypto/base.md b/docs/api/crypto/base.md index ebd3383ae6..4f3e8a1cde 100644 --- a/docs/api/crypto/base.md +++ b/docs/api/crypto/base.md @@ -1,22 +1,27 @@ - + + # aea.crypto.base Abstract module wrapping the public and private key cryptography and ledger api. - + + ## Crypto Objects ```python -class Crypto(Generic[EntityClass], ABC) +class Crypto(Generic[EntityClass], ABC) ``` Base class for a crypto object. - + + #### `__`init`__` ```python - | __init__(private_key_path: Optional[str] = None, password: Optional[str] = None, **kwargs: Any, ,) -> None +def __init__(private_key_path: Optional[str] = None, + password: Optional[str] = None, + **kwargs: Any) -> None ``` Initialize the crypto object. @@ -33,13 +38,14 @@ If not None, the path will be processed by 'load_private_key_from_path()'. - `password`: the password to encrypt/decrypt the private key. - `kwargs`: keyword arguments. - + + #### generate`_`private`_`key ```python - | @classmethod - | @abstractmethod - | generate_private_key(cls) -> EntityClass +@classmethod +@abstractmethod +def generate_private_key(cls) -> EntityClass ``` Generate a private key. @@ -48,13 +54,16 @@ Generate a private key. the entity object. Implementation dependent. - + + #### load`_`private`_`key`_`from`_`path ```python - | @classmethod - | @abstractmethod - | load_private_key_from_path(cls, file_name: str, password: Optional[str] = None) -> EntityClass +@classmethod +@abstractmethod +def load_private_key_from_path(cls, + file_name: str, + password: Optional[str] = None) -> EntityClass ``` Load a private key in hex format for raw private key and json format for encrypted private key from a file. @@ -68,12 +77,13 @@ Load a private key in hex format for raw private key and json format for encrypt the entity object. - + + #### entity ```python - | @property - | entity() -> EntityClass +@property +def entity() -> EntityClass ``` Return an entity object. @@ -82,13 +92,14 @@ Return an entity object. an entity object - + + #### private`_`key ```python - | @property - | @abstractmethod - | private_key() -> str +@property +@abstractmethod +def private_key() -> str ``` Return a private key. @@ -97,13 +108,14 @@ Return a private key. a private key string - + + #### public`_`key ```python - | @property - | @abstractmethod - | public_key() -> str +@property +@abstractmethod +def public_key() -> str ``` Return a public key. @@ -112,13 +124,14 @@ Return a public key. a public key string - + + #### address ```python - | @property - | @abstractmethod - | address() -> str +@property +@abstractmethod +def address() -> str ``` Return the address. @@ -127,12 +140,13 @@ Return the address. an address string - + + #### sign`_`message ```python - | @abstractmethod - | sign_message(message: bytes, is_deprecated_mode: bool = False) -> str +@abstractmethod +def sign_message(message: bytes, is_deprecated_mode: bool = False) -> str ``` Sign a message in bytes string form. @@ -146,12 +160,13 @@ Sign a message in bytes string form. signature of the message in string form - + + #### sign`_`transaction ```python - | @abstractmethod - | sign_transaction(transaction: JSONLike) -> JSONLike +@abstractmethod +def sign_transaction(transaction: JSONLike) -> JSONLike ``` Sign a transaction in dict form. @@ -164,12 +179,13 @@ Sign a transaction in dict form. signed transaction - + + #### load ```python - | @classmethod - | load(cls, private_key_file: str, password: Optional[str] = None) -> str +@classmethod +def load(cls, private_key_file: str, password: Optional[str] = None) -> str ``` Load private key from file. @@ -183,11 +199,12 @@ Load private key from file. private_key in hex string format - + + #### dump ```python - | dump(private_key_file: str, password: Optional[str] = None) -> None +def dump(private_key_file: str, password: Optional[str] = None) -> None ``` Dump private key to file. @@ -197,12 +214,13 @@ Dump private key to file. - `private_key_file`: the file where the key is stored. - `password`: the password to encrypt/decrypt the private key. - + + #### encrypt ```python - | @abstractmethod - | encrypt(password: str) -> str +@abstractmethod +def encrypt(password: str) -> str ``` Encrypt the private key and return in json. @@ -215,13 +233,14 @@ Encrypt the private key and return in json. json string containing encrypted private key. - + + #### decrypt ```python - | @classmethod - | @abstractmethod - | decrypt(cls, keyfile_json: str, password: str) -> str +@classmethod +@abstractmethod +def decrypt(cls, keyfile_json: str, password: str) -> str ``` Decrypt the private key and return in raw form. @@ -235,7 +254,8 @@ Decrypt the private key and return in raw form. the raw private key. - + + ## Helper Objects ```python @@ -244,13 +264,14 @@ class Helper(ABC) Interface for helper class usable as Mixin for LedgerApi or as standalone class. - + + #### is`_`transaction`_`settled ```python - | @staticmethod - | @abstractmethod - | is_transaction_settled(tx_receipt: JSONLike) -> bool +@staticmethod +@abstractmethod +def is_transaction_settled(tx_receipt: JSONLike) -> bool ``` Check whether a transaction is settled or not. @@ -263,13 +284,15 @@ Check whether a transaction is settled or not. True if the transaction has been settled, False o/w. - + + #### is`_`transaction`_`valid ```python - | @staticmethod - | @abstractmethod - | is_transaction_valid(tx: JSONLike, seller: Address, client: Address, tx_nonce: str, amount: int) -> bool +@staticmethod +@abstractmethod +def is_transaction_valid(tx: JSONLike, seller: Address, client: Address, + tx_nonce: str, amount: int) -> bool ``` Check whether a transaction is valid or not. @@ -286,13 +309,14 @@ Check whether a transaction is valid or not. True if the random_message is equals to tx['input'] - + + #### get`_`contract`_`address ```python - | @staticmethod - | @abstractmethod - | get_contract_address(tx_receipt: JSONLike) -> Optional[str] +@staticmethod +@abstractmethod +def get_contract_address(tx_receipt: JSONLike) -> Optional[str] ``` Get the contract address from a transaction receipt. @@ -305,13 +329,14 @@ Get the contract address from a transaction receipt. the contract address if successful - + + #### generate`_`tx`_`nonce ```python - | @staticmethod - | @abstractmethod - | generate_tx_nonce(seller: Address, client: Address) -> str +@staticmethod +@abstractmethod +def generate_tx_nonce(seller: Address, client: Address) -> str ``` Generate a unique hash to distinguish transactions with the same terms. @@ -325,13 +350,14 @@ Generate a unique hash to distinguish transactions with the same terms. return the hash in hex. - + + #### get`_`address`_`from`_`public`_`key ```python - | @classmethod - | @abstractmethod - | get_address_from_public_key(cls, public_key: str) -> str +@classmethod +@abstractmethod +def get_address_from_public_key(cls, public_key: str) -> str ``` Get the address from the public key. @@ -344,13 +370,17 @@ Get the address from the public key. str - + + #### recover`_`message ```python - | @classmethod - | @abstractmethod - | recover_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[Address, ...] +@classmethod +@abstractmethod +def recover_message(cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[Address, ...] ``` Recover the addresses from the hash. @@ -365,13 +395,18 @@ Recover the addresses from the hash. the recovered addresses - + + #### recover`_`public`_`keys`_`from`_`message ```python - | @classmethod - | @abstractmethod - | recover_public_keys_from_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[str, ...] +@classmethod +@abstractmethod +def recover_public_keys_from_message( + cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[str, ...] ``` Get the public key used to produce the `signature` of the `message` @@ -386,13 +421,14 @@ Get the public key used to produce the `signature` of the `message` the recovered public keys - + + #### get`_`hash ```python - | @staticmethod - | @abstractmethod - | get_hash(message: bytes) -> str +@staticmethod +@abstractmethod +def get_hash(message: bytes) -> str ``` Get the hash of a message. @@ -405,13 +441,14 @@ Get the hash of a message. the hash of the message. - + + #### is`_`valid`_`address ```python - | @classmethod - | @abstractmethod - | is_valid_address(cls, address: Address) -> bool +@classmethod +@abstractmethod +def is_valid_address(cls, address: Address) -> bool ``` Check if the address is valid. @@ -420,13 +457,14 @@ Check if the address is valid. - `address`: the address to validate - + + #### load`_`contract`_`interface ```python - | @classmethod - | @abstractmethod - | load_contract_interface(cls, file_path: Path) -> Dict[str, str] +@classmethod +@abstractmethod +def load_contract_interface(cls, file_path: Path) -> Dict[str, str] ``` Load contract interface. @@ -439,22 +477,24 @@ Load contract interface. the interface - + + ## LedgerApi Objects ```python -class LedgerApi(Helper, ABC) +class LedgerApi(Helper, ABC) ``` Interface for ledger APIs. - + + #### api ```python - | @property - | @abstractmethod - | api() -> Any +@property +@abstractmethod +def api() -> Any ``` Get the underlying API object. @@ -462,12 +502,13 @@ Get the underlying API object. This can be used for low-level operations with the concrete ledger APIs. If there is no such object, return None. - + + #### get`_`balance ```python - | @abstractmethod - | get_balance(address: Address) -> Optional[int] +@abstractmethod +def get_balance(address: Address) -> Optional[int] ``` Get the balance of a given account. @@ -482,12 +523,14 @@ This usually takes the form of a web request to be waited synchronously. the balance. - + + #### get`_`state ```python - | @abstractmethod - | get_state(callable_name: str, *args: Any, **kwargs: Any) -> Optional[JSONLike] +@abstractmethod +def get_state(callable_name: str, *args: Any, + **kwargs: Any) -> Optional[JSONLike] ``` Call a specified function on the underlying ledger API. @@ -504,12 +547,16 @@ This usually takes the form of a web request to be waited synchronously. the ledger API response. - + + #### get`_`transfer`_`transaction ```python - | @abstractmethod - | get_transfer_transaction(sender_address: Address, destination_address: Address, amount: int, tx_fee: int, tx_nonce: str, **kwargs: Any, ,) -> Optional[JSONLike] +@abstractmethod +def get_transfer_transaction(sender_address: Address, + destination_address: Address, amount: int, + tx_fee: int, tx_nonce: str, + **kwargs: Any) -> Optional[JSONLike] ``` Submit a transfer transaction to the ledger. @@ -527,12 +574,13 @@ Submit a transfer transaction to the ledger. the transfer transaction - + + #### send`_`signed`_`transaction ```python - | @abstractmethod - | send_signed_transaction(tx_signed: JSONLike) -> Optional[str] +@abstractmethod +def send_signed_transaction(tx_signed: JSONLike) -> Optional[str] ``` Send a signed transaction and wait for confirmation. @@ -543,12 +591,13 @@ Use keyword arguments for the specifying the signed transaction payload. - `tx_signed`: the signed transaction - + + #### get`_`transaction`_`receipt ```python - | @abstractmethod - | get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] +@abstractmethod +def get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction receipt for a transaction digest. @@ -561,12 +610,13 @@ Get the transaction receipt for a transaction digest. the tx receipt, if present - + + #### get`_`transaction ```python - | @abstractmethod - | get_transaction(tx_digest: str) -> Optional[JSONLike] +@abstractmethod +def get_transaction(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction for a transaction digest. @@ -579,12 +629,14 @@ Get the transaction for a transaction digest. the tx, if present - + + #### get`_`contract`_`instance ```python - | @abstractmethod - | get_contract_instance(contract_interface: Dict[str, str], contract_address: Optional[str] = None) -> Any +@abstractmethod +def get_contract_instance(contract_interface: Dict[str, str], + contract_address: Optional[str] = None) -> Any ``` Get the instance of a contract. @@ -598,12 +650,15 @@ Get the instance of a contract. the contract instance - + + #### get`_`deploy`_`transaction ```python - | @abstractmethod - | get_deploy_transaction(contract_interface: Dict[str, str], deployer_address: Address, **kwargs: Any, ,) -> Optional[JSONLike] +@abstractmethod +def get_deploy_transaction(contract_interface: Dict[str, str], + deployer_address: Address, + **kwargs: Any) -> Optional[JSONLike] ``` Get the transaction to deploy the smart contract. @@ -613,14 +668,18 @@ Get the transaction to deploy the smart contract. - `contract_interface`: the contract interface. - `deployer_address`: The address that will deploy the contract. - `kwargs`: the keyword arguments. -:returns tx: the transaction dictionary. - +**Returns**: + +`tx`: the transaction dictionary. + + + #### update`_`with`_`gas`_`estimate ```python - | @abstractmethod - | update_with_gas_estimate(transaction: JSONLike) -> JSONLike +@abstractmethod +def update_with_gas_estimate(transaction: JSONLike) -> JSONLike ``` Attempts to update the transaction with a gas estimate @@ -633,7 +692,8 @@ Attempts to update the transaction with a gas estimate the updated transaction - + + ## FaucetApi Objects ```python @@ -642,12 +702,13 @@ class FaucetApi(ABC) Interface for testnet faucet APIs. - + + #### get`_`wealth ```python - | @abstractmethod - | get_wealth(address: Address, url: Optional[str] = None) -> None +@abstractmethod +def get_wealth(address: Address, url: Optional[str] = None) -> None ``` Get wealth from the faucet for the provided address. diff --git a/docs/api/crypto/helpers.md b/docs/api/crypto/helpers.md index 8e01725b6c..0004155426 100644 --- a/docs/api/crypto/helpers.md +++ b/docs/api/crypto/helpers.md @@ -1,13 +1,17 @@ - + + # aea.crypto.helpers Module wrapping the helpers of public and private key cryptography. - + + #### try`_`validate`_`private`_`key`_`path ```python -try_validate_private_key_path(ledger_id: str, private_key_path: str, password: Optional[str] = None) -> None +def try_validate_private_key_path(ledger_id: str, + private_key_path: str, + password: Optional[str] = None) -> None ``` Try validate a private key path. @@ -17,13 +21,19 @@ Try validate a private key path. - `ledger_id`: one of 'fetchai', 'ethereum' - `private_key_path`: the path to the private key. - `password`: the password to encrypt/decrypt the private key. -:raises: ValueError if the identifier is invalid. - +**Raises**: + +- `None`: ValueError if the identifier is invalid. + + + #### create`_`private`_`key ```python -create_private_key(ledger_id: str, private_key_file: str, password: Optional[str] = None) -> None +def create_private_key(ledger_id: str, + private_key_file: str, + password: Optional[str] = None) -> None ``` Create a private key for the specified ledger identifier. @@ -33,13 +43,20 @@ Create a private key for the specified ledger identifier. - `ledger_id`: the ledger identifier. - `private_key_file`: the private key file. - `password`: the password to encrypt/decrypt the private key. -:raises: ValueError if the identifier is invalid. - +**Raises**: + +- `None`: ValueError if the identifier is invalid. + + + #### try`_`generate`_`testnet`_`wealth ```python -try_generate_testnet_wealth(identifier: str, address: str, url: Optional[str] = None, _sync: bool = True) -> None +def try_generate_testnet_wealth(identifier: str, + address: str, + url: Optional[str] = None, + _sync: bool = True) -> None ``` Try generate wealth on a testnet. @@ -51,11 +68,14 @@ Try generate wealth on a testnet. - `url`: the url - `_sync`: whether to wait to sync or not; currently unused - + + #### private`_`key`_`verify ```python -private_key_verify(aea_conf: AgentConfig, aea_project_path: Path, password: Optional[str] = None) -> None +def private_key_verify(aea_conf: AgentConfig, + aea_project_path: Path, + password: Optional[str] = None) -> None ``` Check key. @@ -66,11 +86,16 @@ Check key. - `aea_project_path`: Path, where project placed. - `password`: the password to encrypt/decrypt the private key. - + + #### make`_`certificate ```python -make_certificate(ledger_id: str, crypto_private_key_path: str, message: bytes, output_path: str, password: Optional[str] = None) -> str +def make_certificate(ledger_id: str, + crypto_private_key_path: str, + message: bytes, + output_path: str, + password: Optional[str] = None) -> str ``` Create certificate. @@ -87,11 +112,13 @@ Create certificate. the signature/certificate - + + #### get`_`wallet`_`from`_`agent`_`config ```python -get_wallet_from_agent_config(agent_config: AgentConfig, password: Optional[str] = None) -> Wallet +def get_wallet_from_agent_config(agent_config: AgentConfig, + password: Optional[str] = None) -> Wallet ``` Get wallet from agent_cofig provided. @@ -105,7 +132,8 @@ Get wallet from agent_cofig provided. wallet - + + ## DecryptError Objects ```python @@ -114,16 +142,18 @@ class DecryptError(ValueError) Error on bytes decryption with password. - + + #### `__`init`__` ```python - | __init__(msg: Optional[str] = None) -> None +def __init__(msg: Optional[str] = None) -> None ``` Init exception. - + + ## KeyIsIncorrect Objects ```python @@ -132,11 +162,12 @@ class KeyIsIncorrect(ValueError) Error decoding hex string to bytes for private key. - + + #### hex`_`to`_`bytes`_`for`_`key ```python -hex_to_bytes_for_key(data: str) -> bytes +def hex_to_bytes_for_key(data: str) -> bytes ``` Convert hex string to bytes with error handling. diff --git a/docs/api/crypto/ledger_apis.md b/docs/api/crypto/ledger_apis.md index 704da349e1..c20b0c604c 100644 --- a/docs/api/crypto/ledger_apis.md +++ b/docs/api/crypto/ledger_apis.md @@ -1,9 +1,11 @@ - + + # aea.crypto.ledger`_`apis Module wrapping all the public and private keys cryptography. - + + ## LedgerApis Objects ```python @@ -12,32 +14,35 @@ class LedgerApis() Store all the ledger apis we initialise. - + + #### has`_`ledger ```python - | @staticmethod - | has_ledger(identifier: str) -> bool +@staticmethod +def has_ledger(identifier: str) -> bool ``` Check if it has the api. - + + #### get`_`api ```python - | @classmethod - | get_api(cls, identifier: str) -> LedgerApi +@classmethod +def get_api(cls, identifier: str) -> LedgerApi ``` Get the ledger API. - + + #### get`_`balance ```python - | @classmethod - | get_balance(cls, identifier: str, address: str) -> Optional[int] +@classmethod +def get_balance(cls, identifier: str, address: str) -> Optional[int] ``` Get the token balance. @@ -51,12 +56,16 @@ Get the token balance. the token balance - + + #### get`_`transfer`_`transaction ```python - | @classmethod - | get_transfer_transaction(cls, identifier: str, sender_address: str, destination_address: str, amount: int, tx_fee: int, tx_nonce: str, **kwargs: Any, ,) -> Optional[Any] +@classmethod +def get_transfer_transaction(cls, identifier: str, sender_address: str, + destination_address: str, amount: int, + tx_fee: int, tx_nonce: str, + **kwargs: Any) -> Optional[Any] ``` Get a transaction to transfer from self to destination. @@ -75,12 +84,14 @@ Get a transaction to transfer from self to destination. tx - + + #### send`_`signed`_`transaction ```python - | @classmethod - | send_signed_transaction(cls, identifier: str, tx_signed: Any) -> Optional[str] +@classmethod +def send_signed_transaction(cls, identifier: str, + tx_signed: Any) -> Optional[str] ``` Send a signed transaction and wait for confirmation. @@ -94,12 +105,14 @@ Send a signed transaction and wait for confirmation. the tx_digest, if present - + + #### get`_`transaction`_`receipt ```python - | @classmethod - | get_transaction_receipt(cls, identifier: str, tx_digest: str) -> Optional[Any] +@classmethod +def get_transaction_receipt(cls, identifier: str, + tx_digest: str) -> Optional[Any] ``` Get the transaction receipt for a transaction digest. @@ -113,12 +126,13 @@ Get the transaction receipt for a transaction digest. the tx receipt, if present - + + #### get`_`transaction ```python - | @classmethod - | get_transaction(cls, identifier: str, tx_digest: str) -> Optional[Any] +@classmethod +def get_transaction(cls, identifier: str, tx_digest: str) -> Optional[Any] ``` Get the transaction for a transaction digest. @@ -132,12 +146,14 @@ Get the transaction for a transaction digest. the tx, if present - + + #### get`_`contract`_`address ```python - | @staticmethod - | get_contract_address(identifier: str, tx_receipt: Any) -> Optional[Address] +@staticmethod +def get_contract_address(identifier: str, + tx_receipt: Any) -> Optional[Address] ``` Get the contract address from a transaction receipt. @@ -151,12 +167,13 @@ Get the contract address from a transaction receipt. the contract address if successful - + + #### is`_`transaction`_`settled ```python - | @staticmethod - | is_transaction_settled(identifier: str, tx_receipt: Any) -> bool +@staticmethod +def is_transaction_settled(identifier: str, tx_receipt: Any) -> bool ``` Check whether the transaction is settled and correct. @@ -170,12 +187,14 @@ Check whether the transaction is settled and correct. True if correctly settled, False otherwise - + + #### is`_`transaction`_`valid ```python - | @staticmethod - | is_transaction_valid(identifier: str, tx: Any, seller: Address, client: Address, tx_nonce: str, amount: int) -> bool +@staticmethod +def is_transaction_valid(identifier: str, tx: Any, seller: Address, + client: Address, tx_nonce: str, amount: int) -> bool ``` Check whether the transaction is valid. @@ -193,12 +212,14 @@ Check whether the transaction is valid. True if is valid , False otherwise - + + #### generate`_`tx`_`nonce ```python - | @staticmethod - | generate_tx_nonce(identifier: str, seller: Address, client: Address) -> str +@staticmethod +def generate_tx_nonce(identifier: str, seller: Address, + client: Address) -> str ``` Generate a random str message. @@ -213,12 +234,16 @@ Generate a random str message. return the hash in hex. - + + #### recover`_`message ```python - | @staticmethod - | recover_message(identifier: str, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[Address, ...] +@staticmethod +def recover_message(identifier: str, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[Address, ...] ``` Recover the addresses from the hash. @@ -234,12 +259,13 @@ Recover the addresses from the hash. the recovered addresses - + + #### get`_`hash ```python - | @staticmethod - | get_hash(identifier: str, message: bytes) -> str +@staticmethod +def get_hash(identifier: str, message: bytes) -> str ``` Get the hash of a message. @@ -253,12 +279,13 @@ Get the hash of a message. the hash of the message. - + + #### is`_`valid`_`address ```python - | @staticmethod - | is_valid_address(identifier: str, address: Address) -> bool +@staticmethod +def is_valid_address(identifier: str, address: Address) -> bool ``` Check if the address is valid. diff --git a/docs/api/crypto/plugin.md b/docs/api/crypto/plugin.md index ccad079091..0ba7ba3eb6 100644 --- a/docs/api/crypto/plugin.md +++ b/docs/api/crypto/plugin.md @@ -1,9 +1,11 @@ - + + # aea.crypto.plugin Implementation of plug-in mechanism for cryptos. - + + ## Plugin Objects ```python @@ -12,11 +14,12 @@ class Plugin() Class that implements an AEA plugin. - + + #### `__`init`__` ```python - | __init__(group: str, entry_point: EntryPoint) +def __init__(group: str, entry_point: EntryPoint) ``` Initialize the plugin. @@ -26,51 +29,56 @@ Initialize the plugin. - `group`: the group the plugin belongs to. - `entry_point`: the entrypoint. - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the plugin identifier. - + + #### group ```python - | @property - | group() -> str +@property +def group() -> str ``` Get the group. - + + #### attr ```python - | @property - | attr() -> str +@property +def attr() -> str ``` Get the class name. - + + #### entry`_`point`_`path ```python - | @property - | entry_point_path() -> str +@property +def entry_point_path() -> str ``` Get the entry point path. - + + #### load`_`all`_`plugins ```python -load_all_plugins(is_raising_exception: bool = True) -> None +def load_all_plugins(is_raising_exception: bool = True) -> None ``` Load all plugins. diff --git a/docs/api/crypto/registries/base.md b/docs/api/crypto/registries/base.md index 266d36e195..7d59ba2a1b 100644 --- a/docs/api/crypto/registries/base.md +++ b/docs/api/crypto/registries/base.md @@ -1,9 +1,11 @@ - + + # aea.crypto.registries.base This module implements the base registry. - + + ## ItemId Objects ```python @@ -12,21 +14,23 @@ class ItemId(RegexConstrainedString) The identifier of an item class. - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the id name. - + + ## EntryPoint Objects ```python -class EntryPoint(Generic[ItemType], RegexConstrainedString) +class EntryPoint(Generic[ItemType], RegexConstrainedString) ``` The entry point for a resource. @@ -35,40 +39,44 @@ The regular expression matches the strings in the following format: path.to.module:className - + + #### `__`init`__` ```python - | __init__(seq: Union["EntryPoint", str]) -> None +def __init__(seq: Union["EntryPoint", str]) -> None ``` Initialize the entrypoint. - + + #### import`_`path ```python - | @property - | import_path() -> str +@property +def import_path() -> str ``` Get the import path. - + + #### class`_`name ```python - | @property - | class_name() -> str +@property +def class_name() -> str ``` Get the class name. - + + #### load ```python - | load() -> Type[ItemType] +def load() -> Type[ItemType] ``` Load the item object. @@ -77,7 +85,8 @@ Load the item object. the crypto object, loaded following the spec. - + + ## ItemSpec Objects ```python @@ -86,11 +95,15 @@ class ItemSpec(Generic[ItemType]) A specification for a particular instance of an object. - + + #### `__`init`__` ```python - | __init__(id_: ItemId, entry_point: EntryPoint[ItemType], class_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict, ,) -> None +def __init__(id_: ItemId, + entry_point: EntryPoint[ItemType], + class_kwargs: Optional[Dict[str, Any]] = None, + **kwargs: Dict) -> None ``` Initialize an item specification. @@ -102,11 +115,12 @@ Initialize an item specification. - `class_kwargs`: keyword arguments to be attached on the class as class variables. - `kwargs`: other custom keyword arguments. - + + #### make ```python - | make(**kwargs: Any) -> ItemType +def make(**kwargs: Any) -> ItemType ``` Instantiate an instance of the item object with appropriate arguments. @@ -119,11 +133,12 @@ Instantiate an instance of the item object with appropriate arguments. an item - + + #### get`_`class ```python - | get_class() -> Type[ItemType] +def get_class() -> Type[ItemType] ``` Get the class of the item with class variables instantiated. @@ -132,7 +147,8 @@ Get the class of the item with class variables instantiated. an item class - + + ## Registry Objects ```python @@ -141,30 +157,36 @@ class Registry(Generic[ItemType]) Registry for generic classes. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Initialize the registry. - + + #### supported`_`ids ```python - | @property - | supported_ids() -> Set[str] +@property +def supported_ids() -> Set[str] ``` Get the supported item ids. - + + #### register ```python - | register(id_: Union[ItemId, str], entry_point: Union[EntryPoint[ItemType], str], class_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Any, ,) -> None +def register(id_: Union[ItemId, str], + entry_point: Union[EntryPoint[ItemType], str], + class_kwargs: Optional[Dict[str, Any]] = None, + **kwargs: Any) -> None ``` Register an item type. @@ -176,11 +198,14 @@ Register an item type. - `class_kwargs`: keyword arguments to be attached on the class as class variables. - `kwargs`: arguments to provide to the crypto class. - + + #### make ```python - | make(id_: Union[ItemId, str], module: Optional[str] = None, **kwargs: Any) -> ItemType +def make(id_: Union[ItemId, str], + module: Optional[str] = None, + **kwargs: Any) -> ItemType ``` Create an instance of the associated type item id. @@ -203,11 +228,13 @@ the make can then find the identifier. the new item instance. - + + #### make`_`cls ```python - | make_cls(id_: Union[ItemId, str], module: Optional[str] = None) -> Type[ItemType] +def make_cls(id_: Union[ItemId, str], + module: Optional[str] = None) -> Type[ItemType] ``` Load a class of the associated type item id. @@ -229,11 +256,12 @@ the make can then find the identifier. the new item class. - + + #### has`_`spec ```python - | has_spec(item_id: ItemId) -> bool +def has_spec(item_id: ItemId) -> bool ``` Check whether there exist a spec associated with an item id. diff --git a/docs/api/crypto/wallet.md b/docs/api/crypto/wallet.md index 739dd292fc..9ecf7281b1 100644 --- a/docs/api/crypto/wallet.md +++ b/docs/api/crypto/wallet.md @@ -1,9 +1,11 @@ - + + # aea.crypto.wallet Module wrapping all the public and private keys cryptography. - + + ## CryptoStore Objects ```python @@ -12,11 +14,13 @@ class CryptoStore() Utility class to store and retrieve crypto objects. - + + #### `__`init`__` ```python - | __init__(crypto_id_to_path: Optional[Dict[str, Optional[str]]] = None, password: Optional[str] = None) -> None +def __init__(crypto_id_to_path: Optional[Dict[str, Optional[str]]] = None, + password: Optional[str] = None) -> None ``` Initialize the crypto store. @@ -27,47 +31,52 @@ Initialize the crypto store. to the private key. - `password`: the password to encrypt/decrypt the private key. - + + #### public`_`keys ```python - | @property - | public_keys() -> Dict[str, str] +@property +def public_keys() -> Dict[str, str] ``` Get the public_key dictionary. - + + #### crypto`_`objects ```python - | @property - | crypto_objects() -> Dict[str, Crypto] +@property +def crypto_objects() -> Dict[str, Crypto] ``` Get the crypto objects (key pair). - + + #### addresses ```python - | @property - | addresses() -> Dict[str, str] +@property +def addresses() -> Dict[str, str] ``` Get the crypto addresses. - + + #### private`_`keys ```python - | @property - | private_keys() -> Dict[str, str] +@property +def private_keys() -> Dict[str, str] ``` Get the crypto addresses. - + + ## Wallet Objects ```python @@ -81,11 +90,16 @@ The cryptos are separated into two categories: - main cryptos: used by the AEA for the economic side (i.e. signing transaction) - connection cryptos: exposed to the connection objects for encrypted communication. - + + #### `__`init`__` ```python - | __init__(private_key_paths: Dict[str, Optional[str]], connection_private_key_paths: Optional[Dict[str, Optional[str]]] = None, password: Optional[str] = None) +def __init__( + private_key_paths: Dict[str, Optional[str]], + connection_private_key_paths: Optional[Dict[str, + Optional[str]]] = None, + password: Optional[str] = None) ``` Instantiate a wallet object. @@ -96,71 +110,80 @@ Instantiate a wallet object. - `connection_private_key_paths`: the private key paths for the connections. - `password`: the password to encrypt/decrypt the private key. - + + #### public`_`keys ```python - | @property - | public_keys() -> Dict[str, str] +@property +def public_keys() -> Dict[str, str] ``` Get the public_key dictionary. - + + #### crypto`_`objects ```python - | @property - | crypto_objects() -> Dict[str, Crypto] +@property +def crypto_objects() -> Dict[str, Crypto] ``` Get the crypto objects (key pair). - + + #### addresses ```python - | @property - | addresses() -> Dict[str, str] +@property +def addresses() -> Dict[str, str] ``` Get the crypto addresses. - + + #### private`_`keys ```python - | @property - | private_keys() -> Dict[str, str] +@property +def private_keys() -> Dict[str, str] ``` Get the crypto addresses. - + + #### main`_`cryptos ```python - | @property - | main_cryptos() -> CryptoStore +@property +def main_cryptos() -> CryptoStore ``` Get the main crypto store. - + + #### connection`_`cryptos ```python - | @property - | connection_cryptos() -> CryptoStore +@property +def connection_cryptos() -> CryptoStore ``` Get the connection crypto store. - + + #### sign`_`message ```python - | sign_message(crypto_id: str, message: bytes, is_deprecated_mode: bool = False) -> Optional[str] +def sign_message(crypto_id: str, + message: bytes, + is_deprecated_mode: bool = False) -> Optional[str] ``` Sign a message. @@ -175,11 +198,12 @@ Sign a message. the signature of the message - + + #### sign`_`transaction ```python - | sign_transaction(crypto_id: str, transaction: Any) -> Optional[JSONLike] +def sign_transaction(crypto_id: str, transaction: Any) -> Optional[JSONLike] ``` Sign a tx. diff --git a/docs/api/decision_maker/base.md b/docs/api/decision_maker/base.md index 71c3d52821..2365b74b39 100644 --- a/docs/api/decision_maker/base.md +++ b/docs/api/decision_maker/base.md @@ -1,9 +1,11 @@ - + + # aea.decision`_`maker.base This module contains the decision maker class. - + + ## OwnershipState Objects ```python @@ -12,12 +14,13 @@ class OwnershipState(ABC) Represent the ownership state of an agent (can proxy a ledger). - + + #### set ```python - | @abstractmethod - | set(**kwargs: Any) -> None +@abstractmethod +def set(**kwargs: Any) -> None ``` Set values on the ownership state. @@ -26,12 +29,13 @@ Set values on the ownership state. - `kwargs`: the relevant keyword arguments - + + #### apply`_`delta ```python - | @abstractmethod - | apply_delta(**kwargs: Any) -> None +@abstractmethod +def apply_delta(**kwargs: Any) -> None ``` Apply a state update to the ownership state. @@ -42,23 +46,25 @@ This method is used to apply a raw state update without a transaction. - `kwargs`: the relevant keyword arguments - + + #### is`_`initialized ```python - | @property - | @abstractmethod - | is_initialized() -> bool +@property +@abstractmethod +def is_initialized() -> bool ``` Get the initialization status. - + + #### is`_`affordable`_`transaction ```python - | @abstractmethod - | is_affordable_transaction(terms: Terms) -> bool +@abstractmethod +def is_affordable_transaction(terms: Terms) -> bool ``` Check if the transaction is affordable (and consistent). @@ -71,12 +77,13 @@ Check if the transaction is affordable (and consistent). True if the transaction is legal wrt the current state, false otherwise. - + + #### apply`_`transactions ```python - | @abstractmethod - | apply_transactions(list_of_terms: List[Terms]) -> "OwnershipState" +@abstractmethod +def apply_transactions(list_of_terms: List[Terms]) -> "OwnershipState" ``` Apply a list of transactions to (a copy of) the current state. @@ -89,17 +96,19 @@ Apply a list of transactions to (a copy of) the current state. the final state. - + + #### `__`copy`__` ```python - | @abstractmethod - | __copy__() -> "OwnershipState" +@abstractmethod +def __copy__() -> "OwnershipState" ``` Copy the object. - + + ## Preferences Objects ```python @@ -108,12 +117,13 @@ class Preferences(ABC) Class to represent the preferences. - + + #### set ```python - | @abstractmethod - | set(**kwargs: Any) -> None +@abstractmethod +def set(**kwargs: Any) -> None ``` Set values on the preferences. @@ -122,25 +132,27 @@ Set values on the preferences. - `kwargs`: the relevant key word arguments - + + #### is`_`initialized ```python - | @property - | @abstractmethod - | is_initialized() -> bool +@property +@abstractmethod +def is_initialized() -> bool ``` Get the initialization status. Returns True if exchange_params_by_currency_id and utility_params_by_good_id are not None. - + + #### marginal`_`utility ```python - | @abstractmethod - | marginal_utility(ownership_state: OwnershipState, **kwargs: Any) -> float +@abstractmethod +def marginal_utility(ownership_state: OwnershipState, **kwargs: Any) -> float ``` Compute the marginal utility. @@ -154,12 +166,14 @@ Compute the marginal utility. the marginal utility score - + + #### utility`_`diff`_`from`_`transaction ```python - | @abstractmethod - | utility_diff_from_transaction(ownership_state: OwnershipState, terms: Terms) -> float +@abstractmethod +def utility_diff_from_transaction(ownership_state: OwnershipState, + terms: Terms) -> float ``` Simulate a transaction and get the resulting utility difference (taking into account the fee). @@ -173,17 +187,19 @@ Simulate a transaction and get the resulting utility difference (taking into acc the score. - + + #### `__`copy`__` ```python - | @abstractmethod - | __copy__() -> "Preferences" +@abstractmethod +def __copy__() -> "Preferences" ``` Copy the object. - + + ## ProtectedQueue Objects ```python @@ -192,11 +208,12 @@ class ProtectedQueue(Queue) A wrapper of a queue to protect which object can read from it. - + + #### `__`init`__` ```python - | __init__(access_code: str) -> None +def __init__(access_code: str) -> None ``` Initialize the protected queue. @@ -205,11 +222,14 @@ Initialize the protected queue. - `access_code`: the access code to read from the queue - + + #### put ```python - | put(internal_message: Optional[Message], block: bool = True, timeout: Optional[float] = None) -> None +def put(internal_message: Optional[Message], + block: bool = True, + timeout: Optional[float] = None) -> None ``` Put an internal message on the queue. @@ -227,13 +247,17 @@ ignored in that case). - `internal_message`: the internal message to put on the queue - `block`: whether to block or not - `timeout`: timeout on block -:raises: ValueError, if the item is not an internal message - +**Raises**: + +- `None`: ValueError, if the item is not an internal message + + + #### put`_`nowait ```python - | put_nowait(internal_message: Optional[Message]) -> None +def put_nowait(internal_message: Optional[Message]) -> None ``` Put an internal message on the queue. @@ -243,13 +267,17 @@ Equivalent to put(item, False). **Arguments**: - `internal_message`: the internal message to put on the queue -:raises: ValueError, if the item is not an internal message - +**Raises**: + +- `None`: ValueError, if the item is not an internal message + + + #### get ```python - | get(block: bool = True, timeout: Optional[float] = None) -> None +def get(block: bool = True, timeout: Optional[float] = None) -> None ``` Inaccessible get method. @@ -258,24 +286,33 @@ Inaccessible get method. - `block`: whether to block or not - `timeout`: timeout on block -:raises: ValueError, access not permitted. - +**Raises**: + +- `None`: ValueError, access not permitted. + + + #### get`_`nowait ```python - | get_nowait() -> None +def get_nowait() -> None ``` Inaccessible get_nowait method. -:raises: ValueError, access not permitted. +**Raises**: + +- `None`: ValueError, access not permitted. + + - #### protected`_`get ```python - | protected_get(access_code: str, block: bool = True, timeout: Optional[float] = None) -> Optional[Message] +def protected_get(access_code: str, + block: bool = True, + timeout: Optional[float] = None) -> Optional[Message] ``` Access protected get method. @@ -285,26 +322,32 @@ Access protected get method. - `access_code`: the access code - `block`: If optional args block is true and timeout is None (the default), block if necessary until an item is available. - `timeout`: If timeout is a positive number, it blocks at most timeout seconds and raises the Empty exception if no item was available within that time. -:raises: ValueError, if caller is not permitted + +**Raises**: + +- `None`: ValueError, if caller is not permitted **Returns**: internal message - + + ## DecisionMakerHandler Objects ```python -class DecisionMakerHandler(WithLogger, ABC) +class DecisionMakerHandler(WithLogger, ABC) ``` This class implements the decision maker. - + + #### `__`init`__` ```python - | __init__(identity: Identity, wallet: Wallet, config: Dict[str, Any], **kwargs: Any) -> None +def __init__(identity: Identity, wallet: Wallet, config: Dict[str, Any], + **kwargs: Any) -> None ``` Initialize the decision maker handler. @@ -316,72 +359,79 @@ Initialize the decision maker handler. - `config`: the user defined configuration of the handler - `kwargs`: the key word arguments - + + #### agent`_`name ```python - | @property - | agent_name() -> str +@property +def agent_name() -> str ``` Get the agent name. - + + #### identity ```python - | @property - | identity() -> Identity +@property +def identity() -> Identity ``` Get identity of the agent. - + + #### wallet ```python - | @property - | wallet() -> Wallet +@property +def wallet() -> Wallet ``` Get wallet of the agent. - + + #### config ```python - | @property - | config() -> Dict[str, Any] +@property +def config() -> Dict[str, Any] ``` Get user defined configuration - + + #### context ```python - | @property - | context() -> SimpleNamespace +@property +def context() -> SimpleNamespace ``` Get the context. - + + #### message`_`out`_`queue ```python - | @property - | message_out_queue() -> AsyncFriendlyQueue +@property +def message_out_queue() -> AsyncFriendlyQueue ``` Get (out) queue. - + + #### handle ```python - | @abstractmethod - | handle(message: Message) -> None +@abstractmethod +def handle(message: Message) -> None ``` Handle an internal message from the skills. @@ -390,7 +440,8 @@ Handle an internal message from the skills. - `message`: the internal message - + + ## DecisionMaker Objects ```python @@ -399,11 +450,12 @@ class DecisionMaker(WithLogger) This class implements the decision maker. - + + #### `__`init`__` ```python - | __init__(decision_maker_handler: DecisionMakerHandler) -> None +def __init__(decision_maker_handler: DecisionMakerHandler) -> None ``` Initialize the decision maker. @@ -412,69 +464,76 @@ Initialize the decision maker. - `decision_maker_handler`: the decision maker handler - + + #### agent`_`name ```python - | @property - | agent_name() -> str +@property +def agent_name() -> str ``` Get the agent name. - + + #### message`_`in`_`queue ```python - | @property - | message_in_queue() -> ProtectedQueue +@property +def message_in_queue() -> ProtectedQueue ``` Get (in) queue. - + + #### message`_`out`_`queue ```python - | @property - | message_out_queue() -> AsyncFriendlyQueue +@property +def message_out_queue() -> AsyncFriendlyQueue ``` Get (out) queue. - + + #### decision`_`maker`_`handler ```python - | @property - | decision_maker_handler() -> DecisionMakerHandler +@property +def decision_maker_handler() -> DecisionMakerHandler ``` Get the decision maker handler. - + + #### start ```python - | start() -> None +def start() -> None ``` Start the decision maker. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop the decision maker. - + + #### execute ```python - | execute() -> None +def execute() -> None ``` Execute the decision maker. @@ -483,11 +542,12 @@ Performs the following while not stopped: - gets internal messages from the in queue and calls handle() on them - + + #### handle ```python - | handle(message: Message) -> None +def handle(message: Message) -> None ``` Handle an internal message from the skills. diff --git a/docs/api/decision_maker/default.md b/docs/api/decision_maker/default.md index 2b6ffcb2ab..39253694a3 100644 --- a/docs/api/decision_maker/default.md +++ b/docs/api/decision_maker/default.md @@ -1,9 +1,11 @@ - + + # aea.decision`_`maker.default This module contains the decision maker class. - + + ## DecisionMakerHandler Objects ```python @@ -12,7 +14,8 @@ class DecisionMakerHandler(BaseDecisionMakerHandler) This class implements the decision maker. - + + ## SigningDialogues Objects ```python @@ -21,11 +24,12 @@ class SigningDialogues(BaseSigningDialogues) This class keeps track of all oef_search dialogues. - + + #### `__`init`__` ```python - | __init__(self_address: Address, **kwargs: Any) -> None +def __init__(self_address: Address, **kwargs: Any) -> None ``` Initialize dialogues. @@ -35,11 +39,13 @@ Initialize dialogues. - `self_address`: the address of the entity for whom dialogues are maintained - `kwargs`: the keyword arguments - + + #### `__`init`__` ```python - | __init__(identity: Identity, wallet: Wallet, config: Dict[str, Any]) -> None +def __init__(identity: Identity, wallet: Wallet, config: Dict[str, + Any]) -> None ``` Initialize the decision maker. @@ -50,11 +56,12 @@ Initialize the decision maker. - `wallet`: the wallet - `config`: the user defined configuration of the handler - + + #### handle ```python - | handle(message: Message) -> None +def handle(message: Message) -> None ``` Handle an internal message from the skills. diff --git a/docs/api/decision_maker/gop.md b/docs/api/decision_maker/gop.md index d1054382e3..4400f5b462 100644 --- a/docs/api/decision_maker/gop.md +++ b/docs/api/decision_maker/gop.md @@ -1,9 +1,11 @@ - + + # aea.decision`_`maker.gop This module contains the decision maker class. - + + ## GoalPursuitReadiness Objects ```python @@ -12,7 +14,8 @@ class GoalPursuitReadiness() The goal pursuit readiness. - + + ## Status Objects ```python @@ -26,30 +29,33 @@ In particular, it can be one of the following: - Status.READY: when the agent is ready to pursuit its goal - Status.NOT_READY: when the agent is not ready to pursuit its goal - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Instantiate the goal pursuit readiness. - + + #### is`_`ready ```python - | @property - | is_ready() -> bool +@property +def is_ready() -> bool ``` Get the readiness. - + + #### update ```python - | update(new_status: Status) -> None +def update(new_status: Status) -> None ``` Update the goal pursuit readiness. @@ -58,7 +64,8 @@ Update the goal pursuit readiness. - `new_status`: the new status - + + ## OwnershipState Objects ```python @@ -67,20 +74,24 @@ class OwnershipState(BaseOwnershipState) Represent the ownership state of an agent (can proxy a ledger). - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Instantiate an ownership state object. - + + #### set ```python - | set(amount_by_currency_id: CurrencyHoldings = None, quantities_by_good_id: GoodHoldings = None, **kwargs: Any, ,) -> None +def set(amount_by_currency_id: CurrencyHoldings = None, + quantities_by_good_id: GoodHoldings = None, + **kwargs: Any) -> None ``` Set values on the ownership state. @@ -91,11 +102,14 @@ Set values on the ownership state. - `quantities_by_good_id`: the good endowment of the agent in this state. - `kwargs`: the keyword arguments. - + + #### apply`_`delta ```python - | apply_delta(delta_amount_by_currency_id: Dict[str, int] = None, delta_quantities_by_good_id: Dict[str, int] = None, **kwargs: Any, ,) -> None +def apply_delta(delta_amount_by_currency_id: Dict[str, int] = None, + delta_quantities_by_good_id: Dict[str, int] = None, + **kwargs: Any) -> None ``` Apply a state update to the ownership state. @@ -108,41 +122,45 @@ This method is used to apply a raw state update without a transaction. - `delta_quantities_by_good_id`: the delta in the quantities by good - `kwargs`: the keyword arguments - + + #### is`_`initialized ```python - | @property - | is_initialized() -> bool +@property +def is_initialized() -> bool ``` Get the initialization status. - + + #### amount`_`by`_`currency`_`id ```python - | @property - | amount_by_currency_id() -> CurrencyHoldings +@property +def amount_by_currency_id() -> CurrencyHoldings ``` Get currency holdings in this state. - + + #### quantities`_`by`_`good`_`id ```python - | @property - | quantities_by_good_id() -> GoodHoldings +@property +def quantities_by_good_id() -> GoodHoldings ``` Get good holdings in this state. - + + #### is`_`affordable`_`transaction ```python - | is_affordable_transaction(terms: Terms) -> bool +def is_affordable_transaction(terms: Terms) -> bool ``` Check if the transaction is affordable (and consistent). @@ -158,11 +176,12 @@ Note, the agent is the sender of the transaction message by design. True if the transaction is legal wrt the current state, false otherwise. - + + #### is`_`affordable ```python - | is_affordable(terms: Terms) -> bool +def is_affordable(terms: Terms) -> bool ``` Check if the tx is affordable. @@ -175,11 +194,12 @@ Check if the tx is affordable. whether the transaction is affordable or not - + + #### update ```python - | update(terms: Terms) -> None +def update(terms: Terms) -> None ``` Update the agent state from a transaction. @@ -188,11 +208,12 @@ Update the agent state from a transaction. - `terms`: the transaction terms - + + #### apply`_`transactions ```python - | apply_transactions(list_of_terms: List[Terms]) -> "OwnershipState" +def apply_transactions(list_of_terms: List[Terms]) -> "OwnershipState" ``` Apply a list of transactions to (a copy of) the current state. @@ -205,16 +226,18 @@ Apply a list of transactions to (a copy of) the current state. the final state. - + + #### `__`copy`__` ```python - | __copy__() -> "OwnershipState" +def __copy__() -> "OwnershipState" ``` Copy the object. - + + ## Preferences Objects ```python @@ -223,20 +246,24 @@ class Preferences(BasePreferences) Class to represent the preferences. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Instantiate an agent preference object. - + + #### set ```python - | set(exchange_params_by_currency_id: ExchangeParams = None, utility_params_by_good_id: UtilityParams = None, **kwargs: Any, ,) -> None +def set(exchange_params_by_currency_id: ExchangeParams = None, + utility_params_by_good_id: UtilityParams = None, + **kwargs: Any) -> None ``` Set values on the preferences. @@ -247,12 +274,13 @@ Set values on the preferences. - `utility_params_by_good_id`: the utility params for every asset. - `kwargs`: the keyword arguments. - + + #### is`_`initialized ```python - | @property - | is_initialized() -> bool +@property +def is_initialized() -> bool ``` Get the initialization status. @@ -261,31 +289,34 @@ Get the initialization status. True if exchange_params_by_currency_id and utility_params_by_good_id are not None. - + + #### exchange`_`params`_`by`_`currency`_`id ```python - | @property - | exchange_params_by_currency_id() -> ExchangeParams +@property +def exchange_params_by_currency_id() -> ExchangeParams ``` Get exchange parameter for each currency. - + + #### utility`_`params`_`by`_`good`_`id ```python - | @property - | utility_params_by_good_id() -> UtilityParams +@property +def utility_params_by_good_id() -> UtilityParams ``` Get utility parameter for each good. - + + #### logarithmic`_`utility ```python - | logarithmic_utility(quantities_by_good_id: GoodHoldings) -> float +def logarithmic_utility(quantities_by_good_id: GoodHoldings) -> float ``` Compute agent's utility given her utility function params and a good bundle. @@ -298,11 +329,12 @@ Compute agent's utility given her utility function params and a good bundle. utility value - + + #### linear`_`utility ```python - | linear_utility(amount_by_currency_id: CurrencyHoldings) -> float +def linear_utility(amount_by_currency_id: CurrencyHoldings) -> float ``` Compute agent's utility given her utility function params and a currency bundle. @@ -315,11 +347,13 @@ Compute agent's utility given her utility function params and a currency bundle. utility value - + + #### utility ```python - | utility(quantities_by_good_id: GoodHoldings, amount_by_currency_id: CurrencyHoldings) -> float +def utility(quantities_by_good_id: GoodHoldings, + amount_by_currency_id: CurrencyHoldings) -> float ``` Compute the utility given the good and currency holdings. @@ -333,11 +367,16 @@ Compute the utility given the good and currency holdings. the utility value. - + + #### marginal`_`utility ```python - | marginal_utility(ownership_state: BaseOwnershipState, delta_quantities_by_good_id: Optional[GoodHoldings] = None, delta_amount_by_currency_id: Optional[CurrencyHoldings] = None, **kwargs: Any, ,) -> float +def marginal_utility( + ownership_state: BaseOwnershipState, + delta_quantities_by_good_id: Optional[GoodHoldings] = None, + delta_amount_by_currency_id: Optional[CurrencyHoldings] = None, + **kwargs: Any) -> float ``` Compute the marginal utility. @@ -353,11 +392,13 @@ Compute the marginal utility. the marginal utility score - + + #### utility`_`diff`_`from`_`transaction ```python - | utility_diff_from_transaction(ownership_state: BaseOwnershipState, terms: Terms) -> float +def utility_diff_from_transaction(ownership_state: BaseOwnershipState, + terms: Terms) -> float ``` Simulate a transaction and get the resulting utility difference (taking into account the fee). @@ -371,11 +412,13 @@ Simulate a transaction and get the resulting utility difference (taking into acc the score. - + + #### is`_`utility`_`enhancing ```python - | is_utility_enhancing(ownership_state: BaseOwnershipState, terms: Terms) -> bool +def is_utility_enhancing(ownership_state: BaseOwnershipState, + terms: Terms) -> bool ``` Check if the tx is utility enhancing. @@ -389,16 +432,18 @@ Check if the tx is utility enhancing. whether the transaction is utility enhancing or not - + + #### `__`copy`__` ```python - | __copy__() -> "Preferences" +def __copy__() -> "Preferences" ``` Copy the object. - + + ## DecisionMakerHandler Objects ```python @@ -407,7 +452,8 @@ class DecisionMakerHandler(BaseDecisionMakerHandler) This class implements the decision maker. - + + ## SigningDialogues Objects ```python @@ -416,11 +462,12 @@ class SigningDialogues(BaseSigningDialogues) This class keeps track of all oef_search dialogues. - + + #### `__`init`__` ```python - | __init__(self_address: Address, **kwargs: Any) -> None +def __init__(self_address: Address, **kwargs: Any) -> None ``` Initialize dialogues. @@ -430,7 +477,8 @@ Initialize dialogues. - `self_address`: the address of the entity for whom dialogues are maintained - `kwargs`: the keyword arguments - + + ## StateUpdateDialogues Objects ```python @@ -439,11 +487,12 @@ class StateUpdateDialogues(BaseStateUpdateDialogues) This class keeps track of all oef_search dialogues. - + + #### `__`init`__` ```python - | __init__(self_address: Address, **kwargs: Any) -> None +def __init__(self_address: Address, **kwargs: Any) -> None ``` Initialize dialogues. @@ -453,11 +502,13 @@ Initialize dialogues. - `self_address`: the address of the entity for whom dialogues are maintained - `kwargs`: the keyword arguments - + + #### `__`init`__` ```python - | __init__(identity: Identity, wallet: Wallet, config: Dict[str, Any]) -> None +def __init__(identity: Identity, wallet: Wallet, config: Dict[str, + Any]) -> None ``` Initialize the decision maker. @@ -468,11 +519,12 @@ Initialize the decision maker. - `wallet`: the wallet - `config`: the user defined configuration of the handler - + + #### handle ```python - | handle(message: Message) -> None +def handle(message: Message) -> None ``` Handle an internal message from the skills. diff --git a/docs/api/error_handler/base.md b/docs/api/error_handler/base.md index 920c12dca8..b242d8eb7e 100644 --- a/docs/api/error_handler/base.md +++ b/docs/api/error_handler/base.md @@ -1,9 +1,11 @@ - + + # aea.error`_`handler.base This module contains the abstract error handler class. - + + ## AbstractErrorHandler Objects ```python @@ -12,31 +14,34 @@ class AbstractErrorHandler(ABC) Error handler class for handling problematic envelopes. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) +def __init__(**kwargs: Any) ``` Instantiate error handler. - + + #### config ```python - | @property - | config() -> Dict[str, Any] +@property +def config() -> Dict[str, Any] ``` Get handler config. - + + #### send`_`unsupported`_`protocol ```python - | @abstractmethod - | send_unsupported_protocol(envelope: Envelope, logger: Logger) -> None +@abstractmethod +def send_unsupported_protocol(envelope: Envelope, logger: Logger) -> None ``` Handle the received envelope in case the protocol is not supported. @@ -50,12 +55,14 @@ Handle the received envelope in case the protocol is not supported. None - + + #### send`_`decoding`_`error ```python - | @abstractmethod - | send_decoding_error(envelope: Envelope, exception: Exception, logger: Logger) -> None +@abstractmethod +def send_decoding_error(envelope: Envelope, exception: Exception, + logger: Logger) -> None ``` Handle a decoding error. @@ -70,12 +77,14 @@ Handle a decoding error. None - + + #### send`_`no`_`active`_`handler ```python - | @abstractmethod - | send_no_active_handler(envelope: Envelope, reason: str, logger: Logger) -> None +@abstractmethod +def send_no_active_handler(envelope: Envelope, reason: str, + logger: Logger) -> None ``` Handle the received envelope in case the handler is not supported. diff --git a/docs/api/error_handler/default.md b/docs/api/error_handler/default.md index 1e4efbd010..659cee6893 100644 --- a/docs/api/error_handler/default.md +++ b/docs/api/error_handler/default.md @@ -1,9 +1,11 @@ - + + # aea.error`_`handler.default This module contains the default error handler class. - + + ## ErrorHandler Objects ```python @@ -12,20 +14,22 @@ class ErrorHandler(AbstractErrorHandler) Error handler class for handling problematic envelopes. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) +def __init__(**kwargs: Any) ``` Instantiate error handler. - + + #### send`_`unsupported`_`protocol ```python - | send_unsupported_protocol(envelope: Envelope, logger: Logger) -> None +def send_unsupported_protocol(envelope: Envelope, logger: Logger) -> None ``` Handle the received envelope in case the protocol is not supported. @@ -35,11 +39,13 @@ Handle the received envelope in case the protocol is not supported. - `envelope`: the envelope - `logger`: the logger - + + #### send`_`decoding`_`error ```python - | send_decoding_error(envelope: Envelope, exception: Exception, logger: Logger) -> None +def send_decoding_error(envelope: Envelope, exception: Exception, + logger: Logger) -> None ``` Handle a decoding error. @@ -50,11 +56,13 @@ Handle a decoding error. - `exception`: the exception raised during decoding - `logger`: the logger - + + #### send`_`no`_`active`_`handler ```python - | send_no_active_handler(envelope: Envelope, reason: str, logger: Logger) -> None +def send_no_active_handler(envelope: Envelope, reason: str, + logger: Logger) -> None ``` Handle the received envelope in case the handler is not supported. diff --git a/docs/api/exceptions.md b/docs/api/exceptions.md index 0a90300693..836990bbe6 100644 --- a/docs/api/exceptions.md +++ b/docs/api/exceptions.md @@ -1,9 +1,11 @@ - + + # aea.exceptions Exceptions for the AEA package. - + + ## AEAException Objects ```python @@ -12,7 +14,8 @@ class AEAException(Exception) User-defined exception for the AEA framework. - + + ## AEAPackageLoadingError Objects ```python @@ -21,7 +24,8 @@ class AEAPackageLoadingError(AEAException) Class for exceptions that are raised for loading errors of AEA packages. - + + ## AEASetupError Objects ```python @@ -30,7 +34,8 @@ class AEASetupError(AEAException) Class for exceptions that are raised for setup errors of AEA packages. - + + ## AEATeardownError Objects ```python @@ -39,7 +44,8 @@ class AEATeardownError(AEAException) Class for exceptions that are raised for teardown errors of AEA packages. - + + ## AEAActException Objects ```python @@ -48,7 +54,8 @@ class AEAActException(AEAException) Class for exceptions that are raised for act errors of AEA packages. - + + ## AEAHandleException Objects ```python @@ -57,7 +64,8 @@ class AEAHandleException(AEAException) Class for exceptions that are raised for handler errors of AEA packages. - + + ## AEAInstantiationException Objects ```python @@ -66,7 +74,8 @@ class AEAInstantiationException(AEAException) Class for exceptions that are raised for instantiation errors of AEA packages. - + + ## AEAPluginError Objects ```python @@ -75,7 +84,8 @@ class AEAPluginError(AEAException) Class for exceptions that are raised for wrong plugin setup of the working set. - + + ## AEAEnforceError Objects ```python @@ -84,7 +94,8 @@ class AEAEnforceError(AEAException) Class for enforcement errors. - + + ## AEAValidationError Objects ```python @@ -93,7 +104,8 @@ class AEAValidationError(AEAException) Class for validation errors of an AEA. - + + ## AEAComponentLoadException Objects ```python @@ -102,7 +114,8 @@ class AEAComponentLoadException(AEAException) Class for component loading errors of an AEA. - + + ## AEAWalletNoAddressException Objects ```python @@ -111,7 +124,8 @@ class AEAWalletNoAddressException(AEAException) Class for attempts to instantiate a wallet without addresses. - + + ## `_`StopRuntime Objects ```python @@ -123,11 +137,12 @@ Exception to stop runtime. For internal usage only! Used to perform asyncio call from sync callbacks. - + + #### `__`init`__` ```python - | __init__(reraise: Optional[Exception] = None) -> None +def __init__(reraise: Optional[Exception] = None) -> None ``` Init _StopRuntime exception. @@ -136,11 +151,14 @@ Init _StopRuntime exception. - `reraise`: exception to reraise. - + + #### enforce ```python -enforce(is_valid_condition: bool, exception_text: str, exception_class: Type[Exception] = AEAEnforceError) -> None +def enforce(is_valid_condition: bool, + exception_text: str, + exception_class: Type[Exception] = AEAEnforceError) -> None ``` Evaluate a condition and raise an exception with the provided text if it is not satisfied. @@ -151,11 +169,12 @@ Evaluate a condition and raise an exception with the provided text if it is not - `exception_text`: the exception to be raised - `exception_class`: the class of exception - + + #### parse`_`exception ```python -parse_exception(exception: Exception, limit: int = -1) -> str +def parse_exception(exception: Exception, limit: int = -1) -> str ``` Parse an exception to get the relevant lines. diff --git a/docs/api/helpers/acn/agent_record.md b/docs/api/helpers/acn/agent_record.md index af6f326c57..421576114d 100644 --- a/docs/api/helpers/acn/agent_record.md +++ b/docs/api/helpers/acn/agent_record.md @@ -1,9 +1,11 @@ - + + # aea.helpers.acn.agent`_`record This module contains types and helpers for ACN Proof-of-Representation. - + + ## AgentRecord Objects ```python @@ -12,11 +14,15 @@ class AgentRecord() Agent Proof-of-Representation to representative. - + + #### `__`init`__` ```python - | __init__(address: str, representative_public_key: str, identifier: SimpleIdOrStr, ledger_id: SimpleIdOrStr, not_before: str, not_after: str, message_format: str, signature: str) -> None +def __init__(address: str, representative_public_key: str, + identifier: SimpleIdOrStr, ledger_id: SimpleIdOrStr, + not_before: str, not_after: str, message_format: str, + signature: str) -> None ``` Initialize the AgentRecord @@ -32,121 +38,137 @@ Initialize the AgentRecord - `message_format`: message format used for signing - `signature`: proof-of-representation of this AgentRecord - + + #### address ```python - | @property - | address() -> str +@property +def address() -> str ``` Get agent address - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Get agent public key - + + #### representative`_`public`_`key ```python - | @property - | representative_public_key() -> str +@property +def representative_public_key() -> str ``` Get agent representative's public key - + + #### signature ```python - | @property - | signature() -> str +@property +def signature() -> str ``` Get record signature - + + #### message ```python - | @property - | message() -> bytes +@property +def message() -> bytes ``` Get the message. - + + #### identifier ```python - | @property - | identifier() -> SimpleIdOrStr +@property +def identifier() -> SimpleIdOrStr ``` Get the identifier. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> SimpleIdOrStr +@property +def ledger_id() -> SimpleIdOrStr ``` Get ledger id. - + + #### not`_`before ```python - | @property - | not_before() -> str +@property +def not_before() -> str ``` Get the not_before field. - + + #### not`_`after ```python - | @property - | not_after() -> str +@property +def not_after() -> str ``` Get the not_after field. - + + #### message`_`format ```python - | @property - | message_format() -> str +@property +def message_format() -> str ``` Get the message format. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + #### from`_`cert`_`request ```python - | @classmethod - | from_cert_request(cls, cert_request: CertRequest, address: str, representative_public_key: str, data_dir: Optional[PathLike] = None) -> "AgentRecord" +@classmethod +def from_cert_request(cls, + cert_request: CertRequest, + address: str, + representative_public_key: str, + data_dir: Optional[PathLike] = None) -> "AgentRecord" ``` Get agent record from cert request. diff --git a/docs/api/helpers/acn/uri.md b/docs/api/helpers/acn/uri.md index 0c7b02959b..a95c639cac 100644 --- a/docs/api/helpers/acn/uri.md +++ b/docs/api/helpers/acn/uri.md @@ -1,9 +1,11 @@ - + + # aea.helpers.acn.uri This module contains types and helpers for libp2p connections Uris. - + + ## Uri Objects ```python @@ -12,49 +14,56 @@ class Uri() Holds a node address in format "host:port". - + + #### `__`init`__` ```python - | __init__(uri: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None) -> None +def __init__(uri: Optional[str] = None, + host: Optional[str] = None, + port: Optional[int] = None) -> None ``` Initialise Uri. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get object representation. - + + #### host ```python - | @property - | host() -> str +@property +def host() -> str ``` Get host. - + + #### port ```python - | @property - | port() -> int +@property +def port() -> int ``` Get port. diff --git a/docs/api/helpers/async_friendly_queue.md b/docs/api/helpers/async_friendly_queue.md index 70a9f2c08f..38a77cc874 100644 --- a/docs/api/helpers/async_friendly_queue.md +++ b/docs/api/helpers/async_friendly_queue.md @@ -1,9 +1,11 @@ - + + # aea.helpers.async`_`friendly`_`queue This module contains the implementation of AsyncFriendlyQueue. - + + ## AsyncFriendlyQueue Objects ```python @@ -12,20 +14,22 @@ class AsyncFriendlyQueue(queue.Queue) queue.Queue with async_get method. - + + #### `__`init`__` ```python - | __init__(*args: Any, **kwargs: Any) -> None +def __init__(*args: Any, **kwargs: Any) -> None ``` Init queue. - + + #### put ```python - | put(item: Any, *args: Any, **kwargs: Any) -> None +def put(item: Any, *args: Any, **kwargs: Any) -> None ``` Put an item into the queue. @@ -36,11 +40,12 @@ Put an item into the queue. - `args`: similar to queue.Queue.put - `kwargs`: similar to queue.Queue.put - + + #### get ```python - | get(*args: Any, **kwargs: Any) -> Any +def get(*args: Any, **kwargs: Any) -> Any ``` Get an item into the queue. @@ -54,11 +59,12 @@ Get an item into the queue. similar to queue.Queue.get - + + #### async`_`wait ```python - | async async_wait() -> None +async def async_wait() -> None ``` Wait an item appears in the queue. @@ -67,11 +73,12 @@ Wait an item appears in the queue. None - + + #### async`_`get ```python - | async async_get() -> Any +async def async_get() -> Any ``` Wait and get an item from the queue. diff --git a/docs/api/helpers/async_utils.md b/docs/api/helpers/async_utils.md index e9608ec2bf..cb50d5f50e 100644 --- a/docs/api/helpers/async_utils.md +++ b/docs/api/helpers/async_utils.md @@ -1,18 +1,21 @@ - + + # aea.helpers.async`_`utils This module contains the misc utils for async code. - + + #### ensure`_`list ```python -ensure_list(value: Any) -> List +def ensure_list(value: Any) -> List ``` Return [value] or list(value) if value is a sequence. - + + ## AsyncState Objects ```python @@ -21,11 +24,13 @@ class AsyncState() Awaitable state. - + + #### `__`init`__` ```python - | __init__(initial_state: Any = None, states_enum: Optional[Container[Any]] = None) -> None +def __init__(initial_state: Any = None, + states_enum: Optional[Container[Any]] = None) -> None ``` Init async state. @@ -35,20 +40,22 @@ Init async state. - `initial_state`: state to set on start. - `states_enum`: container of valid states if not provided state not checked on set. - + + #### set ```python - | set(state: Any) -> None +def set(state: Any) -> None ``` Set state. - + + #### add`_`callback ```python - | add_callback(callback_fn: Callable[[Any], None]) -> None +def add_callback(callback_fn: Callable[[Any], None]) -> None ``` Add callback to track state changes. @@ -57,20 +64,22 @@ Add callback to track state changes. - `callback_fn`: callable object to be called on state changed. - + + #### get ```python - | get() -> Any +def get() -> Any ``` Get state. - + + #### wait ```python - | async wait(state_or_states: Union[Any, Sequence[Any]]) -> Tuple[Any, Any] +async def wait(state_or_states: Union[Any, Sequence[Any]]) -> Tuple[Any, Any] ``` Wait state to be set. @@ -83,12 +92,15 @@ Wait state to be set. tuple of previous state and new state. - + + #### transit ```python - | @contextmanager - | transit(initial: Any = not_set, success: Any = not_set, fail: Any = not_set) -> Generator +@contextmanager +def transit(initial: Any = not_set, + success: Any = not_set, + fail: Any = not_set) -> Generator ``` Change state context according to success or not. @@ -98,9 +110,13 @@ Change state context according to success or not. - `initial`: set state on context enter, not_set by default - `success`: set state on context block done, not_set by default - `fail`: set state on context block raises exception, not_set by default -:yield: generator - +**Returns**: + +generator + + + ## PeriodicCaller Objects ```python @@ -111,11 +127,17 @@ Schedule a periodic call of callable using event loop. Used for periodic function run using asyncio. - + + #### `__`init`__` ```python - | __init__(callback: Callable, period: float, start_at: Optional[datetime.datetime] = None, exception_callback: Optional[Callable[[Callable, Exception], None]] = None, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(callback: Callable, + period: float, + start_at: Optional[datetime.datetime] = None, + exception_callback: Optional[Callable[[Callable, Exception], + None]] = None, + loop: Optional[AbstractEventLoop] = None) -> None ``` Init periodic caller. @@ -128,25 +150,28 @@ Init periodic caller. - `exception_callback`: optional handler to call on exception raised. - `loop`: optional asyncio event loop - + + #### start ```python - | start() -> None +def start() -> None ``` Activate period calls. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Remove from schedule. - + + ## AnotherThreadTask Objects ```python @@ -157,11 +182,12 @@ Schedule a task to run on the loop in another thread. Provides better cancel behaviour: on cancel it will wait till cancelled completely. - + + #### `__`init`__` ```python - | __init__(coro: Coroutine[Any, Any, Any], loop: AbstractEventLoop) -> None +def __init__(coro: Coroutine[Any, Any, Any], loop: AbstractEventLoop) -> None ``` Init the task. @@ -171,11 +197,12 @@ Init the task. - `coro`: coroutine to schedule - `loop`: an event loop to schedule on. - + + #### result ```python - | result(timeout: Optional[float] = None) -> Any +def result(timeout: Optional[float] = None) -> Any ``` Wait for coroutine execution result. @@ -188,25 +215,28 @@ Wait for coroutine execution result. result - + + #### cancel ```python - | cancel() -> None +def cancel() -> None ``` Cancel coroutine task execution in a target loop. - + + #### done ```python - | done() -> bool +def done() -> bool ``` Check task is done. - + + ## ThreadedAsyncRunner Objects ```python @@ -215,11 +245,12 @@ class ThreadedAsyncRunner(Thread) Util to run thread with event loop and execute coroutines inside. - + + #### `__`init`__` ```python - | __init__(loop: Optional[AbstractEventLoop] = None) -> None +def __init__(loop: Optional[AbstractEventLoop] = None) -> None ``` Init threaded runner. @@ -228,29 +259,32 @@ Init threaded runner. - `loop`: optional event loop. is it's running loop, threaded runner will use it. - + + #### start ```python - | start() -> None +def start() -> None ``` Start event loop in dedicated thread. - + + #### run ```python - | run() -> None +def run() -> None ``` Run code inside thread. - + + #### call ```python - | call(coro: Coroutine[Any, Any, Any]) -> Any +def call(coro: Coroutine[Any, Any, Any]) -> Any ``` Run a coroutine inside the event loop. @@ -263,16 +297,18 @@ Run a coroutine inside the event loop. task - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop event loop in thread. - + + ## Runnable Objects ```python @@ -285,11 +321,13 @@ Use to run async task in same event loop or in dedicated thread. Provides: start, stop sync methods to start and stop task Use wait_completed to await task was completed. - + + #### `__`init`__` ```python - | __init__(loop: asyncio.AbstractEventLoop = None, threaded: bool = False) -> None +def __init__(loop: asyncio.AbstractEventLoop = None, + threaded: bool = False) -> None ``` Init runnable. @@ -299,11 +337,12 @@ Init runnable. - `loop`: asyncio event loop to use. - `threaded`: bool. start in thread if True. - + + #### start ```python - | start() -> bool +def start() -> bool ``` Start runnable. @@ -312,31 +351,36 @@ Start runnable. bool started or not. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Get running state. - + + #### run ```python - | @abstractmethod - | async run() -> Any +@abstractmethod +async def run() -> Any ``` Implement run logic respectful to CancelError on termination. - + + #### wait`_`completed ```python - | wait_completed(sync: bool = False, timeout: float = None, force_result: bool = False) -> Union[Coroutine, Awaitable] +def wait_completed(sync: bool = False, + timeout: float = None, + force_result: bool = False) -> Union[Coroutine, Awaitable] ``` Wait runnable execution completed. @@ -351,20 +395,23 @@ Wait runnable execution completed. awaitable if sync is False, otherwise None - + + #### stop ```python - | stop(force: bool = False) -> None +def stop(force: bool = False) -> None ``` Stop runnable. - + + #### start`_`and`_`wait`_`completed ```python - | start_and_wait_completed(*args: Any, **kwargs: Any) -> Union[Coroutine, Awaitable] +def start_and_wait_completed(*args: Any, + **kwargs: Any) -> Union[Coroutine, Awaitable] ``` Alias for start and wait methods. diff --git a/docs/api/helpers/base.md b/docs/api/helpers/base.md index 0116996eba..23900b0a5b 100644 --- a/docs/api/helpers/base.md +++ b/docs/api/helpers/base.md @@ -1,22 +1,25 @@ - + + # aea.helpers.base Miscellaneous helpers. - + + #### locate ```python -locate(path: str) -> Any +def locate(path: str) -> Any ``` Locate an object by name or dotted save_path, importing as necessary. - + + #### load`_`module ```python -load_module(dotted_path: str, filepath: Path) -> types.ModuleType +def load_module(dotted_path: str, filepath: Path) -> types.ModuleType ``` Load a module. @@ -26,20 +29,21 @@ Load a module. - `dotted_path`: the dotted save_path of the package/module. - `filepath`: the file to the package/module. -**Returns**: - -module type - **Raises**: - `ValueError`: if the filepath provided is not a module. # noqa: DAR402 - `Exception`: if the execution of the module raises exception. # noqa: DAR402 - +**Returns**: + +module type + + + #### load`_`env`_`file ```python -load_env_file(env_file: str) -> None +def load_env_file(env_file: str) -> None ``` Load the content of the environment file into the process environment. @@ -48,11 +52,12 @@ Load the content of the environment file into the process environment. - `env_file`: save_path to the env file. - + + #### sigint`_`crossplatform ```python -sigint_crossplatform(process: subprocess.Popen) -> None +def sigint_crossplatform(process: subprocess.Popen) -> None ``` Send a SIGINT, cross-platform. @@ -68,11 +73,12 @@ However, a subprocess.Popen class has the method - `process`: the process to send the signal to. - + + #### win`_`popen`_`kwargs ```python -win_popen_kwargs() -> dict +def win_popen_kwargs() -> dict ``` Return kwargs to start a process in windows with new process group. @@ -84,11 +90,13 @@ Return empty dict if platform is not win32 windows popen kwargs - + + #### send`_`control`_`c ```python -send_control_c(process: subprocess.Popen, kill_group: bool = False) -> None +def send_control_c(process: subprocess.Popen, + kill_group: bool = False) -> None ``` Send ctrl-C cross-platform to terminate a subprocess. @@ -98,7 +106,8 @@ Send ctrl-C cross-platform to terminate a subprocess. - `process`: the process to send the signal to. - `kill_group`: whether or not to kill group - + + ## RegexConstrainedString Objects ```python @@ -111,16 +120,18 @@ The default behaviour is to match anything. Subclass this class and change the 'REGEX' class attribute to implement a different behaviour. - + + #### `__`init`__` ```python - | __init__(seq: Union[UserString, str]) -> None +def __init__(seq: Union[UserString, str]) -> None ``` Initialize a regex constrained string. - + + ## SimpleId Objects ```python @@ -155,21 +166,24 @@ Traceback (most recent call last): ... ValueError: Value does not match the regular expression re.compile('[a-zA-Z_][a-zA-Z0-9_]{0,127}') - + + #### cd ```python @contextlib.contextmanager -cd(path: PathLike) -> Generator +def cd(path: PathLike) -> Generator ``` Change working directory temporarily. - + + #### get`_`logger`_`method ```python -get_logger_method(fn: Callable, logger_method: Union[str, Callable]) -> Callable +def get_logger_method(fn: Callable, + logger_method: Union[str, Callable]) -> Callable ``` Get logger method for function. @@ -186,11 +200,14 @@ Or return logger_method if it's callable. callable to write log with - + + #### try`_`decorator ```python -try_decorator(error_message: str, default_return: Callable = None, logger_method: Any = "error") -> Callable +def try_decorator(error_message: str, + default_return: Callable = None, + logger_method: Any = "error") -> Callable ``` Run function, log and return default value on exception. @@ -207,7 +224,8 @@ Does not support async or coroutines! the callable - + + ## MaxRetriesError Objects ```python @@ -216,11 +234,15 @@ class MaxRetriesError(Exception) Exception for retry decorator. - + + #### retry`_`decorator ```python -retry_decorator(number_of_retries: int, error_message: str, delay: float = 0, logger_method: str = "error") -> Callable +def retry_decorator(number_of_retries: int, + error_message: str, + delay: float = 0, + logger_method: str = "error") -> Callable ``` Run function with several attempts. @@ -238,12 +260,13 @@ Does not support async or coroutines! the callable - + + #### exception`_`log`_`and`_`reraise ```python @contextlib.contextmanager -exception_log_and_reraise(log_method: Callable, message: str) -> Generator +def exception_log_and_reraise(log_method: Callable, message: str) -> Generator ``` Run code in context to log and re raise exception. @@ -252,13 +275,19 @@ Run code in context to log and re raise exception. - `log_method`: function to print log - `message`: message template to add error text. -:yield: the generator - +**Returns**: + +the generator + + + #### recursive`_`update ```python -recursive_update(to_update: Dict, new_values: Dict, allow_new_values: bool = False) -> None +def recursive_update(to_update: Dict, + new_values: Dict, + allow_new_values: bool = False) -> None ``` Update a dictionary by replacing conflicts with the new values. @@ -277,11 +306,12 @@ It does side-effects to the first dictionary. - `new_values`: the dictionary of new values to replace. - `allow_new_values`: whether or not to allow new values. - + + #### find`_`topological`_`order ```python -find_topological_order(adjacency_list: Dict[T, Set[T]]) -> List[T] +def find_topological_order(adjacency_list: Dict[T, Set[T]]) -> List[T] ``` Compute the topological order of a graph (using Kahn's algorithm). @@ -290,19 +320,21 @@ Compute the topological order of a graph (using Kahn's algorithm). - `adjacency_list`: the adjacency list of the graph. +**Raises**: + +- `ValueError`: if the graph contains a cycle. + **Returns**: the topological order for the graph (as a sequence of nodes) -**Raises**: + -- `ValueError`: if the graph contains a cycle. - - #### reachable`_`nodes ```python -reachable_nodes(adjacency_list: Dict[T, Set[T]], starting_nodes: Set[T]) -> Dict[T, Set[T]] +def reachable_nodes(adjacency_list: Dict[T, Set[T]], + starting_nodes: Set[T]) -> Dict[T, Set[T]] ``` Find the reachable subgraph induced by a set of starting nodes. @@ -316,7 +348,8 @@ Find the reachable subgraph induced by a set of starting nodes. the adjacency list of the subgraph. - + + ## cached`_`property Objects ```python @@ -325,61 +358,70 @@ class cached_property() Cached property from python3.8 functools. - + + #### `__`init`__` ```python - | __init__(func: Callable) -> None +def __init__(func: Callable) -> None ``` Init cached property. - + + #### `__`set`_`name`__` ```python - | __set_name__(_: Any, name: Any) -> None +def __set_name__(_: Any, name: Any) -> None ``` Set name. - + + #### `__`get`__` ```python - | __get__(instance: Any, _: Optional[Any] = None) -> Any +def __get__(instance: Any, _: Optional[Any] = None) -> Any ``` Get instance. - + + #### ensure`_`dir ```python -ensure_dir(dir_path: str) -> None +def ensure_dir(dir_path: str) -> None ``` Check if dir_path is a directory or create it. - + + #### dict`_`to`_`path`_`value ```python -dict_to_path_value(data: Mapping, path: Optional[List] = None) -> Iterable[Tuple[List[str], Any]] +def dict_to_path_value( + data: Mapping, + path: Optional[List] = None) -> Iterable[Tuple[List[str], Any]] ``` Convert dict to sequence of terminal path build of keys and value. - + + #### parse`_`datetime`_`from`_`str ```python -parse_datetime_from_str(date_string: str) -> datetime.datetime +def parse_datetime_from_str(date_string: str) -> datetime.datetime ``` Parse datetime from string. - + + ## CertRequest Objects ```python @@ -388,11 +430,14 @@ class CertRequest() Certificate request for proof of representation. - + + #### `__`init`__` ```python - | __init__(public_key: str, identifier: SimpleIdOrStr, ledger_id: SimpleIdOrStr, not_before: str, not_after: str, message_format: str, save_path: str) -> None +def __init__(public_key: str, identifier: SimpleIdOrStr, + ledger_id: SimpleIdOrStr, not_before: str, not_after: str, + message_format: str, save_path: str) -> None ``` Initialize the certificate request. @@ -407,102 +452,112 @@ Initialize the certificate request. - `message_format`: message format used for signing - `save_path`: the save_path where to save the certificate. - + + #### public`_`key ```python - | @property - | public_key() -> Optional[str] +@property +def public_key() -> Optional[str] ``` Get the public key. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the ledger id. - + + #### key`_`identifier ```python - | @property - | key_identifier() -> Optional[str] +@property +def key_identifier() -> Optional[str] ``` Get the key identifier. - + + #### identifier ```python - | @property - | identifier() -> str +@property +def identifier() -> str ``` Get the identifier. - + + #### not`_`before`_`string ```python - | @property - | not_before_string() -> str +@property +def not_before_string() -> str ``` Get the not_before field as string. - + + #### not`_`after`_`string ```python - | @property - | not_after_string() -> str +@property +def not_after_string() -> str ``` Get the not_after field as string. - + + #### not`_`before ```python - | @property - | not_before() -> datetime.datetime +@property +def not_before() -> datetime.datetime ``` Get the not_before field. - + + #### not`_`after ```python - | @property - | not_after() -> datetime.datetime +@property +def not_after() -> datetime.datetime ``` Get the not_after field. - + + #### message`_`format ```python - | @property - | message_format() -> str +@property +def message_format() -> str ``` Get the message format. - + + #### save`_`path ```python - | @property - | save_path() -> Path +@property +def save_path() -> Path ``` Get the save path for the certificate. @@ -514,11 +569,12 @@ the actual save path might depend on the context. the save path - + + #### get`_`absolute`_`save`_`path ```python - | get_absolute_save_path(path_prefix: Optional[PathLike] = None) -> Path +def get_absolute_save_path(path_prefix: Optional[PathLike] = None) -> Path ``` Get the absolute save path. @@ -534,31 +590,36 @@ Otherwise, the path prefix is prepended. the actual save path. - + + #### public`_`key`_`or`_`identifier ```python - | @property - | public_key_or_identifier() -> str +@property +def public_key_or_identifier() -> str ``` Get the public key or identifier. - + + #### get`_`message ```python - | get_message(public_key: str) -> bytes +def get_message(public_key: str) -> bytes ``` Get the message to sign. - + + #### construct`_`message ```python - | @classmethod - | construct_message(cls, public_key: str, identifier: SimpleIdOrStr, not_before_string: str, not_after_string: str, message_format: str) -> bytes +@classmethod +def construct_message(cls, public_key: str, identifier: SimpleIdOrStr, + not_before_string: str, not_after_string: str, + message_format: str) -> bytes ``` Construct message for singning. @@ -575,11 +636,12 @@ Construct message for singning. the message - + + #### get`_`signature ```python - | get_signature(path_prefix: Optional[PathLike] = None) -> str +def get_signature(path_prefix: Optional[PathLike] = None) -> str ``` Get signature from save_path. @@ -592,40 +654,44 @@ Get signature from save_path. the signature. - + + #### json ```python - | @property - | json() -> Dict +@property +def json() -> Dict ``` Compute the JSON representation. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, obj: Dict) -> "CertRequest" +@classmethod +def from_json(cls, obj: Dict) -> "CertRequest" ``` Compute the JSON representation. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### compute`_`specifier`_`from`_`version ```python -compute_specifier_from_version(version: Version) -> str +def compute_specifier_from_version(version: Version) -> str ``` Compute the specifier set from a version. @@ -640,11 +706,12 @@ version specifier is: >=major.minor.0, + + #### decorator`_`with`_`optional`_`params ```python -decorator_with_optional_params(decorator: Callable) -> Callable +def decorator_with_optional_params(decorator: Callable) -> Callable ``` Make a decorator usable either with or without parameters. @@ -654,13 +721,13 @@ It can be used both as: @mydecorator def myfunction(): -... + ... or as: @mydecorator(arg1, kwarg1="value") def myfunction(): -... + ... **Arguments**: @@ -670,20 +737,22 @@ def myfunction(): a decorator callable - + + #### delete`_`directory`_`contents ```python -delete_directory_contents(directory: Path) -> None +def delete_directory_contents(directory: Path) -> None ``` Delete the content of a directory, without deleting it. - + + #### prepend`_`if`_`not`_`absolute ```python -prepend_if_not_absolute(path: PathLike, prefix: PathLike) -> PathLike +def prepend_if_not_absolute(path: PathLike, prefix: PathLike) -> PathLike ``` Prepend a path with a prefix, but only if not absolute diff --git a/docs/api/helpers/constants.md b/docs/api/helpers/constants.md index 711fa71dd3..ac8d5c7033 100644 --- a/docs/api/helpers/constants.md +++ b/docs/api/helpers/constants.md @@ -1,4 +1,5 @@ - + + # aea.helpers.constants Module with helpers constants. diff --git a/docs/api/helpers/env_vars.md b/docs/api/helpers/env_vars.md index 90c05eebad..cc640d19d9 100644 --- a/docs/api/helpers/env_vars.md +++ b/docs/api/helpers/env_vars.md @@ -1,40 +1,49 @@ - + + # aea.helpers.env`_`vars Implementation of the environment variables support. - + + #### is`_`env`_`variable ```python -is_env_variable(value: Any) -> bool +def is_env_variable(value: Any) -> bool ``` Check is variable string with env variable pattern. - + + #### replace`_`with`_`env`_`var ```python -replace_with_env_var(value: str, env_variables: dict, default_value: Any = NotSet) -> JSON_TYPES +def replace_with_env_var(value: str, + env_variables: dict, + default_value: Any = NotSet) -> JSON_TYPES ``` Replace env var with value. - + + #### apply`_`env`_`variables ```python -apply_env_variables(data: Union[Dict, List[Dict]], env_variables: Mapping[str, Any], default_value: Any = NotSet) -> JSON_TYPES +def apply_env_variables(data: Union[Dict, List[Dict]], + env_variables: Mapping[str, Any], + default_value: Any = NotSet) -> JSON_TYPES ``` Create new resulting dict with env variables applied. - + + #### convert`_`value`_`str`_`to`_`type ```python -convert_value_str_to_type(value: str, type_str: str) -> JSON_TYPES +def convert_value_str_to_type(value: str, type_str: str) -> JSON_TYPES ``` Convert value by type name to native python type. diff --git a/docs/api/helpers/exception_policy.md b/docs/api/helpers/exception_policy.md index 40ea1a4a3d..256aefb01b 100644 --- a/docs/api/helpers/exception_policy.md +++ b/docs/api/helpers/exception_policy.md @@ -1,9 +1,11 @@ - + + # aea.helpers.exception`_`policy This module contains enum of aea exception policies. - + + ## ExceptionPolicyEnum Objects ```python diff --git a/docs/api/helpers/exec_timeout.md b/docs/api/helpers/exec_timeout.md index 3107224ccb..8544722ca5 100644 --- a/docs/api/helpers/exec_timeout.md +++ b/docs/api/helpers/exec_timeout.md @@ -1,9 +1,11 @@ - + + # aea.helpers.exec`_`timeout Python code execution time limit tools. - + + ## TimeoutResult Objects ```python @@ -12,29 +14,32 @@ class TimeoutResult() Result of ExecTimeout context manager. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Init. - + + #### set`_`cancelled`_`by`_`timeout ```python - | set_cancelled_by_timeout() -> None +def set_cancelled_by_timeout() -> None ``` Set code was terminated cause timeout. - + + #### is`_`cancelled`_`by`_`timeout ```python - | is_cancelled_by_timeout() -> bool +def is_cancelled_by_timeout() -> bool ``` Return True if code was terminated by ExecTimeout cause timeout. @@ -43,7 +48,8 @@ Return True if code was terminated by ExecTimeout cause timeout. bool - + + ## TimeoutException Objects ```python @@ -54,7 +60,8 @@ TimeoutException raised by ExecTimeout context managers in thread with limited e Used internally, does not propagated outside of context manager - + + ## BaseExecTimeout Objects ```python @@ -65,11 +72,12 @@ Base class for implementing context managers to limit python code execution time exception_class - is exception type to raise in code controlled in case of timeout. - + + #### `__`init`__` ```python - | __init__(timeout: float = 0.0) -> None +def __init__(timeout: float = 0.0) -> None ``` Init. @@ -78,11 +86,12 @@ Init. - `timeout`: number of seconds to execute code before interruption - + + #### `__`enter`__` ```python - | __enter__() -> TimeoutResult +def __enter__() -> TimeoutResult ``` Enter context manager. @@ -91,11 +100,13 @@ Enter context manager. TimeoutResult - + + #### `__`exit`__` ```python - | __exit__(exc_type: Type[Exception], exc_val: Exception, exc_tb: TracebackType) -> None +def __exit__(exc_type: Type[Exception], exc_val: Exception, + exc_tb: TracebackType) -> None ``` Exit context manager. @@ -106,7 +117,8 @@ Exit context manager. - `exc_val`: the exception - `exc_tb`: the traceback - + + ## ExecTimeoutSigAlarm Objects ```python @@ -117,7 +129,8 @@ ExecTimeout context manager implementation using signals and SIGALARM. Does not support threads, have to be used only in main thread. - + + ## ExecTimeoutThreadGuard Objects ```python @@ -130,11 +143,12 @@ Support threads. Requires supervisor thread start/stop to control execution time control. Possible will be not accurate in case of long c functions used inside code controlled. - + + #### `__`init`__` ```python - | __init__(timeout: float = 0.0) -> None +def __init__(timeout: float = 0.0) -> None ``` Init ExecTimeoutThreadGuard variables. @@ -143,24 +157,26 @@ Init ExecTimeoutThreadGuard variables. - `timeout`: number of seconds to execute code before interruption - + + #### start ```python - | @classmethod - | start(cls) -> None +@classmethod +def start(cls) -> None ``` Start supervisor thread to check timeouts. Supervisor starts once but number of start counted. - + + #### stop ```python - | @classmethod - | stop(cls, force: bool = False) -> None +@classmethod +def stop(cls, force: bool = False) -> None ``` Stop supervisor thread. diff --git a/docs/api/helpers/file_io.md b/docs/api/helpers/file_io.md index fed4769290..02797a1629 100644 --- a/docs/api/helpers/file_io.md +++ b/docs/api/helpers/file_io.md @@ -1,14 +1,17 @@ - + + # aea.helpers.file`_`io Read to and write from file with envelopes. - + + #### lock`_`file ```python @contextmanager -lock_file(file_descriptor: IO[bytes], logger: Logger = _default_logger) -> Generator +def lock_file(file_descriptor: IO[bytes], + logger: Logger = _default_logger) -> Generator ``` Lock file in context manager. @@ -17,31 +20,45 @@ Lock file in context manager. - `file_descriptor`: file descriptor of file to lock. - `logger`: the logger. -:yield: generator - +**Returns**: + +generator + + + #### write`_`envelope ```python -write_envelope(envelope: Envelope, file_pointer: IO[bytes], separator: bytes = SEPARATOR, logger: Logger = _default_logger) -> None +def write_envelope(envelope: Envelope, + file_pointer: IO[bytes], + separator: bytes = SEPARATOR, + logger: Logger = _default_logger) -> None ``` Write envelope to file. - + + #### write`_`with`_`lock ```python -write_with_lock(file_pointer: IO[bytes], data: Union[bytes], logger: Logger = _default_logger) -> None +def write_with_lock(file_pointer: IO[bytes], + data: Union[bytes], + logger: Logger = _default_logger) -> None ``` Write bytes to file protected with file lock. - + + #### envelope`_`from`_`bytes ```python -envelope_from_bytes(bytes_: bytes, separator: bytes = SEPARATOR, logger: Logger = _default_logger) -> Optional[Envelope] +def envelope_from_bytes( + bytes_: bytes, + separator: bytes = SEPARATOR, + logger: Logger = _default_logger) -> Optional[Envelope] ``` Decode bytes to get the envelope. diff --git a/docs/api/helpers/file_lock.md b/docs/api/helpers/file_lock.md index 1123a0a518..ffda4bf078 100644 --- a/docs/api/helpers/file_lock.md +++ b/docs/api/helpers/file_lock.md @@ -1,4 +1,5 @@ - + + # aea.helpers.file`_`lock Patch of 'fnctl' to make it compatible with Windows. diff --git a/docs/api/helpers/http_requests.md b/docs/api/helpers/http_requests.md index 4e8d7c3809..9b2c27ffeb 100644 --- a/docs/api/helpers/http_requests.md +++ b/docs/api/helpers/http_requests.md @@ -1,13 +1,15 @@ - + + # aea.helpers.http`_`requests Wrapper over requests library. - + + #### add`_`default`_`timeout ```python -add_default_timeout(fn: Callable, timeout: float) -> Callable +def add_default_timeout(fn: Callable, timeout: float) -> Callable ``` Add default timeout for requests methods. diff --git a/docs/api/helpers/install_dependency.md b/docs/api/helpers/install_dependency.md index 96d3e3587d..f7652aabe4 100644 --- a/docs/api/helpers/install_dependency.md +++ b/docs/api/helpers/install_dependency.md @@ -1,13 +1,18 @@ - + + # aea.helpers.install`_`dependency Helper to install python dependencies. - + + #### install`_`dependency ```python -install_dependency(dependency_name: str, dependency: Dependency, logger: Logger, install_timeout: float = 300) -> None +def install_dependency(dependency_name: str, + dependency: Dependency, + logger: Logger, + install_timeout: float = 300) -> None ``` Install python dependency to the current python environment. @@ -19,11 +24,14 @@ Install python dependency to the current python environment. - `logger`: the logger - `install_timeout`: timeout to wait pip to install - + + #### install`_`dependencies ```python -install_dependencies(dependencies: List[Dependency], logger: Logger, install_timeout: float = 300) -> None +def install_dependencies(dependencies: List[Dependency], + logger: Logger, + install_timeout: float = 300) -> None ``` Install python dependencies to the current python environment. @@ -34,11 +42,14 @@ Install python dependencies to the current python environment. - `logger`: the logger - `install_timeout`: timeout to wait pip to install - + + #### call`_`pip ```python -call_pip(pip_args: List[str], timeout: float = 300, retry: bool = False) -> None +def call_pip(pip_args: List[str], + timeout: float = 300, + retry: bool = False) -> None ``` Run pip install command. @@ -49,11 +60,13 @@ Run pip install command. - `timeout`: timeout to wait pip to install - `retry`: bool, try one more time if command failed - + + #### run`_`install`_`subprocess ```python -run_install_subprocess(install_command: List[str], install_timeout: float = 300) -> int +def run_install_subprocess(install_command: List[str], + install_timeout: float = 300) -> int ``` Try executing install command. diff --git a/docs/api/helpers/io.md b/docs/api/helpers/io.md index bbd70e8775..bb51a319eb 100644 --- a/docs/api/helpers/io.md +++ b/docs/api/helpers/io.md @@ -1,3 +1,4 @@ - + + # aea.helpers.io diff --git a/docs/api/helpers/ipfs/base.md b/docs/api/helpers/ipfs/base.md index 0d76bed5ae..9eba890b19 100644 --- a/docs/api/helpers/ipfs/base.md +++ b/docs/api/helpers/ipfs/base.md @@ -1,18 +1,21 @@ - + + # aea.helpers.ipfs.base This module contains helper methods and classes for the 'aea' package. - + + #### chunks ```python -chunks(data: Sized, size: int) -> Generator +def chunks(data: Sized, size: int) -> Generator ``` Yield successivesize chunks from data. - + + ## IPFSHashOnly Objects ```python @@ -21,11 +24,12 @@ class IPFSHashOnly() A helper class which allows construction of an IPFS hash without interacting with an IPFS daemon. - + + #### get ```python - | get(file_path: str) -> str +def get(file_path: str) -> str ``` Get the IPFS hash for a single file. diff --git a/docs/api/helpers/ipfs/utils.md b/docs/api/helpers/ipfs/utils.md index 8e641af209..6a1656d78e 100644 --- a/docs/api/helpers/ipfs/utils.md +++ b/docs/api/helpers/ipfs/utils.md @@ -1,4 +1,5 @@ - + + # aea.helpers.ipfs.utils This module contains utility methods for ipfs helpers. diff --git a/docs/api/helpers/logging.md b/docs/api/helpers/logging.md index a00923cb60..e573f49a16 100644 --- a/docs/api/helpers/logging.md +++ b/docs/api/helpers/logging.md @@ -1,18 +1,21 @@ - + + # aea.helpers.logging Logging helpers. - + + #### get`_`logger ```python -get_logger(module_path: str, agent_name: str) -> Logger +def get_logger(module_path: str, agent_name: str) -> Logger ``` Get the logger based on a module path and agent name. - + + ## AgentLoggerAdapter Objects ```python @@ -21,11 +24,12 @@ class AgentLoggerAdapter(LoggerAdapter) This class is a logger adapter that prepends the agent name to log messages. - + + #### `__`init`__` ```python - | __init__(logger: Logger, agent_name: str) -> None +def __init__(logger: Logger, agent_name: str) -> None ``` Initialize the logger adapter. @@ -35,16 +39,21 @@ Initialize the logger adapter. - `logger`: the logger. - `agent_name`: the agent name. - + + #### process ```python - | process(msg: Any, kwargs: MutableMapping[str, Any]) -> Tuple[Any, MutableMapping[str, Any]] +def process( + msg: Any, + kwargs: MutableMapping[str, + Any]) -> Tuple[Any, MutableMapping[str, Any]] ``` Prepend the agent name to every log message. - + + ## WithLogger Objects ```python @@ -53,11 +62,13 @@ class WithLogger() Interface to endow subclasses with a logger. - + + #### `__`init`__` ```python - | __init__(logger: Optional[Logger] = None, default_logger_name: str = "aea") -> None +def __init__(logger: Optional[Logger] = None, + default_logger_name: str = "aea") -> None ``` Initialize the logger. @@ -67,22 +78,24 @@ Initialize the logger. - `logger`: the logger object. - `default_logger_name`: the default logger name, if a logger is not provided. - + + #### logger ```python - | @property - | logger() -> Logger +@property +def logger() -> Logger ``` Get the component logger. - + + #### logger ```python - | @logger.setter - | logger(logger: Optional[Logger]) -> None +@logger.setter +def logger(logger: Optional[Logger]) -> None ``` Set the logger. diff --git a/docs/api/helpers/multiaddr/base.md b/docs/api/helpers/multiaddr/base.md index c44dfc78f1..c0455faf29 100644 --- a/docs/api/helpers/multiaddr/base.md +++ b/docs/api/helpers/multiaddr/base.md @@ -1,9 +1,11 @@ - + + # aea.helpers.multiaddr.base This module contains multiaddress class. - + + ## MultiAddr Objects ```python @@ -12,11 +14,15 @@ class MultiAddr() Protocol Labs' Multiaddress representation of a network address. - + + #### `__`init`__` ```python - | __init__(host: str, port: int, public_key: Optional[str] = None, multihash_id: Optional[str] = None) -> None +def __init__(host: str, + port: int, + public_key: Optional[str] = None, + multihash_id: Optional[str] = None) -> None ``` Initialize a multiaddress. @@ -28,12 +34,13 @@ Initialize a multiaddress. - `public_key`: hex encoded public key. Must conform to Bitcoin EC encoding standard for Secp256k1 - `multihash_id`: a multihash of the public key - + + #### compute`_`peerid ```python - | @staticmethod - | compute_peerid(public_key: str) -> str +@staticmethod +def compute_peerid(public_key: str) -> str ``` Compute the peer id from a public key. @@ -49,12 +56,13 @@ libp2p PeerID from Bitcoin EC encoded Secp256k1 public key. the peer id. - + + #### from`_`string ```python - | @classmethod - | from_string(cls, maddr: str) -> "MultiAddr" +@classmethod +def from_string(cls, maddr: str) -> "MultiAddr" ``` Construct a MultiAddr object from its string format @@ -67,60 +75,66 @@ Construct a MultiAddr object from its string format multiaddress object - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Get the public key. - + + #### peer`_`id ```python - | @property - | peer_id() -> str +@property +def peer_id() -> str ``` Get the peer id. - + + #### host ```python - | @property - | host() -> str +@property +def host() -> str ``` Get the peer host. - + + #### port ```python - | @property - | port() -> int +@property +def port() -> int ``` Get the peer port. - + + #### format ```python - | format() -> str +def format() -> str ``` Canonical representation of a multiaddress. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Default string representation of a multiaddress. diff --git a/docs/api/helpers/multiple_executor.md b/docs/api/helpers/multiple_executor.md index 3cbb2daff0..73c99c2aeb 100644 --- a/docs/api/helpers/multiple_executor.md +++ b/docs/api/helpers/multiple_executor.md @@ -1,9 +1,11 @@ - + + # aea.helpers.multiple`_`executor This module contains the helpers to run multiple stoppable tasks in different modes: async, threaded, multiprocess . - + + ## ExecutorExceptionPolicies Objects ```python @@ -12,7 +14,8 @@ class ExecutorExceptionPolicies(Enum) Runner exception policy modes. - + + ## AbstractExecutorTask Objects ```python @@ -21,61 +24,67 @@ class AbstractExecutorTask(ABC) Abstract task class to create Task classes. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Init task. - + + #### future ```python - | @property - | future() -> Optional[TaskAwaitable] +@property +def future() -> Optional[TaskAwaitable] ``` Return awaitable to get result of task execution. - + + #### future ```python - | @future.setter - | future(future: TaskAwaitable) -> None +@future.setter +def future(future: TaskAwaitable) -> None ``` Set awaitable to get result of task execution. - + + #### start ```python - | @abstractmethod - | start() -> Tuple[Callable, Sequence[Any]] +@abstractmethod +def start() -> Tuple[Callable, Sequence[Any]] ``` Implement start task function here. - + + #### stop ```python - | @abstractmethod - | stop() -> None +@abstractmethod +def stop() -> None ``` Implement stop task function here. - + + #### create`_`async`_`task ```python - | @abstractmethod - | create_async_task(loop: AbstractEventLoop) -> TaskAwaitable +@abstractmethod +def create_async_task(loop: AbstractEventLoop) -> TaskAwaitable ``` Create asyncio task for task run in asyncio loop. @@ -88,22 +97,24 @@ Create asyncio task for task run in asyncio loop. task to run in asyncio loop. - + + #### id ```python - | @property - | id() -> Any +@property +def id() -> Any ``` Return task id. - + + #### failed ```python - | @property - | failed() -> bool +@property +def failed() -> bool ``` Return was exception failed or not. @@ -114,7 +125,8 @@ If it's running it's not failed. bool - + + ## AbstractMultiprocessExecutorTask Objects ```python @@ -123,21 +135,23 @@ class AbstractMultiprocessExecutorTask(AbstractExecutorTask) Task for multiprocess executor. - + + #### start ```python - | @abstractmethod - | start() -> Tuple[Callable, Sequence[Any]] +@abstractmethod +def start() -> Tuple[Callable, Sequence[Any]] ``` Return function and arguments to call within subprocess. - + + #### create`_`async`_`task ```python - | create_async_task(loop: AbstractEventLoop) -> TaskAwaitable +def create_async_task(loop: AbstractEventLoop) -> TaskAwaitable ``` Create asyncio task for task run in asyncio loop. @@ -152,7 +166,8 @@ Raise error, cause async mode is not supported, cause this task for multiprocess - `ValueError`: async task construction not possible - + + ## AbstractMultipleExecutor Objects ```python @@ -161,11 +176,16 @@ class AbstractMultipleExecutor(ABC) Abstract class to create multiple executors classes. - + + #### `__`init`__` ```python - | __init__(tasks: Sequence[AbstractExecutorTask], task_fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies.propagate) -> None +def __init__( + tasks: Sequence[AbstractExecutorTask], + task_fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies. + propagate +) -> None ``` Init executor. @@ -175,65 +195,72 @@ Init executor. - `tasks`: sequence of AbstractExecutorTask instances to run. - `task_fail_policy`: the exception policy of all the tasks - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Return running state of the executor. - + + #### start ```python - | start() -> None +def start() -> None ``` Start tasks. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop tasks. - + + #### num`_`failed ```python - | @property - | num_failed() -> int +@property +def num_failed() -> int ``` Return number of failed tasks. - + + #### failed`_`tasks ```python - | @property - | failed_tasks() -> Sequence[AbstractExecutorTask] +@property +def failed_tasks() -> Sequence[AbstractExecutorTask] ``` Return sequence failed tasks. - + + #### not`_`failed`_`tasks ```python - | @property - | not_failed_tasks() -> Sequence[AbstractExecutorTask] +@property +def not_failed_tasks() -> Sequence[AbstractExecutorTask] ``` Return sequence successful tasks. - + + ## ThreadExecutor Objects ```python @@ -242,7 +269,8 @@ class ThreadExecutor(AbstractMultipleExecutor) Thread based executor to run multiple agents in threads. - + + ## ProcessExecutor Objects ```python @@ -251,7 +279,8 @@ class ProcessExecutor(ThreadExecutor) Subprocess based executor to run multiple agents in threads. - + + ## AsyncExecutor Objects ```python @@ -260,7 +289,8 @@ class AsyncExecutor(AbstractMultipleExecutor) Thread based executor to run multiple agents in threads. - + + ## AbstractMultipleRunner Objects ```python @@ -269,11 +299,16 @@ class AbstractMultipleRunner() Abstract multiple runner to create classes to launch tasks with selected mode. - + + #### `__`init`__` ```python - | __init__(mode: str, fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies.propagate) -> None +def __init__( + mode: str, + fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies. + propagate +) -> None ``` Init with selected executor mode. @@ -283,21 +318,23 @@ Init with selected executor mode. - `mode`: one of supported executor modes - `fail_policy`: one of ExecutorExceptionPolicies to be used with Executor - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Return state of the executor. - + + #### start ```python - | start(threaded: bool = False) -> None +def start(threaded: bool = False) -> None ``` Run agents. @@ -306,11 +343,12 @@ Run agents. - `threaded`: run in dedicated thread without blocking current thread. - + + #### stop ```python - | stop(timeout: Optional[float] = None) -> None +def stop(timeout: Optional[float] = None) -> None ``` Stop agents. @@ -319,41 +357,45 @@ Stop agents. - `timeout`: timeout in seconds to wait thread stopped, only if started in thread mode. - + + #### num`_`failed ```python - | @property - | num_failed() -> int +@property +def num_failed() -> int ``` Return number of failed tasks. - + + #### failed ```python - | @property - | failed() -> Sequence[Task] +@property +def failed() -> Sequence[Task] ``` Return sequence failed tasks. - + + #### not`_`failed ```python - | @property - | not_failed() -> Sequence[Task] +@property +def not_failed() -> Sequence[Task] ``` Return sequence successful tasks. - + + #### try`_`join`_`thread ```python - | try_join_thread() -> None +def try_join_thread() -> None ``` Try to join thread if running in thread mode. diff --git a/docs/api/helpers/pipe.md b/docs/api/helpers/pipe.md index bb98eff24c..9919d5fa78 100644 --- a/docs/api/helpers/pipe.md +++ b/docs/api/helpers/pipe.md @@ -1,9 +1,11 @@ - + + # aea.helpers.pipe Portable pipe implementation for Linux, MacOS, and Windows. - + + ## IPCChannelClient Objects ```python @@ -12,12 +14,13 @@ class IPCChannelClient(ABC) Multi-platform interprocess communication channel for the client side. - + + #### connect ```python - | @abstractmethod - | async connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool +@abstractmethod +async def connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool ``` Connect to communication channel @@ -30,12 +33,13 @@ Connect to communication channel connection status - + + #### write ```python - | @abstractmethod - | async write(data: bytes) -> None +@abstractmethod +async def write(data: bytes) -> None ``` Write `data` bytes to the other end of the channel @@ -46,12 +50,13 @@ Will first write the size than the actual data - `data`: bytes to write - + + #### read ```python - | @abstractmethod - | async read() -> Optional[bytes] +@abstractmethod +async def read() -> Optional[bytes] ``` Read bytes from the other end of the channel @@ -62,17 +67,19 @@ Will first read the size than the actual data read bytes - + + #### close ```python - | @abstractmethod - | async close() -> None +@abstractmethod +async def close() -> None ``` Close the communication channel. - + + ## IPCChannel Objects ```python @@ -81,13 +88,14 @@ class IPCChannel(IPCChannelClient) Multi-platform interprocess communication channel. - + + #### in`_`path ```python - | @property - | @abstractmethod - | in_path() -> str +@property +@abstractmethod +def in_path() -> str ``` Rendezvous point for incoming communication. @@ -96,13 +104,14 @@ Rendezvous point for incoming communication. path - + + #### out`_`path ```python - | @property - | @abstractmethod - | out_path() -> str +@property +@abstractmethod +def out_path() -> str ``` Rendezvous point for outgoing communication. @@ -111,7 +120,8 @@ Rendezvous point for outgoing communication. path - + + ## PosixNamedPipeProtocol Objects ```python @@ -120,11 +130,15 @@ class PosixNamedPipeProtocol() Posix named pipes async wrapper communication protocol. - + + #### `__`init`__` ```python - | __init__(in_path: str, out_path: str, logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(in_path: str, + out_path: str, + logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> None ``` Initialize a new posix named pipe. @@ -136,11 +150,12 @@ Initialize a new posix named pipe. - `logger`: the logger - `loop`: the event loop - + + #### connect ```python - | async connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool +async def connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool ``` Connect to the other end of the pipe @@ -153,11 +168,12 @@ Connect to the other end of the pipe connection success - + + #### write ```python - | async write(data: bytes) -> None +async def write(data: bytes) -> None ``` Write to pipe. @@ -166,11 +182,12 @@ Write to pipe. - `data`: bytes to write to pipe - + + #### read ```python - | async read() -> Optional[bytes] +async def read() -> Optional[bytes] ``` Read from pipe. @@ -179,16 +196,18 @@ Read from pipe. read bytes - + + #### close ```python - | async close() -> None +async def close() -> None ``` Disconnect pipe. - + + ## TCPSocketProtocol Objects ```python @@ -197,11 +216,15 @@ class TCPSocketProtocol() TCP socket communication protocol. - + + #### `__`init`__` ```python - | __init__(reader: asyncio.StreamReader, writer: asyncio.StreamWriter, logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(reader: asyncio.StreamReader, + writer: asyncio.StreamWriter, + logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> None ``` Initialize the tcp socket protocol. @@ -213,21 +236,23 @@ Initialize the tcp socket protocol. - `logger`: the logger - `loop`: the event loop - + + #### writer ```python - | @property - | writer() -> StreamWriter +@property +def writer() -> StreamWriter ``` Get a writer associated with protocol. - + + #### write ```python - | async write(data: bytes) -> None +async def write(data: bytes) -> None ``` Write to socket. @@ -236,11 +261,12 @@ Write to socket. - `data`: bytes to write - + + #### read ```python - | async read() -> Optional[bytes] +async def read() -> Optional[bytes] ``` Read from socket. @@ -249,16 +275,18 @@ Read from socket. read bytes - + + #### close ```python - | async close() -> None +async def close() -> None ``` Disconnect socket. - + + ## TCPSocketChannel Objects ```python @@ -267,20 +295,23 @@ class TCPSocketChannel(IPCChannel) Interprocess communication channel implementation using tcp sockets. - + + #### `__`init`__` ```python - | __init__(logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> None ``` Initialize tcp socket interprocess communication channel. - + + #### connect ```python - | async connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool +async def connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool ``` Setup communication channel and wait for other end to connect. @@ -293,11 +324,12 @@ Setup communication channel and wait for other end to connect. connection status - + + #### write ```python - | async write(data: bytes) -> None +async def write(data: bytes) -> None ``` Write to channel. @@ -306,11 +338,12 @@ Write to channel. - `data`: bytes to write - + + #### read ```python - | async read() -> Optional[bytes] +async def read() -> Optional[bytes] ``` Read from channel. @@ -319,36 +352,40 @@ Read from channel. read bytes - + + #### close ```python - | async close() -> None +async def close() -> None ``` Disconnect from channel and clean it up. - + + #### in`_`path ```python - | @property - | in_path() -> str +@property +def in_path() -> str ``` Rendezvous point for incoming communication. - + + #### out`_`path ```python - | @property - | out_path() -> str +@property +def out_path() -> str ``` Rendezvous point for outgoing communication. - + + ## PosixNamedPipeChannel Objects ```python @@ -357,20 +394,23 @@ class PosixNamedPipeChannel(IPCChannel) Interprocess communication channel implementation using Posix named pipes. - + + #### `__`init`__` ```python - | __init__(logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> None ``` Initialize posix named pipe interprocess communication channel. - + + #### connect ```python - | async connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool +async def connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool ``` Setup communication channel and wait for other end to connect. @@ -383,11 +423,12 @@ Setup communication channel and wait for other end to connect. bool, indicating success - + + #### write ```python - | async write(data: bytes) -> None +async def write(data: bytes) -> None ``` Write to the channel. @@ -396,11 +437,12 @@ Write to the channel. - `data`: data to write to channel - + + #### read ```python - | async read() -> Optional[bytes] +async def read() -> Optional[bytes] ``` Read from the channel. @@ -409,36 +451,40 @@ Read from the channel. read bytes - + + #### close ```python - | async close() -> None +async def close() -> None ``` Close the channel and clean it up. - + + #### in`_`path ```python - | @property - | in_path() -> str +@property +def in_path() -> str ``` Rendezvous point for incoming communication. - + + #### out`_`path ```python - | @property - | out_path() -> str +@property +def out_path() -> str ``` Rendezvous point for outgoing communication. - + + ## TCPSocketChannelClient Objects ```python @@ -447,11 +493,15 @@ class TCPSocketChannelClient(IPCChannelClient) Interprocess communication channel client using tcp sockets. - + + #### `__`init`__` ```python - | __init__(in_path: str, out_path: str, logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(in_path: str, + out_path: str, + logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> None ``` Initialize a tcp socket communication channel client. @@ -463,11 +513,12 @@ Initialize a tcp socket communication channel client. - `logger`: the logger - `loop`: the event loop - + + #### connect ```python - | async connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool +async def connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool ``` Connect to the other end of the communication channel. @@ -480,11 +531,12 @@ Connect to the other end of the communication channel. connection status - + + #### write ```python - | async write(data: bytes) -> None +async def write(data: bytes) -> None ``` Write data to channel. @@ -493,11 +545,12 @@ Write data to channel. - `data`: bytes to write - + + #### read ```python - | async read() -> Optional[bytes] +async def read() -> Optional[bytes] ``` Read data from channel. @@ -506,16 +559,18 @@ Read data from channel. read bytes - + + #### close ```python - | async close() -> None +async def close() -> None ``` Disconnect from communication channel. - + + ## PosixNamedPipeChannelClient Objects ```python @@ -524,11 +579,15 @@ class PosixNamedPipeChannelClient(IPCChannelClient) Interprocess communication channel client using Posix named pipes. - + + #### `__`init`__` ```python - | __init__(in_path: str, out_path: str, logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> None +def __init__(in_path: str, + out_path: str, + logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> None ``` Initialize a posix named pipe communication channel client. @@ -540,11 +599,12 @@ Initialize a posix named pipe communication channel client. - `logger`: the logger - `loop`: the event loop - + + #### connect ```python - | async connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool +async def connect(timeout: float = PIPE_CONN_TIMEOUT) -> bool ``` Connect to the other end of the communication channel. @@ -557,11 +617,12 @@ Connect to the other end of the communication channel. connection status - + + #### write ```python - | async write(data: bytes) -> None +async def write(data: bytes) -> None ``` Write data to channel. @@ -570,11 +631,12 @@ Write data to channel. - `data`: bytes to write - + + #### read ```python - | async read() -> Optional[bytes] +async def read() -> Optional[bytes] ``` Read data from channel. @@ -583,20 +645,23 @@ Read data from channel. read bytes - + + #### close ```python - | async close() -> None +async def close() -> None ``` Disconnect from communication channel. - + + #### make`_`ipc`_`channel ```python -make_ipc_channel(logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> IPCChannel +def make_ipc_channel(logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> IPCChannel ``` Build a portable bidirectional InterProcess Communication channel @@ -610,11 +675,16 @@ Build a portable bidirectional InterProcess Communication channel IPCChannel - + + #### make`_`ipc`_`channel`_`client ```python -make_ipc_channel_client(in_path: str, out_path: str, logger: logging.Logger = _default_logger, loop: Optional[AbstractEventLoop] = None) -> IPCChannelClient +def make_ipc_channel_client( + in_path: str, + out_path: str, + logger: logging.Logger = _default_logger, + loop: Optional[AbstractEventLoop] = None) -> IPCChannelClient ``` Build a portable bidirectional InterProcess Communication client channel diff --git a/docs/api/helpers/preference_representations/base.md b/docs/api/helpers/preference_representations/base.md index fb382e180b..fcc4620e07 100644 --- a/docs/api/helpers/preference_representations/base.md +++ b/docs/api/helpers/preference_representations/base.md @@ -1,13 +1,17 @@ - + + # aea.helpers.preference`_`representations.base Preference representation helpers. - + + #### logarithmic`_`utility ```python -logarithmic_utility(utility_params_by_good_id: Dict[str, float], quantities_by_good_id: Dict[str, int], quantity_shift: int = 100) -> float +def logarithmic_utility(utility_params_by_good_id: Dict[str, float], + quantities_by_good_id: Dict[str, int], + quantity_shift: int = 100) -> float ``` Compute agent's utility given her utility function params and a good bundle. @@ -22,11 +26,13 @@ Compute agent's utility given her utility function params and a good bundle. utility value - + + #### linear`_`utility ```python -linear_utility(exchange_params_by_currency_id: Dict[str, float], balance_by_currency_id: Dict[str, int]) -> float +def linear_utility(exchange_params_by_currency_id: Dict[str, float], + balance_by_currency_id: Dict[str, int]) -> float ``` Compute agent's utility given her utility function params and a good bundle. diff --git a/docs/api/helpers/profiling.md b/docs/api/helpers/profiling.md index 28ae6f1fa6..e280b51b93 100644 --- a/docs/api/helpers/profiling.md +++ b/docs/api/helpers/profiling.md @@ -1,9 +1,11 @@ - + + # aea.helpers.profiling Implementation of background profiling daemon. - + + ## Profiling Objects ```python @@ -12,11 +14,17 @@ class Profiling(Runnable) Profiling service. - + + #### `__`init`__` ```python - | __init__(period: int = 0, objects_instances_to_count: List[Type] = None, objects_created_to_count: List[Type] = None, output_function: Callable[[str], None] = lambda x: print(x, flush=True)) -> None +def __init__( + period: int = 0, + objects_instances_to_count: List[Type] = None, + objects_created_to_count: List[Type] = None, + output_function: Callable[[str], None] = lambda x: print(x, flush=True) +) -> None ``` Init profiler. @@ -28,56 +36,62 @@ Init profiler. - `objects_created_to_count`: object created to count - `output_function`: function to display output, one str argument. - + + #### set`_`counters ```python - | set_counters() -> None +def set_counters() -> None ``` Modify obj.__new__ to count objects created created. - + + #### run ```python - | async run() -> None +async def run() -> None ``` Run profiling. - + + #### output`_`profile`_`data ```python - | output_profile_data() -> None +def output_profile_data() -> None ``` Render profiling data and call output_function. - + + #### get`_`profile`_`data ```python - | get_profile_data() -> Dict +def get_profile_data() -> Dict ``` Get profiling data dict. - + + #### get`_`objects`_`instances ```python - | get_objects_instances() -> Dict +def get_objects_instances() -> Dict ``` Return dict with counted object instances present now. - + + #### get`_`objecst`_`created ```python - | get_objecst_created() -> Dict +def get_objecst_created() -> Dict ``` Return dict with counted object instances created. diff --git a/docs/api/helpers/search/generic.md b/docs/api/helpers/search/generic.md index 6043e47460..2da0e03794 100644 --- a/docs/api/helpers/search/generic.md +++ b/docs/api/helpers/search/generic.md @@ -1,9 +1,11 @@ - + + # aea.helpers.search.generic This module contains a generic data model. - + + ## GenericDataModel Objects ```python @@ -12,11 +14,13 @@ class GenericDataModel(DataModel) Generic data model. - + + #### `__`init`__` ```python - | __init__(data_model_name: str, data_model_attributes: Dict[str, Any]) -> None +def __init__(data_model_name: str, data_model_attributes: Dict[str, + Any]) -> None ``` Initialise the dataModel. diff --git a/docs/api/helpers/search/models.md b/docs/api/helpers/search/models.md index ec67c4575f..e69de29bb2 100644 --- a/docs/api/helpers/search/models.md +++ b/docs/api/helpers/search/models.md @@ -1,1271 +0,0 @@ - -# aea.helpers.search.models - -Useful classes for the OEF search. - - -## Location Objects - -```python -class Location() -``` - -Data structure to represent locations (i.e. a pair of latitude and longitude). - - -#### `__`init`__` - -```python - | __init__(latitude: float, longitude: float) -> None -``` - -Initialize a location. - -**Arguments**: - -- `latitude`: the latitude of the location. -- `longitude`: the longitude of the location. - - -#### tuple - -```python - | @property - | tuple() -> Tuple[float, float] -``` - -Get the tuple representation of a location. - - -#### distance - -```python - | distance(other: "Location") -> float -``` - -Get the distance to another location. - -**Arguments**: - -- `other`: the other location - -**Returns**: - -the distance - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare equality of two locations. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the data model. - - -#### encode - -```python - | encode() -> models_pb2.Query.Location -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, location_pb: Any) -> "Location" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `location_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## AttributeInconsistencyException Objects - -```python -class AttributeInconsistencyException(Exception) -``` - -Raised when the attributes in a Description are inconsistent. - -Inconsistency is defined when values do not meet their respective schema, or if the values -are not of an allowed type. - - -## Attribute Objects - -```python -class Attribute() -``` - -Implements an attribute for an OEF data model. - - -#### `__`init`__` - -```python - | __init__(name: str, type_: Type[ATTRIBUTE_TYPES], is_required: bool, description: str = "") -> None -``` - -Initialize an attribute. - -**Arguments**: - -- `name`: the name of the attribute. -- `type_`: the type of the attribute. -- `is_required`: whether the attribute is required by the data model. -- `description`: an (optional) human-readable description for the attribute. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the data model. - - -#### encode - -```python - | encode() -> models_pb2.Query.Attribute -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, attribute_pb: models_pb2.Query.Attribute) -> "Attribute" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `attribute_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## DataModel Objects - -```python -class DataModel() -``` - -Implements an OEF data model. - - -#### `__`init`__` - -```python - | __init__(name: str, attributes: List[Attribute], description: str = "") -> None -``` - -Initialize a data model. - -**Arguments**: - -- `name`: the name of the data model. -- `attributes`: the attributes of the data model. -- `description`: the data model description. - - -#### attributes`_`by`_`name - -```python - | @property - | attributes_by_name() -> Dict[str, Attribute] -``` - -Get the attributes by name. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the data model. - - -#### encode - -```python - | encode() -> models_pb2.Query.DataModel -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, data_model_pb: Any) -> "DataModel" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `data_model_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -#### generate`_`data`_`model - -```python -generate_data_model(model_name: str, attribute_values: Mapping[str, ATTRIBUTE_TYPES]) -> DataModel -``` - -Generate a data model that matches the values stored in this description. - -That is, for each attribute (name, value), generate an Attribute. -It is assumed that each attribute is required. - -**Arguments**: - -- `model_name`: the name of the model. -- `attribute_values`: the values of each attribute - -**Returns**: - -the schema compliant with the values specified. - - -## Description Objects - -```python -class Description() -``` - -Implements an OEF description. - - -#### `__`init`__` - -```python - | __init__(values: Mapping[str, ATTRIBUTE_TYPES], data_model: Optional[DataModel] = None, data_model_name: str = "") -> None -``` - -Initialize the description object. - -**Arguments**: - -- `values`: the values in the description. -- `data_model`: the data model (optional) -- `data_model_name`: the data model name if a datamodel is created on the fly. - - -#### values - -```python - | @property - | values() -> Dict -``` - -Get the values. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### `__`iter`__` - -```python - | __iter__() -> Iterator -``` - -Create an iterator. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the description. - - -#### encode - -```python - | @classmethod - | encode(cls, description_pb: Any, description: "Description") -> None -``` - -Encode an instance of this class into the protocol buffer object. - -The protocol buffer object in the description_protobuf_object argument must be matched -with the instance of this class in the 'description_object' argument. - -**Arguments**: - -- `description_pb`: the protocol buffer object whose type corresponds with this class. -- `description`: an instance of this class to be encoded in the protocol buffer object. - - -#### decode - -```python - | @classmethod - | decode(cls, description_pb: Any) -> "Description" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -A new instance of this class must be created that matches the protocol -buffer object in the 'description_protobuf_object' argument. - -**Arguments**: - -- `description_pb`: the protocol buffer object whose type corresponds with this class. - -**Returns**: - -A new instance of this class that matches the protocol buffer object in the 'description_protobuf_object' argument. - - -## ConstraintTypes Objects - -```python -class ConstraintTypes(Enum) -``` - -Types of constraint. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation. - - -## ConstraintType Objects - -```python -class ConstraintType() -``` - -Type of constraint. - -Used with the Constraint class, this class allows to specify constraint over attributes. - -**Examples**: - - Equal to three - >>> equal_3 = ConstraintType(ConstraintTypes.EQUAL, 3) - - You can also specify a type of constraint by using its string representation, e.g.: - >>> equal_3 = ConstraintType("==", 3) - >>> not_equal_london = ConstraintType("!=", "London") - >>> less_than_pi = ConstraintType("<", 3.14) - >>> within_range = ConstraintType("within", (-10.0, 10.0)) - >>> in_a_set = ConstraintType("in", (1, 2, 3)) - >>> not_in_a_set = ConstraintType("not_in", ("C", "Java", "Python")) - - -#### `__`init`__` - -```python - | __init__(type_: Union[ConstraintTypes, str], value: Any) -> None -``` - -Initialize a constraint type. - -**Arguments**: - -- `type_`: the type of the constraint. -| Either an instance of the ConstraintTypes enum, -| or a string representation associated with the type. -- `value`: the value that defines the constraint. - -**Raises**: - -- `AEAEnforceError`: if the type of the constraint is not # noqa: DAR402 - - -#### check`_`validity - -```python - | check_validity() -> bool -``` - -Check the validity of the input provided. - -**Returns**: - -boolean to indicate validity - -**Raises**: - -- `AEAEnforceError`: if the value is not valid wrt the constraint type. # noqa: DAR402 - - -#### is`_`valid - -```python - | is_valid(attribute: Attribute) -> bool -``` - -Check if the constraint type is valid wrt a given attribute. - -A constraint type is valid wrt an attribute if the -type of its operand(s) is the same of the attribute type. - ->>> attribute = Attribute("year", int, True) ->>> valid_constraint_type = ConstraintType(ConstraintTypes.GREATER_THAN, 2000) ->>> valid_constraint_type.is_valid(attribute) -True - ->>> valid_constraint_type = ConstraintType(ConstraintTypes.WITHIN, (2000, 2001)) ->>> valid_constraint_type.is_valid(attribute) -True - -The following constraint is invalid: the year is in a string variable, -whereas the attribute is defined over integers. - ->>> invalid_constraint_type = ConstraintType(ConstraintTypes.GREATER_THAN, "2000") ->>> invalid_constraint_type.is_valid(attribute) -False - -**Arguments**: - -- `attribute`: the data model used to check the validity of the constraint type. - -**Returns**: - -``True`` if the constraint type is valid wrt the attribute, ``False`` otherwise. - - -#### get`_`data`_`type - -```python - | get_data_type() -> Type[ATTRIBUTE_TYPES] -``` - -Get the type of the data used to define the constraint type. - -For instance: ->>> c = ConstraintType(ConstraintTypes.EQUAL, 1) ->>> c.get_data_type() - - -**Returns**: - -data type - - -#### check - -```python - | check(value: ATTRIBUTE_TYPES) -> bool -``` - -Check if an attribute value satisfies the constraint. - -The implementation depends on the constraint type. - -**Arguments**: - -- `value`: the value to check. - -**Returns**: - -True if the value satisfy the constraint, False otherwise. - -**Raises**: - -- `ValueError`: if the constraint type is not recognized. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Check equality with another object. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the constraint type. - - -#### encode - -```python - | encode() -> Optional[Any] -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, constraint_type_pb: Any, category: str) -> "ConstraintType" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `constraint_type_pb`: the protocol buffer object corresponding with this class. -- `category`: the category of the constraint ('relation', 'set', 'range', 'distance). - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## ConstraintExpr Objects - -```python -class ConstraintExpr(ABC) -``` - -Implementation of the constraint language to query the OEF node. - - -#### check - -```python - | @abstractmethod - | check(description: Description) -> bool -``` - -Check if a description satisfies the constraint expression. - -**Arguments**: - -- `description`: the description to check. - -**Returns**: - -True if the description satisfy the constraint expression, False otherwise. - - -#### is`_`valid - -```python - | @abstractmethod - | is_valid(data_model: DataModel) -> bool -``` - -Check whether a constraint expression is valid wrt a data model. - -Specifically, check the following conditions: -- If all the attributes referenced by the constraints are correctly associated with the Data Model attributes. - -**Arguments**: - -- `data_model`: the data model used to check the validity of the constraint expression. - -**Returns**: - -``True`` if the constraint expression is valid wrt the data model, ``False`` otherwise. - - -#### check`_`validity - -```python - | check_validity() -> None -``` - -Check whether a Constraint Expression satisfies some basic requirements. - -**Raises**: - -- `AEAEnforceError`: if the object does not satisfy some requirements. # noqa: DAR402 - - -## And Objects - -```python -class And(ConstraintExpr) -``` - -Implementation of the 'And' constraint expression. - - -#### `__`init`__` - -```python - | __init__(constraints: List[ConstraintExpr]) -> None -``` - -Initialize an 'And' expression. - -**Arguments**: - -- `constraints`: the list of constraints expression (in conjunction). - - -#### check - -```python - | check(description: Description) -> bool -``` - -Check if a value satisfies the 'And' constraint expression. - -**Arguments**: - -- `description`: the description to check. - -**Returns**: - -True if the description satisfy the constraint expression, False otherwise. - - -#### is`_`valid - -```python - | is_valid(data_model: DataModel) -> bool -``` - -Check whether the constraint expression is valid wrt a data model. - -**Arguments**: - -- `data_model`: the data model used to check the validity of the constraint expression. - -**Returns**: - -``True`` if the constraint expression is valid wrt the data model, ``False`` otherwise. - - -#### check`_`validity - -```python - | check_validity() -> None -``` - -Check whether the Constraint Expression satisfies some basic requirements. - -:return ``None`` - -**Raises**: - -- `ValueError`: if the object does not satisfy some requirements. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### encode - -```python - | encode() -> models_pb2.Query.ConstraintExpr.And -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, and_pb: Any) -> "And" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `and_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## Or Objects - -```python -class Or(ConstraintExpr) -``` - -Implementation of the 'Or' constraint expression. - - -#### `__`init`__` - -```python - | __init__(constraints: List[ConstraintExpr]) -> None -``` - -Initialize an 'Or' expression. - -**Arguments**: - -- `constraints`: the list of constraints expressions (in disjunction). - - -#### check - -```python - | check(description: Description) -> bool -``` - -Check if a value satisfies the 'Or' constraint expression. - -**Arguments**: - -- `description`: the description to check. - -**Returns**: - -True if the description satisfy the constraint expression, False otherwise. - - -#### is`_`valid - -```python - | is_valid(data_model: DataModel) -> bool -``` - -Check whether the constraint expression is valid wrt a data model. - -**Arguments**: - -- `data_model`: the data model used to check the validity of the constraint expression. - -**Returns**: - -``True`` if the constraint expression is valid wrt the data model, ``False`` otherwise. - - -#### check`_`validity - -```python - | check_validity() -> None -``` - -Check whether the Constraint Expression satisfies some basic requirements. - -:return ``None`` - -**Raises**: - -- `ValueError`: if the object does not satisfy some requirements. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### encode - -```python - | encode() -> models_pb2.Query.ConstraintExpr.Or -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, or_pb: Any) -> "Or" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `or_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## Not Objects - -```python -class Not(ConstraintExpr) -``` - -Implementation of the 'Not' constraint expression. - - -#### `__`init`__` - -```python - | __init__(constraint: ConstraintExpr) -> None -``` - -Initialize a 'Not' expression. - -**Arguments**: - -- `constraint`: the constraint expression to negate. - - -#### check - -```python - | check(description: Description) -> bool -``` - -Check if a value satisfies the 'Not' constraint expression. - -**Arguments**: - -- `description`: the description to check. - -**Returns**: - -True if the description satisfy the constraint expression, False otherwise. - - -#### is`_`valid - -```python - | is_valid(data_model: DataModel) -> bool -``` - -Check whether the constraint expression is valid wrt a data model. - -**Arguments**: - -- `data_model`: the data model used to check the validity of the constraint expression. - -**Returns**: - -``True`` if the constraint expression is valid wrt the data model, ``False`` otherwise. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### encode - -```python - | encode() -> models_pb2.Query.ConstraintExpr.Not -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, not_pb: Any) -> "Not" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `not_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## Constraint Objects - -```python -class Constraint(ConstraintExpr) -``` - -The atomic component of a constraint expression. - - -#### `__`init`__` - -```python - | __init__(attribute_name: str, constraint_type: ConstraintType) -> None -``` - -Initialize a constraint. - -**Arguments**: - -- `attribute_name`: the name of the attribute to be constrained. -- `constraint_type`: the constraint type. - - -#### check - -```python - | check(description: Description) -> bool -``` - -Check if a description satisfies the constraint. The implementation depends on the type of the constraint. - -**Arguments**: - -- `description`: the description to check. - -**Returns**: - -True if the description satisfies the constraint, False otherwise. - -Examples: ->>> attr_author = Attribute("author" , str, True, "The author of the book.") ->>> attr_year = Attribute("year", int, True, "The year of publication of the book.") ->>> attr_genre = Attribute("genre", str, True, "The genre of the book.") ->>> c1 = Constraint("author", ConstraintType("==", "Stephen King")) ->>> c2 = Constraint("year", ConstraintType(">", 1990)) ->>> c3 = Constraint("genre", ConstraintType("in", ("horror", "science_fiction"))) ->>> book_1 = Description({"author": "Stephen King", "year": 1991, "genre": "horror"}) ->>> book_2 = Description({"author": "George Orwell", "year": 1948, "genre": "horror"}) - -The "author" attribute instantiation satisfies the constraint, so the result is True. - ->>> c1.check(book_1) -True - -Here, the "author" does not satisfy the constraints. Hence, the result is False. - ->>> c1.check(book_2) -False - -In this case, there is a missing field specified by the query, that is "year" -So the result is False, even in the case it is not required by the schema: - ->>> c2.check(Description({"author": "Stephen King"})) -False - -If the type of some attribute of the description is not correct, the result is False. -In this case, the field "year" has a string instead of an integer: - ->>> c2.check(Description({"author": "Stephen King", "year": "1991"})) -False - ->>> c3.check(Description({"author": "Stephen King", "genre": False})) -False - - -#### is`_`valid - -```python - | is_valid(data_model: DataModel) -> bool -``` - -Check whether the constraint expression is valid wrt a data model. - -**Arguments**: - -- `data_model`: the data model used to check the validity of the constraint expression. - -**Returns**: - -``True`` if the constraint expression is valid wrt the data model, ``False`` otherwise. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the constraint. - - -#### encode - -```python - | encode() -> models_pb2.Query.ConstraintExpr.Constraint -``` - -Encode an instance of this class into a protocol buffer object. - -**Returns**: - -the matching protocol buffer object - - -#### decode - -```python - | @classmethod - | decode(cls, constraint_pb: Any) -> "Constraint" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -**Arguments**: - -- `constraint_pb`: the protocol buffer object corresponding with this class. - -**Returns**: - -A new instance of this class matching the protocol buffer object - - -## Query Objects - -```python -class Query() -``` - -This class lets you build a query for the OEF. - - -#### `__`init`__` - -```python - | __init__(constraints: List[ConstraintExpr], model: Optional[DataModel] = None) -> None -``` - -Initialize a query. - -**Arguments**: - -- `constraints`: a list of constraint expressions. -- `model`: the data model that the query refers to. - - -#### check - -```python - | check(description: Description) -> bool -``` - -Check if a description satisfies the constraints of the query. - -The constraints are interpreted as conjunction. - -**Arguments**: - -- `description`: the description to check. - -**Returns**: - -True if the description satisfies all the constraints, False otherwise. - - -#### is`_`valid - -```python - | is_valid(data_model: Optional[DataModel]) -> bool -``` - -Given a data model, check whether the query is valid for that data model. - -**Arguments**: - -- `data_model`: optional datamodel - -**Returns**: - -``True`` if the query is compliant with the data model, ``False`` otherwise. - - -#### check`_`validity - -```python - | check_validity() -> None -``` - -Check whether the` object is valid. - -:return ``None`` - -**Raises**: - -- `ValueError`: if the query does not satisfy some sanity requirements. - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare with another object. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation of the constraint. - - -#### encode - -```python - | @classmethod - | encode(cls, query_pb: Any, query: "Query") -> None -``` - -Encode an instance of this class into the protocol buffer object. - -The protocol buffer object in the query_protobuf_object argument must be matched -with the instance of this class in the 'query_object' argument. - -**Arguments**: - -- `query_pb`: the protocol buffer object wrapping an object that corresponds with this class. -- `query`: an instance of this class to be encoded in the protocol buffer object. - - -#### decode - -```python - | @classmethod - | decode(cls, query_pb: Any) -> "Query" -``` - -Decode a protocol buffer object that corresponds with this class into an instance of this class. - -A new instance of this class must be created that matches the protocol -buffer object in the 'query_protobuf_object' argument. - -**Arguments**: - -- `query_pb`: the protocol buffer object whose type corresponds with this class. - -**Returns**: - -A new instance of this class that matches the protocol buffer object in the 'query_protobuf_object' argument. - - -#### haversine - -```python -haversine(lat1: float, lon1: float, lat2: float, lon2: float) -> float -``` - -Compute the Haversine distance between two locations (i.e. two pairs of latitude and longitude). - -**Arguments**: - -- `lat1`: the latitude of the first location. -- `lon1`: the longitude of the first location. -- `lat2`: the latitude of the second location. -- `lon2`: the longitude of the second location. - -**Returns**: - -the Haversine distance. - diff --git a/docs/api/helpers/serializers.md b/docs/api/helpers/serializers.md index bc36e4613e..83913cd029 100644 --- a/docs/api/helpers/serializers.md +++ b/docs/api/helpers/serializers.md @@ -1,9 +1,11 @@ - + + # aea.helpers.serializers This module contains Serializers that can be used for custom types. - + + ## DictProtobufStructSerializer Objects ```python @@ -15,12 +17,13 @@ Serialize python dictionaries of type DictType = Dict[str, ValueType] recursivel ValueType = PrimitiveType | DictType | List[ValueType]] PrimitiveType = bool | int | float | str | bytes - + + #### encode ```python - | @classmethod - | encode(cls, dictionary: Dict[str, Any]) -> bytes +@classmethod +def encode(cls, dictionary: Dict[str, Any]) -> bytes ``` Serialize compatible dictionary to bytes. @@ -35,12 +38,13 @@ Copies entire dictionary in the process. serialized bytes string - + + #### decode ```python - | @classmethod - | decode(cls, buffer: bytes) -> Dict[str, Any] +@classmethod +def decode(cls, buffer: bytes) -> Dict[str, Any] ``` Deserialize a compatible dictionary diff --git a/docs/api/helpers/storage/backends/base.md b/docs/api/helpers/storage/backends/base.md index a90d85f753..4246f70014 100644 --- a/docs/api/helpers/storage/backends/base.md +++ b/docs/api/helpers/storage/backends/base.md @@ -1,9 +1,11 @@ - + + # aea.helpers.storage.backends.base This module contains storage abstract backend class. - + + ## AbstractStorageBackend Objects ```python @@ -12,41 +14,45 @@ class AbstractStorageBackend(ABC) Abstract base class for storage backend. - + + #### `__`init`__` ```python - | __init__(uri: str) -> None +def __init__(uri: str) -> None ``` Init backend. - + + #### connect ```python - | @abstractmethod - | async connect() -> None +@abstractmethod +async def connect() -> None ``` Connect to backend. - + + #### disconnect ```python - | @abstractmethod - | async disconnect() -> None +@abstractmethod +async def disconnect() -> None ``` Disconnect the backend. - + + #### ensure`_`collection ```python - | @abstractmethod - | async ensure_collection(collection_name: str) -> None +@abstractmethod +async def ensure_collection(collection_name: str) -> None ``` Create collection if not exits. @@ -59,12 +65,14 @@ Create collection if not exits. None - + + #### put ```python - | @abstractmethod - | async put(collection_name: str, object_id: str, object_body: JSON_TYPES) -> None +@abstractmethod +async def put(collection_name: str, object_id: str, + object_body: JSON_TYPES) -> None ``` Put object into collection. @@ -79,12 +87,13 @@ Put object into collection. None - + + #### get ```python - | @abstractmethod - | async get(collection_name: str, object_id: str) -> Optional[JSON_TYPES] +@abstractmethod +async def get(collection_name: str, object_id: str) -> Optional[JSON_TYPES] ``` Get object from the collection. @@ -98,12 +107,13 @@ Get object from the collection. dict if object exists in collection otherwise None - + + #### remove ```python - | @abstractmethod - | async remove(collection_name: str, object_id: str) -> None +@abstractmethod +async def remove(collection_name: str, object_id: str) -> None ``` Remove object from the collection. @@ -117,12 +127,14 @@ Remove object from the collection. None - + + #### find ```python - | @abstractmethod - | async find(collection_name: str, field: str, equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] +@abstractmethod +async def find(collection_name: str, field: str, + equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] ``` Get objects from the collection by filtering by field value. @@ -137,12 +149,13 @@ Get objects from the collection by filtering by field value. list of objects bodies - + + #### list ```python - | @abstractmethod - | async list(collection_name: str) -> List[OBJECT_ID_AND_BODY] +@abstractmethod +async def list(collection_name: str) -> List[OBJECT_ID_AND_BODY] ``` List all objects with keys from the collection. diff --git a/docs/api/helpers/storage/backends/sqlite.md b/docs/api/helpers/storage/backends/sqlite.md index 642b918dfb..b3f27e91dd 100644 --- a/docs/api/helpers/storage/backends/sqlite.md +++ b/docs/api/helpers/storage/backends/sqlite.md @@ -1,9 +1,11 @@ - + + # aea.helpers.storage.backends.sqlite This module contains sqlite storage backend implementation. - + + ## SqliteStorageBackend Objects ```python @@ -12,38 +14,42 @@ class SqliteStorageBackend(AbstractStorageBackend) Sqlite storage backend. - + + #### `__`init`__` ```python - | __init__(uri: str) -> None +def __init__(uri: str) -> None ``` Init backend. - + + #### connect ```python - | async connect() -> None +async def connect() -> None ``` Connect to backend. - + + #### disconnect ```python - | async disconnect() -> None +async def disconnect() -> None ``` Disconnect the backend. - + + #### ensure`_`collection ```python - | async ensure_collection(collection_name: str) -> None +async def ensure_collection(collection_name: str) -> None ``` Create collection if not exits. @@ -52,11 +58,13 @@ Create collection if not exits. - `collection_name`: name of the collection. - + + #### put ```python - | async put(collection_name: str, object_id: str, object_body: JSON_TYPES) -> None +async def put(collection_name: str, object_id: str, + object_body: JSON_TYPES) -> None ``` Put object into collection. @@ -67,11 +75,12 @@ Put object into collection. - `object_id`: str object id - `object_body`: python dict, json compatible. - + + #### get ```python - | async get(collection_name: str, object_id: str) -> Optional[JSON_TYPES] +async def get(collection_name: str, object_id: str) -> Optional[JSON_TYPES] ``` Get object from the collection. @@ -85,11 +94,12 @@ Get object from the collection. dict if object exists in collection otherwise None - + + #### remove ```python - | async remove(collection_name: str, object_id: str) -> None +async def remove(collection_name: str, object_id: str) -> None ``` Remove object from the collection. @@ -99,11 +109,13 @@ Remove object from the collection. - `collection_name`: str. - `object_id`: str object id - + + #### find ```python - | async find(collection_name: str, field: str, equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] +async def find(collection_name: str, field: str, + equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] ``` Get objects from the collection by filtering by field value. @@ -118,11 +130,12 @@ Get objects from the collection by filtering by field value. list of object ids and body - + + #### list ```python - | async list(collection_name: str) -> List[OBJECT_ID_AND_BODY] +async def list(collection_name: str) -> List[OBJECT_ID_AND_BODY] ``` List all objects with keys from the collection. diff --git a/docs/api/helpers/storage/generic_storage.md b/docs/api/helpers/storage/generic_storage.md index b70a2db946..297695ff41 100644 --- a/docs/api/helpers/storage/generic_storage.md +++ b/docs/api/helpers/storage/generic_storage.md @@ -1,9 +1,11 @@ - + + # aea.helpers.storage.generic`_`storage This module contains the storage implementation. - + + ## AsyncCollection Objects ```python @@ -12,11 +14,13 @@ class AsyncCollection() Async collection. - + + #### `__`init`__` ```python - | __init__(storage_backend: AbstractStorageBackend, collection_name: str) -> None +def __init__(storage_backend: AbstractStorageBackend, + collection_name: str) -> None ``` Init collection object. @@ -26,11 +30,12 @@ Init collection object. - `storage_backend`: storage backed to use. - `collection_name`: str - + + #### put ```python - | async put(object_id: str, object_body: JSON_TYPES) -> None +async def put(object_id: str, object_body: JSON_TYPES) -> None ``` Put object into collection. @@ -44,11 +49,12 @@ Put object into collection. None - + + #### get ```python - | async get(object_id: str) -> Optional[JSON_TYPES] +async def get(object_id: str) -> Optional[JSON_TYPES] ``` Get object from the collection. @@ -61,11 +67,12 @@ Get object from the collection. dict if object exists in collection otherwise None - + + #### remove ```python - | async remove(object_id: str) -> None +async def remove(object_id: str) -> None ``` Remove object from the collection. @@ -78,11 +85,12 @@ Remove object from the collection. None - + + #### find ```python - | async find(field: str, equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] +async def find(field: str, equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] ``` Get objects from the collection by filtering by field value. @@ -96,11 +104,12 @@ Get objects from the collection by filtering by field value. None - + + #### list ```python - | async list() -> List[OBJECT_ID_AND_BODY] +async def list() -> List[OBJECT_ID_AND_BODY] ``` List all objects with keys from the collection. @@ -109,7 +118,8 @@ List all objects with keys from the collection. Tuple of objects keys, bodies. - + + ## SyncCollection Objects ```python @@ -118,11 +128,13 @@ class SyncCollection() Async collection. - + + #### `__`init`__` ```python - | __init__(async_collection_coro: Coroutine, loop: asyncio.AbstractEventLoop) -> None +def __init__(async_collection_coro: Coroutine, + loop: asyncio.AbstractEventLoop) -> None ``` Init collection object. @@ -132,11 +144,12 @@ Init collection object. - `async_collection_coro`: coroutine returns async collection. - `loop`: abstract event loop where storage is running. - + + #### put ```python - | put(object_id: str, object_body: JSON_TYPES) -> None +def put(object_id: str, object_body: JSON_TYPES) -> None ``` Put object into collection. @@ -150,11 +163,12 @@ Put object into collection. None - + + #### get ```python - | get(object_id: str) -> Optional[JSON_TYPES] +def get(object_id: str) -> Optional[JSON_TYPES] ``` Get object from the collection. @@ -167,11 +181,12 @@ Get object from the collection. dict if object exists in collection otherwise None - + + #### remove ```python - | remove(object_id: str) -> None +def remove(object_id: str) -> None ``` Remove object from the collection. @@ -184,11 +199,12 @@ Remove object from the collection. None - + + #### find ```python - | find(field: str, equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] +def find(field: str, equals: EQUALS_TYPE) -> List[OBJECT_ID_AND_BODY] ``` Get objects from the collection by filtering by field value. @@ -202,11 +218,12 @@ Get objects from the collection by filtering by field value. List of object bodies - + + #### list ```python - | list() -> List[OBJECT_ID_AND_BODY] +def list() -> List[OBJECT_ID_AND_BODY] ``` List all objects with keys from the collection. @@ -215,7 +232,8 @@ List all objects with keys from the collection. Tuple of objects keys, bodies. - + + ## Storage Objects ```python @@ -224,11 +242,14 @@ class Storage(Runnable) Generic storage. - + + #### `__`init`__` ```python - | __init__(storage_uri: str, loop: asyncio.AbstractEventLoop = None, threaded: bool = False) -> None +def __init__(storage_uri: str, + loop: asyncio.AbstractEventLoop = None, + threaded: bool = False) -> None ``` Init storage. @@ -239,57 +260,63 @@ Init storage. - `loop`: asyncio event loop to use. - `threaded`: bool. start in thread if True. - + + #### wait`_`connected ```python - | async wait_connected() -> None +async def wait_connected() -> None ``` Wait generic storage is connected. - + + #### is`_`connected ```python - | @property - | is_connected() -> bool +@property +def is_connected() -> bool ``` Get running state of the storage. - + + #### run ```python - | async run() -> None +async def run() -> None ``` Connect storage. - + + #### get`_`collection ```python - | async get_collection(collection_name: str) -> AsyncCollection +async def get_collection(collection_name: str) -> AsyncCollection ``` Get async collection. - + + #### get`_`sync`_`collection ```python - | get_sync_collection(collection_name: str) -> SyncCollection +def get_sync_collection(collection_name: str) -> SyncCollection ``` Get sync collection. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get string representation of the storage. diff --git a/docs/api/helpers/sym_link.md b/docs/api/helpers/sym_link.md index 96fbb9a418..37b96f09a0 100644 --- a/docs/api/helpers/sym_link.md +++ b/docs/api/helpers/sym_link.md @@ -1,13 +1,15 @@ - + + # aea.helpers.sym`_`link Sym link implementation for Linux, MacOS, and Windows. - + + #### make`_`symlink ```python -make_symlink(link_name: str, target: str) -> None +def make_symlink(link_name: str, target: str) -> None ``` Make a symbolic link, cross platform. @@ -17,21 +19,23 @@ Make a symbolic link, cross platform. - `link_name`: the link name. - `target`: the target. - + + #### cd ```python @contextlib.contextmanager -cd(path: Path) -> Generator +def cd(path: Path) -> Generator ``` Change directory with context manager. - + + #### create`_`symlink ```python -create_symlink(link_path: Path, target_path: Path, root_path: Path) -> int +def create_symlink(link_path: Path, target_path: Path, root_path: Path) -> int ``` Change directory and call the cross-platform script. @@ -43,7 +47,7 @@ symbolic link directory to the target directory. So: 1) from link_path, extract the number of jumps to the parent directory -in order to reach the repository root directory, and chain many "../" paths. + in order to reach the repository root directory, and chain many "../" paths. 2) from target_path, compute the relative path to the root 3) relative_target_path is just the concatenation of the results from step (1) and (2). @@ -58,7 +62,7 @@ we want to compute: The resulting command on UNIX systems will be: -cd directory_1 && ln -s ../../directory_1/target_path symbolic_link + cd directory_1 && ln -s ../../directory_1/target_path symbolic_link **Arguments**: diff --git a/docs/api/helpers/transaction/base.md b/docs/api/helpers/transaction/base.md index 7b5eb319aa..a54abf91ed 100644 --- a/docs/api/helpers/transaction/base.md +++ b/docs/api/helpers/transaction/base.md @@ -1,9 +1,11 @@ - + + # aea.helpers.transaction.base This module contains terms related classes. - + + ## RawTransaction Objects ```python @@ -12,41 +14,46 @@ class RawTransaction() This class represents an instance of RawTransaction. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, body: JSONLike) -> None +def __init__(ledger_id: str, body: JSONLike) -> None ``` Initialise an instance of RawTransaction. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### body ```python - | @property - | body() -> JSONLike +@property +def body() -> JSONLike ``` Get the body. - + + #### encode ```python - | @staticmethod - | encode(raw_transaction_protobuf_object: Any, raw_transaction_object: "RawTransaction") -> None +@staticmethod +def encode(raw_transaction_protobuf_object: Any, + raw_transaction_object: "RawTransaction") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -58,12 +65,13 @@ The protocol buffer object in the raw_transaction_protobuf_object argument must - `raw_transaction_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `raw_transaction_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, raw_transaction_protobuf_object: Any) -> "RawTransaction" +@classmethod +def decode(cls, raw_transaction_protobuf_object: Any) -> "RawTransaction" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -78,25 +86,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'raw_transaction_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## RawMessage Objects ```python @@ -105,51 +116,59 @@ class RawMessage() This class represents an instance of RawMessage. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, body: bytes, is_deprecated_mode: bool = False) -> None +def __init__(ledger_id: str, + body: bytes, + is_deprecated_mode: bool = False) -> None ``` Initialise an instance of RawMessage. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### body ```python - | @property - | body() -> bytes +@property +def body() -> bytes ``` Get the body. - + + #### is`_`deprecated`_`mode ```python - | @property - | is_deprecated_mode() -> bool +@property +def is_deprecated_mode() -> bool ``` Get the is_deprecated_mode. - + + #### encode ```python - | @staticmethod - | encode(raw_message_protobuf_object: Any, raw_message_object: "RawMessage") -> None +@staticmethod +def encode(raw_message_protobuf_object: Any, + raw_message_object: "RawMessage") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -161,12 +180,13 @@ The protocol buffer object in the raw_message_protobuf_object argument must be m - `raw_message_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `raw_message_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, raw_message_protobuf_object: Any) -> "RawMessage" +@classmethod +def decode(cls, raw_message_protobuf_object: Any) -> "RawMessage" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -181,25 +201,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'raw_message_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## SignedTransaction Objects ```python @@ -208,41 +231,46 @@ class SignedTransaction() This class represents an instance of SignedTransaction. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, body: JSONLike) -> None +def __init__(ledger_id: str, body: JSONLike) -> None ``` Initialise an instance of SignedTransaction. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### body ```python - | @property - | body() -> JSONLike +@property +def body() -> JSONLike ``` Get the body. - + + #### encode ```python - | @staticmethod - | encode(signed_transaction_protobuf_object: Any, signed_transaction_object: "SignedTransaction") -> None +@staticmethod +def encode(signed_transaction_protobuf_object: Any, + signed_transaction_object: "SignedTransaction") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -254,12 +282,14 @@ The protocol buffer object in the signed_transaction_protobuf_object argument mu - `signed_transaction_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `signed_transaction_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, signed_transaction_protobuf_object: Any) -> "SignedTransaction" +@classmethod +def decode(cls, + signed_transaction_protobuf_object: Any) -> "SignedTransaction" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -274,25 +304,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'signed_transaction_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## SignedMessage Objects ```python @@ -301,51 +334,59 @@ class SignedMessage() This class represents an instance of RawMessage. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, body: str, is_deprecated_mode: bool = False) -> None +def __init__(ledger_id: str, + body: str, + is_deprecated_mode: bool = False) -> None ``` Initialise an instance of SignedMessage. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### body ```python - | @property - | body() -> str +@property +def body() -> str ``` Get the body. - + + #### is`_`deprecated`_`mode ```python - | @property - | is_deprecated_mode() -> bool +@property +def is_deprecated_mode() -> bool ``` Get the is_deprecated_mode. - + + #### encode ```python - | @staticmethod - | encode(signed_message_protobuf_object: Any, signed_message_object: "SignedMessage") -> None +@staticmethod +def encode(signed_message_protobuf_object: Any, + signed_message_object: "SignedMessage") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -357,12 +398,13 @@ The protocol buffer object in the signed_message_protobuf_object argument must b - `signed_message_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `signed_message_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, signed_message_protobuf_object: Any) -> "SignedMessage" +@classmethod +def decode(cls, signed_message_protobuf_object: Any) -> "SignedMessage" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -377,25 +419,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'signed_message_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## State Objects ```python @@ -404,41 +449,45 @@ class State() This class represents an instance of State. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, body: JSONLike) -> None +def __init__(ledger_id: str, body: JSONLike) -> None ``` Initialise an instance of State. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### body ```python - | @property - | body() -> JSONLike +@property +def body() -> JSONLike ``` Get the body. - + + #### encode ```python - | @staticmethod - | encode(state_protobuf_object: Any, state_object: "State") -> None +@staticmethod +def encode(state_protobuf_object: Any, state_object: "State") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -450,12 +499,13 @@ The protocol buffer object in the state_protobuf_object argument must be matched - `state_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `state_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, state_protobuf_object: Any) -> "State" +@classmethod +def decode(cls, state_protobuf_object: Any) -> "State" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -470,25 +520,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'state_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## Terms Objects ```python @@ -497,11 +550,21 @@ class Terms() Class to represent the terms of a multi-currency & multi-token ledger transaction. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, sender_address: Address, counterparty_address: Address, amount_by_currency_id: Dict[str, int], quantities_by_good_id: Dict[str, int], nonce: str, is_sender_payable_tx_fee: bool = True, fee_by_currency_id: Optional[Dict[str, int]] = None, is_strict: bool = False, **kwargs: Any, ,) -> None +def __init__(ledger_id: str, + sender_address: Address, + counterparty_address: Address, + amount_by_currency_id: Dict[str, int], + quantities_by_good_id: Dict[str, int], + nonce: str, + is_sender_payable_tx_fee: bool = True, + fee_by_currency_id: Optional[Dict[str, int]] = None, + is_strict: bool = False, + **kwargs: Any) -> None ``` Instantiate terms of a transaction. @@ -519,292 +582,325 @@ Instantiate terms of a transaction. - `is_strict`: whether or not terms must have quantities and amounts of opposite signs. - `kwargs`: keyword arguments - + + #### id ```python - | @property - | id() -> str +@property +def id() -> str ``` Get hash of the terms. - + + #### sender`_`hash ```python - | @property - | sender_hash() -> str +@property +def sender_hash() -> str ``` Get the sender hash. - + + #### counterparty`_`hash ```python - | @property - | counterparty_hash() -> str +@property +def counterparty_hash() -> str ``` Get the sender hash. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### sender`_`address ```python - | @property - | sender_address() -> Address +@property +def sender_address() -> Address ``` Get the sender address. - + + #### counterparty`_`address ```python - | @property - | counterparty_address() -> Address +@property +def counterparty_address() -> Address ``` Get the counterparty address. - + + #### counterparty`_`address ```python - | @counterparty_address.setter - | counterparty_address(counterparty_address: Address) -> None +@counterparty_address.setter +def counterparty_address(counterparty_address: Address) -> None ``` Set the counterparty address. - + + #### amount`_`by`_`currency`_`id ```python - | @property - | amount_by_currency_id() -> Dict[str, int] +@property +def amount_by_currency_id() -> Dict[str, int] ``` Get the amount by currency id. - + + #### is`_`sender`_`payable`_`tx`_`fee ```python - | @property - | is_sender_payable_tx_fee() -> bool +@property +def is_sender_payable_tx_fee() -> bool ``` Bool indicating whether the tx fee is paid by sender or counterparty. - + + #### is`_`single`_`currency ```python - | @property - | is_single_currency() -> bool +@property +def is_single_currency() -> bool ``` Check whether a single currency is used for payment. - + + #### is`_`empty`_`currency ```python - | @property - | is_empty_currency() -> bool +@property +def is_empty_currency() -> bool ``` Check whether a single currency is used for payment. - + + #### currency`_`id ```python - | @property - | currency_id() -> str +@property +def currency_id() -> str ``` Get the amount the sender must pay. - + + #### sender`_`payable`_`amount ```python - | @property - | sender_payable_amount() -> int +@property +def sender_payable_amount() -> int ``` Get the amount the sender must pay. - + + #### sender`_`payable`_`amount`_`incl`_`fee ```python - | @property - | sender_payable_amount_incl_fee() -> int +@property +def sender_payable_amount_incl_fee() -> int ``` Get the amount the sender must pay inclusive fee. - + + #### counterparty`_`payable`_`amount ```python - | @property - | counterparty_payable_amount() -> int +@property +def counterparty_payable_amount() -> int ``` Get the amount the counterparty must pay. - + + #### counterparty`_`payable`_`amount`_`incl`_`fee ```python - | @property - | counterparty_payable_amount_incl_fee() -> int +@property +def counterparty_payable_amount_incl_fee() -> int ``` Get the amount the counterparty must pay. - + + #### quantities`_`by`_`good`_`id ```python - | @property - | quantities_by_good_id() -> Dict[str, int] +@property +def quantities_by_good_id() -> Dict[str, int] ``` Get the quantities by good id. - + + #### good`_`ids ```python - | @property - | good_ids() -> List[str] +@property +def good_ids() -> List[str] ``` Get the (ordered) good ids. - + + #### sender`_`supplied`_`quantities ```python - | @property - | sender_supplied_quantities() -> List[int] +@property +def sender_supplied_quantities() -> List[int] ``` Get the (ordered) quantities supplied by the sender. - + + #### counterparty`_`supplied`_`quantities ```python - | @property - | counterparty_supplied_quantities() -> List[int] +@property +def counterparty_supplied_quantities() -> List[int] ``` Get the (ordered) quantities supplied by the counterparty. - + + #### nonce ```python - | @property - | nonce() -> str +@property +def nonce() -> str ``` Get the nonce. - + + #### has`_`fee ```python - | @property - | has_fee() -> bool +@property +def has_fee() -> bool ``` Check if fee is set. - + + #### fee ```python - | @property - | fee() -> int +@property +def fee() -> int ``` Get the fee. - + + #### sender`_`fee ```python - | @property - | sender_fee() -> int +@property +def sender_fee() -> int ``` Get the sender fee. - + + #### counterparty`_`fee ```python - | @property - | counterparty_fee() -> int +@property +def counterparty_fee() -> int ``` Get the counterparty fee. - + + #### fee`_`by`_`currency`_`id ```python - | @property - | fee_by_currency_id() -> Dict[str, int] +@property +def fee_by_currency_id() -> Dict[str, int] ``` Get fee by currency. - + + #### kwargs ```python - | @property - | kwargs() -> JSONLike +@property +def kwargs() -> JSONLike ``` Get the kwargs. - + + #### is`_`strict ```python - | @property - | is_strict() -> bool +@property +def is_strict() -> bool ``` Get is_strict. - + + #### get`_`hash ```python - | @staticmethod - | get_hash(ledger_id: str, sender_address: str, counterparty_address: str, good_ids: List[str], sender_supplied_quantities: List[int], counterparty_supplied_quantities: List[int], sender_payable_amount: int, counterparty_payable_amount: int, nonce: str) -> str +@staticmethod +def get_hash(ledger_id: str, sender_address: str, counterparty_address: str, + good_ids: List[str], sender_supplied_quantities: List[int], + counterparty_supplied_quantities: List[int], + sender_payable_amount: int, counterparty_payable_amount: int, + nonce: str) -> str ``` Generate a hash from transaction information. @@ -825,12 +921,13 @@ Generate a hash from transaction information. the hash - + + #### encode ```python - | @staticmethod - | encode(terms_protobuf_object: Any, terms_object: "Terms") -> None +@staticmethod +def encode(terms_protobuf_object: Any, terms_object: "Terms") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -842,12 +939,13 @@ The protocol buffer object in the terms_protobuf_object argument must be matched - `terms_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `terms_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, terms_protobuf_object: Any) -> "Terms" +@classmethod +def decode(cls, terms_protobuf_object: Any) -> "Terms" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -862,25 +960,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'terms_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## TransactionDigest Objects ```python @@ -889,41 +990,46 @@ class TransactionDigest() This class represents an instance of TransactionDigest. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, body: str) -> None +def __init__(ledger_id: str, body: str) -> None ``` Initialise an instance of TransactionDigest. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### body ```python - | @property - | body() -> str +@property +def body() -> str ``` Get the receipt. - + + #### encode ```python - | @staticmethod - | encode(transaction_digest_protobuf_object: Any, transaction_digest_object: "TransactionDigest") -> None +@staticmethod +def encode(transaction_digest_protobuf_object: Any, + transaction_digest_object: "TransactionDigest") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -935,12 +1041,14 @@ The protocol buffer object in the transaction_digest_protobuf_object argument mu - `transaction_digest_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `transaction_digest_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, transaction_digest_protobuf_object: Any) -> "TransactionDigest" +@classmethod +def decode(cls, + transaction_digest_protobuf_object: Any) -> "TransactionDigest" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -955,25 +1063,28 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'transaction_digest_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + ## TransactionReceipt Objects ```python @@ -982,51 +1093,57 @@ class TransactionReceipt() This class represents an instance of TransactionReceipt. - + + #### `__`init`__` ```python - | __init__(ledger_id: str, receipt: JSONLike, transaction: JSONLike) -> None +def __init__(ledger_id: str, receipt: JSONLike, transaction: JSONLike) -> None ``` Initialise an instance of TransactionReceipt. - + + #### ledger`_`id ```python - | @property - | ledger_id() -> str +@property +def ledger_id() -> str ``` Get the id of the ledger on which the terms are to be settled. - + + #### receipt ```python - | @property - | receipt() -> JSONLike +@property +def receipt() -> JSONLike ``` Get the receipt. - + + #### transaction ```python - | @property - | transaction() -> JSONLike +@property +def transaction() -> JSONLike ``` Get the transaction. - + + #### encode ```python - | @staticmethod - | encode(transaction_receipt_protobuf_object: Any, transaction_receipt_object: "TransactionReceipt") -> None +@staticmethod +def encode(transaction_receipt_protobuf_object: Any, + transaction_receipt_object: "TransactionReceipt") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -1038,12 +1155,14 @@ The protocol buffer object in the transaction_receipt_protobuf_object argument m - `transaction_receipt_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `transaction_receipt_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, transaction_receipt_protobuf_object: Any) -> "TransactionReceipt" +@classmethod +def decode(cls, + transaction_receipt_protobuf_object: Any) -> "TransactionReceipt" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. @@ -1058,20 +1177,22 @@ A new instance of this class must be created that matches the protocol buffer ob A new instance of this class that matches the protocol buffer object in the 'transaction_receipt_protobuf_object' argument. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check equality. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. diff --git a/docs/api/helpers/win32.md b/docs/api/helpers/win32.md index 68ea00ee75..4bc2185c71 100644 --- a/docs/api/helpers/win32.md +++ b/docs/api/helpers/win32.md @@ -1,13 +1,15 @@ - + + # aea.helpers.win32 Helpers for Windows. - + + #### enable`_`ctrl`_`c`_`support ```python -enable_ctrl_c_support() -> None +def enable_ctrl_c_support() -> None ``` Enable ctrl+c support for aea.cli command to be tested on windows platform. diff --git a/docs/api/helpers/yaml_utils.md b/docs/api/helpers/yaml_utils.md index 85ea5c7c7b..0e0d0f937f 100644 --- a/docs/api/helpers/yaml_utils.md +++ b/docs/api/helpers/yaml_utils.md @@ -1,9 +1,11 @@ - + + # aea.helpers.yaml`_`utils Helper functions related to YAML loading/dumping. - + + ## `_`AEAYamlLoader Objects ```python @@ -19,11 +21,12 @@ It extends the default SafeLoader in two ways: This class is for internal usage only; please use the public functions of the module 'yaml_load' and 'yaml_load_all'. - + + #### `__`init`__` ```python - | __init__(*args: Any, **kwargs: Any) -> None +def __init__(*args: Any, **kwargs: Any) -> None ``` Initialize the AEAYamlLoader. @@ -35,7 +38,8 @@ It adds a YAML Loader constructor to use 'OderedDict' to load the files. - `args`: the positional arguments. - `kwargs`: the keyword arguments. - + + ## `_`AEAYamlDumper Objects ```python @@ -50,11 +54,12 @@ YAML configurations while *following the order of the fields*. This class is for internal usage only; please use the public functions of the module 'yaml_dump' and 'yaml_dump_all'. - + + #### `__`init`__` ```python - | __init__(*args: Any, **kwargs: Any) -> None +def __init__(*args: Any, **kwargs: Any) -> None ``` Initialize the AEAYamlDumper. @@ -66,11 +71,12 @@ It adds a YAML Dumper representer to use 'OderedDict' to dump the files. - `args`: the positional arguments. - `kwargs`: the keyword arguments. - + + #### yaml`_`load ```python -yaml_load(stream: TextIO) -> Dict[str, Any] +def yaml_load(stream: TextIO) -> Dict[str, Any] ``` Load a yaml from a file pointer in an ordered way. @@ -83,11 +89,12 @@ Load a yaml from a file pointer in an ordered way. the dictionary object with the YAML file content. - + + #### yaml`_`load`_`all ```python -yaml_load_all(stream: TextIO) -> List[Dict[str, Any]] +def yaml_load_all(stream: TextIO) -> List[Dict[str, Any]] ``` Load a multi-paged yaml from a file pointer in an ordered way. @@ -100,11 +107,12 @@ Load a multi-paged yaml from a file pointer in an ordered way. the list of dictionary objects with the (multi-paged) YAML file content. - + + #### yaml`_`dump ```python -yaml_dump(data: Dict, stream: Optional[TextIO] = None) -> None +def yaml_dump(data: Dict, stream: Optional[TextIO] = None) -> None ``` Dump YAML data to a yaml file in an ordered way. @@ -114,11 +122,13 @@ Dump YAML data to a yaml file in an ordered way. - `data`: the data to write. - `stream`: (optional) the file to write on. - + + #### yaml`_`dump`_`all ```python -yaml_dump_all(data: Sequence[Dict], stream: Optional[TextIO] = None) -> None +def yaml_dump_all(data: Sequence[Dict], + stream: Optional[TextIO] = None) -> None ``` Dump YAML data to a yaml file in an ordered way. diff --git a/docs/api/identity/base.md b/docs/api/identity/base.md index 5bccee2081..cb866e266c 100644 --- a/docs/api/identity/base.md +++ b/docs/api/identity/base.md @@ -1,9 +1,11 @@ - + + # aea.identity.base This module contains the identity class. - + + ## Identity Objects ```python @@ -17,11 +19,17 @@ It includes: - the agent name - the addresses, a map from address identifier to address (can be a single key-value pair) - + + #### `__`init`__` ```python - | __init__(name: SimpleIdOrStr, address: Optional[str] = None, public_key: Optional[str] = None, addresses: Optional[Dict[str, Address]] = None, public_keys: Optional[Dict[str, str]] = None, default_address_key: str = DEFAULT_LEDGER) -> None +def __init__(name: SimpleIdOrStr, + address: Optional[str] = None, + public_key: Optional[str] = None, + addresses: Optional[Dict[str, Address]] = None, + public_keys: Optional[Dict[str, str]] = None, + default_address_key: str = DEFAULT_LEDGER) -> None ``` Instantiate the identity. @@ -35,62 +43,68 @@ Instantiate the identity. - `public_keys`: the public keys of the agent. - `default_address_key`: the key for the default address. - + + #### default`_`address`_`key ```python - | @property - | default_address_key() -> str +@property +def default_address_key() -> str ``` Get the default address key. - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the agent name. - + + #### addresses ```python - | @property - | addresses() -> Dict[str, Address] +@property +def addresses() -> Dict[str, Address] ``` Get the addresses. - + + #### address ```python - | @property - | address() -> Address +@property +def address() -> Address ``` Get the default address. - + + #### public`_`keys ```python - | @property - | public_keys() -> Dict[str, str] +@property +def public_keys() -> Dict[str, str] ``` Get the public keys. - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Get the default public key. diff --git a/docs/api/launcher.md b/docs/api/launcher.md index a34bf223af..ea1575e6b0 100644 --- a/docs/api/launcher.md +++ b/docs/api/launcher.md @@ -1,13 +1,16 @@ - + + # aea.launcher This module contains the implementation of multiple AEA configs launcher. - + + #### load`_`agent ```python -load_agent(agent_dir: Union[PathLike, str], password: Optional[str] = None) -> AEA +def load_agent(agent_dir: Union[PathLike, str], + password: Optional[str] = None) -> AEA ``` Load AEA from directory. @@ -21,7 +24,8 @@ Load AEA from directory. AEA instance - + + ## AEADirTask Objects ```python @@ -30,11 +34,13 @@ class AEADirTask(AbstractExecutorTask) Task to run agent from agent configuration directory. - + + #### `__`init`__` ```python - | __init__(agent_dir: Union[PathLike, str], password: Optional[str] = None) -> None +def __init__(agent_dir: Union[PathLike, str], + password: Optional[str] = None) -> None ``` Init aea config dir task. @@ -44,44 +50,49 @@ Init aea config dir task. - `agent_dir`: directory with aea config. - `password`: the password to encrypt/decrypt the private key. - + + #### id ```python - | @property - | id() -> Union[PathLike, str] +@property +def id() -> Union[PathLike, str] ``` Return agent_dir. - + + #### start ```python - | start() -> None +def start() -> None ``` Start task. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop task. - + + #### create`_`async`_`task ```python - | create_async_task(loop: AbstractEventLoop) -> TaskAwaitable +def create_async_task(loop: AbstractEventLoop) -> TaskAwaitable ``` Return asyncio Task for task run in asyncio loop. - + + ## AEADirMultiprocessTask Objects ```python @@ -92,11 +103,14 @@ Task to run agent from agent configuration directory. Version for multiprocess executor mode. - + + #### `__`init`__` ```python - | __init__(agent_dir: Union[PathLike, str], log_level: Optional[str] = None, password: Optional[str] = None) -> None +def __init__(agent_dir: Union[PathLike, str], + log_level: Optional[str] = None, + password: Optional[str] = None) -> None ``` Init aea config dir task. @@ -107,22 +121,24 @@ Init aea config dir task. - `log_level`: debug level applied for AEA in subprocess - `password`: the password to encrypt/decrypt the private key. - + + #### id ```python - | @property - | id() -> Union[PathLike, str] +@property +def id() -> Union[PathLike, str] ``` Return agent_dir. - + + #### failed ```python - | @property - | failed() -> bool +@property +def failed() -> bool ``` Return was exception failed or not. @@ -133,25 +149,28 @@ If it's running it's not failed. bool - + + #### start ```python - | start() -> Tuple[Callable, Sequence[Any]] +def start() -> Tuple[Callable, Sequence[Any]] ``` Return function and arguments to call within subprocess. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop task. - + + ## AEALauncher Objects ```python @@ -160,11 +179,17 @@ class AEALauncher(AbstractMultipleRunner) Run multiple AEA instances. - + + #### `__`init`__` ```python - | __init__(agent_dirs: Sequence[Union[PathLike, str]], mode: str, fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies.propagate, log_level: Optional[str] = None, password: Optional[str] = None) -> None +def __init__(agent_dirs: Sequence[Union[PathLike, str]], + mode: str, + fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies + .propagate, + log_level: Optional[str] = None, + password: Optional[str] = None) -> None ``` Init AEALauncher. diff --git a/docs/api/mail/base.md b/docs/api/mail/base.md index c2c31f9a35..6920afd945 100644 --- a/docs/api/mail/base.md +++ b/docs/api/mail/base.md @@ -1,9 +1,11 @@ - + + # aea.mail.base Mail module abstract base classes. - + + ## URI Objects ```python @@ -12,11 +14,12 @@ class URI() URI following RFC3986. - + + #### `__`init`__` ```python - | __init__(uri_raw: str) -> None +def __init__(uri_raw: str) -> None ``` Initialize the URI. @@ -27,125 +30,138 @@ Must follow: https://tools.ietf.org/html/rfc3986.html - `uri_raw`: the raw form uri - + + #### scheme ```python - | @property - | scheme() -> str +@property +def scheme() -> str ``` Get the scheme. - + + #### netloc ```python - | @property - | netloc() -> str +@property +def netloc() -> str ``` Get the netloc. - + + #### path ```python - | @property - | path() -> str +@property +def path() -> str ``` Get the path. - + + #### params ```python - | @property - | params() -> str +@property +def params() -> str ``` Get the params. - + + #### query ```python - | @property - | query() -> str +@property +def query() -> str ``` Get the query. - + + #### fragment ```python - | @property - | fragment() -> str +@property +def fragment() -> str ``` Get the fragment. - + + #### username ```python - | @property - | username() -> Optional[str] +@property +def username() -> Optional[str] ``` Get the username. - + + #### password ```python - | @property - | password() -> Optional[str] +@property +def password() -> Optional[str] ``` Get the password. - + + #### host ```python - | @property - | host() -> Optional[str] +@property +def host() -> Optional[str] ``` Get the host. - + + #### port ```python - | @property - | port() -> Optional[int] +@property +def port() -> Optional[int] ``` Get the port. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get string representation. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + ## EnvelopeContext Objects ```python @@ -154,11 +170,13 @@ class EnvelopeContext() Contains context information of an envelope. - + + #### `__`init`__` ```python - | __init__(connection_id: Optional[PublicId] = None, uri: Optional[URI] = None) -> None +def __init__(connection_id: Optional[PublicId] = None, + uri: Optional[URI] = None) -> None ``` Initialize the envelope context. @@ -168,55 +186,61 @@ Initialize the envelope context. - `connection_id`: the connection id used for routing the outgoing envelope in the multiplexer. - `uri`: the URI sent with the envelope. - + + #### uri ```python - | @property - | uri() -> Optional[URI] +@property +def uri() -> Optional[URI] ``` Get the URI. - + + #### connection`_`id ```python - | @property - | connection_id() -> Optional[PublicId] +@property +def connection_id() -> Optional[PublicId] ``` Get the connection id to route the envelope. - + + #### connection`_`id ```python - | @connection_id.setter - | connection_id(connection_id: PublicId) -> None +@connection_id.setter +def connection_id(connection_id: PublicId) -> None ``` Set the 'via' connection id. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + ## AEAConnectionError Objects ```python @@ -225,7 +249,8 @@ class AEAConnectionError(Exception) Exception class for connection errors. - + + ## Empty Objects ```python @@ -234,7 +259,8 @@ class Empty(Exception) Exception for when the inbox is empty. - + + ## EnvelopeSerializer Objects ```python @@ -243,12 +269,13 @@ class EnvelopeSerializer(ABC) Abstract class to specify the serialization layer for the envelope. - + + #### encode ```python - | @abstractmethod - | encode(envelope: "Envelope") -> bytes +@abstractmethod +def encode(envelope: "Envelope") -> bytes ``` Encode the envelope. @@ -261,12 +288,13 @@ Encode the envelope. the encoded envelope - + + #### decode ```python - | @abstractmethod - | decode(envelope_bytes: bytes) -> "Envelope" +@abstractmethod +def decode(envelope_bytes: bytes) -> "Envelope" ``` Decode the envelope. @@ -279,7 +307,8 @@ Decode the envelope. the envelope - + + ## ProtobufEnvelopeSerializer Objects ```python @@ -288,11 +317,12 @@ class ProtobufEnvelopeSerializer(EnvelopeSerializer) Envelope serializer using Protobuf. - + + #### encode ```python - | encode(envelope: "Envelope") -> bytes +def encode(envelope: "Envelope") -> bytes ``` Encode the envelope. @@ -305,11 +335,12 @@ Encode the envelope. the encoded envelope - + + #### decode ```python - | decode(envelope_bytes: bytes) -> "Envelope" +def decode(envelope_bytes: bytes) -> "Envelope" ``` Decode the envelope. @@ -324,7 +355,8 @@ The default serializer doesn't decode the message field. the envelope - + + ## Envelope Objects ```python @@ -333,11 +365,16 @@ class Envelope() The top level message class for agent to agent communication. - + + #### `__`init`__` ```python - | __init__(to: Address, sender: Address, message: Union[Message, bytes], context: Optional[EnvelopeContext] = None, protocol_specification_id: Optional[PublicId] = None) -> None +def __init__(to: Address, + sender: Address, + message: Union[Message, bytes], + context: Optional[EnvelopeContext] = None, + protocol_specification_id: Optional[PublicId] = None) -> None ``` Initialize a Message object. @@ -350,150 +387,165 @@ Initialize a Message object. - `context`: the optional envelope context. - `protocol_specification_id`: the protocol specification id (wire id). - + + #### to ```python - | @property - | to() -> Address +@property +def to() -> Address ``` Get address of receiver. - + + #### to ```python - | @to.setter - | to(to: Address) -> None +@to.setter +def to(to: Address) -> None ``` Set address of receiver. - + + #### sender ```python - | @property - | sender() -> Address +@property +def sender() -> Address ``` Get address of sender. - + + #### sender ```python - | @sender.setter - | sender(sender: Address) -> None +@sender.setter +def sender(sender: Address) -> None ``` Set address of sender. - + + #### protocol`_`specification`_`id ```python - | @property - | protocol_specification_id() -> PublicId +@property +def protocol_specification_id() -> PublicId ``` Get protocol_specification_id. - + + #### message ```python - | @property - | message() -> Union[Message, bytes] +@property +def message() -> Union[Message, bytes] ``` Get the protocol-specific message. - + + #### message ```python - | @message.setter - | message(message: Union[Message, bytes]) -> None +@message.setter +def message(message: Union[Message, bytes]) -> None ``` Set the protocol-specific message. - + + #### message`_`bytes ```python - | @property - | message_bytes() -> bytes +@property +def message_bytes() -> bytes ``` Get the protocol-specific message. - + + #### context ```python - | @property - | context() -> Optional[EnvelopeContext] +@property +def context() -> Optional[EnvelopeContext] ``` Get the envelope context. - + + #### to`_`as`_`public`_`id ```python - | @property - | to_as_public_id() -> Optional[PublicId] +@property +def to_as_public_id() -> Optional[PublicId] ``` Get to as public id. - + + #### is`_`sender`_`public`_`id ```python - | @property - | is_sender_public_id() -> bool +@property +def is_sender_public_id() -> bool ``` Check if sender is a public id. - + + #### is`_`to`_`public`_`id ```python - | @property - | is_to_public_id() -> bool +@property +def is_to_public_id() -> bool ``` Check if to is a public id. - + + #### is`_`component`_`to`_`component`_`message ```python - | @property - | is_component_to_component_message() -> bool +@property +def is_component_to_component_message() -> bool ``` Whether or not the message contained is component to component. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + #### encode ```python - | encode(serializer: Optional[EnvelopeSerializer] = None) -> bytes +def encode(serializer: Optional[EnvelopeSerializer] = None) -> bytes ``` Encode the envelope. @@ -506,12 +558,15 @@ Encode the envelope. the encoded envelope. - + + #### decode ```python - | @classmethod - | decode(cls, envelope_bytes: bytes, serializer: Optional[EnvelopeSerializer] = None) -> "Envelope" +@classmethod +def decode(cls, + envelope_bytes: bytes, + serializer: Optional[EnvelopeSerializer] = None) -> "Envelope" ``` Decode the envelope. @@ -525,11 +580,12 @@ Decode the envelope. the decoded envelope. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation of an envelope. diff --git a/docs/api/manager/manager.md b/docs/api/manager/manager.md index 47b4936c8c..bc02c85156 100644 --- a/docs/api/manager/manager.md +++ b/docs/api/manager/manager.md @@ -1,9 +1,11 @@ - + + # aea.manager.manager This module contains the implementation of AEA agents manager. - + + ## ProjectNotFoundError Objects ```python @@ -12,7 +14,8 @@ class ProjectNotFoundError(ValueError) Project not found exception. - + + ## ProjectCheckError Objects ```python @@ -21,16 +24,18 @@ class ProjectCheckError(ValueError) Project check error exception. - + + #### `__`init`__` ```python - | __init__(msg: str, source_exception: Exception) +def __init__(msg: str, source_exception: Exception) ``` Init exception. - + + ## ProjectPackageConsistencyCheckError Objects ```python @@ -39,11 +44,14 @@ class ProjectPackageConsistencyCheckError(ValueError) Check consistency of package versions against already added project. - + + #### `__`init`__` ```python - | __init__(agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, str, str, Set[PublicId]]]) +def __init__(agent_project_id: PublicId, + conflicting_packages: List[Tuple[PackageIdPrefix, str, str, + Set[PublicId]]]) ``` Initialize the exception. @@ -53,7 +61,8 @@ Initialize the exception. - `agent_project_id`: the agent project id whose addition has failed. - `conflicting_packages`: the conflicting packages. - + + ## BaseAgentRunTask Objects ```python @@ -62,48 +71,53 @@ class BaseAgentRunTask(ABC) Base abstract class for agent run tasks. - + + #### start ```python - | @abstractmethod - | start() -> None +@abstractmethod +def start() -> None ``` Start task. - + + #### wait ```python - | @abstractmethod - | wait() -> asyncio.Future +@abstractmethod +def wait() -> asyncio.Future ``` Return future to wait task completed. - + + #### stop ```python - | @abstractmethod - | stop() -> None +@abstractmethod +def stop() -> None ``` Stop task. - + + #### is`_`running ```python - | @property - | @abstractmethod - | is_running() -> bool +@property +@abstractmethod +def is_running() -> bool ``` Return is task running. - + + ## AgentRunAsyncTask Objects ```python @@ -112,71 +126,79 @@ class AgentRunAsyncTask(BaseAgentRunTask) Async task wrapper for agent. - + + #### `__`init`__` ```python - | __init__(agent: AEA, loop: asyncio.AbstractEventLoop) -> None +def __init__(agent: AEA, loop: asyncio.AbstractEventLoop) -> None ``` Init task with agent alias and loop. - + + #### create`_`run`_`loop ```python - | create_run_loop() -> None +def create_run_loop() -> None ``` Create run loop. - + + #### start ```python - | start() -> None +def start() -> None ``` Start task. - + + #### wait ```python - | wait() -> asyncio.Future +def wait() -> asyncio.Future ``` Return future to wait task completed. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop task. - + + #### run ```python - | async run() -> None +async def run() -> None ``` Run task body. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Return is task running. - + + ## AgentRunThreadTask Objects ```python @@ -185,43 +207,48 @@ class AgentRunThreadTask(AgentRunAsyncTask) Threaded wrapper to run agent. - + + #### `__`init`__` ```python - | __init__(agent: AEA, loop: asyncio.AbstractEventLoop) -> None +def __init__(agent: AEA, loop: asyncio.AbstractEventLoop) -> None ``` Init task with agent alias and loop. - + + #### create`_`run`_`loop ```python - | create_run_loop() -> None +def create_run_loop() -> None ``` Create run loop. - + + #### start ```python - | start() -> None +def start() -> None ``` Run task in a dedicated thread. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop the task. - + + ## AgentRunProcessTask Objects ```python @@ -230,53 +257,59 @@ class AgentRunProcessTask(BaseAgentRunTask) Subprocess wrapper to run agent. - + + #### `__`init`__` ```python - | __init__(agent_alias: AgentAlias, loop: asyncio.AbstractEventLoop) -> None +def __init__(agent_alias: AgentAlias, loop: asyncio.AbstractEventLoop) -> None ``` Init task with agent alias and loop. - + + #### start ```python - | start() -> None +def start() -> None ``` Run task in a dedicated process. - + + #### wait ```python - | wait() -> asyncio.Future +def wait() -> asyncio.Future ``` Return future to wait task completed. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop the task. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Is agent running. - + + ## MultiAgentManager Objects ```python @@ -285,11 +318,16 @@ class MultiAgentManager() Multi agents manager. - + + #### `__`init`__` ```python - | __init__(working_dir: str, mode: str = "async", registry_path: str = DEFAULT_REGISTRY_NAME, auto_add_remove_project: bool = False, password: Optional[str] = None) -> None +def __init__(working_dir: str, + mode: str = "async", + registry_path: str = DEFAULT_REGISTRY_NAME, + auto_add_remove_project: bool = False, + password: Optional[str] = None) -> None ``` Initialize manager. @@ -302,69 +340,79 @@ Initialize manager. - `auto_add_remove_project`: bool. add/remove project on the first agent add/last agent remove - `password`: the password to encrypt/decrypt the private key. - + + #### data`_`dir ```python - | @property - | data_dir() -> str +@property +def data_dir() -> str ``` Get the certs directory. - + + #### get`_`data`_`dir`_`of`_`agent ```python - | get_data_dir_of_agent(agent_name: str) -> str +def get_data_dir_of_agent(agent_name: str) -> str ``` Get the data directory of a specific agent. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Is manager running. - + + #### dict`_`state ```python - | @property - | dict_state() -> Dict[str, Any] +@property +def dict_state() -> Dict[str, Any] ``` Create MultiAgentManager dist state. - + + #### projects ```python - | @property - | projects() -> Dict[PublicId, Project] +@property +def projects() -> Dict[PublicId, Project] ``` Get all projects. - + + #### add`_`error`_`callback ```python - | add_error_callback(error_callback: Callable[[str, BaseException], None]) -> "MultiAgentManager" +def add_error_callback( + error_callback: Callable[[str, BaseException], + None]) -> "MultiAgentManager" ``` Add error callback to call on error raised. - + + #### start`_`manager ```python - | start_manager(local: bool = False, remote: bool = False) -> "MultiAgentManager" +def start_manager(local: bool = False, + remote: bool = False) -> "MultiAgentManager" ``` Start manager. @@ -382,25 +430,25 @@ registry, and then from remote registry in case of failure). the MultiAgentManager instance. - + + #### last`_`start`_`status ```python - | @property - | last_start_status() -> Tuple[ - | bool, - | Dict[PublicId, List[Dict]], - | List[Tuple[PublicId, List[Dict], Exception]], - | ] +@property +def last_start_status() -> Tuple[bool, Dict[PublicId, List[Dict]], List[Tuple[ + PublicId, List[Dict], Exception]], ] ``` Get status of the last agents start loading state. - + + #### stop`_`manager ```python - | stop_manager(cleanup: bool = True, save: bool = False) -> "MultiAgentManager" +def stop_manager(cleanup: bool = True, + save: bool = False) -> "MultiAgentManager" ``` Stop manager. @@ -416,11 +464,15 @@ Stops all running agents and stop agent. None - + + #### add`_`project ```python - | add_project(public_id: PublicId, local: bool = False, remote: bool = False, restore: bool = False) -> "MultiAgentManager" +def add_project(public_id: PublicId, + local: bool = False, + remote: bool = False, + restore: bool = False) -> "MultiAgentManager" ``` Fetch agent project and all dependencies to working_dir. @@ -440,20 +492,23 @@ registry, and then from remote registry in case of failure). self - + + #### remove`_`project ```python - | remove_project(public_id: PublicId, keep_files: bool = False) -> "MultiAgentManager" +def remove_project(public_id: PublicId, + keep_files: bool = False) -> "MultiAgentManager" ``` Remove agent project. - + + #### list`_`projects ```python - | list_projects() -> List[PublicId] +def list_projects() -> List[PublicId] ``` List all agents projects added. @@ -462,11 +517,18 @@ List all agents projects added. list of public ids of projects - + + #### add`_`agent ```python - | add_agent(public_id: PublicId, agent_name: Optional[str] = None, agent_overrides: Optional[dict] = None, component_overrides: Optional[List[dict]] = None, local: bool = False, remote: bool = False, restore: bool = False) -> "MultiAgentManager" +def add_agent(public_id: PublicId, + agent_name: Optional[str] = None, + agent_overrides: Optional[dict] = None, + component_overrides: Optional[List[dict]] = None, + local: bool = False, + remote: bool = False, + restore: bool = False) -> "MultiAgentManager" ``` Create new agent configuration based on project with config overrides applied. @@ -487,11 +549,15 @@ Alias is stored in memory only! self - + + #### add`_`agent`_`with`_`config ```python - | add_agent_with_config(public_id: PublicId, config: List[dict], agent_name: Optional[str] = None) -> "MultiAgentManager" +def add_agent_with_config( + public_id: PublicId, + config: List[dict], + agent_name: Optional[str] = None) -> "MultiAgentManager" ``` Create new agent configuration based on project with config provided. @@ -508,11 +574,12 @@ Alias is stored in memory only! manager - + + #### get`_`agent`_`overridables ```python - | get_agent_overridables(agent_name: str) -> Tuple[Dict, List[Dict]] +def get_agent_overridables(agent_name: str) -> Tuple[Dict, List[Dict]] ``` Get agent config overridables. @@ -525,11 +592,14 @@ Get agent config overridables. Tuple of agent overridables dict and and list of component overridables dict. - + + #### set`_`agent`_`overrides ```python - | set_agent_overrides(agent_name: str, agent_overides: Optional[Dict], components_overrides: Optional[List[Dict]]) -> "MultiAgentManager" +def set_agent_overrides( + agent_name: str, agent_overides: Optional[Dict], + components_overrides: Optional[List[Dict]]) -> "MultiAgentManager" ``` Set agent overrides. @@ -544,11 +614,12 @@ Set agent overrides. self - + + #### list`_`agents`_`info ```python - | list_agents_info() -> List[Dict[str, Any]] +def list_agents_info() -> List[Dict[str, Any]] ``` List agents detailed info. @@ -557,11 +628,12 @@ List agents detailed info. list of dicts that represents agent info: public_id, name, is_running. - + + #### list`_`agents ```python - | list_agents(running_only: bool = False) -> List[str] +def list_agents(running_only: bool = False) -> List[str] ``` List all agents. @@ -574,11 +646,14 @@ List all agents. list of agents names - + + #### remove`_`agent ```python - | remove_agent(agent_name: str, skip_project_auto_remove: bool = False) -> "MultiAgentManager" +def remove_agent( + agent_name: str, + skip_project_auto_remove: bool = False) -> "MultiAgentManager" ``` Remove agent alias definition from registry. @@ -592,11 +667,12 @@ Remove agent alias definition from registry. None - + + #### start`_`agent ```python - | start_agent(agent_name: str) -> "MultiAgentManager" +def start_agent(agent_name: str) -> "MultiAgentManager" ``` Start selected agent. @@ -609,11 +685,12 @@ Start selected agent. None - + + #### start`_`all`_`agents ```python - | start_all_agents() -> "MultiAgentManager" +def start_all_agents() -> "MultiAgentManager" ``` Start all not started agents. @@ -622,11 +699,12 @@ Start all not started agents. None - + + #### stop`_`agent ```python - | stop_agent(agent_name: str) -> "MultiAgentManager" +def stop_agent(agent_name: str) -> "MultiAgentManager" ``` Stop running agent. @@ -639,11 +717,12 @@ Stop running agent. self - + + #### stop`_`all`_`agents ```python - | stop_all_agents() -> "MultiAgentManager" +def stop_all_agents() -> "MultiAgentManager" ``` Stop all agents running. @@ -652,11 +731,12 @@ Stop all agents running. self - + + #### stop`_`agents ```python - | stop_agents(agent_names: List[str]) -> "MultiAgentManager" +def stop_agents(agent_names: List[str]) -> "MultiAgentManager" ``` Stop specified agents. @@ -669,11 +749,12 @@ Stop specified agents. self - + + #### start`_`agents ```python - | start_agents(agent_names: List[str]) -> "MultiAgentManager" +def start_agents(agent_names: List[str]) -> "MultiAgentManager" ``` Stop specified agents. @@ -686,11 +767,12 @@ Stop specified agents. self - + + #### get`_`agent`_`alias ```python - | get_agent_alias(agent_name: str) -> AgentAlias +def get_agent_alias(agent_name: str) -> AgentAlias ``` Return details about agent alias definition. diff --git a/docs/api/manager/project.md b/docs/api/manager/project.md index 9b6d061513..2930fcbfa3 100644 --- a/docs/api/manager/project.md +++ b/docs/api/manager/project.md @@ -1,9 +1,11 @@ - + + # aea.manager.project This module contains the implementation of AEA agents project configuration. - + + ## `_`Base Objects ```python @@ -12,26 +14,29 @@ class _Base() Base class to share some methods. - + + #### builder ```python - | @property - | builder() -> AEABuilder +@property +def builder() -> AEABuilder ``` Get AEABuilder instance. - + + #### install`_`pypi`_`dependencies ```python - | install_pypi_dependencies() -> None +def install_pypi_dependencies() -> None ``` Install python dependencies for the project. - + + ## Project Objects ```python @@ -40,30 +45,42 @@ class Project(_Base) Agent project representation. - + + #### `__`init`__` ```python - | __init__(public_id: PublicId, path: str) -> None +def __init__(public_id: PublicId, path: str) -> None ``` Init project with public_id and project's path. - + + #### build ```python - | build() -> None +def build() -> None ``` Call all build entry points. - + + #### load ```python - | @classmethod - | load(cls, working_dir: str, public_id: PublicId, is_local: bool = False, is_remote: bool = False, is_restore: bool = False, cli_verbosity: str = "INFO", registry_path: str = DEFAULT_REGISTRY_NAME, skip_consistency_check: bool = False, skip_aea_validation: bool = False) -> "Project" +@classmethod +def load(cls, + working_dir: str, + public_id: PublicId, + is_local: bool = False, + is_remote: bool = False, + is_restore: bool = False, + cli_verbosity: str = "INFO", + registry_path: str = DEFAULT_REGISTRY_NAME, + skip_consistency_check: bool = False, + skip_aea_validation: bool = False) -> "Project" ``` Load project with given public_id to working_dir. @@ -88,45 +105,50 @@ registry, and then from remote registry in case of failure). project - + + #### remove ```python - | remove() -> None +def remove() -> None ``` Remove project, do cleanup. - + + #### agent`_`config ```python - | @property - | agent_config() -> AgentConfig +@property +def agent_config() -> AgentConfig ``` Get the agent configuration. - + + #### builder ```python - | @property - | builder() -> AEABuilder +@property +def builder() -> AEABuilder ``` Get builder instance. - + + #### check ```python - | check() -> None +def check() -> None ``` Check we can still construct an AEA from the project with builder.build. - + + ## AgentAlias Objects ```python @@ -135,20 +157,25 @@ class AgentAlias(_Base) Agent alias representation. - + + #### `__`init`__` ```python - | __init__(project: Project, agent_name: str, data_dir: str, password: Optional[str] = None) +def __init__(project: Project, + agent_name: str, + data_dir: str, + password: Optional[str] = None) ``` Init agent alias with project, config, name, agent, builder. - + + #### set`_`agent`_`config`_`from`_`data ```python - | set_agent_config_from_data(json_data: List[Dict]) -> None +def set_agent_config_from_data(json_data: List[Dict]) -> None ``` Set agent config instance constructed from json data. @@ -157,106 +184,118 @@ Set agent config instance constructed from json data. - `json_data`: agent config json data - + + #### builder ```python - | @property - | builder() -> AEABuilder +@property +def builder() -> AEABuilder ``` Get builder instance. - + + #### agent`_`config ```python - | @property - | agent_config() -> AgentConfig +@property +def agent_config() -> AgentConfig ``` Get agent config. - + + #### remove`_`from`_`project ```python - | remove_from_project() -> None +def remove_from_project() -> None ``` Remove agent alias from project. - + + #### dict ```python - | @property - | dict() -> Dict[str, Any] +@property +def dict() -> Dict[str, Any] ``` Convert AgentAlias to dict. - + + #### config`_`json ```python - | @property - | config_json() -> List[Dict] +@property +def config_json() -> List[Dict] ``` Get agent config json data. - + + #### get`_`aea`_`instance ```python - | get_aea_instance() -> AEA +def get_aea_instance() -> AEA ``` Build new aea instance. - + + #### issue`_`certificates ```python - | issue_certificates() -> None +def issue_certificates() -> None ``` Issue the certificates for this agent. - + + #### set`_`overrides ```python - | set_overrides(agent_overrides: Optional[Dict] = None, component_overrides: Optional[List[Dict]] = None) -> None +def set_overrides(agent_overrides: Optional[Dict] = None, + component_overrides: Optional[List[Dict]] = None) -> None ``` Set override for this agent alias's config. - + + #### agent`_`config`_`manager ```python - | @property - | agent_config_manager() -> AgentConfigManager +@property +def agent_config_manager() -> AgentConfigManager ``` Get agent configuration manager instance for the config. - + + #### get`_`overridables ```python - | get_overridables() -> Tuple[Dict, List[Dict]] +def get_overridables() -> Tuple[Dict, List[Dict]] ``` Get all overridables for this agent alias's config. - + + #### get`_`addresses ```python - | get_addresses() -> Dict[str, str] +def get_addresses() -> Dict[str, str] ``` Get addresses from private keys. @@ -265,11 +304,12 @@ Get addresses from private keys. dict with crypto id str as key and address str as value - + + #### get`_`connections`_`addresses ```python - | get_connections_addresses() -> Dict[str, str] +def get_connections_addresses() -> Dict[str, str] ``` Get connections addresses from connections private keys. diff --git a/docs/api/manager/utils.md b/docs/api/manager/utils.md index 0546fcf2b7..721ed40fc2 100644 --- a/docs/api/manager/utils.md +++ b/docs/api/manager/utils.md @@ -1,22 +1,25 @@ - + + # aea.manager.utils Multiagent manager utils. - + + #### get`_`lib`_`path ```python -get_lib_path(env_dir: str) -> str +def get_lib_path(env_dir: str) -> str ``` Get librarty path for env dir. - + + #### make`_`venv ```python -make_venv(env_dir: str, set_env: bool = False) -> None +def make_venv(env_dir: str, set_env: bool = False) -> None ``` Make venv and update variable to use it. @@ -26,38 +29,42 @@ Make venv and update variable to use it. - `env_dir`: str, path for new env dir - `set_env`: bool. use evn within this python process (update, sys.executable and sys.path) - + + #### project`_`install`_`and`_`build ```python -project_install_and_build(project: Project) -> None +def project_install_and_build(project: Project) -> None ``` Install project dependencies and build required components. - + + #### get`_`venv`_`dir`_`for`_`project ```python -get_venv_dir_for_project(project: Project) -> str +def get_venv_dir_for_project(project: Project) -> str ``` Get virtual env directory for project specified. - + + #### project`_`check ```python -project_check(project: Project) -> None +def project_check(project: Project) -> None ``` Perform project loads well. - + + #### run`_`in`_`venv ```python -run_in_venv(env_dir: str, fn: Callable, timeout: float, *args: Any) -> Any +def run_in_venv(env_dir: str, fn: Callable, timeout: float, *args: Any) -> Any ``` Run python function in a dedicated process with virtual env specified. diff --git a/docs/api/multiplexer.md b/docs/api/multiplexer.md index 0606ede79a..488261b7ba 100644 --- a/docs/api/multiplexer.md +++ b/docs/api/multiplexer.md @@ -1,9 +1,11 @@ - + + # aea.multiplexer Module for the multiplexer class and related classes. - + + ## MultiplexerStatus Objects ```python @@ -12,69 +14,85 @@ class MultiplexerStatus(AsyncState) The connection status class. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Initialize the connection status. - + + #### is`_`connected ```python - | @property - | is_connected() -> bool +@property +def is_connected() -> bool ``` Return is connected. - + + #### is`_`connecting ```python - | @property - | is_connecting() -> bool +@property +def is_connecting() -> bool ``` Return is connecting. - + + #### is`_`disconnected ```python - | @property - | is_disconnected() -> bool +@property +def is_disconnected() -> bool ``` Return is disconnected. - + + #### is`_`disconnecting ```python - | @property - | is_disconnecting() -> bool +@property +def is_disconnecting() -> bool ``` Return is disconnected. - + + ## AsyncMultiplexer Objects ```python -class AsyncMultiplexer(Runnable, WithLogger) +class AsyncMultiplexer(Runnable, WithLogger) ``` This class can handle multiple connections at once. - + + #### `__`init`__` ```python - | __init__(connections: Optional[Sequence[Connection]] = None, default_connection_index: int = 0, loop: Optional[AbstractEventLoop] = None, exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate, threaded: bool = False, agent_name: str = "standalone", default_routing: Optional[Dict[PublicId, PublicId]] = None, default_connection: Optional[PublicId] = None, protocols: Optional[List[Union[Protocol, Message]]] = None) -> None +def __init__( + connections: Optional[Sequence[Connection]] = None, + default_connection_index: int = 0, + loop: Optional[AbstractEventLoop] = None, + exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate, + threaded: bool = False, + agent_name: str = "standalone", + default_routing: Optional[Dict[PublicId, PublicId]] = None, + default_connection: Optional[PublicId] = None, + protocols: Optional[List[Union[Protocol, Message]]] = None) -> None ``` Initialize the connection multiplexer. @@ -93,100 +111,110 @@ If connections is None, this parameter is ignored. - `default_connection`: default connection - `protocols`: protocols used - + + #### default`_`connection ```python - | @property - | default_connection() -> Optional[Connection] +@property +def default_connection() -> Optional[Connection] ``` Get the default connection. - + + #### in`_`queue ```python - | @property - | in_queue() -> AsyncFriendlyQueue +@property +def in_queue() -> AsyncFriendlyQueue ``` Get the in queue. - + + #### out`_`queue ```python - | @property - | out_queue() -> asyncio.Queue +@property +def out_queue() -> asyncio.Queue ``` Get the out queue. - + + #### connections ```python - | @property - | connections() -> Tuple[Connection, ...] +@property +def connections() -> Tuple[Connection, ...] ``` Get the connections. - + + #### is`_`connected ```python - | @property - | is_connected() -> bool +@property +def is_connected() -> bool ``` Check whether the multiplexer is processing envelopes. - + + #### default`_`routing ```python - | @property - | default_routing() -> Dict[PublicId, PublicId] +@property +def default_routing() -> Dict[PublicId, PublicId] ``` Get the default routing. - + + #### default`_`routing ```python - | @default_routing.setter - | default_routing(default_routing: Dict[PublicId, PublicId]) -> None +@default_routing.setter +def default_routing(default_routing: Dict[PublicId, PublicId]) -> None ``` Set the default routing. - + + #### connection`_`status ```python - | @property - | connection_status() -> MultiplexerStatus +@property +def connection_status() -> MultiplexerStatus ``` Get the connection status. - + + #### run ```python - | async run() -> None +async def run() -> None ``` Run multiplexer connect and receive/send tasks. - + + #### set`_`loop ```python - | set_loop(loop: AbstractEventLoop) -> None +def set_loop(loop: AbstractEventLoop) -> None ``` Set event loop and all event loop related objects. @@ -195,11 +223,12 @@ Set event loop and all event loop related objects. - `loop`: asyncio event loop. - + + #### add`_`connection ```python - | add_connection(connection: Connection, is_default: bool = False) -> None +def add_connection(connection: Connection, is_default: bool = False) -> None ``` Add a connection to the multiplexer. @@ -209,29 +238,33 @@ Add a connection to the multiplexer. - `connection`: the connection to add. - `is_default`: whether the connection added should be the default one. - + + #### connect ```python - | async connect() -> None +async def connect() -> None ``` Connect the multiplexer. - + + #### disconnect ```python - | async disconnect() -> None +async def disconnect() -> None ``` Disconnect the multiplexer. - + + #### get ```python - | get(block: bool = False, timeout: Optional[float] = None) -> Optional[Envelope] +def get(block: bool = False, + timeout: Optional[float] = None) -> Optional[Envelope] ``` Get an envelope within a timeout. @@ -245,11 +278,12 @@ Get an envelope within a timeout. the envelope, or None if no envelope is available within a timeout. - + + #### async`_`get ```python - | async async_get() -> Envelope +async def async_get() -> Envelope ``` Get an envelope async way. @@ -258,11 +292,12 @@ Get an envelope async way. the envelope - + + #### async`_`wait ```python - | async async_wait() -> None +async def async_wait() -> None ``` Get an envelope async way. @@ -271,11 +306,12 @@ Get an envelope async way. the envelope - + + #### put ```python - | put(envelope: Envelope) -> None +def put(envelope: Envelope) -> None ``` Schedule an envelope for sending it. @@ -287,7 +323,8 @@ running on a different thread than the one used in this function. - `envelope`: the envelope to be sent. - + + ## Multiplexer Objects ```python @@ -296,11 +333,12 @@ class Multiplexer(AsyncMultiplexer) Transit sync multiplexer for compatibility. - + + #### `__`init`__` ```python - | __init__(*args: Any, **kwargs: Any) -> None +def __init__(*args: Any, **kwargs: Any) -> None ``` Initialize the connection multiplexer. @@ -310,11 +348,12 @@ Initialize the connection multiplexer. - `args`: arguments - `kwargs`: keyword arguments - + + #### set`_`loop ```python - | set_loop(loop: AbstractEventLoop) -> None +def set_loop(loop: AbstractEventLoop) -> None ``` Set event loop and all event loop related objects. @@ -323,33 +362,36 @@ Set event loop and all event loop related objects. - `loop`: asyncio event loop. - + + #### connect ```python - | connect() -> None +def connect() -> None ``` Connect the multiplexer. Synchronously in thread spawned if new loop created. - + + #### disconnect ```python - | disconnect() -> None +def disconnect() -> None ``` Disconnect the multiplexer. Also stops a dedicated thread for event loop if spawned on connect. - + + #### put ```python - | put(envelope: Envelope) -> None +def put(envelope: Envelope) -> None ``` Schedule an envelope for sending it. @@ -361,7 +403,8 @@ running on a different thread than the one used in this function. - `envelope`: the envelope to be sent. - + + ## InBox Objects ```python @@ -370,11 +413,12 @@ class InBox() A queue from where you can only consume envelopes. - + + #### `__`init`__` ```python - | __init__(multiplexer: AsyncMultiplexer) -> None +def __init__(multiplexer: AsyncMultiplexer) -> None ``` Initialize the inbox. @@ -383,11 +427,12 @@ Initialize the inbox. - `multiplexer`: the multiplexer - + + #### empty ```python - | empty() -> bool +def empty() -> bool ``` Check for a envelope on the in queue. @@ -396,11 +441,12 @@ Check for a envelope on the in queue. boolean indicating whether there is an envelope or not - + + #### get ```python - | get(block: bool = False, timeout: Optional[float] = None) -> Envelope +def get(block: bool = False, timeout: Optional[float] = None) -> Envelope ``` Check for a envelope on the in queue. @@ -410,19 +456,20 @@ Check for a envelope on the in queue. - `block`: make the call blocking (ignore the timeout). - `timeout`: times out the block after timeout seconds. +**Raises**: + +- `Empty`: if the attempt to get an envelope fails. + **Returns**: the envelope object. -**Raises**: - -- `Empty`: if the attempt to get an envelope fails. + - #### get`_`nowait ```python - | get_nowait() -> Optional[Envelope] +def get_nowait() -> Optional[Envelope] ``` Check for a envelope on the in queue and wait for no time. @@ -431,11 +478,12 @@ Check for a envelope on the in queue and wait for no time. the envelope object - + + #### async`_`get ```python - | async async_get() -> Envelope +async def async_get() -> Envelope ``` Check for a envelope on the in queue. @@ -444,16 +492,18 @@ Check for a envelope on the in queue. the envelope object. - + + #### async`_`wait ```python - | async async_wait() -> None +async def async_wait() -> None ``` Check for a envelope on the in queue. - + + ## OutBox Objects ```python @@ -462,11 +512,12 @@ class OutBox() A queue from where you can only enqueue envelopes. - + + #### `__`init`__` ```python - | __init__(multiplexer: AsyncMultiplexer) -> None +def __init__(multiplexer: AsyncMultiplexer) -> None ``` Initialize the outbox. @@ -475,11 +526,12 @@ Initialize the outbox. - `multiplexer`: the multiplexer - + + #### empty ```python - | empty() -> bool +def empty() -> bool ``` Check for a envelope on the in queue. @@ -488,11 +540,12 @@ Check for a envelope on the in queue. boolean indicating whether there is an envelope or not - + + #### put ```python - | put(envelope: Envelope) -> None +def put(envelope: Envelope) -> None ``` Put an envelope into the queue. @@ -501,11 +554,13 @@ Put an envelope into the queue. - `envelope`: the envelope. - + + #### put`_`message ```python - | put_message(message: Message, context: Optional[EnvelopeContext] = None) -> None +def put_message(message: Message, + context: Optional[EnvelopeContext] = None) -> None ``` Put a message in the outbox. diff --git a/docs/api/plugins/aea_cli_ipfs/core.md b/docs/api/plugins/aea_cli_ipfs/core.md index 6afb4c5997..567fa5ff36 100644 --- a/docs/api/plugins/aea_cli_ipfs/core.md +++ b/docs/api/plugins/aea_cli_ipfs/core.md @@ -1,51 +1,61 @@ - + + # plugins.aea-cli-ipfs.aea`_`cli`_`ipfs.core Core components for `ipfs cli command`. - + + #### ipfs ```python @click.group() @click.pass_context -ipfs(click_context: click.Context) -> None +def ipfs(click_context: click.Context) -> None ``` IPFS Commands - + + #### process`_`result ```python @ipfs.result_callback() @click.pass_context -process_result(click_context: click.Context, *_: Any) -> None +def process_result(click_context: click.Context, *_: Any) -> None ``` Tear down command group. - + + #### add ```python @ipfs.command() @click.argument( "dir_path", - type=click.Path( - exists=True, dir_okay=True, file_okay=False, resolve_path=True, readable=True - ), + type=click.Path(exists=True, + dir_okay=True, + file_okay=False, + resolve_path=True, + readable=True), required=False, ) @click.option("-p", "--publish", is_flag=True) @click.option("--no-pin", is_flag=True) @click.pass_context -add(click_context: click.Context, dir_path: Optional[str], publish: bool = False, no_pin: bool = False) -> None +def add(click_context: click.Context, + dir_path: Optional[str], + publish: bool = False, + no_pin: bool = False) -> None ``` Add directory to ipfs, if not directory specified the current one will be added. - + + #### remove ```python @@ -57,12 +67,13 @@ Add directory to ipfs, if not directory specified the current one will be added. required=True, ) @click.pass_context -remove(click_context: click.Context, hash_: str) -> None +def remove(click_context: click.Context, hash_: str) -> None ``` Remove a directory from ipfs by it's hash. - + + #### download ```python @@ -79,7 +90,8 @@ Remove a directory from ipfs by it's hash. required=False, ) @click.pass_context -download(click_context: click.Context, hash_: str, target_dir: Optional[str]) -> None +def download(click_context: click.Context, hash_: str, + target_dir: Optional[str]) -> None ``` Download directory by it's hash, if not target directory specified will use current one. diff --git a/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md b/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md index 7649ff116d..df9665ba5f 100644 --- a/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md +++ b/docs/api/plugins/aea_cli_ipfs/ipfs_utils.md @@ -1,9 +1,11 @@ - + + # plugins.aea-cli-ipfs.aea`_`cli`_`ipfs.ipfs`_`utils Ipfs utils for `ipfs cli command`. - + + ## IPFSDaemon Objects ```python @@ -16,43 +18,48 @@ Set up the IPFS daemon. - `Exception`: if IPFS is not installed. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Initialise IPFS daemon. - + + #### is`_`started ```python - | is_started() -> bool +def is_started() -> bool ``` Check daemon was started. - + + #### start ```python - | start() -> None +def start() -> None ``` Run the ipfs daemon. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Terminate the ipfs daemon. - + + ## BaseIPFSToolException Objects ```python @@ -61,7 +68,8 @@ class BaseIPFSToolException(Exception) Base ipfs tool exception. - + + ## RemoveError Objects ```python @@ -70,7 +78,8 @@ class RemoveError(BaseIPFSToolException) Exception on remove. - + + ## PublishError Objects ```python @@ -79,7 +88,8 @@ class PublishError(BaseIPFSToolException) Exception on publish. - + + ## NodeError Objects ```python @@ -88,7 +98,8 @@ class NodeError(BaseIPFSToolException) Exception for node connection check. - + + ## DownloadError Objects ```python @@ -97,7 +108,8 @@ class DownloadError(BaseIPFSToolException) Exception on download failed. - + + ## IPFSTool Objects ```python @@ -106,11 +118,12 @@ class IPFSTool() IPFS tool to add, publish, remove, download directories. - + + #### `__`init`__` ```python - | __init__(client_options: Optional[Dict] = None) +def __init__(client_options: Optional[Dict] = None) ``` Init tool. @@ -119,11 +132,12 @@ Init tool. - `client_options`: dict, options for ipfshttpclient instance. - + + #### add ```python - | add(dir_path: str, pin: bool = True) -> Tuple[str, str, List] +def add(dir_path: str, pin: bool = True) -> Tuple[str, str, List] ``` Add directory to ipfs. @@ -139,11 +153,12 @@ It wraps into directory. dir name published, hash, list of items processed - + + #### remove ```python - | remove(hash_id: str) -> Dict +def remove(hash_id: str) -> Dict ``` Remove dir added by it's hash. @@ -156,11 +171,12 @@ Remove dir added by it's hash. dict with unlinked items. - + + #### download ```python - | download(hash_id: str, target_dir: str, fix_path: bool = True) -> None +def download(hash_id: str, target_dir: str, fix_path: bool = True) -> None ``` Download dir by it's hash. @@ -171,11 +187,12 @@ Download dir by it's hash. - `target_dir`: str. directory to place downloaded - `fix_path`: bool. default True. on download don't wrap result in to hash_id directory. - + + #### publish ```python - | publish(hash_id: str) -> Dict +def publish(hash_id: str) -> Dict ``` Publish directory by it's hash id. @@ -188,11 +205,12 @@ Publish directory by it's hash id. dict of names it was publish for. - + + #### chec`_`ipfs`_`node`_`running ```python - | chec_ipfs_node_running() -> None +def chec_ipfs_node_running() -> None ``` Check ipfs node running. diff --git a/docs/api/plugins/aea_ledger_cosmos/cosmos.md b/docs/api/plugins/aea_ledger_cosmos/cosmos.md index 53f0db8850..ed575bbca7 100644 --- a/docs/api/plugins/aea_ledger_cosmos/cosmos.md +++ b/docs/api/plugins/aea_ledger_cosmos/cosmos.md @@ -1,9 +1,11 @@ - + + # plugins.aea-ledger-cosmos.aea`_`ledger`_`cosmos.cosmos Cosmos module wrapping the public and private key cryptography and ledger api. - + + ## DataEncrypt Objects ```python @@ -12,47 +14,52 @@ class DataEncrypt() Class to encrypt/decrypt data strings with password provided. - + + #### encrypt ```python - | @classmethod - | encrypt(cls, data: bytes, password: str) -> bytes +@classmethod +def encrypt(cls, data: bytes, password: str) -> bytes ``` Encrypt data with password. - + + #### bytes`_`encode ```python - | @staticmethod - | bytes_encode(data: bytes) -> str +@staticmethod +def bytes_encode(data: bytes) -> str ``` Encode bytes to ascii friendly string. - + + #### bytes`_`decode ```python - | @staticmethod - | bytes_decode(data: str) -> bytes +@staticmethod +def bytes_decode(data: str) -> bytes ``` Decode ascii friendly string to bytes. - + + #### decrypt ```python - | @classmethod - | decrypt(cls, encrypted_data: bytes, password: str) -> bytes +@classmethod +def decrypt(cls, encrypted_data: bytes, password: str) -> bytes ``` Decrypt data with password provided. - + + ## CosmosHelper Objects ```python @@ -61,12 +68,13 @@ class CosmosHelper(Helper) Helper class usable as Mixin for CosmosApi or as standalone class. - + + #### is`_`transaction`_`settled ```python - | @staticmethod - | is_transaction_settled(tx_receipt: JSONLike) -> bool +@staticmethod +def is_transaction_settled(tx_receipt: JSONLike) -> bool ``` Check whether a transaction is settled or not. @@ -79,12 +87,13 @@ Check whether a transaction is settled or not. True if the transaction has been settled, False o/w. - + + #### get`_`code`_`id ```python - | @classmethod - | get_code_id(cls, tx_receipt: JSONLike) -> Optional[int] +@classmethod +def get_code_id(cls, tx_receipt: JSONLike) -> Optional[int] ``` Retrieve the `code_id` from a transaction receipt. @@ -97,12 +106,13 @@ Retrieve the `code_id` from a transaction receipt. the code id, if present - + + #### get`_`event`_`attributes ```python - | @staticmethod - | get_event_attributes(tx_receipt: JSONLike) -> Dict +@staticmethod +def get_event_attributes(tx_receipt: JSONLike) -> Dict ``` Retrieve events attributes from tx receipt. @@ -115,12 +125,13 @@ Retrieve events attributes from tx receipt. dict - + + #### get`_`contract`_`address ```python - | @classmethod - | get_contract_address(cls, tx_receipt: JSONLike) -> Optional[str] +@classmethod +def get_contract_address(cls, tx_receipt: JSONLike) -> Optional[str] ``` Retrieve the `contract_address` from a transaction receipt. @@ -133,12 +144,14 @@ Retrieve the `contract_address` from a transaction receipt. the contract address, if present - + + #### is`_`transaction`_`valid ```python - | @staticmethod - | is_transaction_valid(tx: JSONLike, seller: Address, client: Address, tx_nonce: str, amount: int) -> bool +@staticmethod +def is_transaction_valid(tx: JSONLike, seller: Address, client: Address, + tx_nonce: str, amount: int) -> bool ``` Check whether a transaction is valid or not. @@ -155,12 +168,13 @@ Check whether a transaction is valid or not. True if the random_message is equals to tx['input'] - + + #### generate`_`tx`_`nonce ```python - | @staticmethod - | generate_tx_nonce(seller: Address, client: Address) -> str +@staticmethod +def generate_tx_nonce(seller: Address, client: Address) -> str ``` Generate a unique hash to distinguish transactions with the same terms. @@ -174,12 +188,13 @@ Generate a unique hash to distinguish transactions with the same terms. return the hash in hex. - + + #### get`_`address`_`from`_`public`_`key ```python - | @classmethod - | get_address_from_public_key(cls, public_key: str) -> str +@classmethod +def get_address_from_public_key(cls, public_key: str) -> str ``` Get the address from the public key. @@ -192,12 +207,16 @@ Get the address from the public key. str - + + #### recover`_`message ```python - | @classmethod - | recover_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[Address, ...] +@classmethod +def recover_message(cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[Address, ...] ``` Recover the addresses from the hash. @@ -212,12 +231,17 @@ Recover the addresses from the hash. the recovered addresses - + + #### recover`_`public`_`keys`_`from`_`message ```python - | @classmethod - | recover_public_keys_from_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[str, ...] +@classmethod +def recover_public_keys_from_message( + cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[str, ...] ``` Get the public key used to produce the `signature` of the `message` @@ -232,12 +256,13 @@ Get the public key used to produce the `signature` of the `message` the recovered public keys - + + #### get`_`hash ```python - | @staticmethod - | get_hash(message: bytes) -> str +@staticmethod +def get_hash(message: bytes) -> str ``` Get the hash of a message. @@ -250,12 +275,13 @@ Get the hash of a message. the hash of the message. - + + #### is`_`valid`_`address ```python - | @classmethod - | is_valid_address(cls, address: Address) -> bool +@classmethod +def is_valid_address(cls, address: Address) -> bool ``` Check if the address is valid. @@ -268,12 +294,13 @@ Check if the address is valid. whether address is valid or not - + + #### load`_`contract`_`interface ```python - | @classmethod - | load_contract_interface(cls, file_path: Path) -> Dict[str, str] +@classmethod +def load_contract_interface(cls, file_path: Path) -> Dict[str, str] ``` Load contract interface. @@ -286,7 +313,8 @@ Load contract interface. the interface - + + ## CosmosCrypto Objects ```python @@ -295,11 +323,13 @@ class CosmosCrypto(Crypto[SigningKey]) Class wrapping the Account Generation from Ethereum ledger. - + + #### `__`init`__` ```python - | __init__(private_key_path: Optional[str] = None, password: Optional[str] = None) -> None +def __init__(private_key_path: Optional[str] = None, + password: Optional[str] = None) -> None ``` Instantiate an ethereum crypto object. @@ -309,12 +339,13 @@ Instantiate an ethereum crypto object. - `private_key_path`: the private key path of the agent - `password`: the password to encrypt/decrypt the private key. - + + #### private`_`key ```python - | @property - | private_key() -> str +@property +def private_key() -> str ``` Return a private key. @@ -323,12 +354,13 @@ Return a private key. a private key string - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Return a public key in hex format. @@ -337,12 +369,13 @@ Return a public key in hex format. a public key string in hex format - + + #### address ```python - | @property - | address() -> str +@property +def address() -> str ``` Return the address for the key pair. @@ -351,12 +384,15 @@ Return the address for the key pair. a display_address str - + + #### load`_`private`_`key`_`from`_`path ```python - | @classmethod - | load_private_key_from_path(cls, file_name: str, password: Optional[str] = None) -> SigningKey +@classmethod +def load_private_key_from_path(cls, + file_name: str, + password: Optional[str] = None) -> SigningKey ``` Load a private key in hex format from a file. @@ -370,11 +406,12 @@ Load a private key in hex format from a file. the Entity. - + + #### sign`_`message ```python - | sign_message(message: bytes, is_deprecated_mode: bool = False) -> str +def sign_message(message: bytes, is_deprecated_mode: bool = False) -> str ``` Sign a message in bytes string form. @@ -388,11 +425,12 @@ Sign a message in bytes string form. signature of the message in string form - + + #### sign`_`transaction ```python - | sign_transaction(transaction: JSONLike) -> JSONLike +def sign_transaction(transaction: JSONLike) -> JSONLike ``` Sign a transaction in bytes string form. @@ -405,21 +443,23 @@ Sign a transaction in bytes string form. signed transaction - + + #### generate`_`private`_`key ```python - | @classmethod - | generate_private_key(cls) -> SigningKey +@classmethod +def generate_private_key(cls) -> SigningKey ``` Generate a key pair for cosmos network. - + + #### encrypt ```python - | encrypt(password: str) -> str +def encrypt(password: str) -> str ``` Encrypt the private key and return in json. @@ -432,12 +472,13 @@ Encrypt the private key and return in json. json string containing encrypted private key. - + + #### decrypt ```python - | @classmethod - | decrypt(cls, keyfile_json: str, password: str) -> str +@classmethod +def decrypt(cls, keyfile_json: str, password: str) -> str ``` Decrypt the private key and return in raw form. @@ -451,7 +492,8 @@ Decrypt the private key and return in raw form. the raw private key. - + + ## `_`CosmosApi Objects ```python @@ -460,39 +502,44 @@ class _CosmosApi(LedgerApi) Class to interact with the Cosmos SDK via a HTTP APIs. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize the Cosmos ledger APIs. - + + #### api ```python - | @property - | api() -> Any +@property +def api() -> Any ``` Get the underlying API object. - + + #### get`_`balance ```python - | get_balance(address: Address) -> Optional[int] +def get_balance(address: Address) -> Optional[int] ``` Get the balance of a given account. - + + #### get`_`state ```python - | get_state(callable_name: str, *args: Any, **kwargs: Any) -> Optional[JSONLike] +def get_state(callable_name: str, *args: Any, + **kwargs: Any) -> Optional[JSONLike] ``` Call a specified function on the ledger API. @@ -512,11 +559,14 @@ as the callable_name and the rest of the path as args. the transaction dictionary - + + #### get`_`deploy`_`transaction ```python - | get_deploy_transaction(contract_interface: Dict[str, str], deployer_address: Address, **kwargs: Any, ,) -> Optional[JSONLike] +def get_deploy_transaction(contract_interface: Dict[str, str], + deployer_address: Address, + **kwargs: Any) -> Optional[JSONLike] ``` Get the transaction to deploy the smart contract. @@ -533,11 +583,24 @@ Dispatches to _get_storage_transaction and _get_init_transaction based on kwargs the transaction dictionary. - + + #### get`_`handle`_`transaction ```python - | get_handle_transaction(sender_address: Address, contract_address: Address, handle_msg: Any, amount: int, tx_fee: int, denom: Optional[str] = None, gas: int = DEFAULT_GAS_AMOUNT, memo: str = "", chain_id: Optional[str] = None, account_number: Optional[int] = None, sequence: Optional[int] = None, tx_fee_denom: Optional[str] = None) -> Optional[JSONLike] +def get_handle_transaction( + sender_address: Address, + contract_address: Address, + handle_msg: Any, + amount: int, + tx_fee: int, + denom: Optional[str] = None, + gas: int = DEFAULT_GAS_AMOUNT, + memo: str = "", + chain_id: Optional[str] = None, + account_number: Optional[int] = None, + sequence: Optional[int] = None, + tx_fee_denom: Optional[str] = None) -> Optional[JSONLike] ``` Create a CosmWasm HandleMsg transaction. @@ -561,11 +624,13 @@ Create a CosmWasm HandleMsg transaction. the unsigned CosmWasm HandleMsg - + + #### execute`_`contract`_`query ```python - | execute_contract_query(contract_address: Address, query_msg: JSONLike) -> Optional[JSONLike] +def execute_contract_query(contract_address: Address, + query_msg: JSONLike) -> Optional[JSONLike] ``` Execute a CosmWasm QueryMsg. QueryMsg doesn't require signing. @@ -579,11 +644,24 @@ Execute a CosmWasm QueryMsg. QueryMsg doesn't require signing. the message receipt - + + #### get`_`transfer`_`transaction ```python - | get_transfer_transaction(sender_address: Address, destination_address: Address, amount: int, tx_fee: int, tx_nonce: str, denom: Optional[str] = None, gas: int = DEFAULT_GAS_AMOUNT, memo: str = "", chain_id: Optional[str] = None, account_number: Optional[int] = None, sequence: Optional[int] = None, tx_fee_denom: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] +def get_transfer_transaction(sender_address: Address, + destination_address: Address, + amount: int, + tx_fee: int, + tx_nonce: str, + denom: Optional[str] = None, + gas: int = DEFAULT_GAS_AMOUNT, + memo: str = "", + chain_id: Optional[str] = None, + account_number: Optional[int] = None, + sequence: Optional[int] = None, + tx_fee_denom: Optional[str] = None, + **kwargs: Any) -> Optional[JSONLike] ``` Submit a transfer transaction to the ledger. @@ -608,11 +686,16 @@ Submit a transfer transaction to the ledger. the transfer transaction - + + #### get`_`packed`_`exec`_`msg ```python - | get_packed_exec_msg(sender_address: Address, contract_address: str, msg: JSONLike, funds: int = 0, denom: Optional[str] = None) -> ProtoAny +def get_packed_exec_msg(sender_address: Address, + contract_address: str, + msg: JSONLike, + funds: int = 0, + denom: Optional[str] = None) -> ProtoAny ``` Create and pack MsgExecuteContract @@ -629,11 +712,15 @@ Create and pack MsgExecuteContract Packed MsgExecuteContract - + + #### get`_`packed`_`send`_`msg ```python - | get_packed_send_msg(from_address: Address, to_address: Address, amount: int, denom: Optional[str] = None) -> ProtoAny +def get_packed_send_msg(from_address: Address, + to_address: Address, + amount: int, + denom: Optional[str] = None) -> ProtoAny ``` Generate and pack MsgSend @@ -649,11 +736,20 @@ Generate and pack MsgSend packer ProtoAny type message - + + #### get`_`multi`_`transaction ```python - | get_multi_transaction(from_addresses: List[str], pub_keys: Optional[List[bytes]], msgs: List[ProtoAny], gas: int, tx_fee: int = 0, memo: str = "", chain_id: Optional[str] = None, denom: Optional[str] = None, tx_fee_denom: Optional[str] = None) -> JSONLike +def get_multi_transaction(from_addresses: List[str], + pub_keys: Optional[List[bytes]], + msgs: List[ProtoAny], + gas: int, + tx_fee: int = 0, + memo: str = "", + chain_id: Optional[str] = None, + denom: Optional[str] = None, + tx_fee_denom: Optional[str] = None) -> JSONLike ``` Generate transaction with multiple messages @@ -670,17 +766,20 @@ Generate transaction with multiple messages - `denom`: the denomination of tx fee - `tx_fee_denom`: Denomination of tx_fee, identical with denom param when None -:raises: RuntimeError if number of pubkeys is not equal to number of from_addresses +**Raises**: + +- `None`: RuntimeError if number of pubkeys is not equal to number of from_addresses **Returns**: the transaction - + + #### send`_`signed`_`transaction ```python - | send_signed_transaction(tx_signed: JSONLike) -> Optional[str] +def send_signed_transaction(tx_signed: JSONLike) -> Optional[str] ``` Send a signed transaction and wait for confirmation. @@ -693,11 +792,12 @@ Send a signed transaction and wait for confirmation. tx_digest, if present - + + #### get`_`transaction`_`receipt ```python - | get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] +def get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction receipt for a transaction digest. @@ -710,11 +810,12 @@ Get the transaction receipt for a transaction digest. the tx receipt, if present - + + #### get`_`transaction ```python - | get_transaction(tx_digest: str) -> Optional[JSONLike] +def get_transaction(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction for a transaction digest. @@ -727,11 +828,13 @@ Get the transaction for a transaction digest. the tx, if present - + + #### get`_`contract`_`instance ```python - | get_contract_instance(contract_interface: Dict[str, str], contract_address: Optional[str] = None) -> Any +def get_contract_instance(contract_interface: Dict[str, str], + contract_address: Optional[str] = None) -> Any ``` Get the instance of a contract. @@ -745,11 +848,12 @@ Get the instance of a contract. the contract instance - + + #### update`_`with`_`gas`_`estimate ```python - | update_with_gas_estimate(transaction: JSONLike) -> JSONLike +def update_with_gas_estimate(transaction: JSONLike) -> JSONLike ``` Attempts to update the transaction with a gas estimate @@ -757,18 +861,23 @@ Attempts to update the transaction with a gas estimate **Arguments**: - `transaction`: the transaction -:raises: NotImplementedError - +**Raises**: + +- `None`: NotImplementedError + + + ## CosmosApi Objects ```python -class CosmosApi(_CosmosApi, CosmosHelper) +class CosmosApi(_CosmosApi, CosmosHelper) ``` Class to interact with the Cosmos SDK via a HTTP APIs. - + + ## CosmosFaucetApi Objects ```python @@ -777,20 +886,23 @@ class CosmosFaucetApi(FaucetApi) Cosmos testnet faucet API. - + + #### `__`init`__` ```python - | __init__(poll_interval: Optional[float] = None, final_wait_interval: Optional[float] = None) +def __init__(poll_interval: Optional[float] = None, + final_wait_interval: Optional[float] = None) ``` Initialize CosmosFaucetApi. - + + #### get`_`wealth ```python - | get_wealth(address: Address, url: Optional[str] = None) -> None +def get_wealth(address: Address, url: Optional[str] = None) -> None ``` Get wealth from the faucet for the provided address. @@ -799,5 +911,8 @@ Get wealth from the faucet for the provided address. - `address`: the address. - `url`: the url -:raises: RuntimeError of explicit faucet failures + +**Raises**: + +- `None`: RuntimeError of explicit faucet failures diff --git a/docs/api/plugins/aea_ledger_ethereum/ethereum.md b/docs/api/plugins/aea_ledger_ethereum/ethereum.md index 0a6d21c987..cce8a28d60 100644 --- a/docs/api/plugins/aea_ledger_ethereum/ethereum.md +++ b/docs/api/plugins/aea_ledger_ethereum/ethereum.md @@ -1,18 +1,23 @@ - + + # plugins.aea-ledger-ethereum.aea`_`ledger`_`ethereum.ethereum Ethereum module wrapping the public and private key cryptography and ledger api. - + + #### get`_`gas`_`price`_`strategy ```python -get_gas_price_strategy(gas_price_strategy: Optional[str] = None, api_key: Optional[str] = None) -> Callable[[Web3, TxParams], Wei] +def get_gas_price_strategy( + gas_price_strategy: Optional[str] = None, + api_key: Optional[str] = None) -> Callable[[Web3, TxParams], Wei] ``` Get the gas price strategy. - + + ## SignedTransactionTranslator Objects ```python @@ -21,27 +26,31 @@ class SignedTransactionTranslator() Translator for SignedTransaction. - + + #### to`_`dict ```python - | @staticmethod - | to_dict(signed_transaction: SignedTransaction) -> Dict[str, Union[str, int]] +@staticmethod +def to_dict( + signed_transaction: SignedTransaction) -> Dict[str, Union[str, int]] ``` Write SignedTransaction to dict. - + + #### from`_`dict ```python - | @staticmethod - | from_dict(signed_transaction_dict: JSONLike) -> SignedTransaction +@staticmethod +def from_dict(signed_transaction_dict: JSONLike) -> SignedTransaction ``` Get SignedTransaction from dict. - + + ## AttributeDictTranslator Objects ```python @@ -50,27 +59,31 @@ class AttributeDictTranslator() Translator for AttributeDict. - + + #### to`_`dict ```python - | @classmethod - | to_dict(cls, attr_dict: Union[AttributeDict, TxReceipt, TxData]) -> JSONLike +@classmethod +def to_dict(cls, attr_dict: Union[AttributeDict, TxReceipt, + TxData]) -> JSONLike ``` Simplify to dict. - + + #### from`_`dict ```python - | @classmethod - | from_dict(cls, di: JSONLike) -> AttributeDict +@classmethod +def from_dict(cls, di: JSONLike) -> AttributeDict ``` Get back attribute dict. - + + ## EthereumCrypto Objects ```python @@ -79,11 +92,13 @@ class EthereumCrypto(Crypto[Account]) Class wrapping the Account Generation from Ethereum ledger. - + + #### `__`init`__` ```python - | __init__(private_key_path: Optional[str] = None, password: Optional[str] = None) -> None +def __init__(private_key_path: Optional[str] = None, + password: Optional[str] = None) -> None ``` Instantiate an ethereum crypto object. @@ -93,12 +108,13 @@ Instantiate an ethereum crypto object. - `private_key_path`: the private key path of the agent - `password`: the password to encrypt/decrypt the private key. - + + #### private`_`key ```python - | @property - | private_key() -> str +@property +def private_key() -> str ``` Return a private key. @@ -107,12 +123,13 @@ Return a private key. a private key string - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Return a public key in hex format. @@ -121,12 +138,13 @@ Return a public key in hex format. a public key string in hex format - + + #### address ```python - | @property - | address() -> str +@property +def address() -> str ``` Return the address for the key pair. @@ -135,12 +153,15 @@ Return the address for the key pair. a display_address str - + + #### load`_`private`_`key`_`from`_`path ```python - | @classmethod - | load_private_key_from_path(cls, file_name: str, password: Optional[str] = None) -> Account +@classmethod +def load_private_key_from_path(cls, + file_name: str, + password: Optional[str] = None) -> Account ``` Load a private key in hex format from a file. @@ -154,11 +175,12 @@ Load a private key in hex format from a file. the Entity. - + + #### sign`_`message ```python - | sign_message(message: bytes, is_deprecated_mode: bool = False) -> str +def sign_message(message: bytes, is_deprecated_mode: bool = False) -> str ``` Sign a message in bytes string form. @@ -172,11 +194,12 @@ Sign a message in bytes string form. signature of the message in string form - + + #### sign`_`transaction ```python - | sign_transaction(transaction: JSONLike) -> JSONLike +def sign_transaction(transaction: JSONLike) -> JSONLike ``` Sign a transaction in bytes string form. @@ -189,21 +212,23 @@ Sign a transaction in bytes string form. signed transaction - + + #### generate`_`private`_`key ```python - | @classmethod - | generate_private_key(cls) -> Account +@classmethod +def generate_private_key(cls) -> Account ``` Generate a key pair for ethereum network. - + + #### encrypt ```python - | encrypt(password: str) -> str +def encrypt(password: str) -> str ``` Encrypt the private key and return in json. @@ -216,12 +241,13 @@ Encrypt the private key and return in json. json string containing encrypted private key. - + + #### decrypt ```python - | @classmethod - | decrypt(cls, keyfile_json: str, password: str) -> str +@classmethod +def decrypt(cls, keyfile_json: str, password: str) -> str ``` Decrypt the private key and return in raw form. @@ -235,7 +261,8 @@ Decrypt the private key and return in raw form. the raw private key. - + + ## EthereumHelper Objects ```python @@ -244,12 +271,13 @@ class EthereumHelper(Helper) Helper class usable as Mixin for EthereumApi or as standalone class. - + + #### is`_`transaction`_`settled ```python - | @staticmethod - | is_transaction_settled(tx_receipt: JSONLike) -> bool +@staticmethod +def is_transaction_settled(tx_receipt: JSONLike) -> bool ``` Check whether a transaction is settled or not. @@ -262,12 +290,13 @@ Check whether a transaction is settled or not. True if the transaction has been settled, False o/w. - + + #### get`_`contract`_`address ```python - | @staticmethod - | get_contract_address(tx_receipt: JSONLike) -> Optional[str] +@staticmethod +def get_contract_address(tx_receipt: JSONLike) -> Optional[str] ``` Retrieve the `contract_address` from a transaction receipt. @@ -280,12 +309,14 @@ Retrieve the `contract_address` from a transaction receipt. the contract address, if present - + + #### is`_`transaction`_`valid ```python - | @staticmethod - | is_transaction_valid(tx: dict, seller: Address, client: Address, tx_nonce: str, amount: int) -> bool +@staticmethod +def is_transaction_valid(tx: dict, seller: Address, client: Address, + tx_nonce: str, amount: int) -> bool ``` Check whether a transaction is valid or not. @@ -302,12 +333,13 @@ Check whether a transaction is valid or not. True if the random_message is equals to tx['input'] - + + #### generate`_`tx`_`nonce ```python - | @staticmethod - | generate_tx_nonce(seller: Address, client: Address) -> str +@staticmethod +def generate_tx_nonce(seller: Address, client: Address) -> str ``` Generate a unique hash to distinguish transactions with the same terms. @@ -321,12 +353,13 @@ Generate a unique hash to distinguish transactions with the same terms. return the hash in hex. - + + #### get`_`address`_`from`_`public`_`key ```python - | @classmethod - | get_address_from_public_key(cls, public_key: str) -> str +@classmethod +def get_address_from_public_key(cls, public_key: str) -> str ``` Get the address from the public key. @@ -339,12 +372,16 @@ Get the address from the public key. str - + + #### recover`_`message ```python - | @classmethod - | recover_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[Address, ...] +@classmethod +def recover_message(cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[Address, ...] ``` Recover the addresses from the hash. @@ -359,12 +396,17 @@ Recover the addresses from the hash. the recovered addresses - + + #### recover`_`public`_`keys`_`from`_`message ```python - | @classmethod - | recover_public_keys_from_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[str, ...] +@classmethod +def recover_public_keys_from_message( + cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[str, ...] ``` Get the public key used to produce the `signature` of the `message` @@ -379,12 +421,13 @@ Get the public key used to produce the `signature` of the `message` the recovered public keys - + + #### get`_`hash ```python - | @staticmethod - | get_hash(message: bytes) -> str +@staticmethod +def get_hash(message: bytes) -> str ``` Get the hash of a message. @@ -397,12 +440,13 @@ Get the hash of a message. the hash of the message. - + + #### load`_`contract`_`interface ```python - | @classmethod - | load_contract_interface(cls, file_path: Path) -> Dict[str, str] +@classmethod +def load_contract_interface(cls, file_path: Path) -> Dict[str, str] ``` Load contract interface. @@ -415,20 +459,22 @@ Load contract interface. the interface - + + ## EthereumApi Objects ```python -class EthereumApi(LedgerApi, EthereumHelper) +class EthereumApi(LedgerApi, EthereumHelper) ``` Class to interact with the Ethereum Web3 APIs. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) +def __init__(**kwargs: Any) ``` Initialize the Ethereum ledger APIs. @@ -437,39 +483,52 @@ Initialize the Ethereum ledger APIs. - `kwargs`: keyword arguments - + + #### api ```python - | @property - | api() -> Web3 +@property +def api() -> Web3 ``` Get the underlying API object. - + + #### get`_`balance ```python - | get_balance(address: Address) -> Optional[int] +def get_balance(address: Address) -> Optional[int] ``` Get the balance of a given account. - + + #### get`_`state ```python - | get_state(callable_name: str, *args: Any, **kwargs: Any) -> Optional[JSONLike] +def get_state(callable_name: str, *args: Any, + **kwargs: Any) -> Optional[JSONLike] ``` Call a specified function on the ledger API. - + + #### get`_`transfer`_`transaction ```python - | get_transfer_transaction(sender_address: Address, destination_address: Address, amount: int, tx_fee: int, tx_nonce: str, chain_id: Optional[int] = None, gas_price: Optional[str] = None, gas_price_strategy: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] +def get_transfer_transaction(sender_address: Address, + destination_address: Address, + amount: int, + tx_fee: int, + tx_nonce: str, + chain_id: Optional[int] = None, + gas_price: Optional[str] = None, + gas_price_strategy: Optional[str] = None, + **kwargs: Any) -> Optional[JSONLike] ``` Submit a transfer transaction to the ledger. @@ -490,11 +549,12 @@ Submit a transfer transaction to the ledger. the transfer transaction - + + #### update`_`with`_`gas`_`estimate ```python - | update_with_gas_estimate(transaction: JSONLike) -> JSONLike +def update_with_gas_estimate(transaction: JSONLike) -> JSONLike ``` Attempts to update the transaction with a gas estimate @@ -507,11 +567,12 @@ Attempts to update the transaction with a gas estimate the updated transaction - + + #### send`_`signed`_`transaction ```python - | send_signed_transaction(tx_signed: JSONLike) -> Optional[str] +def send_signed_transaction(tx_signed: JSONLike) -> Optional[str] ``` Send a signed transaction and wait for confirmation. @@ -524,11 +585,12 @@ Send a signed transaction and wait for confirmation. tx_digest, if present - + + #### get`_`transaction`_`receipt ```python - | get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] +def get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction receipt for a transaction digest. @@ -541,11 +603,12 @@ Get the transaction receipt for a transaction digest. the tx receipt, if present - + + #### get`_`transaction ```python - | get_transaction(tx_digest: str) -> Optional[JSONLike] +def get_transaction(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction for a transaction digest. @@ -558,11 +621,13 @@ Get the transaction for a transaction digest. the tx, if present - + + #### get`_`contract`_`instance ```python - | get_contract_instance(contract_interface: Dict[str, str], contract_address: Optional[str] = None) -> Any +def get_contract_instance(contract_interface: Dict[str, str], + contract_address: Optional[str] = None) -> Any ``` Get the instance of a contract. @@ -576,11 +641,18 @@ Get the instance of a contract. the contract instance - + + #### get`_`deploy`_`transaction ```python - | get_deploy_transaction(contract_interface: Dict[str, str], deployer_address: Address, value: int = 0, gas: int = 0, gas_price: Optional[str] = None, gas_price_strategy: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] +def get_deploy_transaction(contract_interface: Dict[str, str], + deployer_address: Address, + value: int = 0, + gas: int = 0, + gas_price: Optional[str] = None, + gas_price_strategy: Optional[str] = None, + **kwargs: Any) -> Optional[JSONLike] ``` Get the transaction to deploy the smart contract. @@ -599,12 +671,13 @@ Get the transaction to deploy the smart contract. the transaction dictionary. - + + #### is`_`valid`_`address ```python - | @classmethod - | is_valid_address(cls, address: Address) -> bool +@classmethod +def is_valid_address(cls, address: Address) -> bool ``` Check if the address is valid. @@ -617,7 +690,8 @@ Check if the address is valid. whether the address is valid - + + ## EthereumFaucetApi Objects ```python @@ -626,11 +700,12 @@ class EthereumFaucetApi(FaucetApi) Ethereum testnet faucet API. - + + #### get`_`wealth ```python - | get_wealth(address: Address, url: Optional[str] = None) -> None +def get_wealth(address: Address, url: Optional[str] = None) -> None ``` Get wealth from the faucet for the provided address. @@ -640,7 +715,8 @@ Get wealth from the faucet for the provided address. - `address`: the address. - `url`: the url - + + ## LruLockWrapper Objects ```python @@ -649,56 +725,62 @@ class LruLockWrapper() Wrapper for LRU with threading.Lock. - + + #### `__`init`__` ```python - | __init__(lru: LRU) -> None +def __init__(lru: LRU) -> None ``` Init wrapper. - + + #### `__`getitem`__` ```python - | __getitem__(*args: Any, **kwargs: Any) -> Any +def __getitem__(*args: Any, **kwargs: Any) -> Any ``` Get item - + + #### `__`setitem`__` ```python - | __setitem__(*args: Any, **kwargs: Any) -> Any +def __setitem__(*args: Any, **kwargs: Any) -> Any ``` Set item. - + + #### `__`contains`__` ```python - | __contains__(*args: Any, **kwargs: Any) -> Any +def __contains__(*args: Any, **kwargs: Any) -> Any ``` Contain item. - + + #### `__`delitem`__` ```python - | __delitem__(*args: Any, **kwargs: Any) -> Any +def __delitem__(*args: Any, **kwargs: Any) -> Any ``` Del item. - + + #### set`_`wrapper`_`for`_`web3py`_`session`_`cache ```python -set_wrapper_for_web3py_session_cache() -> None +def set_wrapper_for_web3py_session_cache() -> None ``` Wrap web3py session cache with threading.Lock. diff --git a/docs/api/plugins/aea_ledger_fetchai/_cosmos.md b/docs/api/plugins/aea_ledger_fetchai/_cosmos.md index fe8aed6d37..5c4ce5912f 100644 --- a/docs/api/plugins/aea_ledger_fetchai/_cosmos.md +++ b/docs/api/plugins/aea_ledger_fetchai/_cosmos.md @@ -1,9 +1,11 @@ - + + # plugins.aea-ledger-fetchai.aea`_`ledger`_`fetchai.`_`cosmos Cosmos module wrapping the public and private key cryptography and ledger api. - + + ## DataEncrypt Objects ```python @@ -12,47 +14,52 @@ class DataEncrypt() Class to encrypt/decrypt data strings with password provided. - + + #### encrypt ```python - | @classmethod - | encrypt(cls, data: bytes, password: str) -> bytes +@classmethod +def encrypt(cls, data: bytes, password: str) -> bytes ``` Encrypt data with password. - + + #### bytes`_`encode ```python - | @staticmethod - | bytes_encode(data: bytes) -> str +@staticmethod +def bytes_encode(data: bytes) -> str ``` Encode bytes to ascii friendly string. - + + #### bytes`_`decode ```python - | @staticmethod - | bytes_decode(data: str) -> bytes +@staticmethod +def bytes_decode(data: str) -> bytes ``` Decode ascii friendly string to bytes. - + + #### decrypt ```python - | @classmethod - | decrypt(cls, encrypted_data: bytes, password: str) -> bytes +@classmethod +def decrypt(cls, encrypted_data: bytes, password: str) -> bytes ``` Decrypt data with password provided. - + + ## CosmosHelper Objects ```python @@ -61,12 +68,13 @@ class CosmosHelper(Helper) Helper class usable as Mixin for CosmosApi or as standalone class. - + + #### is`_`transaction`_`settled ```python - | @staticmethod - | is_transaction_settled(tx_receipt: JSONLike) -> bool +@staticmethod +def is_transaction_settled(tx_receipt: JSONLike) -> bool ``` Check whether a transaction is settled or not. @@ -79,12 +87,13 @@ Check whether a transaction is settled or not. True if the transaction has been settled, False o/w. - + + #### get`_`code`_`id ```python - | @classmethod - | get_code_id(cls, tx_receipt: JSONLike) -> Optional[int] +@classmethod +def get_code_id(cls, tx_receipt: JSONLike) -> Optional[int] ``` Retrieve the `code_id` from a transaction receipt. @@ -97,12 +106,13 @@ Retrieve the `code_id` from a transaction receipt. the code id, if present - + + #### get`_`event`_`attributes ```python - | @staticmethod - | get_event_attributes(tx_receipt: JSONLike) -> Dict +@staticmethod +def get_event_attributes(tx_receipt: JSONLike) -> Dict ``` Retrieve events attributes from tx receipt. @@ -115,12 +125,13 @@ Retrieve events attributes from tx receipt. dict - + + #### get`_`contract`_`address ```python - | @classmethod - | get_contract_address(cls, tx_receipt: JSONLike) -> Optional[str] +@classmethod +def get_contract_address(cls, tx_receipt: JSONLike) -> Optional[str] ``` Retrieve the `contract_address` from a transaction receipt. @@ -133,12 +144,14 @@ Retrieve the `contract_address` from a transaction receipt. the contract address, if present - + + #### is`_`transaction`_`valid ```python - | @staticmethod - | is_transaction_valid(tx: JSONLike, seller: Address, client: Address, tx_nonce: str, amount: int) -> bool +@staticmethod +def is_transaction_valid(tx: JSONLike, seller: Address, client: Address, + tx_nonce: str, amount: int) -> bool ``` Check whether a transaction is valid or not. @@ -155,12 +168,13 @@ Check whether a transaction is valid or not. True if the random_message is equals to tx['input'] - + + #### generate`_`tx`_`nonce ```python - | @staticmethod - | generate_tx_nonce(seller: Address, client: Address) -> str +@staticmethod +def generate_tx_nonce(seller: Address, client: Address) -> str ``` Generate a unique hash to distinguish transactions with the same terms. @@ -174,12 +188,13 @@ Generate a unique hash to distinguish transactions with the same terms. return the hash in hex. - + + #### get`_`address`_`from`_`public`_`key ```python - | @classmethod - | get_address_from_public_key(cls, public_key: str) -> str +@classmethod +def get_address_from_public_key(cls, public_key: str) -> str ``` Get the address from the public key. @@ -192,12 +207,16 @@ Get the address from the public key. str - + + #### recover`_`message ```python - | @classmethod - | recover_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[Address, ...] +@classmethod +def recover_message(cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[Address, ...] ``` Recover the addresses from the hash. @@ -212,12 +231,17 @@ Recover the addresses from the hash. the recovered addresses - + + #### recover`_`public`_`keys`_`from`_`message ```python - | @classmethod - | recover_public_keys_from_message(cls, message: bytes, signature: str, is_deprecated_mode: bool = False) -> Tuple[str, ...] +@classmethod +def recover_public_keys_from_message( + cls, + message: bytes, + signature: str, + is_deprecated_mode: bool = False) -> Tuple[str, ...] ``` Get the public key used to produce the `signature` of the `message` @@ -232,12 +256,13 @@ Get the public key used to produce the `signature` of the `message` the recovered public keys - + + #### get`_`hash ```python - | @staticmethod - | get_hash(message: bytes) -> str +@staticmethod +def get_hash(message: bytes) -> str ``` Get the hash of a message. @@ -250,12 +275,13 @@ Get the hash of a message. the hash of the message. - + + #### is`_`valid`_`address ```python - | @classmethod - | is_valid_address(cls, address: Address) -> bool +@classmethod +def is_valid_address(cls, address: Address) -> bool ``` Check if the address is valid. @@ -268,12 +294,13 @@ Check if the address is valid. whether address is valid or not - + + #### load`_`contract`_`interface ```python - | @classmethod - | load_contract_interface(cls, file_path: Path) -> Dict[str, str] +@classmethod +def load_contract_interface(cls, file_path: Path) -> Dict[str, str] ``` Load contract interface. @@ -286,7 +313,8 @@ Load contract interface. the interface - + + ## CosmosCrypto Objects ```python @@ -295,11 +323,13 @@ class CosmosCrypto(Crypto[SigningKey]) Class wrapping the Account Generation from Ethereum ledger. - + + #### `__`init`__` ```python - | __init__(private_key_path: Optional[str] = None, password: Optional[str] = None) -> None +def __init__(private_key_path: Optional[str] = None, + password: Optional[str] = None) -> None ``` Instantiate an ethereum crypto object. @@ -309,12 +339,13 @@ Instantiate an ethereum crypto object. - `private_key_path`: the private key path of the agent - `password`: the password to encrypt/decrypt the private key. - + + #### private`_`key ```python - | @property - | private_key() -> str +@property +def private_key() -> str ``` Return a private key. @@ -323,12 +354,13 @@ Return a private key. a private key string - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Return a public key in hex format. @@ -337,12 +369,13 @@ Return a public key in hex format. a public key string in hex format - + + #### address ```python - | @property - | address() -> str +@property +def address() -> str ``` Return the address for the key pair. @@ -351,12 +384,15 @@ Return the address for the key pair. a display_address str - + + #### load`_`private`_`key`_`from`_`path ```python - | @classmethod - | load_private_key_from_path(cls, file_name: str, password: Optional[str] = None) -> SigningKey +@classmethod +def load_private_key_from_path(cls, + file_name: str, + password: Optional[str] = None) -> SigningKey ``` Load a private key in hex format from a file. @@ -370,11 +406,12 @@ Load a private key in hex format from a file. the Entity. - + + #### sign`_`message ```python - | sign_message(message: bytes, is_deprecated_mode: bool = False) -> str +def sign_message(message: bytes, is_deprecated_mode: bool = False) -> str ``` Sign a message in bytes string form. @@ -388,11 +425,12 @@ Sign a message in bytes string form. signature of the message in string form - + + #### sign`_`transaction ```python - | sign_transaction(transaction: JSONLike) -> JSONLike +def sign_transaction(transaction: JSONLike) -> JSONLike ``` Sign a transaction in bytes string form. @@ -405,21 +443,23 @@ Sign a transaction in bytes string form. signed transaction - + + #### generate`_`private`_`key ```python - | @classmethod - | generate_private_key(cls) -> SigningKey +@classmethod +def generate_private_key(cls) -> SigningKey ``` Generate a key pair for cosmos network. - + + #### encrypt ```python - | encrypt(password: str) -> str +def encrypt(password: str) -> str ``` Encrypt the private key and return in json. @@ -432,12 +472,13 @@ Encrypt the private key and return in json. json string containing encrypted private key. - + + #### decrypt ```python - | @classmethod - | decrypt(cls, keyfile_json: str, password: str) -> str +@classmethod +def decrypt(cls, keyfile_json: str, password: str) -> str ``` Decrypt the private key and return in raw form. @@ -451,7 +492,8 @@ Decrypt the private key and return in raw form. the raw private key. - + + ## `_`CosmosApi Objects ```python @@ -460,39 +502,44 @@ class _CosmosApi(LedgerApi) Class to interact with the Cosmos SDK via a HTTP APIs. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize the Cosmos ledger APIs. - + + #### api ```python - | @property - | api() -> Any +@property +def api() -> Any ``` Get the underlying API object. - + + #### get`_`balance ```python - | get_balance(address: Address) -> Optional[int] +def get_balance(address: Address) -> Optional[int] ``` Get the balance of a given account. - + + #### get`_`state ```python - | get_state(callable_name: str, *args: Any, **kwargs: Any) -> Optional[JSONLike] +def get_state(callable_name: str, *args: Any, + **kwargs: Any) -> Optional[JSONLike] ``` Call a specified function on the ledger API. @@ -512,11 +559,14 @@ as the callable_name and the rest of the path as args. the transaction dictionary - + + #### get`_`deploy`_`transaction ```python - | get_deploy_transaction(contract_interface: Dict[str, str], deployer_address: Address, **kwargs: Any, ,) -> Optional[JSONLike] +def get_deploy_transaction(contract_interface: Dict[str, str], + deployer_address: Address, + **kwargs: Any) -> Optional[JSONLike] ``` Get the transaction to deploy the smart contract. @@ -533,11 +583,24 @@ Dispatches to _get_storage_transaction and _get_init_transaction based on kwargs the transaction dictionary. - + + #### get`_`handle`_`transaction ```python - | get_handle_transaction(sender_address: Address, contract_address: Address, handle_msg: Any, amount: int, tx_fee: int, denom: Optional[str] = None, gas: int = DEFAULT_GAS_AMOUNT, memo: str = "", chain_id: Optional[str] = None, account_number: Optional[int] = None, sequence: Optional[int] = None, tx_fee_denom: Optional[str] = None) -> Optional[JSONLike] +def get_handle_transaction( + sender_address: Address, + contract_address: Address, + handle_msg: Any, + amount: int, + tx_fee: int, + denom: Optional[str] = None, + gas: int = DEFAULT_GAS_AMOUNT, + memo: str = "", + chain_id: Optional[str] = None, + account_number: Optional[int] = None, + sequence: Optional[int] = None, + tx_fee_denom: Optional[str] = None) -> Optional[JSONLike] ``` Create a CosmWasm HandleMsg transaction. @@ -561,11 +624,13 @@ Create a CosmWasm HandleMsg transaction. the unsigned CosmWasm HandleMsg - + + #### execute`_`contract`_`query ```python - | execute_contract_query(contract_address: Address, query_msg: JSONLike) -> Optional[JSONLike] +def execute_contract_query(contract_address: Address, + query_msg: JSONLike) -> Optional[JSONLike] ``` Execute a CosmWasm QueryMsg. QueryMsg doesn't require signing. @@ -579,11 +644,24 @@ Execute a CosmWasm QueryMsg. QueryMsg doesn't require signing. the message receipt - + + #### get`_`transfer`_`transaction ```python - | get_transfer_transaction(sender_address: Address, destination_address: Address, amount: int, tx_fee: int, tx_nonce: str, denom: Optional[str] = None, gas: int = DEFAULT_GAS_AMOUNT, memo: str = "", chain_id: Optional[str] = None, account_number: Optional[int] = None, sequence: Optional[int] = None, tx_fee_denom: Optional[str] = None, **kwargs: Any, ,) -> Optional[JSONLike] +def get_transfer_transaction(sender_address: Address, + destination_address: Address, + amount: int, + tx_fee: int, + tx_nonce: str, + denom: Optional[str] = None, + gas: int = DEFAULT_GAS_AMOUNT, + memo: str = "", + chain_id: Optional[str] = None, + account_number: Optional[int] = None, + sequence: Optional[int] = None, + tx_fee_denom: Optional[str] = None, + **kwargs: Any) -> Optional[JSONLike] ``` Submit a transfer transaction to the ledger. @@ -608,11 +686,16 @@ Submit a transfer transaction to the ledger. the transfer transaction - + + #### get`_`packed`_`exec`_`msg ```python - | get_packed_exec_msg(sender_address: Address, contract_address: str, msg: JSONLike, funds: int = 0, denom: Optional[str] = None) -> ProtoAny +def get_packed_exec_msg(sender_address: Address, + contract_address: str, + msg: JSONLike, + funds: int = 0, + denom: Optional[str] = None) -> ProtoAny ``` Create and pack MsgExecuteContract @@ -629,11 +712,15 @@ Create and pack MsgExecuteContract Packed MsgExecuteContract - + + #### get`_`packed`_`send`_`msg ```python - | get_packed_send_msg(from_address: Address, to_address: Address, amount: int, denom: Optional[str] = None) -> ProtoAny +def get_packed_send_msg(from_address: Address, + to_address: Address, + amount: int, + denom: Optional[str] = None) -> ProtoAny ``` Generate and pack MsgSend @@ -649,11 +736,20 @@ Generate and pack MsgSend packer ProtoAny type message - + + #### get`_`multi`_`transaction ```python - | get_multi_transaction(from_addresses: List[str], pub_keys: Optional[List[bytes]], msgs: List[ProtoAny], gas: int, tx_fee: int = 0, memo: str = "", chain_id: Optional[str] = None, denom: Optional[str] = None, tx_fee_denom: Optional[str] = None) -> JSONLike +def get_multi_transaction(from_addresses: List[str], + pub_keys: Optional[List[bytes]], + msgs: List[ProtoAny], + gas: int, + tx_fee: int = 0, + memo: str = "", + chain_id: Optional[str] = None, + denom: Optional[str] = None, + tx_fee_denom: Optional[str] = None) -> JSONLike ``` Generate transaction with multiple messages @@ -670,17 +766,20 @@ Generate transaction with multiple messages - `denom`: the denomination of tx fee - `tx_fee_denom`: Denomination of tx_fee, identical with denom param when None -:raises: RuntimeError if number of pubkeys is not equal to number of from_addresses +**Raises**: + +- `None`: RuntimeError if number of pubkeys is not equal to number of from_addresses **Returns**: the transaction - + + #### send`_`signed`_`transaction ```python - | send_signed_transaction(tx_signed: JSONLike) -> Optional[str] +def send_signed_transaction(tx_signed: JSONLike) -> Optional[str] ``` Send a signed transaction and wait for confirmation. @@ -693,11 +792,12 @@ Send a signed transaction and wait for confirmation. tx_digest, if present - + + #### get`_`transaction`_`receipt ```python - | get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] +def get_transaction_receipt(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction receipt for a transaction digest. @@ -710,11 +810,12 @@ Get the transaction receipt for a transaction digest. the tx receipt, if present - + + #### get`_`transaction ```python - | get_transaction(tx_digest: str) -> Optional[JSONLike] +def get_transaction(tx_digest: str) -> Optional[JSONLike] ``` Get the transaction for a transaction digest. @@ -727,11 +828,13 @@ Get the transaction for a transaction digest. the tx, if present - + + #### get`_`contract`_`instance ```python - | get_contract_instance(contract_interface: Dict[str, str], contract_address: Optional[str] = None) -> Any +def get_contract_instance(contract_interface: Dict[str, str], + contract_address: Optional[str] = None) -> Any ``` Get the instance of a contract. @@ -745,11 +848,12 @@ Get the instance of a contract. the contract instance - + + #### update`_`with`_`gas`_`estimate ```python - | update_with_gas_estimate(transaction: JSONLike) -> JSONLike +def update_with_gas_estimate(transaction: JSONLike) -> JSONLike ``` Attempts to update the transaction with a gas estimate @@ -757,18 +861,23 @@ Attempts to update the transaction with a gas estimate **Arguments**: - `transaction`: the transaction -:raises: NotImplementedError - +**Raises**: + +- `None`: NotImplementedError + + + ## CosmosApi Objects ```python -class CosmosApi(_CosmosApi, CosmosHelper) +class CosmosApi(_CosmosApi, CosmosHelper) ``` Class to interact with the Cosmos SDK via a HTTP APIs. - + + ## CosmosFaucetApi Objects ```python @@ -777,20 +886,23 @@ class CosmosFaucetApi(FaucetApi) Cosmos testnet faucet API. - + + #### `__`init`__` ```python - | __init__(poll_interval: Optional[float] = None, final_wait_interval: Optional[float] = None) +def __init__(poll_interval: Optional[float] = None, + final_wait_interval: Optional[float] = None) ``` Initialize CosmosFaucetApi. - + + #### get`_`wealth ```python - | get_wealth(address: Address, url: Optional[str] = None) -> None +def get_wealth(address: Address, url: Optional[str] = None) -> None ``` Get wealth from the faucet for the provided address. @@ -799,5 +911,8 @@ Get wealth from the faucet for the provided address. - `address`: the address. - `url`: the url -:raises: RuntimeError of explicit faucet failures + +**Raises**: + +- `None`: RuntimeError of explicit faucet failures diff --git a/docs/api/plugins/aea_ledger_fetchai/fetchai.md b/docs/api/plugins/aea_ledger_fetchai/fetchai.md index 8bff79a609..72467df6c3 100644 --- a/docs/api/plugins/aea_ledger_fetchai/fetchai.md +++ b/docs/api/plugins/aea_ledger_fetchai/fetchai.md @@ -1,9 +1,11 @@ - + + # plugins.aea-ledger-fetchai.aea`_`ledger`_`fetchai.fetchai Fetchai module wrapping the public and private key cryptography and ledger api. - + + ## FetchAIHelper Objects ```python @@ -12,7 +14,8 @@ class FetchAIHelper(CosmosHelper) Helper class usable as Mixin for FetchAIApi or as standalone class. - + + ## FetchAICrypto Objects ```python @@ -21,25 +24,28 @@ class FetchAICrypto(CosmosCrypto) Class wrapping the Entity Generation from Fetch.AI ledger. - + + ## FetchAIApi Objects ```python -class FetchAIApi(_CosmosApi, FetchAIHelper) +class FetchAIApi(_CosmosApi, FetchAIHelper) ``` Class to interact with the Fetch ledger APIs. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize the Fetch.ai ledger APIs. - + + ## FetchAIFaucetApi Objects ```python diff --git a/docs/api/protocols/base.md b/docs/api/protocols/base.md index 21e70e892f..889f02a489 100644 --- a/docs/api/protocols/base.md +++ b/docs/api/protocols/base.md @@ -1,9 +1,11 @@ - + + # aea.protocols.base This module contains the base message and serialization definition. - + + ## Message Objects ```python @@ -12,7 +14,8 @@ class Message() This class implements a message. - + + ## Performative Objects ```python @@ -21,20 +24,22 @@ class Performative(Enum) Performatives for the base message. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`init`__` ```python - | __init__(_body: Optional[Dict] = None, **kwargs: Any) -> None +def __init__(_body: Optional[Dict] = None, **kwargs: Any) -> None ``` Initialize a Message object. @@ -44,140 +49,154 @@ Initialize a Message object. - `_body`: the dictionary of values to hold. - `kwargs`: any additional value to add to the body. It will overwrite the body values. - + + #### json ```python - | json() -> dict +def json() -> dict ``` Get json friendly str representation of the message. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, data: dict) -> "Message" +@classmethod +def from_json(cls, data: dict) -> "Message" ``` Construct message instance from json data. - + + #### valid`_`performatives ```python - | @property - | valid_performatives() -> Set[str] +@property +def valid_performatives() -> Set[str] ``` Get valid performatives. - + + #### has`_`sender ```python - | @property - | has_sender() -> bool +@property +def has_sender() -> bool ``` Check if it has a sender. - + + #### sender ```python - | @property - | sender() -> Address +@property +def sender() -> Address ``` Get the sender of the message in Address form. - + + #### sender ```python - | @sender.setter - | sender(sender: Address) -> None +@sender.setter +def sender(sender: Address) -> None ``` Set the sender of the message. - + + #### has`_`to ```python - | @property - | has_to() -> bool +@property +def has_to() -> bool ``` Check if it has a sender. - + + #### to ```python - | @property - | to() -> Address +@property +def to() -> Address ``` Get address of receiver. - + + #### to ```python - | @to.setter - | to(to: Address) -> None +@to.setter +def to(to: Address) -> None ``` Set address of receiver. - + + #### dialogue`_`reference ```python - | @property - | dialogue_reference() -> Tuple[str, str] +@property +def dialogue_reference() -> Tuple[str, str] ``` Get the dialogue_reference of the message. - + + #### message`_`id ```python - | @property - | message_id() -> int +@property +def message_id() -> int ``` Get the message_id of the message. - + + #### performative ```python - | @property - | performative() -> "Performative" +@property +def performative() -> "Performative" ``` Get the performative of the message. - + + #### target ```python - | @property - | target() -> int +@property +def target() -> int ``` Get the target of the message. - + + #### set ```python - | set(key: str, value: Any) -> None +def set(key: str, value: Any) -> None ``` Set key and value pair. @@ -187,76 +206,84 @@ Set key and value pair. - `key`: the key. - `value`: the value. - + + #### get ```python - | get(key: str) -> Optional[Any] +def get(key: str) -> Optional[Any] ``` Get value for key. - + + #### is`_`set ```python - | is_set(key: str) -> bool +def is_set(key: str) -> bool ``` Check value is set for key. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Compare with another object. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get the representation of the message. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation of the message. Abbreviated to prevent spamming of logs. - + + #### encode ```python - | encode() -> bytes +def encode() -> bytes ``` Encode the message. - + + #### decode ```python - | @classmethod - | decode(cls, data: bytes) -> "Message" +@classmethod +def decode(cls, data: bytes) -> "Message" ``` Decode the message. - + + #### has`_`dialogue`_`info ```python - | @property - | has_dialogue_info() -> bool +@property +def has_dialogue_info() -> bool ``` Check whether a message has the dialogue fields populated. @@ -268,7 +295,8 @@ More precisely, it checks whether the fields 'message_id', True if the message has the dialogue fields set, False otherwise. - + + ## Encoder Objects ```python @@ -277,13 +305,14 @@ class Encoder(ABC) Encoder interface. - + + #### encode ```python - | @staticmethod - | @abstractmethod - | encode(msg: Message) -> bytes +@staticmethod +@abstractmethod +def encode(msg: Message) -> bytes ``` Encode a message. @@ -296,7 +325,8 @@ Encode a message. the encoded message. - + + ## Decoder Objects ```python @@ -305,13 +335,14 @@ class Decoder(ABC) Decoder interface. - + + #### decode ```python - | @staticmethod - | @abstractmethod - | decode(obj: bytes) -> Message +@staticmethod +@abstractmethod +def decode(obj: bytes) -> Message ``` Decode a message. @@ -324,16 +355,18 @@ Decode a message. the decoded message. - + + ## Serializer Objects ```python -class Serializer(Encoder, Decoder, ABC) +class Serializer(Encoder, Decoder, ABC) ``` The implementations of this class defines a serialization layer for a protocol. - + + ## Protocol Objects ```python @@ -344,11 +377,13 @@ This class implements a specifications for a protocol. It includes a serializer to encode/decode a message. - + + #### `__`init`__` ```python - | __init__(configuration: ProtocolConfig, message_class: Type[Message], **kwargs: Any) -> None +def __init__(configuration: ProtocolConfig, message_class: Type[Message], + **kwargs: Any) -> None ``` Initialize the protocol manager. @@ -359,22 +394,24 @@ Initialize the protocol manager. - `message_class`: the message class. - `kwargs`: the keyword arguments. - + + #### serializer ```python - | @property - | serializer() -> Type[Serializer] +@property +def serializer() -> Type[Serializer] ``` Get the serializer. - + + #### from`_`dir ```python - | @classmethod - | from_dir(cls, directory: str, **kwargs: Any) -> "Protocol" +@classmethod +def from_dir(cls, directory: str, **kwargs: Any) -> "Protocol" ``` Load the protocol from a directory. @@ -388,12 +425,14 @@ Load the protocol from a directory. the protocol object. - + + #### from`_`config ```python - | @classmethod - | from_config(cls, configuration: ProtocolConfig, **kwargs: Any) -> "Protocol" +@classmethod +def from_config(cls, configuration: ProtocolConfig, + **kwargs: Any) -> "Protocol" ``` Load the protocol from configuration. @@ -407,31 +446,34 @@ Load the protocol from configuration. the protocol object. - + + #### protocol`_`id ```python - | @property - | protocol_id() -> PublicId +@property +def protocol_id() -> PublicId ``` Get protocol id. - + + #### protocol`_`specification`_`id ```python - | @property - | protocol_specification_id() -> PublicId +@property +def protocol_specification_id() -> PublicId ``` Get protocol specification id. - + + #### `__`repr`__` ```python - | __repr__() -> str +def __repr__() -> str ``` Get str representation of the protocol. diff --git a/docs/api/protocols/default/custom_types.md b/docs/api/protocols/default/custom_types.md index a04d763ba2..10263b6d6e 100644 --- a/docs/api/protocols/default/custom_types.md +++ b/docs/api/protocols/default/custom_types.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.default.custom`_`types This module contains class representations corresponding to every custom type in the protocol specification. - + + ## ErrorCode Objects ```python @@ -12,12 +14,14 @@ class ErrorCode(Enum) This class represents an instance of ErrorCode. - + + #### encode ```python - | @staticmethod - | encode(error_code_protobuf_object: Any, error_code_object: "ErrorCode") -> None +@staticmethod +def encode(error_code_protobuf_object: Any, + error_code_object: "ErrorCode") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -29,12 +33,13 @@ The protocol buffer object in the error_code_protobuf_object argument is matched - `error_code_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `error_code_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, error_code_protobuf_object: Any) -> "ErrorCode" +@classmethod +def decode(cls, error_code_protobuf_object: Any) -> "ErrorCode" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. diff --git a/docs/api/protocols/default/dialogues.md b/docs/api/protocols/default/dialogues.md index e0822d1578..c29fdbc82e 100644 --- a/docs/api/protocols/default/dialogues.md +++ b/docs/api/protocols/default/dialogues.md @@ -1,4 +1,5 @@ - + + # packages.fetchai.protocols.default.dialogues This module contains the classes required for default dialogue management. @@ -6,7 +7,8 @@ This module contains the classes required for default dialogue management. - DefaultDialogue: The dialogue class maintains state of a dialogue and manages it. - DefaultDialogues: The dialogues class keeps track of all dialogues. - + + ## DefaultDialogue Objects ```python @@ -15,7 +17,8 @@ class DefaultDialogue(Dialogue) The default dialogue class maintains state of a dialogue and manages it. - + + ## Role Objects ```python @@ -24,7 +27,8 @@ class Role(Dialogue.Role) This class defines the agent's role in a default dialogue. - + + ## EndState Objects ```python @@ -33,11 +37,15 @@ class EndState(Dialogue.EndState) This class defines the end states of a default dialogue. - + + #### `__`init`__` ```python - | __init__(dialogue_label: DialogueLabel, self_address: Address, role: Dialogue.Role, message_class: Type[DefaultMessage] = DefaultMessage) -> None +def __init__(dialogue_label: DialogueLabel, + self_address: Address, + role: Dialogue.Role, + message_class: Type[DefaultMessage] = DefaultMessage) -> None ``` Initialize a dialogue. @@ -49,20 +57,25 @@ Initialize a dialogue. - `role`: the role of the agent this dialogue is maintained for - `message_class`: the message class used - + + ## DefaultDialogues Objects ```python -class DefaultDialogues(Dialogues, ABC) +class DefaultDialogues(Dialogues, ABC) ``` This class keeps track of all default dialogues. - + + #### `__`init`__` ```python - | __init__(self_address: Address, role_from_first_message: Callable[[Message, Address], Dialogue.Role], dialogue_class: Type[DefaultDialogue] = DefaultDialogue) -> None +def __init__(self_address: Address, + role_from_first_message: Callable[[Message, Address], + Dialogue.Role], + dialogue_class: Type[DefaultDialogue] = DefaultDialogue) -> None ``` Initialize dialogues. diff --git a/docs/api/protocols/default/message.md b/docs/api/protocols/default/message.md index 42aefc1d20..80f6196479 100644 --- a/docs/api/protocols/default/message.md +++ b/docs/api/protocols/default/message.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.default.message This module contains default's message definition. - + + ## DefaultMessage Objects ```python @@ -12,7 +14,8 @@ class DefaultMessage(Message) A protocol for exchanging any bytes message. - + + ## Performative Objects ```python @@ -21,20 +24,26 @@ class Performative(Message.Performative) Performatives for the default protocol. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`init`__` ```python - | __init__(performative: Performative, dialogue_reference: Tuple[str, str] = ("", ""), message_id: int = 1, target: int = 0, **kwargs: Any, ,) +def __init__(performative: Performative, + dialogue_reference: Tuple[str, str] = ("", ""), + message_id: int = 1, + target: int = 0, + **kwargs: Any) ``` Initialise an instance of DefaultMessage. @@ -45,94 +54,103 @@ Initialise an instance of DefaultMessage. - `dialogue_reference`: the dialogue reference. - `target`: the message target. - `performative`: the message performative. -:param **kwargs: extra options. +- `**kwargs`: extra options. + + - #### valid`_`performatives ```python - | @property - | valid_performatives() -> Set[str] +@property +def valid_performatives() -> Set[str] ``` Get valid performatives. - + + #### dialogue`_`reference ```python - | @property - | dialogue_reference() -> Tuple[str, str] +@property +def dialogue_reference() -> Tuple[str, str] ``` Get the dialogue_reference of the message. - + + #### message`_`id ```python - | @property - | message_id() -> int +@property +def message_id() -> int ``` Get the message_id of the message. - + + #### performative ```python - | @property - | performative() -> Performative +@property +def performative() -> Performative ``` Get the performative of the message. - + + #### target ```python - | @property - | target() -> int +@property +def target() -> int ``` Get the target of the message. - + + #### content ```python - | @property - | content() -> bytes +@property +def content() -> bytes ``` Get the 'content' content from the message. - + + #### error`_`code ```python - | @property - | error_code() -> CustomErrorCode +@property +def error_code() -> CustomErrorCode ``` Get the 'error_code' content from the message. - + + #### error`_`data ```python - | @property - | error_data() -> Dict[str, bytes] +@property +def error_data() -> Dict[str, bytes] ``` Get the 'error_data' content from the message. - + + #### error`_`msg ```python - | @property - | error_msg() -> str +@property +def error_msg() -> str ``` Get the 'error_msg' content from the message. diff --git a/docs/api/protocols/default/serialization.md b/docs/api/protocols/default/serialization.md index b33aba41e1..03a0010f41 100644 --- a/docs/api/protocols/default/serialization.md +++ b/docs/api/protocols/default/serialization.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.default.serialization Serialization module for default protocol. - + + ## DefaultSerializer Objects ```python @@ -12,12 +14,13 @@ class DefaultSerializer(Serializer) Serialization for the 'default' protocol. - + + #### encode ```python - | @staticmethod - | encode(msg: Message) -> bytes +@staticmethod +def encode(msg: Message) -> bytes ``` Encode a 'Default' message into bytes. @@ -30,12 +33,13 @@ Encode a 'Default' message into bytes. the bytes. - + + #### decode ```python - | @staticmethod - | decode(obj: bytes) -> Message +@staticmethod +def decode(obj: bytes) -> Message ``` Decode bytes into a 'Default' message. diff --git a/docs/api/protocols/dialogue/base.md b/docs/api/protocols/dialogue/base.md index 84b3a3449a..7809722096 100644 --- a/docs/api/protocols/dialogue/base.md +++ b/docs/api/protocols/dialogue/base.md @@ -1,4 +1,5 @@ - + + # aea.protocols.dialogue.base This module contains the classes required for dialogue management. @@ -7,7 +8,8 @@ This module contains the classes required for dialogue management. - Dialogue: The dialogue class maintains state of a dialogue and manages it. - Dialogues: The dialogues class keeps track of all dialogues. - + + ## InvalidDialogueMessage Objects ```python @@ -16,7 +18,8 @@ class InvalidDialogueMessage(Exception) Exception for adding invalid message to a dialogue. - + + ## DialogueLabel Objects ```python @@ -25,11 +28,14 @@ class DialogueLabel() The dialogue label class acts as an identifier for dialogues. - + + #### `__`init`__` ```python - | __init__(dialogue_reference: Tuple[str, str], dialogue_opponent_addr: Address, dialogue_starter_addr: Address) -> None +def __init__(dialogue_reference: Tuple[str, + str], dialogue_opponent_addr: Address, + dialogue_starter_addr: Address) -> None ``` Initialize a dialogue label. @@ -40,123 +46,136 @@ Initialize a dialogue label. - `dialogue_opponent_addr`: the addr of the agent with which the dialogue is kept. - `dialogue_starter_addr`: the addr of the agent which started the dialogue. - + + #### dialogue`_`reference ```python - | @property - | dialogue_reference() -> Tuple[str, str] +@property +def dialogue_reference() -> Tuple[str, str] ``` Get the dialogue reference. - + + #### dialogue`_`starter`_`reference ```python - | @property - | dialogue_starter_reference() -> str +@property +def dialogue_starter_reference() -> str ``` Get the dialogue starter reference. - + + #### dialogue`_`responder`_`reference ```python - | @property - | dialogue_responder_reference() -> str +@property +def dialogue_responder_reference() -> str ``` Get the dialogue responder reference. - + + #### dialogue`_`opponent`_`addr ```python - | @property - | dialogue_opponent_addr() -> str +@property +def dialogue_opponent_addr() -> str ``` Get the address of the dialogue opponent. - + + #### dialogue`_`starter`_`addr ```python - | @property - | dialogue_starter_addr() -> str +@property +def dialogue_starter_addr() -> str ``` Get the address of the dialogue starter. - + + #### `__`eq`__` ```python - | __eq__(other: Any) -> bool +def __eq__(other: Any) -> bool ``` Check for equality between two DialogueLabel objects. - + + #### `__`hash`__` ```python - | __hash__() -> int +def __hash__() -> int ``` Turn object into hash. - + + #### json ```python - | @property - | json() -> Dict +@property +def json() -> Dict ``` Return the JSON representation. - + + #### from`_`json ```python - | @classmethod - | from_json(cls, obj: Dict[str, str]) -> "DialogueLabel" +@classmethod +def from_json(cls, obj: Dict[str, str]) -> "DialogueLabel" ``` Get dialogue label from json. - + + #### get`_`incomplete`_`version ```python - | get_incomplete_version() -> "DialogueLabel" +def get_incomplete_version() -> "DialogueLabel" ``` Get the incomplete version of the label. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### from`_`str ```python - | @classmethod - | from_str(cls, obj: str) -> "DialogueLabel" +@classmethod +def from_str(cls, obj: str) -> "DialogueLabel" ``` Get the dialogue label from string representation. - + + ## `_`DialogueMeta Objects ```python @@ -167,1013 +186,17 @@ Metaclass for Dialogue. Creates class level Rules instance to share among instances - + + #### `__`new`__` ```python - | __new__(cls, name: str, bases: Tuple[Type], dct: Dict) -> "_DialogueMeta" +def __new__(cls, name: str, bases: Tuple[Type], dct: Dict) -> "_DialogueMeta" ``` Construct a new type. - -## Dialogue Objects - -```python -class Dialogue(, metaclass=_DialogueMeta) -``` - -The dialogue class maintains state of a dialogue and manages it. - - -## Rules Objects - -```python -class Rules() -``` - -This class defines the rules for the dialogue. - - -#### `__`init`__` - -```python - | __init__(initial_performatives: FrozenSet[Message.Performative], terminal_performatives: FrozenSet[Message.Performative], valid_replies: Dict[Message.Performative, FrozenSet[Message.Performative]]) -> None -``` - -Initialize a dialogue. - -**Arguments**: - -- `initial_performatives`: the set of all initial performatives. -- `terminal_performatives`: the set of all terminal performatives. -- `valid_replies`: the reply structure of speech-acts. - - -#### initial`_`performatives - -```python - | @property - | initial_performatives() -> FrozenSet[Message.Performative] -``` - -Get the performatives one of which the terminal message in the dialogue must have. - -**Returns**: - -the valid performatives of an terminal message - - -#### terminal`_`performatives - -```python - | @property - | terminal_performatives() -> FrozenSet[Message.Performative] -``` - -Get the performatives one of which the terminal message in the dialogue must have. - -**Returns**: - -the valid performatives of an terminal message - - -#### valid`_`replies - -```python - | @property - | valid_replies() -> Dict[Message.Performative, FrozenSet[Message.Performative]] -``` - -Get all the valid performatives which are a valid replies to performatives. - -**Returns**: - -the full valid reply structure. - - -#### get`_`valid`_`replies - -```python - | get_valid_replies(performative: Message.Performative) -> FrozenSet[Message.Performative] -``` - -Given a `performative`, return the list of performatives which are its valid replies in a dialogue. - -**Arguments**: - -- `performative`: the performative in a message - -**Returns**: - -list of valid performative replies - - -## Role Objects - -```python -class Role(Enum) -``` - -This class defines the agent's role in a dialogue. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation. - - -## EndState Objects - -```python -class EndState(Enum) -``` - -This class defines the end states of a dialogue. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation. - - -#### `__`init`__` - -```python - | __init__(dialogue_label: DialogueLabel, message_class: Type[Message], self_address: Address, role: Role) -> None -``` - -Initialize a dialogue. - -**Arguments**: - -- `dialogue_label`: the identifier of the dialogue -- `message_class`: the message class used -- `self_address`: the address of the entity for whom this dialogue is maintained -- `role`: the role of the agent this dialogue is maintained for - - -#### add`_`terminal`_`state`_`callback - -```python - | add_terminal_state_callback(fn: Callable[["Dialogue"], None]) -> None -``` - -Add callback to be called on dialogue reach terminal state. - -**Arguments**: - -- `fn`: callable to be called with one argument: Dialogue - - -#### `__`eq`__` - -```python - | __eq__(other: Any) -> bool -``` - -Compare two dialogues. - - -#### json - -```python - | json() -> dict -``` - -Get json representation of the dialogue. - - -#### from`_`json - -```python - | @classmethod - | from_json(cls, message_class: Type[Message], data: dict) -> "Dialogue" -``` - -Create a dialogue instance with all messages from json data. - -**Arguments**: - -- `message_class`: type of message used with this dialogue -- `data`: dict with data exported with Dialogue.to_json() method - -**Returns**: - -Dialogue instance - - -#### dialogue`_`label - -```python - | @property - | dialogue_label() -> DialogueLabel -``` - -Get the dialogue label. - -**Returns**: - -The dialogue label - - -#### incomplete`_`dialogue`_`label - -```python - | @property - | incomplete_dialogue_label() -> DialogueLabel -``` - -Get the dialogue label. - -**Returns**: - -The incomplete dialogue label - - -#### dialogue`_`labels - -```python - | @property - | dialogue_labels() -> Set[DialogueLabel] -``` - -Get the dialogue labels (incomplete and complete, if it exists). - -**Returns**: - -the dialogue labels - - -#### self`_`address - -```python - | @property - | self_address() -> Address -``` - -Get the address of the entity for whom this dialogues is maintained. - -**Returns**: - -the address of this entity - - -#### role - -```python - | @property - | role() -> "Role" -``` - -Get the agent's role in the dialogue. - -**Returns**: - -the agent's role - - -#### rules - -```python - | @property - | rules() -> "Rules" -``` - -Get the dialogue rules. - -**Returns**: - -the rules - - -#### message`_`class - -```python - | @property - | message_class() -> Type[Message] -``` - -Get the message class. - -**Returns**: - -the message class - - -#### is`_`self`_`initiated - -```python - | @property - | is_self_initiated() -> bool -``` - -Check whether the agent initiated the dialogue. - -**Returns**: - -True if the agent initiated the dialogue, False otherwise - - -#### last`_`incoming`_`message - -```python - | @property - | last_incoming_message() -> Optional[Message] -``` - -Get the last incoming message. - -**Returns**: - -the last incoming message if it exists, None otherwise - - -#### last`_`outgoing`_`message - -```python - | @property - | last_outgoing_message() -> Optional[Message] -``` - -Get the last outgoing message. - -**Returns**: - -the last outgoing message if it exists, None otherwise - - -#### last`_`message - -```python - | @property - | last_message() -> Optional[Message] -``` - -Get the last message. - -**Returns**: - -the last message if it exists, None otherwise - - -#### is`_`empty - -```python - | @property - | is_empty() -> bool -``` - -Check whether the dialogue is empty. - -**Returns**: - -True if empty, False otherwise - - -#### reply - -```python - | reply(performative: Message.Performative, target_message: Optional[Message] = None, target: Optional[int] = None, **kwargs: Any, ,) -> Message -``` - -Reply to the 'target_message' in this dialogue with a message with 'performative', and contents from kwargs. - -Note if no target_message is provided, the last message in the dialogue will be replied to. - -**Arguments**: - -- `target_message`: the message to reply to. -- `target`: the id of the message to reply to. -- `performative`: the performative of the reply message. -- `kwargs`: the content of the reply message. - -**Returns**: - -the reply message if it was successfully added as a reply, None otherwise. - - -#### get`_`message`_`by`_`id - -```python - | get_message_by_id(message_id: int) -> Optional[Message] -``` - -Get message by id, if not presents return None. - - -#### get`_`outgoing`_`next`_`message`_`id - -```python - | get_outgoing_next_message_id() -> int -``` - -Get next outgoing message id. - - -#### get`_`incoming`_`next`_`message`_`id - -```python - | get_incoming_next_message_id() -> int -``` - -Get next incoming message id. - - -#### `__`str`__` - -```python - | __str__() -> str -``` - -Get the string representation. - -**Returns**: - -The string representation of the dialogue - - -## DialogueStats Objects - -```python -class DialogueStats() -``` - -Class to handle statistics on default dialogues. + - -#### `__`init`__` - -```python - | __init__(end_states: FrozenSet[Dialogue.EndState]) -> None -``` - -Initialize a StatsManager. - -**Arguments**: - -- `end_states`: the list of dialogue endstates - - -#### self`_`initiated - -```python - | @property - | self_initiated() -> Dict[Dialogue.EndState, int] -``` - -Get the stats dictionary on self initiated dialogues. - - -#### other`_`initiated - -```python - | @property - | other_initiated() -> Dict[Dialogue.EndState, int] -``` - -Get the stats dictionary on other initiated dialogues. - - -#### add`_`dialogue`_`endstate - -```python - | add_dialogue_endstate(end_state: Dialogue.EndState, is_self_initiated: bool) -> None -``` - -Add dialogue endstate stats. - -**Arguments**: - -- `end_state`: the end state of the dialogue -- `is_self_initiated`: whether the dialogue is initiated by the agent or the opponent - - -#### find`_`caller`_`object - -```python -find_caller_object(object_type: Type) -> Any -``` - -Find caller object of certain type in the call stack. - - -## BasicDialoguesStorage Objects - -```python -class BasicDialoguesStorage() -``` - -Dialogues state storage. - - -#### `__`init`__` - -```python - | __init__(dialogues: "Dialogues") -> None -``` - -Init dialogues storage. - - -#### dialogues`_`in`_`terminal`_`state - -```python - | @property - | dialogues_in_terminal_state() -> List["Dialogue"] -``` - -Get all dialogues in terminal state. - - -#### dialogues`_`in`_`active`_`state - -```python - | @property - | dialogues_in_active_state() -> List["Dialogue"] -``` - -Get all dialogues in active state. - - -#### is`_`terminal`_`dialogues`_`kept - -```python - | @property - | is_terminal_dialogues_kept() -> bool -``` - -Return True if dialogues should stay after terminal state. - - -#### dialogue`_`terminal`_`state`_`callback - -```python - | dialogue_terminal_state_callback(dialogue: "Dialogue") -> None -``` - -Method to be called on dialogue terminal state reached. - - -#### setup - -```python - | setup() -> None -``` - -Set up dialogue storage. - - -#### teardown - -```python - | teardown() -> None -``` - -Tear down dialogue storage. - - -#### add - -```python - | add(dialogue: Dialogue) -> None -``` - -Add dialogue to storage. - -**Arguments**: - -- `dialogue`: dialogue to add. - - -#### remove - -```python - | remove(dialogue_label: DialogueLabel) -> None -``` - -Remove dialogue from storage by it's label. - -**Arguments**: - -- `dialogue_label`: label of the dialogue to remove - - -#### get - -```python - | get(dialogue_label: DialogueLabel) -> Optional[Dialogue] -``` - -Get dialogue stored by it's label. - -**Arguments**: - -- `dialogue_label`: label of the dialogue - -**Returns**: - -dialogue if presents or None - - -#### get`_`dialogues`_`with`_`counterparty - -```python - | get_dialogues_with_counterparty(counterparty: Address) -> List[Dialogue] -``` - -Get the dialogues by address. - -**Arguments**: - -- `counterparty`: the counterparty - -**Returns**: - -The dialogues with the counterparty. - - -#### is`_`in`_`incomplete - -```python - | is_in_incomplete(dialogue_label: DialogueLabel) -> bool -``` - -Check dialogue label presents in list of incomplete. - - -#### set`_`incomplete`_`dialogue - -```python - | set_incomplete_dialogue(incomplete_dialogue_label: DialogueLabel, complete_dialogue_label: DialogueLabel) -> None -``` - -Set incomplete dialogue label. - - -#### is`_`dialogue`_`present - -```python - | is_dialogue_present(dialogue_label: DialogueLabel) -> bool -``` - -Check dialogue with label specified presents in storage. - - -#### get`_`latest`_`label - -```python - | get_latest_label(dialogue_label: DialogueLabel) -> DialogueLabel -``` - -Get latest label for dialogue. - - -## PersistDialoguesStorage Objects - -```python -class PersistDialoguesStorage(BasicDialoguesStorage) -``` - -Persist dialogues storage. - -Uses generic storage to load/save dialogues data on setup/teardown. - - -#### `__`init`__` - -```python - | __init__(dialogues: "Dialogues") -> None -``` - -Init dialogues storage. - - -#### get`_`skill`_`component - -```python - | @staticmethod - | get_skill_component() -> Optional[SkillComponent] -``` - -Get skill component dialogues storage constructed for. - - -#### setup - -```python - | setup() -> None -``` - -Set up dialogue storage. - - -#### teardown - -```python - | teardown() -> None -``` - -Tear down dialogue storage. - - -#### remove - -```python - | remove(dialogue_label: DialogueLabel) -> None -``` - -Remove dialogue from memory and persistent storage. - - -## PersistDialoguesStorageWithOffloading Objects - -```python -class PersistDialoguesStorageWithOffloading(PersistDialoguesStorage) -``` - -Dialogue Storage with dialogues offloading. - - -#### dialogue`_`terminal`_`state`_`callback - -```python - | dialogue_terminal_state_callback(dialogue: "Dialogue") -> None -``` - -Call on dialogue reaches terminal state. - - -#### get - -```python - | get(dialogue_label: DialogueLabel) -> Optional[Dialogue] -``` - -Try to get dialogue by label from memory or persists storage. - - -#### get`_`dialogues`_`with`_`counterparty - -```python - | get_dialogues_with_counterparty(counterparty: Address) -> List[Dialogue] -``` - -Get the dialogues by address. - -**Arguments**: - -- `counterparty`: the counterparty - -**Returns**: - -The dialogues with the counterparty. - - -#### dialogues`_`in`_`terminal`_`state - -```python - | @property - | dialogues_in_terminal_state() -> List["Dialogue"] -``` - -Get all dialogues in terminal state. - - -## Dialogues Objects - -```python -class Dialogues() -``` - -The dialogues class keeps track of all dialogues for an agent. - - -#### `__`init`__` - -```python - | __init__(self_address: Address, end_states: FrozenSet[Dialogue.EndState], message_class: Type[Message], dialogue_class: Type[Dialogue], role_from_first_message: Callable[[Message, Address], Dialogue.Role], keep_terminal_state_dialogues: Optional[bool] = None) -> None -``` - -Initialize dialogues. - -**Arguments**: - -- `self_address`: the address of the entity for whom dialogues are maintained -- `end_states`: the list of dialogue endstates -- `message_class`: the message class used -- `dialogue_class`: the dialogue class used -- `role_from_first_message`: the callable determining role from first message -- `keep_terminal_state_dialogues`: specify do dialogues in terminal state should stay or not - - -#### is`_`keep`_`dialogues`_`in`_`terminal`_`state - -```python - | @property - | is_keep_dialogues_in_terminal_state() -> bool -``` - -Is required to keep dialogues in terminal state. - - -#### self`_`address - -```python - | @property - | self_address() -> Address -``` - -Get the address of the agent for whom dialogues are maintained. - - -#### dialogue`_`stats - -```python - | @property - | dialogue_stats() -> DialogueStats -``` - -Get the dialogue statistics. - -**Returns**: - -dialogue stats object - - -#### message`_`class - -```python - | @property - | message_class() -> Type[Message] -``` - -Get the message class. - -**Returns**: - -the message class - - -#### dialogue`_`class - -```python - | @property - | dialogue_class() -> Type[Dialogue] -``` - -Get the dialogue class. - -**Returns**: - -the dialogue class - - -#### get`_`dialogues`_`with`_`counterparty - -```python - | get_dialogues_with_counterparty(counterparty: Address) -> List[Dialogue] -``` - -Get the dialogues by address. - -**Arguments**: - -- `counterparty`: the counterparty - -**Returns**: - -The dialogues with the counterparty. - - -#### new`_`self`_`initiated`_`dialogue`_`reference - -```python - | @classmethod - | new_self_initiated_dialogue_reference(cls) -> Tuple[str, str] -``` - -Return a dialogue label for a new self initiated dialogue. - -**Returns**: - -the next nonce - - -#### create - -```python - | create(counterparty: Address, performative: Message.Performative, **kwargs: Any, ,) -> Tuple[Message, Dialogue] -``` - -Create a dialogue with 'counterparty', with an initial message whose performative is 'performative' and contents are from 'kwargs'. - -**Arguments**: - -- `counterparty`: the counterparty of the dialogue. -- `performative`: the performative of the initial message. -- `kwargs`: the content of the initial message. - -**Returns**: - -the initial message and the dialogue. - - -#### create`_`with`_`message - -```python - | create_with_message(counterparty: Address, initial_message: Message) -> Dialogue -``` - -Create a dialogue with 'counterparty', with an initial message provided. - -**Arguments**: - -- `counterparty`: the counterparty of the dialogue. -- `initial_message`: the initial_message. - -**Returns**: - -the initial message and the dialogue. - - -#### update - -```python - | update(message: Message) -> Optional[Dialogue] -``` - -Update the state of dialogues with a new incoming message. - -If the message is for a new dialogue, a new dialogue is created with 'message' as its first message, and returned. -If the message is addressed to an existing dialogue, the dialogue is retrieved, extended with this message and returned. -If there are any errors, e.g. the message dialogue reference does not exists or the message is invalid w.r.t. the dialogue, return None. - -**Arguments**: - -- `message`: a new incoming message - -**Returns**: - -the new or existing dialogue the message is intended for, or None in case of any errors. - - -#### get`_`dialogue - -```python - | get_dialogue(message: Message) -> Optional[Dialogue] -``` - -Retrieve the dialogue 'message' belongs to. - -**Arguments**: - -- `message`: a message - -**Returns**: - -the dialogue, or None in case such a dialogue does not exist - - -#### get`_`dialogue`_`from`_`label - -```python - | get_dialogue_from_label(dialogue_label: DialogueLabel) -> Optional[Dialogue] -``` - -Retrieve a dialogue based on its label. - -**Arguments**: - -- `dialogue_label`: the dialogue label - -**Returns**: - -the dialogue if present - - -#### setup - -```python - | setup() -> None -``` - -Set up. - - -#### teardown - -```python - | teardown() -> None -``` - -Tear down. +## Dialogue Objects diff --git a/docs/api/protocols/generator/base.md b/docs/api/protocols/generator/base.md index d6f8d884e1..e69de29bb2 100644 --- a/docs/api/protocols/generator/base.md +++ b/docs/api/protocols/generator/base.md @@ -1,108 +0,0 @@ - -# aea.protocols.generator.base - -This module contains the protocol generator. - - -## ProtocolGenerator Objects - -```python -class ProtocolGenerator() -``` - -This class generates a protocol_verification package from a ProtocolTemplate object. - - -#### `__`init`__` - -```python - | __init__(path_to_protocol_specification: str, output_path: str = ".", dotted_path_to_protocol_package: Optional[str] = None) -> None -``` - -Instantiate a protocol generator. - -**Arguments**: - -- `path_to_protocol_specification`: path to protocol specification file -- `output_path`: the path to the location in which the protocol module is to be generated. -- `dotted_path_to_protocol_package`: the path to the protocol package - -:raises FileNotFoundError if any prerequisite application is not installed -:raises yaml.YAMLError if yaml parser encounters an error condition -:raises ProtocolSpecificationParseError if specification fails generator's validation - - -#### generate`_`protobuf`_`only`_`mode - -```python - | generate_protobuf_only_mode(language: str = PROTOCOL_LANGUAGE_PYTHON, run_protolint: bool = True) -> Optional[str] -``` - -Run the generator in "protobuf only" mode: - -a) validate the protocol specification. -b) create the protocol buffer schema file. -c) create the protocol buffer implementation file via 'protoc'. - -**Arguments**: - -- `language`: the target language in which to generate the package. -- `run_protolint`: whether to run protolint or not. - -**Returns**: - -None - - -#### generate`_`full`_`mode - -```python - | generate_full_mode(language: str) -> Optional[str] -``` - -Run the generator in "full" mode: - -Runs the generator in protobuf only mode: -a) validate the protocol specification. -b) create the protocol buffer schema file. -c) create the protocol buffer implementation file via 'protoc'. -Additionally: -d) generates python modules. -e) applies black formatting -f) applies isort formatting - -**Arguments**: - -- `language`: the language for which to create protobuf files - -**Returns**: - -optional warning message - - -#### generate - -```python - | generate(protobuf_only: bool = False, language: str = PROTOCOL_LANGUAGE_PYTHON) -> Optional[str] -``` - -Run the generator either in "full" or "protobuf only" mode. - -**Arguments**: - -- `protobuf_only`: mode of running the generator. -- `language`: the target language in which to generate the protocol package. - -**Returns**: - -optional warning message. - - -#### public`_`id`_`to`_`package`_`name - -```python -public_id_to_package_name(public_id: PublicId) -> str -``` - -Make package name string from public_id provided. - diff --git a/docs/api/protocols/generator/common.md b/docs/api/protocols/generator/common.md index 6407e85d99..4e2244f6b8 100644 --- a/docs/api/protocols/generator/common.md +++ b/docs/api/protocols/generator/common.md @@ -1,13 +1,15 @@ - + + # aea.protocols.generator.common This module contains utility code for generator modules. - + + #### is`_`installed ```python -is_installed(programme: str) -> bool +def is_installed(programme: str) -> bool ``` Check whether a programme is installed on the system. @@ -20,11 +22,12 @@ Check whether a programme is installed on the system. True if installed, False otherwise - + + #### base`_`protolint`_`command ```python -base_protolint_command() -> str +def base_protolint_command() -> str ``` Return the base protolint command. @@ -33,29 +36,33 @@ Return the base protolint command. The base protolint command - + + #### check`_`prerequisites ```python -check_prerequisites() -> None +def check_prerequisites() -> None ``` Check whether a programme is installed on the system. - + + #### get`_`protoc`_`version ```python -get_protoc_version() -> str +def get_protoc_version() -> str ``` Get the protoc version used. - + + #### load`_`protocol`_`specification ```python -load_protocol_specification(specification_path: str) -> ProtocolSpecification +def load_protocol_specification( + specification_path: str) -> ProtocolSpecification ``` Load a protocol specification. @@ -68,11 +75,12 @@ Load a protocol specification. A ProtocolSpecification object - + + #### try`_`run`_`black`_`formatting ```python -try_run_black_formatting(path_to_protocol_package: str) -> None +def try_run_black_formatting(path_to_protocol_package: str) -> None ``` Run Black code formatting via subprocess. @@ -81,11 +89,12 @@ Run Black code formatting via subprocess. - `path_to_protocol_package`: a path where formatting should be applied. - + + #### try`_`run`_`isort`_`formatting ```python -try_run_isort_formatting(path_to_protocol_package: str) -> None +def try_run_isort_formatting(path_to_protocol_package: str) -> None ``` Run Isort code formatting via subprocess. @@ -94,11 +103,14 @@ Run Isort code formatting via subprocess. - `path_to_protocol_package`: a path where formatting should be applied. - + + #### try`_`run`_`protoc ```python -try_run_protoc(path_to_generated_protocol_package: str, name: str, language: str = PROTOCOL_LANGUAGE_PYTHON) -> None +def try_run_protoc(path_to_generated_protocol_package: str, + name: str, + language: str = PROTOCOL_LANGUAGE_PYTHON) -> None ``` Run 'protoc' protocol buffer compiler via subprocess. @@ -109,11 +121,13 @@ Run 'protoc' protocol buffer compiler via subprocess. - `name`: name of the protocol buffer schema file. - `language`: the target language in which to compile the protobuf schema file - + + #### try`_`run`_`protolint ```python -try_run_protolint(path_to_generated_protocol_package: str, name: str) -> None +def try_run_protolint(path_to_generated_protocol_package: str, + name: str) -> None ``` Run 'protolint' linter via subprocess. @@ -123,11 +137,13 @@ Run 'protolint' linter via subprocess. - `path_to_generated_protocol_package`: path to the protocol buffer schema file. - `name`: name of the protocol buffer schema file. - + + #### check`_`protobuf`_`using`_`protoc ```python -check_protobuf_using_protoc(path_to_generated_protocol_package: str, name: str) -> Tuple[bool, str] +def check_protobuf_using_protoc(path_to_generated_protocol_package: str, + name: str) -> Tuple[bool, str] ``` Check whether a protocol buffer schema file is valid. @@ -144,11 +160,14 @@ If valid, return True and a 'protobuf file is valid' message, otherwise return F Boolean result and an accompanying message - + + #### compile`_`protobuf`_`using`_`protoc ```python -compile_protobuf_using_protoc(path_to_generated_protocol_package: str, name: str, language: str) -> Tuple[bool, str] +def compile_protobuf_using_protoc(path_to_generated_protocol_package: str, + name: str, + language: str) -> Tuple[bool, str] ``` Compile a protocol buffer schema file using protoc. @@ -166,11 +185,12 @@ otherwise return False and the error thrown by the compiler. Boolean result and an accompanying message - + + #### apply`_`protolint ```python -apply_protolint(path_to_proto_file: str, name: str) -> Tuple[bool, str] +def apply_protolint(path_to_proto_file: str, name: str) -> Tuple[bool, str] ``` Apply protolint linter to a protocol buffer schema file. diff --git a/docs/api/protocols/generator/extract_specification.md b/docs/api/protocols/generator/extract_specification.md index afe2e0987b..86662759de 100644 --- a/docs/api/protocols/generator/extract_specification.md +++ b/docs/api/protocols/generator/extract_specification.md @@ -1,9 +1,11 @@ - + + # aea.protocols.generator.extract`_`specification This module extracts a valid protocol specification into pythonic objects. - + + ## PythonicProtocolSpecification Objects ```python @@ -12,20 +14,24 @@ class PythonicProtocolSpecification() This class represents a protocol specification in python. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Instantiate a Pythonic protocol specification. - + + #### extract ```python -extract(protocol_specification: ProtocolSpecification) -> PythonicProtocolSpecification +def extract( + protocol_specification: ProtocolSpecification +) -> PythonicProtocolSpecification ``` Converts a protocol specification into a Pythonic protocol specification. diff --git a/docs/api/protocols/generator/validate.md b/docs/api/protocols/generator/validate.md index fca871cea0..c7895c092b 100644 --- a/docs/api/protocols/generator/validate.md +++ b/docs/api/protocols/generator/validate.md @@ -1,13 +1,16 @@ - + + # aea.protocols.generator.validate This module validates a protocol specification. - + + #### validate ```python -validate(protocol_specification: ProtocolSpecification) -> Tuple[bool, str] +def validate( + protocol_specification: ProtocolSpecification) -> Tuple[bool, str] ``` Evaluate whether a protocol specification is valid. diff --git a/docs/api/protocols/signing/custom_types.md b/docs/api/protocols/signing/custom_types.md index b5933f114b..3b3dbc7560 100644 --- a/docs/api/protocols/signing/custom_types.md +++ b/docs/api/protocols/signing/custom_types.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.signing.custom`_`types This module contains class representations corresponding to every custom type in the protocol specification. - + + ## ErrorCode Objects ```python @@ -12,12 +14,14 @@ class ErrorCode(Enum) This class represents an instance of ErrorCode. - + + #### encode ```python - | @staticmethod - | encode(error_code_protobuf_object: Any, error_code_object: "ErrorCode") -> None +@staticmethod +def encode(error_code_protobuf_object: Any, + error_code_object: "ErrorCode") -> None ``` Encode an instance of this class into the protocol buffer object. @@ -29,12 +33,13 @@ The protocol buffer object in the error_code_protobuf_object argument is matched - `error_code_protobuf_object`: the protocol buffer object whose type corresponds with this class. - `error_code_object`: an instance of this class to be encoded in the protocol buffer object. - + + #### decode ```python - | @classmethod - | decode(cls, error_code_protobuf_object: Any) -> "ErrorCode" +@classmethod +def decode(cls, error_code_protobuf_object: Any) -> "ErrorCode" ``` Decode a protocol buffer object that corresponds with this class into an instance of this class. diff --git a/docs/api/protocols/signing/dialogues.md b/docs/api/protocols/signing/dialogues.md index 9a571c010c..e6108f51d5 100644 --- a/docs/api/protocols/signing/dialogues.md +++ b/docs/api/protocols/signing/dialogues.md @@ -1,4 +1,5 @@ - + + # packages.fetchai.protocols.signing.dialogues This module contains the classes required for signing dialogue management. @@ -6,7 +7,8 @@ This module contains the classes required for signing dialogue management. - SigningDialogue: The dialogue class maintains state of a dialogue and manages it. - SigningDialogues: The dialogues class keeps track of all dialogues. - + + ## SigningDialogue Objects ```python @@ -15,7 +17,8 @@ class SigningDialogue(Dialogue) The signing dialogue class maintains state of a dialogue and manages it. - + + ## Role Objects ```python @@ -24,7 +27,8 @@ class Role(Dialogue.Role) This class defines the agent's role in a signing dialogue. - + + ## EndState Objects ```python @@ -33,11 +37,15 @@ class EndState(Dialogue.EndState) This class defines the end states of a signing dialogue. - + + #### `__`init`__` ```python - | __init__(dialogue_label: DialogueLabel, self_address: Address, role: Dialogue.Role, message_class: Type[SigningMessage] = SigningMessage) -> None +def __init__(dialogue_label: DialogueLabel, + self_address: Address, + role: Dialogue.Role, + message_class: Type[SigningMessage] = SigningMessage) -> None ``` Initialize a dialogue. @@ -49,20 +57,25 @@ Initialize a dialogue. - `role`: the role of the agent this dialogue is maintained for - `message_class`: the message class used - + + ## SigningDialogues Objects ```python -class SigningDialogues(Dialogues, ABC) +class SigningDialogues(Dialogues, ABC) ``` This class keeps track of all signing dialogues. - + + #### `__`init`__` ```python - | __init__(self_address: Address, role_from_first_message: Callable[[Message, Address], Dialogue.Role], dialogue_class: Type[SigningDialogue] = SigningDialogue) -> None +def __init__(self_address: Address, + role_from_first_message: Callable[[Message, Address], + Dialogue.Role], + dialogue_class: Type[SigningDialogue] = SigningDialogue) -> None ``` Initialize dialogues. diff --git a/docs/api/protocols/signing/message.md b/docs/api/protocols/signing/message.md index 6a65dbbb4a..eccb09669a 100644 --- a/docs/api/protocols/signing/message.md +++ b/docs/api/protocols/signing/message.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.signing.message This module contains signing's message definition. - + + ## SigningMessage Objects ```python @@ -12,7 +14,8 @@ class SigningMessage(Message) A protocol for communication between skills and decision maker. - + + ## Performative Objects ```python @@ -21,20 +24,26 @@ class Performative(Message.Performative) Performatives for the signing protocol. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`init`__` ```python - | __init__(performative: Performative, dialogue_reference: Tuple[str, str] = ("", ""), message_id: int = 1, target: int = 0, **kwargs: Any, ,) +def __init__(performative: Performative, + dialogue_reference: Tuple[str, str] = ("", ""), + message_id: int = 1, + target: int = 0, + **kwargs: Any) ``` Initialise an instance of SigningMessage. @@ -45,114 +54,125 @@ Initialise an instance of SigningMessage. - `dialogue_reference`: the dialogue reference. - `target`: the message target. - `performative`: the message performative. -:param **kwargs: extra options. +- `**kwargs`: extra options. + + - #### valid`_`performatives ```python - | @property - | valid_performatives() -> Set[str] +@property +def valid_performatives() -> Set[str] ``` Get valid performatives. - + + #### dialogue`_`reference ```python - | @property - | dialogue_reference() -> Tuple[str, str] +@property +def dialogue_reference() -> Tuple[str, str] ``` Get the dialogue_reference of the message. - + + #### message`_`id ```python - | @property - | message_id() -> int +@property +def message_id() -> int ``` Get the message_id of the message. - + + #### performative ```python - | @property - | performative() -> Performative +@property +def performative() -> Performative ``` Get the performative of the message. - + + #### target ```python - | @property - | target() -> int +@property +def target() -> int ``` Get the target of the message. - + + #### error`_`code ```python - | @property - | error_code() -> CustomErrorCode +@property +def error_code() -> CustomErrorCode ``` Get the 'error_code' content from the message. - + + #### raw`_`message ```python - | @property - | raw_message() -> CustomRawMessage +@property +def raw_message() -> CustomRawMessage ``` Get the 'raw_message' content from the message. - + + #### raw`_`transaction ```python - | @property - | raw_transaction() -> CustomRawTransaction +@property +def raw_transaction() -> CustomRawTransaction ``` Get the 'raw_transaction' content from the message. - + + #### signed`_`message ```python - | @property - | signed_message() -> CustomSignedMessage +@property +def signed_message() -> CustomSignedMessage ``` Get the 'signed_message' content from the message. - + + #### signed`_`transaction ```python - | @property - | signed_transaction() -> CustomSignedTransaction +@property +def signed_transaction() -> CustomSignedTransaction ``` Get the 'signed_transaction' content from the message. - + + #### terms ```python - | @property - | terms() -> CustomTerms +@property +def terms() -> CustomTerms ``` Get the 'terms' content from the message. diff --git a/docs/api/protocols/signing/serialization.md b/docs/api/protocols/signing/serialization.md index eaeb9ca5a1..f1274f3f88 100644 --- a/docs/api/protocols/signing/serialization.md +++ b/docs/api/protocols/signing/serialization.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.signing.serialization Serialization module for signing protocol. - + + ## SigningSerializer Objects ```python @@ -12,12 +14,13 @@ class SigningSerializer(Serializer) Serialization for the 'signing' protocol. - + + #### encode ```python - | @staticmethod - | encode(msg: Message) -> bytes +@staticmethod +def encode(msg: Message) -> bytes ``` Encode a 'Signing' message into bytes. @@ -30,12 +33,13 @@ Encode a 'Signing' message into bytes. the bytes. - + + #### decode ```python - | @staticmethod - | decode(obj: bytes) -> Message +@staticmethod +def decode(obj: bytes) -> Message ``` Decode bytes into a 'Signing' message. diff --git a/docs/api/protocols/state_update/dialogues.md b/docs/api/protocols/state_update/dialogues.md index 73dd9a3cf6..cfba64c888 100644 --- a/docs/api/protocols/state_update/dialogues.md +++ b/docs/api/protocols/state_update/dialogues.md @@ -1,4 +1,5 @@ - + + # packages.fetchai.protocols.state`_`update.dialogues This module contains the classes required for state_update dialogue management. @@ -6,7 +7,8 @@ This module contains the classes required for state_update dialogue management. - StateUpdateDialogue: The dialogue class maintains state of a dialogue and manages it. - StateUpdateDialogues: The dialogues class keeps track of all dialogues. - + + ## StateUpdateDialogue Objects ```python @@ -15,7 +17,8 @@ class StateUpdateDialogue(Dialogue) The state_update dialogue class maintains state of a dialogue and manages it. - + + ## Role Objects ```python @@ -24,7 +27,8 @@ class Role(Dialogue.Role) This class defines the agent's role in a state_update dialogue. - + + ## EndState Objects ```python @@ -33,11 +37,16 @@ class EndState(Dialogue.EndState) This class defines the end states of a state_update dialogue. - + + #### `__`init`__` ```python - | __init__(dialogue_label: DialogueLabel, self_address: Address, role: Dialogue.Role, message_class: Type[StateUpdateMessage] = StateUpdateMessage) -> None +def __init__( + dialogue_label: DialogueLabel, + self_address: Address, + role: Dialogue.Role, + message_class: Type[StateUpdateMessage] = StateUpdateMessage) -> None ``` Initialize a dialogue. @@ -49,20 +58,26 @@ Initialize a dialogue. - `role`: the role of the agent this dialogue is maintained for - `message_class`: the message class used - + + ## StateUpdateDialogues Objects ```python -class StateUpdateDialogues(Dialogues, ABC) +class StateUpdateDialogues(Dialogues, ABC) ``` This class keeps track of all state_update dialogues. - + + #### `__`init`__` ```python - | __init__(self_address: Address, role_from_first_message: Callable[[Message, Address], Dialogue.Role], dialogue_class: Type[StateUpdateDialogue] = StateUpdateDialogue) -> None +def __init__( + self_address: Address, + role_from_first_message: Callable[[Message, Address], Dialogue.Role], + dialogue_class: Type[StateUpdateDialogue] = StateUpdateDialogue +) -> None ``` Initialize dialogues. diff --git a/docs/api/protocols/state_update/message.md b/docs/api/protocols/state_update/message.md index f0d35f9794..841aff4d08 100644 --- a/docs/api/protocols/state_update/message.md +++ b/docs/api/protocols/state_update/message.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.state`_`update.message This module contains state_update's message definition. - + + ## StateUpdateMessage Objects ```python @@ -12,7 +14,8 @@ class StateUpdateMessage(Message) A protocol for state updates to the decision maker state. - + + ## Performative Objects ```python @@ -21,20 +24,26 @@ class Performative(Message.Performative) Performatives for the state_update protocol. - + + #### `__`str`__` ```python - | __str__() -> str +def __str__() -> str ``` Get the string representation. - + + #### `__`init`__` ```python - | __init__(performative: Performative, dialogue_reference: Tuple[str, str] = ("", ""), message_id: int = 1, target: int = 0, **kwargs: Any, ,) +def __init__(performative: Performative, + dialogue_reference: Tuple[str, str] = ("", ""), + message_id: int = 1, + target: int = 0, + **kwargs: Any) ``` Initialise an instance of StateUpdateMessage. @@ -45,94 +54,103 @@ Initialise an instance of StateUpdateMessage. - `dialogue_reference`: the dialogue reference. - `target`: the message target. - `performative`: the message performative. -:param **kwargs: extra options. +- `**kwargs`: extra options. + + - #### valid`_`performatives ```python - | @property - | valid_performatives() -> Set[str] +@property +def valid_performatives() -> Set[str] ``` Get valid performatives. - + + #### dialogue`_`reference ```python - | @property - | dialogue_reference() -> Tuple[str, str] +@property +def dialogue_reference() -> Tuple[str, str] ``` Get the dialogue_reference of the message. - + + #### message`_`id ```python - | @property - | message_id() -> int +@property +def message_id() -> int ``` Get the message_id of the message. - + + #### performative ```python - | @property - | performative() -> Performative +@property +def performative() -> Performative ``` Get the performative of the message. - + + #### target ```python - | @property - | target() -> int +@property +def target() -> int ``` Get the target of the message. - + + #### amount`_`by`_`currency`_`id ```python - | @property - | amount_by_currency_id() -> Dict[str, int] +@property +def amount_by_currency_id() -> Dict[str, int] ``` Get the 'amount_by_currency_id' content from the message. - + + #### exchange`_`params`_`by`_`currency`_`id ```python - | @property - | exchange_params_by_currency_id() -> Dict[str, float] +@property +def exchange_params_by_currency_id() -> Dict[str, float] ``` Get the 'exchange_params_by_currency_id' content from the message. - + + #### quantities`_`by`_`good`_`id ```python - | @property - | quantities_by_good_id() -> Dict[str, int] +@property +def quantities_by_good_id() -> Dict[str, int] ``` Get the 'quantities_by_good_id' content from the message. - + + #### utility`_`params`_`by`_`good`_`id ```python - | @property - | utility_params_by_good_id() -> Dict[str, float] +@property +def utility_params_by_good_id() -> Dict[str, float] ``` Get the 'utility_params_by_good_id' content from the message. diff --git a/docs/api/protocols/state_update/serialization.md b/docs/api/protocols/state_update/serialization.md index 0361217700..d0798586ed 100644 --- a/docs/api/protocols/state_update/serialization.md +++ b/docs/api/protocols/state_update/serialization.md @@ -1,9 +1,11 @@ - + + # packages.fetchai.protocols.state`_`update.serialization Serialization module for state_update protocol. - + + ## StateUpdateSerializer Objects ```python @@ -12,12 +14,13 @@ class StateUpdateSerializer(Serializer) Serialization for the 'state_update' protocol. - + + #### encode ```python - | @staticmethod - | encode(msg: Message) -> bytes +@staticmethod +def encode(msg: Message) -> bytes ``` Encode a 'StateUpdate' message into bytes. @@ -30,12 +33,13 @@ Encode a 'StateUpdate' message into bytes. the bytes. - + + #### decode ```python - | @staticmethod - | decode(obj: bytes) -> Message +@staticmethod +def decode(obj: bytes) -> Message ``` Decode bytes into a 'StateUpdate' message. diff --git a/docs/api/registries/base.md b/docs/api/registries/base.md index 75ac3a65eb..cc841b660f 100644 --- a/docs/api/registries/base.md +++ b/docs/api/registries/base.md @@ -1,22 +1,25 @@ - + + # aea.registries.base This module contains registries. - + + ## Registry Objects ```python -class Registry(Generic[ItemId, Item], WithLogger, ABC) +class Registry(Generic[ItemId, Item], WithLogger, ABC) ``` This class implements an abstract registry. - + + #### `__`init`__` ```python - | __init__(agent_name: str = "standalone") -> None +def __init__(agent_name: str = "standalone") -> None ``` Initialize the registry. @@ -25,12 +28,15 @@ Initialize the registry. - `agent_name`: the name of the agent - + + #### register ```python - | @abstractmethod - | register(item_id: ItemId, item: Item, is_dynamically_added: bool = False) -> None +@abstractmethod +def register(item_id: ItemId, + item: Item, + is_dynamically_added: bool = False) -> None ``` Register an item. @@ -41,17 +47,21 @@ Register an item. - `item`: the item. - `is_dynamically_added`: whether or not the item is dynamically added. +**Raises**: + +- `None`: ValueError if an item is already registered with that item id. + **Returns**: None -:raises: ValueError if an item is already registered with that item id. - + + #### unregister ```python - | @abstractmethod - | unregister(item_id: ItemId) -> Optional[Item] +@abstractmethod +def unregister(item_id: ItemId) -> Optional[Item] ``` Unregister an item. @@ -60,17 +70,21 @@ Unregister an item. - `item_id`: the public id of the item. +**Raises**: + +- `None`: ValueError if no item registered with that item id. + **Returns**: the item -:raises: ValueError if no item registered with that item id. - + + #### fetch ```python - | @abstractmethod - | fetch(item_id: ItemId) -> Optional[Item] +@abstractmethod +def fetch(item_id: ItemId) -> Optional[Item] ``` Fetch an item. @@ -83,12 +97,13 @@ Fetch an item. the Item - + + #### fetch`_`all ```python - | @abstractmethod - | fetch_all() -> List[Item] +@abstractmethod +def fetch_all() -> List[Item] ``` Fetch all the items. @@ -97,12 +112,13 @@ Fetch all the items. the list of items. - + + #### ids ```python - | @abstractmethod - | ids() -> Set[ItemId] +@abstractmethod +def ids() -> Set[ItemId] ``` Return the set of all the used item ids. @@ -111,12 +127,13 @@ Return the set of all the used item ids. the set of item ids. - + + #### setup ```python - | @abstractmethod - | setup() -> None +@abstractmethod +def setup() -> None ``` Set up registry. @@ -125,12 +142,13 @@ Set up registry. None - + + #### teardown ```python - | @abstractmethod - | teardown() -> None +@abstractmethod +def teardown() -> None ``` Teardown the registry. @@ -139,11 +157,12 @@ Teardown the registry. None - + + ## PublicIdRegistry Objects ```python -class PublicIdRegistry(Generic[Item], Registry[PublicId, Item]) +class PublicIdRegistry(Generic[Item], Registry[PublicId, Item]) ``` This class implement a registry whose keys are public ids. @@ -151,38 +170,44 @@ This class implement a registry whose keys are public ids. In particular, it is able to handle the case when the public id points to the 'latest' version of a package. - + + #### `__`init`__` ```python - | __init__() -> None +def __init__() -> None ``` Initialize the registry. - + + #### register ```python - | register(public_id: PublicId, item: Item, is_dynamically_added: bool = False) -> None +def register(public_id: PublicId, + item: Item, + is_dynamically_added: bool = False) -> None ``` Register an item. - + + #### unregister ```python - | unregister(public_id: PublicId) -> Item +def unregister(public_id: PublicId) -> Item ``` Unregister an item. - + + #### fetch ```python - | fetch(public_id: PublicId) -> Optional[Item] +def fetch(public_id: PublicId) -> Optional[Item] ``` Fetch an item associated with a public id. @@ -195,43 +220,48 @@ Fetch an item associated with a public id. an item, or None if the key is not present. - + + #### fetch`_`all ```python - | fetch_all() -> List[Item] +def fetch_all() -> List[Item] ``` Fetch all the items. - + + #### ids ```python - | ids() -> Set[PublicId] +def ids() -> Set[PublicId] ``` Get all the item ids. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set up the items. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Tear down the items. - + + ## AgentComponentRegistry Objects ```python @@ -240,11 +270,12 @@ class AgentComponentRegistry(Registry[ComponentId, Component]) This class implements a simple dictionary-based registry for agent components. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Instantiate the registry. @@ -253,11 +284,14 @@ Instantiate the registry. - `kwargs`: kwargs - + + #### register ```python - | register(component_id: ComponentId, component: Component, is_dynamically_added: bool = False) -> None +def register(component_id: ComponentId, + component: Component, + is_dynamically_added: bool = False) -> None ``` Register a component. @@ -268,11 +302,12 @@ Register a component. - `component`: the component object. - `is_dynamically_added`: whether or not the item is dynamically added. - + + #### unregister ```python - | unregister(component_id: ComponentId) -> Optional[Component] +def unregister(component_id: ComponentId) -> Optional[Component] ``` Unregister a component. @@ -285,11 +320,12 @@ Unregister a component. the item - + + #### fetch ```python - | fetch(component_id: ComponentId) -> Optional[Component] +def fetch(component_id: ComponentId) -> Optional[Component] ``` Fetch the component by id. @@ -302,11 +338,12 @@ Fetch the component by id. the component or None if the component is not registered - + + #### fetch`_`all ```python - | fetch_all() -> List[Component] +def fetch_all() -> List[Component] ``` Fetch all the components. @@ -315,11 +352,12 @@ Fetch all the components. the list of registered components. - + + #### fetch`_`by`_`type ```python - | fetch_by_type(component_type: ComponentType) -> List[Component] +def fetch_by_type(component_type: ComponentType) -> List[Component] ``` Fetch all the components by a given type.. @@ -332,48 +370,53 @@ Fetch all the components by a given type.. the list of registered components of a given type. - + + #### ids ```python - | ids() -> Set[ComponentId] +def ids() -> Set[ComponentId] ``` Get the item ids. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set up the registry. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Teardown the registry. - + + ## ComponentRegistry Objects ```python -class ComponentRegistry( - Registry[Tuple[PublicId, str], SkillComponentType], Generic[SkillComponentType]) +class ComponentRegistry(Registry[Tuple[PublicId, str], SkillComponentType], + Generic[SkillComponentType]) ``` This class implements a generic registry for skill components. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Instantiate the registry. @@ -382,11 +425,14 @@ Instantiate the registry. - `kwargs`: kwargs - + + #### register ```python - | register(item_id: Tuple[PublicId, str], item: SkillComponentType, is_dynamically_added: bool = False) -> None +def register(item_id: Tuple[PublicId, str], + item: SkillComponentType, + is_dynamically_added: bool = False) -> None ``` Register a item. @@ -396,13 +442,17 @@ Register a item. - `item_id`: a pair (skill id, item name). - `item`: the item to register. - `is_dynamically_added`: whether or not the item is dynamically added. -:raises: ValueError if an item is already registered with that item id. - +**Raises**: + +- `None`: ValueError if an item is already registered with that item id. + + + #### unregister ```python - | unregister(item_id: Tuple[PublicId, str]) -> Optional[SkillComponentType] +def unregister(item_id: Tuple[PublicId, str]) -> Optional[SkillComponentType] ``` Unregister a item. @@ -411,16 +461,20 @@ Unregister a item. - `item_id`: a pair (skill id, item name). +**Raises**: + +- `None`: ValueError if no item registered with that item id. + **Returns**: skill component -:raises: ValueError if no item registered with that item id. - + + #### fetch ```python - | fetch(item_id: Tuple[PublicId, str]) -> Optional[SkillComponentType] +def fetch(item_id: Tuple[PublicId, str]) -> Optional[SkillComponentType] ``` Fetch an item. @@ -433,61 +487,68 @@ Fetch an item. the Item - + + #### fetch`_`by`_`skill ```python - | fetch_by_skill(skill_id: PublicId) -> List[SkillComponentType] +def fetch_by_skill(skill_id: PublicId) -> List[SkillComponentType] ``` Fetch all the items of a given skill. - + + #### fetch`_`all ```python - | fetch_all() -> List[SkillComponentType] +def fetch_all() -> List[SkillComponentType] ``` Fetch all the items. - + + #### unregister`_`by`_`skill ```python - | unregister_by_skill(skill_id: PublicId) -> None +def unregister_by_skill(skill_id: PublicId) -> None ``` Unregister all the components by skill. - + + #### ids ```python - | ids() -> Set[Tuple[PublicId, str]] +def ids() -> Set[Tuple[PublicId, str]] ``` Get the item ids. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set up the items in the registry. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Teardown the registry. - + + ## HandlerRegistry Objects ```python @@ -496,11 +557,12 @@ class HandlerRegistry(ComponentRegistry[Handler]) This class implements the handlers registry. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Instantiate the registry. @@ -509,11 +571,14 @@ Instantiate the registry. - `kwargs`: kwargs - + + #### register ```python - | register(item_id: Tuple[PublicId, str], item: Handler, is_dynamically_added: bool = False) -> None +def register(item_id: Tuple[PublicId, str], + item: Handler, + is_dynamically_added: bool = False) -> None ``` Register a handler. @@ -528,11 +593,12 @@ Register a handler. - `ValueError`: if the protocol is None, or an item with pair (skill_id, protocol_id_ already exists. - + + #### unregister ```python - | unregister(item_id: Tuple[PublicId, str]) -> Handler +def unregister(item_id: Tuple[PublicId, str]) -> Handler ``` Unregister a item. @@ -541,25 +607,30 @@ Unregister a item. - `item_id`: a pair (skill id, item name). +**Raises**: + +- `None`: ValueError if no item is registered with that item id. + **Returns**: the unregistered handler -:raises: ValueError if no item is registered with that item id. - + + #### unregister`_`by`_`skill ```python - | unregister_by_skill(skill_id: PublicId) -> None +def unregister_by_skill(skill_id: PublicId) -> None ``` Unregister all the components by skill. - + + #### fetch`_`by`_`protocol ```python - | fetch_by_protocol(protocol_id: PublicId) -> List[Handler] +def fetch_by_protocol(protocol_id: PublicId) -> List[Handler] ``` Fetch the handler by the pair protocol id and skill id. @@ -572,11 +643,13 @@ Fetch the handler by the pair protocol id and skill id. the handlers registered for the protocol_id and skill_id - + + #### fetch`_`by`_`protocol`_`and`_`skill ```python - | fetch_by_protocol_and_skill(protocol_id: PublicId, skill_id: PublicId) -> Optional[Handler] +def fetch_by_protocol_and_skill(protocol_id: PublicId, + skill_id: PublicId) -> Optional[Handler] ``` Fetch the handler by the pair protocol id and skill id. diff --git a/docs/api/registries/filter.md b/docs/api/registries/filter.md index d1b1b6e086..a9d6dff0e5 100644 --- a/docs/api/registries/filter.md +++ b/docs/api/registries/filter.md @@ -1,9 +1,11 @@ - + + # aea.registries.filter This module contains registries. - + + ## Filter Objects ```python @@ -12,11 +14,13 @@ class Filter(WithLogger) This class implements the filter of an AEA. - + + #### `__`init`__` ```python - | __init__(resources: Resources, decision_maker_out_queue: AsyncFriendlyQueue) -> None +def __init__(resources: Resources, + decision_maker_out_queue: AsyncFriendlyQueue) -> None ``` Instantiate the filter. @@ -26,31 +30,35 @@ Instantiate the filter. - `resources`: the resources - `decision_maker_out_queue`: the decision maker queue - + + #### resources ```python - | @property - | resources() -> Resources +@property +def resources() -> Resources ``` Get resources. - + + #### decision`_`maker`_`out`_`queue ```python - | @property - | decision_maker_out_queue() -> AsyncFriendlyQueue +@property +def decision_maker_out_queue() -> AsyncFriendlyQueue ``` Get decision maker (out) queue. - + + #### get`_`active`_`handlers ```python - | get_active_handlers(protocol_id: PublicId, skill_id: Optional[PublicId] = None) -> List[Handler] +def get_active_handlers(protocol_id: PublicId, + skill_id: Optional[PublicId] = None) -> List[Handler] ``` Get active handlers based on protocol id and optional skill id. @@ -64,11 +72,12 @@ Get active handlers based on protocol id and optional skill id. the list of handlers currently active - + + #### get`_`active`_`behaviours ```python - | get_active_behaviours() -> List[Behaviour] +def get_active_behaviours() -> List[Behaviour] ``` Get the active behaviours. @@ -77,29 +86,32 @@ Get the active behaviours. the list of behaviours currently active - + + #### handle`_`new`_`handlers`_`and`_`behaviours ```python - | handle_new_handlers_and_behaviours() -> None +def handle_new_handlers_and_behaviours() -> None ``` Handle the messages from the decision maker. - + + #### get`_`internal`_`message ```python - | async get_internal_message() -> Optional[Message] +async def get_internal_message() -> Optional[Message] ``` Get a message from decision_maker_out_queue. - + + #### handle`_`internal`_`message ```python - | handle_internal_message(internal_message: Optional[Message]) -> None +def handle_internal_message(internal_message: Optional[Message]) -> None ``` Handle internal message. diff --git a/docs/api/registries/resources.md b/docs/api/registries/resources.md index 295ce1cf7a..be3c13d1e0 100644 --- a/docs/api/registries/resources.md +++ b/docs/api/registries/resources.md @@ -1,9 +1,11 @@ - + + # aea.registries.resources This module contains the resources class. - + + ## Resources Objects ```python @@ -12,11 +14,12 @@ class Resources() This class implements the object that holds the resources of an AEA. - + + #### `__`init`__` ```python - | __init__(agent_name: str = "standalone") -> None +def __init__(agent_name: str = "standalone") -> None ``` Instantiate the resources. @@ -25,70 +28,77 @@ Instantiate the resources. - `agent_name`: the name of the agent - + + #### agent`_`name ```python - | @property - | agent_name() -> str +@property +def agent_name() -> str ``` Get the agent name. - + + #### component`_`registry ```python - | @property - | component_registry() -> AgentComponentRegistry +@property +def component_registry() -> AgentComponentRegistry ``` Get the agent component registry. - + + #### behaviour`_`registry ```python - | @property - | behaviour_registry() -> ComponentRegistry[Behaviour] +@property +def behaviour_registry() -> ComponentRegistry[Behaviour] ``` Get the behaviour registry. - + + #### handler`_`registry ```python - | @property - | handler_registry() -> HandlerRegistry +@property +def handler_registry() -> HandlerRegistry ``` Get the handler registry. - + + #### model`_`registry ```python - | @property - | model_registry() -> ComponentRegistry[Model] +@property +def model_registry() -> ComponentRegistry[Model] ``` Get the model registry. - + + #### add`_`component ```python - | add_component(component: Component) -> None +def add_component(component: Component) -> None ``` Add a component to resources. - + + #### add`_`protocol ```python - | add_protocol(protocol: Protocol) -> None +def add_protocol(protocol: Protocol) -> None ``` Add a protocol to the set of resources. @@ -97,11 +107,12 @@ Add a protocol to the set of resources. - `protocol`: a protocol - + + #### get`_`protocol ```python - | get_protocol(protocol_id: PublicId) -> Optional[Protocol] +def get_protocol(protocol_id: PublicId) -> Optional[Protocol] ``` Get protocol for given protocol id. @@ -114,11 +125,13 @@ Get protocol for given protocol id. a matching protocol, if present, else None - + + #### get`_`protocol`_`by`_`specification`_`id ```python - | get_protocol_by_specification_id(protocol_specification_id: PublicId) -> Optional[Protocol] +def get_protocol_by_specification_id( + protocol_specification_id: PublicId) -> Optional[Protocol] ``` Get protocol for given protocol_specification_id. @@ -131,11 +144,12 @@ Get protocol for given protocol_specification_id. a matching protocol, if present, else None - + + #### get`_`all`_`protocols ```python - | get_all_protocols() -> List[Protocol] +def get_all_protocols() -> List[Protocol] ``` Get the list of all the protocols. @@ -144,11 +158,12 @@ Get the list of all the protocols. the list of protocols. - + + #### remove`_`protocol ```python - | remove_protocol(protocol_id: PublicId) -> None +def remove_protocol(protocol_id: PublicId) -> None ``` Remove a protocol from the set of resources. @@ -157,11 +172,12 @@ Remove a protocol from the set of resources. - `protocol_id`: the protocol id for the protocol to be removed. - + + #### add`_`contract ```python - | add_contract(contract: Contract) -> None +def add_contract(contract: Contract) -> None ``` Add a contract to the set of resources. @@ -170,11 +186,12 @@ Add a contract to the set of resources. - `contract`: a contract - + + #### get`_`contract ```python - | get_contract(contract_id: PublicId) -> Optional[Contract] +def get_contract(contract_id: PublicId) -> Optional[Contract] ``` Get contract for given contract id. @@ -187,11 +204,12 @@ Get contract for given contract id. a matching contract, if present, else None - + + #### get`_`all`_`contracts ```python - | get_all_contracts() -> List[Contract] +def get_all_contracts() -> List[Contract] ``` Get the list of all the contracts. @@ -200,11 +218,12 @@ Get the list of all the contracts. the list of contracts. - + + #### remove`_`contract ```python - | remove_contract(contract_id: PublicId) -> None +def remove_contract(contract_id: PublicId) -> None ``` Remove a contract from the set of resources. @@ -213,11 +232,12 @@ Remove a contract from the set of resources. - `contract_id`: the contract id for the contract to be removed. - + + #### add`_`connection ```python - | add_connection(connection: Connection) -> None +def add_connection(connection: Connection) -> None ``` Add a connection to the set of resources. @@ -226,11 +246,12 @@ Add a connection to the set of resources. - `connection`: a connection - + + #### get`_`connection ```python - | get_connection(connection_id: PublicId) -> Optional[Connection] +def get_connection(connection_id: PublicId) -> Optional[Connection] ``` Get connection for given connection id. @@ -243,11 +264,12 @@ Get connection for given connection id. a matching connection, if present, else None - + + #### get`_`all`_`connections ```python - | get_all_connections() -> List[Connection] +def get_all_connections() -> List[Connection] ``` Get the list of all the connections. @@ -256,11 +278,12 @@ Get the list of all the connections. the list of connections. - + + #### remove`_`connection ```python - | remove_connection(connection_id: PublicId) -> None +def remove_connection(connection_id: PublicId) -> None ``` Remove a connection from the set of resources. @@ -269,11 +292,12 @@ Remove a connection from the set of resources. - `connection_id`: the connection id for the connection to be removed. - + + #### add`_`skill ```python - | add_skill(skill: Skill) -> None +def add_skill(skill: Skill) -> None ``` Add a skill to the set of resources. @@ -282,11 +306,12 @@ Add a skill to the set of resources. - `skill`: a skill - + + #### get`_`skill ```python - | get_skill(skill_id: PublicId) -> Optional[Skill] +def get_skill(skill_id: PublicId) -> Optional[Skill] ``` Get the skill for a given skill id. @@ -299,11 +324,12 @@ Get the skill for a given skill id. a matching skill, if present, else None - + + #### get`_`all`_`skills ```python - | get_all_skills() -> List[Skill] +def get_all_skills() -> List[Skill] ``` Get the list of all the skills. @@ -312,11 +338,12 @@ Get the list of all the skills. the list of skills. - + + #### remove`_`skill ```python - | remove_skill(skill_id: PublicId) -> None +def remove_skill(skill_id: PublicId) -> None ``` Remove a skill from the set of resources. @@ -325,11 +352,13 @@ Remove a skill from the set of resources. - `skill_id`: the skill id for the skill to be removed. - + + #### get`_`handler ```python - | get_handler(protocol_id: PublicId, skill_id: PublicId) -> Optional[Handler] +def get_handler(protocol_id: PublicId, + skill_id: PublicId) -> Optional[Handler] ``` Get a specific handler. @@ -343,11 +372,12 @@ Get a specific handler. the handler - + + #### get`_`handlers ```python - | get_handlers(protocol_id: PublicId) -> List[Handler] +def get_handlers(protocol_id: PublicId) -> List[Handler] ``` Get all handlers for a given protocol. @@ -360,11 +390,12 @@ Get all handlers for a given protocol. the list of handlers matching the protocol - + + #### get`_`all`_`handlers ```python - | get_all_handlers() -> List[Handler] +def get_all_handlers() -> List[Handler] ``` Get all handlers from all skills. @@ -373,11 +404,13 @@ Get all handlers from all skills. the list of handlers - + + #### get`_`behaviour ```python - | get_behaviour(skill_id: PublicId, behaviour_name: str) -> Optional[Behaviour] +def get_behaviour(skill_id: PublicId, + behaviour_name: str) -> Optional[Behaviour] ``` Get a specific behaviours for a given skill. @@ -391,11 +424,12 @@ Get a specific behaviours for a given skill. the behaviour, if it is present, else None - + + #### get`_`behaviours ```python - | get_behaviours(skill_id: PublicId) -> List[Behaviour] +def get_behaviours(skill_id: PublicId) -> List[Behaviour] ``` Get all behaviours for a given skill. @@ -408,11 +442,12 @@ Get all behaviours for a given skill. the list of behaviours of the skill - + + #### get`_`all`_`behaviours ```python - | get_all_behaviours() -> List[Behaviour] +def get_all_behaviours() -> List[Behaviour] ``` Get all behaviours from all skills. @@ -421,22 +456,24 @@ Get all behaviours from all skills. the list of all behaviours - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set up the resources. Calls setup on all resources. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Teardown the resources. diff --git a/docs/api/runner.md b/docs/api/runner.md index e5b7c77648..1a8c2ff8d6 100644 --- a/docs/api/runner.md +++ b/docs/api/runner.md @@ -1,9 +1,11 @@ - + + # aea.runner This module contains the implementation of AEA multiple instances runner. - + + ## AEAInstanceTask Objects ```python @@ -12,11 +14,12 @@ class AEAInstanceTask(AbstractExecutorTask) Task to run agent instance. - + + #### `__`init`__` ```python - | __init__(agent: AEA) -> None +def __init__(agent: AEA) -> None ``` Init aea instance task. @@ -25,39 +28,43 @@ Init aea instance task. - `agent`: AEA instance to run within task. - + + #### id ```python - | @property - | id() -> str +@property +def id() -> str ``` Return agent name. - + + #### start ```python - | start() -> None +def start() -> None ``` Start task. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop task. - + + #### create`_`async`_`task ```python - | create_async_task(loop: AbstractEventLoop) -> TaskAwaitable +def create_async_task(loop: AbstractEventLoop) -> TaskAwaitable ``` Return asyncio Task for task run in asyncio loop. @@ -70,7 +77,8 @@ Return asyncio Task for task run in asyncio loop. task to run runtime - + + ## AEARunner Objects ```python @@ -79,11 +87,17 @@ class AEARunner(AbstractMultipleRunner) Run multiple AEA instances. - + + #### `__`init`__` ```python - | __init__(agents: Sequence[AEA], mode: str, fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies.propagate) -> None +def __init__( + agents: Sequence[AEA], + mode: str, + fail_policy: ExecutorExceptionPolicies = ExecutorExceptionPolicies. + propagate +) -> None ``` Init AEARunner. diff --git a/docs/api/runtime.md b/docs/api/runtime.md index 135562634f..990b0a5984 100644 --- a/docs/api/runtime.md +++ b/docs/api/runtime.md @@ -1,9 +1,11 @@ - + + # aea.runtime This module contains the implementation of runtime for economic agent (AEA). - + + ## RuntimeStates Objects ```python @@ -12,20 +14,27 @@ class RuntimeStates(Enum) Runtime states. - + + ## BaseRuntime Objects ```python -class BaseRuntime(Runnable, WithLogger) +class BaseRuntime(Runnable, WithLogger) ``` Abstract runtime class to create implementations. - + + #### `__`init`__` ```python - | __init__(agent: AbstractAgent, multiplexer_options: Dict, loop_mode: Optional[str] = None, loop: Optional[AbstractEventLoop] = None, threaded: bool = False, task_manager_mode: Optional[str] = None) -> None +def __init__(agent: AbstractAgent, + multiplexer_options: Dict, + loop_mode: Optional[str] = None, + loop: Optional[AbstractEventLoop] = None, + threaded: bool = False, + task_manager_mode: Optional[str] = None) -> None ``` Init runtime. @@ -39,92 +48,101 @@ Init runtime. - `threaded`: if True, run in threaded mode, else async - `task_manager_mode`: mode of the task manager. - + + #### storage ```python - | @property - | storage() -> Optional[Storage] +@property +def storage() -> Optional[Storage] ``` Get optional storage. - + + #### loop`_`mode ```python - | @property - | loop_mode() -> str +@property +def loop_mode() -> str ``` Get current loop mode. - + + #### task`_`manager ```python - | @property - | task_manager() -> TaskManager +@property +def task_manager() -> TaskManager ``` Get the task manager. - + + #### loop ```python - | @property - | loop() -> Optional[AbstractEventLoop] +@property +def loop() -> Optional[AbstractEventLoop] ``` Get event loop. - + + #### agent`_`loop ```python - | @property - | agent_loop() -> BaseAgentLoop +@property +def agent_loop() -> BaseAgentLoop ``` Get the agent loop. - + + #### multiplexer ```python - | @property - | multiplexer() -> AsyncMultiplexer +@property +def multiplexer() -> AsyncMultiplexer ``` Get multiplexer. - + + #### is`_`running ```python - | @property - | is_running() -> bool +@property +def is_running() -> bool ``` Get running state of the runtime. - + + #### is`_`stopped ```python - | @property - | is_stopped() -> bool +@property +def is_stopped() -> bool ``` Get stopped state of the runtime. - + + #### state ```python - | @property - | state() -> RuntimeStates +@property +def state() -> RuntimeStates ``` Get runtime state. @@ -133,30 +151,33 @@ Get runtime state. RuntimeStates - + + #### decision`_`maker ```python - | @property - | decision_maker() -> DecisionMaker +@property +def decision_maker() -> DecisionMaker ``` Return decision maker if set. - + + #### set`_`decision`_`maker ```python - | set_decision_maker(decision_maker_handler: DecisionMakerHandler) -> None +def set_decision_maker(decision_maker_handler: DecisionMakerHandler) -> None ``` Set decision maker with handler provided. - + + #### set`_`loop ```python - | set_loop(loop: AbstractEventLoop) -> None +def set_loop(loop: AbstractEventLoop) -> None ``` Set event loop to be used. @@ -165,7 +186,8 @@ Set event loop to be used. - `loop`: event loop to use. - + + ## AsyncRuntime Objects ```python @@ -174,11 +196,17 @@ class AsyncRuntime(BaseRuntime) Asynchronous runtime: uses asyncio loop for multiplexer and async agent main loop. - + + #### `__`init`__` ```python - | __init__(agent: AbstractAgent, multiplexer_options: Dict, loop_mode: Optional[str] = None, loop: Optional[AbstractEventLoop] = None, threaded: bool = False, task_manager_mode: Optional[str] = None) -> None +def __init__(agent: AbstractAgent, + multiplexer_options: Dict, + loop_mode: Optional[str] = None, + loop: Optional[AbstractEventLoop] = None, + threaded: bool = False, + task_manager_mode: Optional[str] = None) -> None ``` Init runtime. @@ -192,11 +220,12 @@ Init runtime. - `threaded`: if True, run in threaded mode, else async - `task_manager_mode`: mode of the task manager. - + + #### set`_`loop ```python - | set_loop(loop: AbstractEventLoop) -> None +def set_loop(loop: AbstractEventLoop) -> None ``` Set event loop to be used. @@ -205,22 +234,24 @@ Set event loop to be used. - `loop`: event loop to use. - + + #### run ```python - | async run() -> None +async def run() -> None ``` Start runtime task. Starts multiplexer and agent loop. - + + #### stop`_`runtime ```python - | async stop_runtime() -> None +async def stop_runtime() -> None ``` Stop runtime coroutine. @@ -229,16 +260,18 @@ Stop main loop. Tear down the agent.. Disconnect multiplexer. - + + #### run`_`runtime ```python - | async run_runtime() -> None +async def run_runtime() -> None ``` Run runtime which means start agent loop, multiplexer and storage. - + + ## ThreadedRuntime Objects ```python diff --git a/docs/api/skills/base.md b/docs/api/skills/base.md index 0a078541b9..dab3a16b0a 100644 --- a/docs/api/skills/base.md +++ b/docs/api/skills/base.md @@ -1,9 +1,11 @@ - + + # aea.skills.base This module contains the base classes for the skills. - + + ## SkillContext Objects ```python @@ -12,11 +14,13 @@ class SkillContext() This class implements the context of a skill. - + + #### `__`init`__` ```python - | __init__(agent_context: Optional[AgentContext] = None, skill: Optional["Skill"] = None) -> None +def __init__(agent_context: Optional[AgentContext] = None, + skill: Optional["Skill"] = None) -> None ``` Initialize a skill context. @@ -26,91 +30,100 @@ Initialize a skill context. - `agent_context`: the agent context. - `skill`: the skill. - + + #### logger ```python - | @property - | logger() -> Logger +@property +def logger() -> Logger ``` Get the logger. - + + #### logger ```python - | @logger.setter - | logger(logger_: Logger) -> None +@logger.setter +def logger(logger_: Logger) -> None ``` Set the logger. - + + #### set`_`agent`_`context ```python - | set_agent_context(agent_context: AgentContext) -> None +def set_agent_context(agent_context: AgentContext) -> None ``` Set the agent context. - + + #### shared`_`state ```python - | @property - | shared_state() -> Dict[str, Any] +@property +def shared_state() -> Dict[str, Any] ``` Get the shared state dictionary. - + + #### agent`_`name ```python - | @property - | agent_name() -> str +@property +def agent_name() -> str ``` Get agent name. - + + #### skill`_`id ```python - | @property - | skill_id() -> PublicId +@property +def skill_id() -> PublicId ``` Get the skill id of the skill context. - + + #### is`_`active ```python - | @property - | is_active() -> bool +@property +def is_active() -> bool ``` Get the status of the skill (active/not active). - + + #### is`_`active ```python - | @is_active.setter - | is_active(value: bool) -> None +@is_active.setter +def is_active(value: bool) -> None ``` Set the status of the skill (active/not active). - + + #### new`_`behaviours ```python - | @property - | new_behaviours() -> "Queue[Behaviour]" +@property +def new_behaviours() -> "Queue[Behaviour]" ``` Queue for the new behaviours. @@ -122,12 +135,13 @@ to request the registration of a behaviour. the queue of new behaviours. - + + #### new`_`handlers ```python - | @property - | new_handlers() -> "Queue[Handler]" +@property +def new_handlers() -> "Queue[Handler]" ``` Queue for the new handlers. @@ -139,200 +153,221 @@ to request the registration of a handler. the queue of new handlers. - + + #### agent`_`addresses ```python - | @property - | agent_addresses() -> Dict[str, str] +@property +def agent_addresses() -> Dict[str, str] ``` Get addresses. - + + #### agent`_`address ```python - | @property - | agent_address() -> str +@property +def agent_address() -> str ``` Get address. - + + #### public`_`key ```python - | @property - | public_key() -> str +@property +def public_key() -> str ``` Get public key. - + + #### public`_`keys ```python - | @property - | public_keys() -> Dict[str, str] +@property +def public_keys() -> Dict[str, str] ``` Get public keys. - + + #### connection`_`status ```python - | @property - | connection_status() -> MultiplexerStatus +@property +def connection_status() -> MultiplexerStatus ``` Get connection status. - + + #### outbox ```python - | @property - | outbox() -> OutBox +@property +def outbox() -> OutBox ``` Get outbox. - + + #### storage ```python - | @property - | storage() -> Optional[Storage] +@property +def storage() -> Optional[Storage] ``` Get optional storage for agent. - + + #### message`_`in`_`queue ```python - | @property - | message_in_queue() -> Queue +@property +def message_in_queue() -> Queue ``` Get message in queue. - + + #### decision`_`maker`_`message`_`queue ```python - | @property - | decision_maker_message_queue() -> Queue +@property +def decision_maker_message_queue() -> Queue ``` Get message queue of decision maker. - + + #### decision`_`maker`_`handler`_`context ```python - | @property - | decision_maker_handler_context() -> SimpleNamespace +@property +def decision_maker_handler_context() -> SimpleNamespace ``` Get decision maker handler context. - + + #### task`_`manager ```python - | @property - | task_manager() -> TaskManager +@property +def task_manager() -> TaskManager ``` Get behaviours of the skill. - + + #### default`_`ledger`_`id ```python - | @property - | default_ledger_id() -> str +@property +def default_ledger_id() -> str ``` Get the default ledger id. - + + #### currency`_`denominations ```python - | @property - | currency_denominations() -> Dict[str, str] +@property +def currency_denominations() -> Dict[str, str] ``` Get a dictionary mapping ledger ids to currency denominations. - + + #### search`_`service`_`address ```python - | @property - | search_service_address() -> Address +@property +def search_service_address() -> Address ``` Get the address of the search service. - + + #### decision`_`maker`_`address ```python - | @property - | decision_maker_address() -> Address +@property +def decision_maker_address() -> Address ``` Get the address of the decision maker. - + + #### handlers ```python - | @property - | handlers() -> SimpleNamespace +@property +def handlers() -> SimpleNamespace ``` Get handlers of the skill. - + + #### behaviours ```python - | @property - | behaviours() -> SimpleNamespace +@property +def behaviours() -> SimpleNamespace ``` Get behaviours of the skill. - + + #### namespace ```python - | @property - | namespace() -> SimpleNamespace +@property +def namespace() -> SimpleNamespace ``` Get the agent context namespace. - + + #### `__`getattr`__` ```python - | __getattr__(item: Any) -> Any +def __getattr__(item: Any) -> Any ``` Get attribute. - + + #### send`_`to`_`skill ```python - | send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None +def send_to_skill(message_or_envelope: Union[Message, Envelope], + context: Optional[EnvelopeContext] = None) -> None ``` Send message or envelope to another skill. @@ -344,7 +379,8 @@ If message passed it will be wrapped into envelope with optional envelope contex - `message_or_envelope`: envelope to send to another skill. - `context`: the optional envelope context - + + ## SkillComponent Objects ```python @@ -353,11 +389,15 @@ class SkillComponent(ABC) This class defines an abstract interface for skill component classes. - + + #### `__`init`__` ```python - | __init__(name: str, skill_context: SkillContext, configuration: Optional[SkillComponentConfiguration] = None, **kwargs: Any, ,) -> None +def __init__(name: str, + skill_context: SkillContext, + configuration: Optional[SkillComponentConfiguration] = None, + **kwargs: Any) -> None ``` Initialize a skill component. @@ -369,92 +409,103 @@ Initialize a skill component. - `skill_context`: the skill context. - `kwargs`: the keyword arguments. - + + #### name ```python - | @property - | name() -> str +@property +def name() -> str ``` Get the name of the skill component. - + + #### context ```python - | @property - | context() -> SkillContext +@property +def context() -> SkillContext ``` Get the context of the skill component. - + + #### skill`_`id ```python - | @property - | skill_id() -> PublicId +@property +def skill_id() -> PublicId ``` Get the skill id of the skill component. - + + #### configuration ```python - | @property - | configuration() -> SkillComponentConfiguration +@property +def configuration() -> SkillComponentConfiguration ``` Get the skill component configuration. - + + #### config ```python - | @property - | config() -> Dict[Any, Any] +@property +def config() -> Dict[Any, Any] ``` Get the config of the skill component. - + + #### setup ```python - | @abstractmethod - | setup() -> None +@abstractmethod +def setup() -> None ``` Implement the setup. - + + #### teardown ```python - | @abstractmethod - | teardown() -> None +@abstractmethod +def teardown() -> None ``` Implement the teardown. - + + #### parse`_`module ```python - | @classmethod - | @abstractmethod - | parse_module(cls, path: str, configs: Dict[str, SkillComponentConfiguration], skill_context: SkillContext) -> dict +@classmethod +@abstractmethod +def parse_module(cls, path: str, configs: Dict[str, + SkillComponentConfiguration], + skill_context: SkillContext) -> dict ``` Parse the component module. - + + ## AbstractBehaviour Objects ```python -class AbstractBehaviour(SkillComponent, ABC) +class AbstractBehaviour(SkillComponent, ABC) ``` Abstract behaviour for periodical calls. @@ -462,31 +513,34 @@ Abstract behaviour for periodical calls. tick_interval: float, interval to call behaviour's act. start_at: optional datetime, when to start periodical calls. - + + #### tick`_`interval ```python - | @property - | tick_interval() -> float +@property +def tick_interval() -> float ``` Get the tick_interval in seconds. - + + #### start`_`at ```python - | @property - | start_at() -> Optional[datetime.datetime] +@property +def start_at() -> Optional[datetime.datetime] ``` Get the start time of the behaviour. - + + ## Behaviour Objects ```python -class Behaviour(AbstractBehaviour, ABC) +class Behaviour(AbstractBehaviour, ABC) ``` This class implements an abstract behaviour. @@ -498,12 +552,13 @@ In a subclass of Behaviour, the flag 'is_programmatically_defined' module, the framework will just ignore this class instead of printing a warning message. - + + #### act ```python - | @abstractmethod - | act() -> None +@abstractmethod +def act() -> None ``` Implement the behaviour. @@ -512,30 +567,35 @@ Implement the behaviour. None - + + #### is`_`done ```python - | is_done() -> bool +def is_done() -> bool ``` Return True if the behaviour is terminated, False otherwise. - + + #### act`_`wrapper ```python - | act_wrapper() -> None +def act_wrapper() -> None ``` Wrap the call of the action. This method must be called only by the framework. - + + #### parse`_`module ```python - | @classmethod - | parse_module(cls, path: str, behaviour_configs: Dict[str, SkillComponentConfiguration], skill_context: SkillContext) -> Dict[str, "Behaviour"] +@classmethod +def parse_module(cls, path: str, + behaviour_configs: Dict[str, SkillComponentConfiguration], + skill_context: SkillContext) -> Dict[str, "Behaviour"] ``` Parse the behaviours module. @@ -550,11 +610,12 @@ Parse the behaviours module. a list of Behaviour. - + + ## Handler Objects ```python -class Handler(SkillComponent, ABC) +class Handler(SkillComponent, ABC) ``` This class implements an abstract behaviour. @@ -571,12 +632,13 @@ SUPPORTED_PROTOCOL is read by the framework when the handlers are loaded public id. Whenever a message of protocol 'SUPPORTED_PROTOCOL' is sent to the agent, the framework will call the 'handle' method. - + + #### handle ```python - | @abstractmethod - | handle(message: Message) -> None +@abstractmethod +def handle(message: Message) -> None ``` Implement the reaction to a message. @@ -589,21 +651,25 @@ Implement the reaction to a message. None - + + #### handle`_`wrapper ```python - | handle_wrapper(message: Message) -> None +def handle_wrapper(message: Message) -> None ``` Wrap the call of the handler. This method must be called only by the framework. - + + #### parse`_`module ```python - | @classmethod - | parse_module(cls, path: str, handler_configs: Dict[str, SkillComponentConfiguration], skill_context: SkillContext) -> Dict[str, "Handler"] +@classmethod +def parse_module(cls, path: str, + handler_configs: Dict[str, SkillComponentConfiguration], + skill_context: SkillContext) -> Dict[str, "Handler"] ``` Parse the handler module. @@ -618,20 +684,26 @@ Parse the handler module. an handler, or None if the parsing fails. - + + ## Model Objects ```python -class Model(SkillComponent, ABC) +class Model(SkillComponent, ABC) ``` This class implements an abstract model. - + + #### `__`init`__` ```python - | __init__(name: str, skill_context: SkillContext, configuration: Optional[SkillComponentConfiguration] = None, keep_terminal_state_dialogues: Optional[bool] = None, **kwargs: Any, ,) -> None +def __init__(name: str, + skill_context: SkillContext, + configuration: Optional[SkillComponentConfiguration] = None, + keep_terminal_state_dialogues: Optional[bool] = None, + **kwargs: Any) -> None ``` Initialize a model. @@ -644,30 +716,35 @@ Initialize a model. - `keep_terminal_state_dialogues`: specify do dialogues in terminal state should stay or not - `kwargs`: the keyword arguments. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set the class up. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Tear the class down. - + + #### parse`_`module ```python - | @classmethod - | parse_module(cls, path: str, model_configs: Dict[str, SkillComponentConfiguration], skill_context: SkillContext) -> Dict[str, "Model"] +@classmethod +def parse_module(cls, path: str, + model_configs: Dict[str, SkillComponentConfiguration], + skill_context: SkillContext) -> Dict[str, "Model"] ``` Parse the model module. @@ -682,7 +759,8 @@ Parse the model module. a list of Model. - + + ## Skill Objects ```python @@ -691,11 +769,17 @@ class Skill(Component) This class implements a skill. - + + #### `__`init`__` ```python - | __init__(configuration: SkillConfig, skill_context: Optional[SkillContext] = None, handlers: Optional[Dict[str, Handler]] = None, behaviours: Optional[Dict[str, Behaviour]] = None, models: Optional[Dict[str, Model]] = None, **kwargs: Any, ,) +def __init__(configuration: SkillConfig, + skill_context: Optional[SkillContext] = None, + handlers: Optional[Dict[str, Handler]] = None, + behaviours: Optional[Dict[str, Behaviour]] = None, + models: Optional[Dict[str, Model]] = None, + **kwargs: Any) ``` Initialize a skill. @@ -709,52 +793,58 @@ Initialize a skill. - `models`: dictionary of models. - `kwargs`: the keyword arguments. - + + #### skill`_`context ```python - | @property - | skill_context() -> SkillContext +@property +def skill_context() -> SkillContext ``` Get the skill context. - + + #### handlers ```python - | @property - | handlers() -> Dict[str, Handler] +@property +def handlers() -> Dict[str, Handler] ``` Get the handlers. - + + #### behaviours ```python - | @property - | behaviours() -> Dict[str, Behaviour] +@property +def behaviours() -> Dict[str, Behaviour] ``` Get the handlers. - + + #### models ```python - | @property - | models() -> Dict[str, Model] +@property +def models() -> Dict[str, Model] ``` Get the handlers. - + + #### from`_`dir ```python - | @classmethod - | from_dir(cls, directory: str, agent_context: AgentContext, **kwargs: Any) -> "Skill" +@classmethod +def from_dir(cls, directory: str, agent_context: AgentContext, + **kwargs: Any) -> "Skill" ``` Load the skill from a directory. @@ -769,12 +859,13 @@ Load the skill from a directory. the skill object. - + + #### logger ```python - | @property - | logger() -> Logger +@property +def logger() -> Logger ``` Get the logger. @@ -786,22 +877,25 @@ logger provided by the skill context. the logger - + + #### logger ```python - | @logger.setter - | logger(*args: str) -> None +@logger.setter +def logger(*args: str) -> None ``` Set the logger. - + + #### from`_`config ```python - | @classmethod - | from_config(cls, configuration: SkillConfig, agent_context: AgentContext, **kwargs: Any) -> "Skill" +@classmethod +def from_config(cls, configuration: SkillConfig, agent_context: AgentContext, + **kwargs: Any) -> "Skill" ``` Load the skill from configuration. @@ -816,7 +910,8 @@ Load the skill from configuration. the skill. - + + ## `_`SkillComponentLoadingItem Objects ```python @@ -825,16 +920,19 @@ class _SkillComponentLoadingItem() Class to represent a triple (component name, component configuration, component class). - + + #### `__`init`__` ```python - | __init__(name: str, config: SkillComponentConfiguration, class_: Type[SkillComponent], type_: _SKILL_COMPONENT_TYPES) +def __init__(name: str, config: SkillComponentConfiguration, + class_: Type[SkillComponent], type_: _SKILL_COMPONENT_TYPES) ``` Initialize the item. - + + ## `_`SkillComponentLoader Objects ```python @@ -843,20 +941,23 @@ class _SkillComponentLoader() This class implements the loading policy for skill components. - + + #### `__`init`__` ```python - | __init__(configuration: SkillConfig, skill_context: SkillContext, **kwargs: Any) +def __init__(configuration: SkillConfig, skill_context: SkillContext, + **kwargs: Any) ``` Initialize the helper class. - + + #### load`_`skill ```python - | load_skill() -> Skill +def load_skill() -> Skill ``` Load the skill. diff --git a/docs/api/skills/behaviours.md b/docs/api/skills/behaviours.md index bafd4076d0..19424fa377 100644 --- a/docs/api/skills/behaviours.md +++ b/docs/api/skills/behaviours.md @@ -1,22 +1,25 @@ - + + # aea.skills.behaviours This module contains the classes for specific behaviours. - + + ## SimpleBehaviour Objects ```python -class SimpleBehaviour(Behaviour, ABC) +class SimpleBehaviour(Behaviour, ABC) ``` This class implements a simple behaviour. - + + #### `__`init`__` ```python - | __init__(act: Optional[Callable[[], None]] = None, **kwargs: Any) -> None +def __init__(act: Optional[Callable[[], None]] = None, **kwargs: Any) -> None ``` Initialize a simple behaviour. @@ -26,84 +29,93 @@ Initialize a simple behaviour. - `act`: the act callable. - `kwargs`: the keyword arguments to be passed to the parent class. - + + #### setup ```python - | setup() -> None +def setup() -> None ``` Set the behaviour up. - + + #### act ```python - | act() -> None +def act() -> None ``` Do the action. - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Tear the behaviour down. - + + ## CompositeBehaviour Objects ```python -class CompositeBehaviour(Behaviour, ABC) +class CompositeBehaviour(Behaviour, ABC) ``` This class implements a composite behaviour. - + + ## CyclicBehaviour Objects ```python -class CyclicBehaviour(SimpleBehaviour, ABC) +class CyclicBehaviour(SimpleBehaviour, ABC) ``` This behaviour is executed until the agent is stopped. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize the cyclic behaviour. - + + #### number`_`of`_`executions ```python - | @property - | number_of_executions() -> int +@property +def number_of_executions() -> int ``` Get the number of executions. - + + #### act`_`wrapper ```python - | act_wrapper() -> None +def act_wrapper() -> None ``` Wrap the call of the action. This method must be called only by the framework. - + + #### is`_`done ```python - | is_done() -> bool +def is_done() -> bool ``` Return True if the behaviour is terminated, False otherwise. @@ -114,56 +126,64 @@ The user should implement it properly to determine the stopping condition. bool indicating status - + + ## OneShotBehaviour Objects ```python -class OneShotBehaviour(SimpleBehaviour, ABC) +class OneShotBehaviour(SimpleBehaviour, ABC) ``` This behaviour is executed only once. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize the cyclic behaviour. - + + #### is`_`done ```python - | is_done() -> bool +def is_done() -> bool ``` Return True if the behaviour is terminated, False otherwise. - + + #### act`_`wrapper ```python - | act_wrapper() -> None +def act_wrapper() -> None ``` Wrap the call of the action. This method must be called only by the framework. - + + ## TickerBehaviour Objects ```python -class TickerBehaviour(SimpleBehaviour, ABC) +class TickerBehaviour(SimpleBehaviour, ABC) ``` This behaviour is executed periodically with an interval. - + + #### `__`init`__` ```python - | __init__(tick_interval: float = 1.0, start_at: Optional[datetime.datetime] = None, **kwargs: Any, ,) -> None +def __init__(tick_interval: float = 1.0, + start_at: Optional[datetime.datetime] = None, + **kwargs: Any) -> None ``` Initialize the ticker behaviour. @@ -174,50 +194,55 @@ Initialize the ticker behaviour. - `start_at`: whether to start the behaviour with an offset. - `kwargs`: the keyword arguments. - + + #### tick`_`interval ```python - | @property - | tick_interval() -> float +@property +def tick_interval() -> float ``` Get the tick_interval in seconds. - + + #### start`_`at ```python - | @property - | start_at() -> datetime.datetime +@property +def start_at() -> datetime.datetime ``` Get the start time. - + + #### last`_`act`_`time ```python - | @property - | last_act_time() -> datetime.datetime +@property +def last_act_time() -> datetime.datetime ``` Get the last time the act method has been called. - + + #### act`_`wrapper ```python - | act_wrapper() -> None +def act_wrapper() -> None ``` Wrap the call of the action. This method must be called only by the framework. - + + #### is`_`time`_`to`_`act ```python - | is_time_to_act() -> bool +def is_time_to_act() -> bool ``` Check whether it is time to act, according to the tick_interval constraint and the 'start at' constraint. @@ -226,20 +251,22 @@ Check whether it is time to act, according to the tick_interval constraint and t True if it is time to act, false otherwise. - + + ## SequenceBehaviour Objects ```python -class SequenceBehaviour(CompositeBehaviour, ABC) +class SequenceBehaviour(CompositeBehaviour, ABC) ``` This behaviour executes sub-behaviour serially. - + + #### `__`init`__` ```python - | __init__(behaviour_sequence: List[Behaviour], **kwargs: Any) -> None +def __init__(behaviour_sequence: List[Behaviour], **kwargs: Any) -> None ``` Initialize the sequence behaviour. @@ -249,12 +276,13 @@ Initialize the sequence behaviour. - `behaviour_sequence`: the sequence of behaviour. - `kwargs`: the keyword arguments - + + #### current`_`behaviour ```python - | @property - | current_behaviour() -> Optional[Behaviour] +@property +def current_behaviour() -> Optional[Behaviour] ``` Get the current behaviour. @@ -265,29 +293,32 @@ If None, the sequence behaviour can be considered done. current behaviour or None - + + #### act ```python - | act() -> None +def act() -> None ``` Implement the behaviour. - + + #### is`_`done ```python - | is_done() -> bool +def is_done() -> bool ``` Return True if the behaviour is terminated, False otherwise. - + + ## State Objects ```python -class State(SimpleBehaviour, ABC) +class State(SimpleBehaviour, ABC) ``` A state of a FSMBehaviour. @@ -298,77 +329,85 @@ by the implementer. The event is read by the framework when the behaviour is done in order to pick the transition to trigger. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize a state of the state machine. - + + #### event ```python - | @property - | event() -> Optional[str] +@property +def event() -> Optional[str] ``` Get the event to be triggered at the end of the behaviour. - + + #### is`_`done ```python - | @abstractmethod - | is_done() -> bool +@abstractmethod +def is_done() -> bool ``` Return True if the behaviour is terminated, False otherwise. - + + #### reset ```python - | reset() -> None +def reset() -> None ``` Reset initial conditions. - + + ## FSMBehaviour Objects ```python -class FSMBehaviour(CompositeBehaviour, ABC) +class FSMBehaviour(CompositeBehaviour, ABC) ``` This class implements a finite-state machine behaviour. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize the finite-state machine behaviour. - + + #### is`_`started ```python - | @property - | is_started() -> bool +@property +def is_started() -> bool ``` Check if the behaviour is started. - + + #### register`_`state ```python - | register_state(name: str, state: State, initial: bool = False) -> None +def register_state(name: str, state: State, initial: bool = False) -> None ``` Register a state. @@ -383,11 +422,12 @@ Register a state. - `ValueError`: if a state with the provided name already exists. - + + #### register`_`final`_`state ```python - | register_final_state(name: str, state: State) -> None +def register_final_state(name: str, state: State) -> None ``` Register a final state. @@ -401,11 +441,12 @@ Register a final state. - `ValueError`: if a state with the provided name already exists. - + + #### unregister`_`state ```python - | unregister_state(name: str) -> None +def unregister_state(name: str) -> None ``` Unregister a state. @@ -418,78 +459,88 @@ Unregister a state. - `ValueError`: if the state is not registered. - + + #### states ```python - | @property - | states() -> Set[str] +@property +def states() -> Set[str] ``` Get all the state names. - + + #### initial`_`state ```python - | @property - | initial_state() -> Optional[str] +@property +def initial_state() -> Optional[str] ``` Get the initial state name. - + + #### initial`_`state ```python - | @initial_state.setter - | initial_state(name: str) -> None +@initial_state.setter +def initial_state(name: str) -> None ``` Set the initial state. - + + #### final`_`states ```python - | @property - | final_states() -> Set[str] +@property +def final_states() -> Set[str] ``` Get the final state names. - + + #### get`_`state ```python - | get_state(name: str) -> Optional[State] +def get_state(name: str) -> Optional[State] ``` Get a state from its name. - + + #### act ```python - | act() -> None +def act() -> None ``` Implement the behaviour. - + + #### is`_`done ```python - | is_done() -> bool +def is_done() -> bool ``` Return True if the behaviour is terminated, False otherwise. - + + #### register`_`transition ```python - | register_transition(source: str, destination: str, event: Optional[str] = None) -> None +def register_transition(source: str, + destination: str, + event: Optional[str] = None) -> None ``` Register a transition. @@ -506,11 +557,14 @@ No sanity check is done. - `ValueError`: if a transition from source with event is already present. - + + #### unregister`_`transition ```python - | unregister_transition(source: str, destination: str, event: Optional[str] = None) -> None +def unregister_transition(source: str, + destination: str, + event: Optional[str] = None) -> None ``` Unregister a transition. diff --git a/docs/api/skills/tasks.md b/docs/api/skills/tasks.md index ad042f310b..d7bf003937 100644 --- a/docs/api/skills/tasks.md +++ b/docs/api/skills/tasks.md @@ -1,9 +1,11 @@ - + + # aea.skills.tasks This module contains the classes for tasks. - + + ## Task Objects ```python @@ -12,20 +14,22 @@ class Task(WithLogger) This class implements an abstract task. - + + #### `__`init`__` ```python - | __init__(**kwargs: Any) -> None +def __init__(**kwargs: Any) -> None ``` Initialize a task. - + + #### `__`call`__` ```python - | __call__(*args: Any, **kwargs: Any) -> Any +def __call__(*args: Any, **kwargs: Any) -> Any ``` Execute the task. @@ -35,57 +39,61 @@ Execute the task. - `args`: positional arguments forwarded to the 'execute' method. - `kwargs`: keyword arguments forwarded to the 'execute' method. +**Raises**: + +- `ValueError`: if the task has already been executed. + **Returns**: the task instance -**Raises**: - -- `ValueError`: if the task has already been executed. + - #### is`_`executed ```python - | @property - | is_executed() -> bool +@property +def is_executed() -> bool ``` Check if the task has already been executed. - + + #### result ```python - | @property - | result() -> Any +@property +def result() -> Any ``` Get the result. +**Raises**: + +- `ValueError`: if the task has not been executed yet. + **Returns**: the result from the execute method. -**Raises**: + -- `ValueError`: if the task has not been executed yet. - - #### setup ```python - | setup() -> None +def setup() -> None ``` Implement the task setup. - + + #### execute ```python - | @abstractmethod - | execute(*args: Any, **kwargs: Any) -> Any +@abstractmethod +def execute(*args: Any, **kwargs: Any) -> Any ``` Run the task logic. @@ -99,20 +107,22 @@ Run the task logic. any - + + #### teardown ```python - | teardown() -> None +def teardown() -> None ``` Implement the task teardown. - + + #### init`_`worker ```python -init_worker() -> None +def init_worker() -> None ``` Initialize a worker. @@ -120,7 +130,8 @@ Initialize a worker. Disable the SIGINT handler of process pool is using. Related to a well-known bug: https://bugs.python.org/issue8296 - + + ## TaskManager Objects ```python @@ -129,11 +140,15 @@ class TaskManager(WithLogger) A Task manager. - + + #### `__`init`__` ```python - | __init__(nb_workers: int = DEFAULT_WORKERS_AMOUNT, is_lazy_pool_start: bool = True, logger: Optional[logging.Logger] = None, pool_mode: str = THREAD_POOL_MODE) -> None +def __init__(nb_workers: int = DEFAULT_WORKERS_AMOUNT, + is_lazy_pool_start: bool = True, + logger: Optional[logging.Logger] = None, + pool_mode: str = THREAD_POOL_MODE) -> None ``` Initialize the task manager. @@ -145,12 +160,13 @@ Initialize the task manager. - `logger`: the logger. - `pool_mode`: str. multithread or multiprocess - + + #### is`_`started ```python - | @property - | is_started() -> bool +@property +def is_started() -> bool ``` Get started status of TaskManager. @@ -159,12 +175,13 @@ Get started status of TaskManager. bool - + + #### nb`_`workers ```python - | @property - | nb_workers() -> int +@property +def nb_workers() -> int ``` Get the number of workers. @@ -173,11 +190,14 @@ Get the number of workers. int - + + #### enqueue`_`task ```python - | enqueue_task(func: Callable, args: Sequence = (), kwargs: Optional[Dict[str, Any]] = None) -> int +def enqueue_task(func: Callable, + args: Sequence = (), + kwargs: Optional[Dict[str, Any]] = None) -> int ``` Enqueue a task with the executor. @@ -188,19 +208,20 @@ Enqueue a task with the executor. - `args`: the positional arguments to be passed to the function. - `kwargs`: the keyword arguments to be passed to the function. +**Raises**: + +- `ValueError`: if the task manager is not running. + **Returns**: the task id to get the the result. -**Raises**: + -- `ValueError`: if the task manager is not running. - - #### get`_`task`_`result ```python - | get_task_result(task_id: int) -> AsyncResult +def get_task_result(task_id: int) -> AsyncResult ``` Get the result from a task. @@ -213,25 +234,28 @@ Get the result from a task. async result for task_id - + + #### start ```python - | start() -> None +def start() -> None ``` Start the task manager. - + + #### stop ```python - | stop() -> None +def stop() -> None ``` Stop the task manager. - + + ## ThreadedTaskManager Objects ```python @@ -240,11 +264,14 @@ class ThreadedTaskManager(TaskManager) A threaded task manager. - + + #### `__`init`__` ```python - | __init__(nb_workers: int = DEFAULT_WORKERS_AMOUNT, is_lazy_pool_start: bool = True, logger: Optional[logging.Logger] = None) -> None +def __init__(nb_workers: int = DEFAULT_WORKERS_AMOUNT, + is_lazy_pool_start: bool = True, + logger: Optional[logging.Logger] = None) -> None ``` Initialize the task manager. @@ -255,7 +282,8 @@ Initialize the task manager. - `is_lazy_pool_start`: option to postpone pool creation till the first enqueue_task called. - `logger`: the logger. - + + ## ProcessTaskManager Objects ```python @@ -264,11 +292,14 @@ class ProcessTaskManager(TaskManager) A multiprocess task manager. - + + #### `__`init`__` ```python - | __init__(nb_workers: int = DEFAULT_WORKERS_AMOUNT, is_lazy_pool_start: bool = True, logger: Optional[logging.Logger] = None) -> None +def __init__(nb_workers: int = DEFAULT_WORKERS_AMOUNT, + is_lazy_pool_start: bool = True, + logger: Optional[logging.Logger] = None) -> None ``` Initialize the task manager. diff --git a/docs/api/test_tools/constants.md b/docs/api/test_tools/constants.md index c19ee2722a..36bd1adb72 100644 --- a/docs/api/test_tools/constants.md +++ b/docs/api/test_tools/constants.md @@ -1,4 +1,5 @@ - + + # aea.test`_`tools.constants This is a module with constants for test tools. diff --git a/docs/api/test_tools/exceptions.md b/docs/api/test_tools/exceptions.md index 2c364e263a..9d6e0fd993 100644 --- a/docs/api/test_tools/exceptions.md +++ b/docs/api/test_tools/exceptions.md @@ -1,9 +1,11 @@ - + + # aea.test`_`tools.exceptions Module with AEA testing exceptions. - + + ## AEATestingException Objects ```python diff --git a/docs/api/test_tools/generic.md b/docs/api/test_tools/generic.md index 74c2b79286..c2f73b4664 100644 --- a/docs/api/test_tools/generic.md +++ b/docs/api/test_tools/generic.md @@ -1,13 +1,15 @@ - + + # aea.test`_`tools.generic This module contains generic tools for AEA end-to-end testing. - + + #### write`_`envelope`_`to`_`file ```python -write_envelope_to_file(envelope: Envelope, file_path: str) -> None +def write_envelope_to_file(envelope: Envelope, file_path: str) -> None ``` Write an envelope to a file. @@ -17,11 +19,12 @@ Write an envelope to a file. - `envelope`: Envelope. - `file_path`: the file path - + + #### read`_`envelope`_`from`_`file ```python -read_envelope_from_file(file_path: str) -> Envelope +def read_envelope_from_file(file_path: str) -> Envelope ``` Read an envelope from a file. @@ -34,11 +37,14 @@ Read an envelope from a file. envelope - + + #### nested`_`set`_`config ```python -nested_set_config(dotted_path: str, value: Any, author: str = DEFAULT_AUTHOR) -> None +def nested_set_config(dotted_path: str, + value: Any, + author: str = DEFAULT_AUTHOR) -> None ``` Set an AEA config with nested values. @@ -46,12 +52,12 @@ Set an AEA config with nested values. Run from agent's directory. Allowed dotted_path: -'agent.an_attribute_name' -'protocols.my_protocol.an_attribute_name' -'connections.my_connection.an_attribute_name' -'contracts.my_contract.an_attribute_name' -'skills.my_skill.an_attribute_name' -'vendor.author.[protocols|connections|skills].package_name.attribute_name + 'agent.an_attribute_name' + 'protocols.my_protocol.an_attribute_name' + 'connections.my_connection.an_attribute_name' + 'contracts.my_contract.an_attribute_name' + 'skills.my_skill.an_attribute_name' + 'vendor.author.[protocols|connections|skills].package_name.attribute_name **Arguments**: diff --git a/docs/api/test_tools/test_cases.md b/docs/api/test_tools/test_cases.md index 9a9bc17a9f..f33a52bbf7 100644 --- a/docs/api/test_tools/test_cases.md +++ b/docs/api/test_tools/test_cases.md @@ -1,9 +1,11 @@ - + + # aea.test`_`tools.test`_`cases This module contains test case classes based on pytest for AEA end-to-end testing. - + + ## BaseAEATestCase Objects ```python @@ -12,32 +14,38 @@ class BaseAEATestCase(ABC) Base class for AEA test cases. - + + #### set`_`agent`_`context ```python - | @classmethod - | set_agent_context(cls, agent_name: str) -> None +@classmethod +def set_agent_context(cls, agent_name: str) -> None ``` Set the current agent context. - + + #### unset`_`agent`_`context ```python - | @classmethod - | unset_agent_context(cls) -> None +@classmethod +def unset_agent_context(cls) -> None ``` Unset the current agent context. - + + #### set`_`config ```python - | @classmethod - | set_config(cls, dotted_path: str, value: Any, type_: Optional[str] = None) -> Result +@classmethod +def set_config(cls, + dotted_path: str, + value: Any, + type_: Optional[str] = None) -> Result ``` Set a config. @@ -54,34 +62,37 @@ Run from agent's directory. Result - + + #### nested`_`set`_`config ```python - | @classmethod - | nested_set_config(cls, dotted_path: str, value: Any) -> None +@classmethod +def nested_set_config(cls, dotted_path: str, value: Any) -> None ``` Force set config. - + + #### disable`_`aea`_`logging ```python - | @classmethod - | disable_aea_logging(cls) -> None +@classmethod +def disable_aea_logging(cls) -> None ``` Disable AEA logging of specific agent. Run from agent's directory. - + + #### run`_`cli`_`command ```python - | @classmethod - | run_cli_command(cls, *args: str, *, cwd: str = ".", **kwargs: str) -> Result +@classmethod +def run_cli_command(cls, *args: str, cwd: str = ".", **kwargs: str) -> Result ``` Run AEA CLI command. @@ -100,12 +111,13 @@ Run AEA CLI command. Result - + + #### start`_`subprocess ```python - | @classmethod - | start_subprocess(cls, *args: str, *, cwd: str = ".") -> subprocess.Popen +@classmethod +def start_subprocess(cls, *args: str, cwd: str = ".") -> subprocess.Popen ``` Run python with args as subprocess. @@ -119,12 +131,13 @@ Run python with args as subprocess. subprocess object. - + + #### start`_`thread ```python - | @classmethod - | start_thread(cls, target: Callable, **kwargs: subprocess.Popen) -> Thread +@classmethod +def start_thread(cls, target: Callable, **kwargs: subprocess.Popen) -> Thread ``` Start python Thread. @@ -138,12 +151,16 @@ Start python Thread. thread - + + #### create`_`agents ```python - | @classmethod - | create_agents(cls, *agents_names: str, *, is_local: bool = True, is_empty: bool = False) -> None +@classmethod +def create_agents(cls, + *agents_names: str, + is_local: bool = True, + is_empty: bool = False) -> None ``` Create agents in current working directory. @@ -154,12 +171,16 @@ Create agents in current working directory. - `is_local`: a flag for local folder add True by default. - `is_empty`: optional boolean flag for skip adding default dependencies. - + + #### fetch`_`agent ```python - | @classmethod - | fetch_agent(cls, public_id: str, agent_name: str, is_local: bool = True) -> None +@classmethod +def fetch_agent(cls, + public_id: str, + agent_name: str, + is_local: bool = True) -> None ``` Create agents in current working directory. @@ -170,12 +191,14 @@ Create agents in current working directory. - `agent_name`: str agent name. - `is_local`: a flag for local folder add True by default. - + + #### difference`_`to`_`fetched`_`agent ```python - | @classmethod - | difference_to_fetched_agent(cls, public_id: str, agent_name: str) -> List[str] +@classmethod +def difference_to_fetched_agent(cls, public_id: str, + agent_name: str) -> List[str] ``` Compare agent against the one fetched from public id. @@ -189,12 +212,13 @@ Compare agent against the one fetched from public id. list of files differing in the projects - + + #### delete`_`agents ```python - | @classmethod - | delete_agents(cls, *agents_names: str) -> None +@classmethod +def delete_agents(cls, *agents_names: str) -> None ``` Delete agents in current working directory. @@ -203,12 +227,13 @@ Delete agents in current working directory. - `agents_names`: str agent names. - + + #### run`_`agent ```python - | @classmethod - | run_agent(cls, *args: str) -> subprocess.Popen +@classmethod +def run_agent(cls, *args: str) -> subprocess.Popen ``` Run agent as subprocess. @@ -223,12 +248,13 @@ Run from agent's directory. subprocess object. - + + #### run`_`interaction ```python - | @classmethod - | run_interaction(cls) -> subprocess.Popen +@classmethod +def run_interaction(cls) -> subprocess.Popen ``` Run interaction as subprocess. @@ -239,12 +265,15 @@ Run from agent's directory. subprocess object. - + + #### terminate`_`agents ```python - | @classmethod - | terminate_agents(cls, *subprocesses: subprocess.Popen, *, timeout: int = 20) -> None +@classmethod +def terminate_agents(cls, + *subprocesses: subprocess.Popen, + timeout: int = 20) -> None ``` Terminate agent subprocesses. @@ -256,32 +285,38 @@ Run from agent's directory. - `subprocesses`: the subprocesses running the agents - `timeout`: the timeout for interruption - + + #### is`_`successfully`_`terminated ```python - | @classmethod - | is_successfully_terminated(cls, *subprocesses: subprocess.Popen) -> bool +@classmethod +def is_successfully_terminated(cls, *subprocesses: subprocess.Popen) -> bool ``` Check if all subprocesses terminated successfully. - + + #### initialize`_`aea ```python - | @classmethod - | initialize_aea(cls, author: str) -> None +@classmethod +def initialize_aea(cls, author: str) -> None ``` Initialize AEA locally with author name. - + + #### add`_`item ```python - | @classmethod - | add_item(cls, item_type: str, public_id: str, local: bool = True) -> Result +@classmethod +def add_item(cls, + item_type: str, + public_id: str, + local: bool = True) -> Result ``` Add an item to the agent. @@ -298,12 +333,13 @@ Run from agent's directory. Result - + + #### remove`_`item ```python - | @classmethod - | remove_item(cls, item_type: str, public_id: str) -> Result +@classmethod +def remove_item(cls, item_type: str, public_id: str) -> Result ``` Remove an item from the agent. @@ -319,12 +355,16 @@ Run from agent's directory. Result - + + #### scaffold`_`item ```python - | @classmethod - | scaffold_item(cls, item_type: str, name: str, skip_consistency_check: bool = False) -> Result +@classmethod +def scaffold_item(cls, + item_type: str, + name: str, + skip_consistency_check: bool = False) -> Result ``` Scaffold an item for the agent. @@ -341,12 +381,13 @@ Run from agent's directory. Result - + + #### fingerprint`_`item ```python - | @classmethod - | fingerprint_item(cls, item_type: str, public_id: str) -> Result +@classmethod +def fingerprint_item(cls, item_type: str, public_id: str) -> Result ``` Fingerprint an item for the agent. @@ -362,12 +403,13 @@ Run from agent's directory. Result - + + #### eject`_`item ```python - | @classmethod - | eject_item(cls, item_type: str, public_id: str) -> Result +@classmethod +def eject_item(cls, item_type: str, public_id: str) -> Result ``` Eject an item in the agent in quiet mode (i.e. no interaction). @@ -383,12 +425,13 @@ Run from agent's directory. None - + + #### run`_`install ```python - | @classmethod - | run_install(cls) -> Result +@classmethod +def run_install(cls) -> Result ``` Execute AEA CLI install command. @@ -399,12 +442,16 @@ Run from agent's directory. Result - + + #### generate`_`private`_`key ```python - | @classmethod - | generate_private_key(cls, ledger_api_id: str = DEFAULT_LEDGER, private_key_file: Optional[str] = None, password: Optional[str] = None) -> Result +@classmethod +def generate_private_key(cls, + ledger_api_id: str = DEFAULT_LEDGER, + private_key_file: Optional[str] = None, + password: Optional[str] = None) -> Result ``` Generate AEA private key with CLI command. @@ -421,12 +468,17 @@ Run from agent's directory. Result - + + #### add`_`private`_`key ```python - | @classmethod - | add_private_key(cls, ledger_api_id: str = DEFAULT_LEDGER, private_key_filepath: str = DEFAULT_PRIVATE_KEY_FILE, connection: bool = False, password: Optional[str] = None) -> Result +@classmethod +def add_private_key(cls, + ledger_api_id: str = DEFAULT_LEDGER, + private_key_filepath: str = DEFAULT_PRIVATE_KEY_FILE, + connection: bool = False, + password: Optional[str] = None) -> Result ``` Add private key with CLI command. @@ -444,12 +496,15 @@ Run from agent's directory. Result - + + #### remove`_`private`_`key ```python - | @classmethod - | remove_private_key(cls, ledger_api_id: str = DEFAULT_LEDGER, connection: bool = False) -> Result +@classmethod +def remove_private_key(cls, + ledger_api_id: str = DEFAULT_LEDGER, + connection: bool = False) -> Result ``` Remove private key with CLI command. @@ -465,12 +520,16 @@ Run from agent's directory. Result - + + #### replace`_`private`_`key`_`in`_`file ```python - | @classmethod - | replace_private_key_in_file(cls, private_key: str, private_key_filepath: str = DEFAULT_PRIVATE_KEY_FILE) -> None +@classmethod +def replace_private_key_in_file( + cls, + private_key: str, + private_key_filepath: str = DEFAULT_PRIVATE_KEY_FILE) -> None ``` Replace the private key in the provided file with the provided key. @@ -479,14 +538,20 @@ Replace the private key in the provided file with the provided key. - `private_key`: the private key - `private_key_filepath`: the filepath to the private key file -:raises: exception if file does not exist - +**Raises**: + +- `None`: exception if file does not exist + + + #### generate`_`wealth ```python - | @classmethod - | generate_wealth(cls, ledger_api_id: str = DEFAULT_LEDGER, password: Optional[str] = None) -> Result +@classmethod +def generate_wealth(cls, + ledger_api_id: str = DEFAULT_LEDGER, + password: Optional[str] = None) -> Result ``` Generate wealth with CLI command. @@ -502,12 +567,15 @@ Run from agent's directory. Result - + + #### get`_`wealth ```python - | @classmethod - | get_wealth(cls, ledger_api_id: str = DEFAULT_LEDGER, password: Optional[str] = None) -> str +@classmethod +def get_wealth(cls, + ledger_api_id: str = DEFAULT_LEDGER, + password: Optional[str] = None) -> str ``` Get wealth with CLI command. @@ -523,12 +591,15 @@ Run from agent's directory. command line output - + + #### get`_`address ```python - | @classmethod - | get_address(cls, ledger_api_id: str = DEFAULT_LEDGER, password: Optional[str] = None) -> str +@classmethod +def get_address(cls, + ledger_api_id: str = DEFAULT_LEDGER, + password: Optional[str] = None) -> str ``` Get address with CLI command. @@ -544,12 +615,13 @@ Run from agent's directory. command line output - + + #### replace`_`file`_`content ```python - | @classmethod - | replace_file_content(cls, src: Path, dest: Path) -> None +@classmethod +def replace_file_content(cls, src: Path, dest: Path) -> None ``` Replace the content of the source file to the destination file. @@ -559,12 +631,13 @@ Replace the content of the source file to the destination file. - `src`: the source file. - `dest`: the destination file. - + + #### change`_`directory ```python - | @classmethod - | change_directory(cls, path: Path) -> None +@classmethod +def change_directory(cls, path: Path) -> None ``` Change current working directory. @@ -573,32 +646,40 @@ Change current working directory. - `path`: path to the new working directory. - + + #### send`_`envelope`_`to`_`agent ```python - | @classmethod - | send_envelope_to_agent(cls, envelope: Envelope, agent: str) -> None +@classmethod +def send_envelope_to_agent(cls, envelope: Envelope, agent: str) -> None ``` Send an envelope to an agent, using the stub connection. - + + #### read`_`envelope`_`from`_`agent ```python - | @classmethod - | read_envelope_from_agent(cls, agent: str) -> Envelope +@classmethod +def read_envelope_from_agent(cls, agent: str) -> Envelope ``` Read an envelope from an agent, using the stub connection. - + + #### missing`_`from`_`output ```python - | @classmethod - | missing_from_output(cls, process: subprocess.Popen, strings: Sequence[str], timeout: int = DEFAULT_PROCESS_TIMEOUT, period: int = 1, is_terminating: bool = True) -> List[str] +@classmethod +def missing_from_output(cls, + process: subprocess.Popen, + strings: Sequence[str], + timeout: int = DEFAULT_PROCESS_TIMEOUT, + period: int = 1, + is_terminating: bool = True) -> List[str] ``` Check if strings are present in process output. @@ -618,12 +699,15 @@ or timeout expired. list of missed strings. - + + #### is`_`running ```python - | @classmethod - | is_running(cls, process: subprocess.Popen, timeout: int = DEFAULT_LAUNCH_TIMEOUT) -> bool +@classmethod +def is_running(cls, + process: subprocess.Popen, + timeout: int = DEFAULT_LAUNCH_TIMEOUT) -> bool ``` Check if the AEA is launched and running (ready to process messages). @@ -637,47 +721,52 @@ Check if the AEA is launched and running (ready to process messages). bool indicating status - + + #### invoke ```python - | @classmethod - | invoke(cls, *args: str) -> Result +@classmethod +def invoke(cls, *args: str) -> Result ``` Call the cli command. - + + #### load`_`agent`_`config ```python - | @classmethod - | load_agent_config(cls, agent_name: str) -> AgentConfig +@classmethod +def load_agent_config(cls, agent_name: str) -> AgentConfig ``` Load agent configuration. - + + #### setup`_`class ```python - | @classmethod - | setup_class(cls) -> None +@classmethod +def setup_class(cls) -> None ``` Set up the test class. - + + #### teardown`_`class ```python - | @classmethod - | teardown_class(cls) -> None +@classmethod +def teardown_class(cls) -> None ``` Teardown the test. - + + ## AEATestCaseEmpty Objects ```python @@ -688,27 +777,30 @@ Test case for a default AEA project. This test case will create a default AEA project. - + + #### setup`_`class ```python - | @classmethod - | setup_class(cls) -> None +@classmethod +def setup_class(cls) -> None ``` Set up the test class. - + + #### teardown`_`class ```python - | @classmethod - | teardown_class(cls) -> None +@classmethod +def teardown_class(cls) -> None ``` Teardown the test class. - + + ## AEATestCaseEmptyFlaky Objects ```python @@ -721,27 +813,30 @@ This test case will create a default AEA project. Use for flaky tests with the flaky decorator. - + + #### setup`_`class ```python - | @classmethod - | setup_class(cls) -> None +@classmethod +def setup_class(cls) -> None ``` Set up the test class. - + + #### teardown`_`class ```python - | @classmethod - | teardown_class(cls) -> None +@classmethod +def teardown_class(cls) -> None ``` Teardown the test class. - + + ## AEATestCaseMany Objects ```python @@ -750,27 +845,30 @@ class AEATestCaseMany(BaseAEATestCase) Test case for many AEA projects. - + + #### setup`_`class ```python - | @classmethod - | setup_class(cls) -> None +@classmethod +def setup_class(cls) -> None ``` Set up the test class. - + + #### teardown`_`class ```python - | @classmethod - | teardown_class(cls) -> None +@classmethod +def teardown_class(cls) -> None ``` Teardown the test class. - + + ## AEATestCaseManyFlaky Objects ```python @@ -781,27 +879,30 @@ Test case for many AEA projects which are flaky. Use for flaky tests with the flaky decorator. - + + #### setup`_`class ```python - | @classmethod - | setup_class(cls) -> None +@classmethod +def setup_class(cls) -> None ``` Set up the test class. - + + #### teardown`_`class ```python - | @classmethod - | teardown_class(cls) -> None +@classmethod +def teardown_class(cls) -> None ``` Teardown the test class. - + + ## AEATestCase Objects ```python @@ -813,22 +914,24 @@ Test case from an existing AEA project. Subclass this class and set `path_to_aea` properly. By default, it is assumed the project is inside the current working directory. - + + #### setup`_`class ```python - | @classmethod - | setup_class(cls) -> None +@classmethod +def setup_class(cls) -> None ``` Set up the test class. - + + #### teardown`_`class ```python - | @classmethod - | teardown_class(cls) -> None +@classmethod +def teardown_class(cls) -> None ``` Teardown the test class. diff --git a/docs/api/test_tools/test_contract.md b/docs/api/test_tools/test_contract.md index bb08749709..4a14db338c 100644 --- a/docs/api/test_tools/test_contract.md +++ b/docs/api/test_tools/test_contract.md @@ -1,9 +1,11 @@ - + + # aea.test`_`tools.test`_`contract This module contains test case classes based on pytest for AEA contract testing. - + + ## BaseContractTestCase Objects ```python @@ -12,33 +14,36 @@ class BaseContractTestCase(ABC) A class to test a contract. - + + #### contract ```python - | @property - | contract() -> Contract +@property +def contract() -> Contract ``` Get the contract. - + + #### setup ```python - | @classmethod - | setup(cls, **kwargs: Any) -> None +@classmethod +def setup(cls, **kwargs: Any) -> None ``` Set up the contract test case. - + + #### finish`_`contract`_`deployment ```python - | @classmethod - | @abstractmethod - | finish_contract_deployment(cls) -> str +@classmethod +@abstractmethod +def finish_contract_deployment(cls) -> str ``` Finish deploying contract. @@ -47,22 +52,29 @@ Finish deploying contract. contract address - + + #### refill`_`from`_`faucet ```python - | @staticmethod - | refill_from_faucet(ledger_api: LedgerApi, faucet_api: FaucetApi, address: str) -> None +@staticmethod +def refill_from_faucet(ledger_api: LedgerApi, faucet_api: FaucetApi, + address: str) -> None ``` Refill from faucet. - + + #### sign`_`send`_`confirm`_`receipt`_`multisig`_`transaction ```python - | @staticmethod - | sign_send_confirm_receipt_multisig_transaction(tx: JSONLike, ledger_api: LedgerApi, cryptos: List[Crypto], sleep_time: float = 2.0) -> JSONLike +@staticmethod +def sign_send_confirm_receipt_multisig_transaction( + tx: JSONLike, + ledger_api: LedgerApi, + cryptos: List[Crypto], + sleep_time: float = 2.0) -> JSONLike ``` Sign, send and confirm settlement of a transaction with multiple signatures. @@ -78,12 +90,17 @@ Sign, send and confirm settlement of a transaction with multiple signatures. The transaction receipt - + + #### sign`_`send`_`confirm`_`receipt`_`transaction ```python - | @classmethod - | sign_send_confirm_receipt_transaction(cls, tx: JSONLike, ledger_api: LedgerApi, crypto: Crypto, sleep_time: float = 2.0) -> JSONLike +@classmethod +def sign_send_confirm_receipt_transaction(cls, + tx: JSONLike, + ledger_api: LedgerApi, + crypto: Crypto, + sleep_time: float = 2.0) -> JSONLike ``` Sign, send and confirm settlement of a transaction with multiple signatures. diff --git a/docs/api/test_tools/test_skill.md b/docs/api/test_tools/test_skill.md index 93a15932e7..306647f910 100644 --- a/docs/api/test_tools/test_skill.md +++ b/docs/api/test_tools/test_skill.md @@ -1,9 +1,11 @@ - + + # aea.test`_`tools.test`_`skill This module contains test case classes based on pytest for AEA skill testing. - + + ## BaseSkillTestCase Objects ```python @@ -12,94 +14,106 @@ class BaseSkillTestCase() A class to test a skill. - + + #### skill ```python - | @property - | skill() -> Skill +@property +def skill() -> Skill ``` Get the skill. - + + #### get`_`quantity`_`in`_`outbox ```python - | get_quantity_in_outbox() -> int +def get_quantity_in_outbox() -> int ``` Get the quantity of envelopes in the outbox. - + + #### get`_`message`_`from`_`outbox ```python - | get_message_from_outbox() -> Optional[Message] +def get_message_from_outbox() -> Optional[Message] ``` Get message from outbox. - + + #### drop`_`messages`_`from`_`outbox ```python - | drop_messages_from_outbox(number: int = 1) -> None +def drop_messages_from_outbox(number: int = 1) -> None ``` Dismiss the first 'number' number of message from outbox. - + + #### get`_`quantity`_`in`_`decision`_`maker`_`inbox ```python - | get_quantity_in_decision_maker_inbox() -> int +def get_quantity_in_decision_maker_inbox() -> int ``` Get the quantity of messages in the decision maker inbox. - + + #### get`_`message`_`from`_`decision`_`maker`_`inbox ```python - | get_message_from_decision_maker_inbox() -> Optional[Message] +def get_message_from_decision_maker_inbox() -> Optional[Message] ``` Get message from decision maker inbox. - + + #### drop`_`messages`_`from`_`decision`_`maker`_`inbox ```python - | drop_messages_from_decision_maker_inbox(number: int = 1) -> None +def drop_messages_from_decision_maker_inbox(number: int = 1) -> None ``` Dismiss the first 'number' number of message from decision maker inbox. - + + #### assert`_`quantity`_`in`_`outbox ```python - | assert_quantity_in_outbox(expected_quantity: int) -> None +def assert_quantity_in_outbox(expected_quantity: int) -> None ``` Assert the quantity of messages in the outbox. - + + #### assert`_`quantity`_`in`_`decision`_`making`_`queue ```python - | assert_quantity_in_decision_making_queue(expected_quantity: int) -> None +def assert_quantity_in_decision_making_queue(expected_quantity: int) -> None ``` Assert the quantity of messages in the decision maker queue. - + + #### message`_`has`_`attributes ```python - | @staticmethod - | message_has_attributes(actual_message: Message, message_type: Type[Message], **kwargs: Any, ,) -> Tuple[bool, str] +@staticmethod +def message_has_attributes(actual_message: Message, + message_type: Type[Message], + **kwargs: Any) -> Tuple[bool, str] ``` Evaluates whether a message's attributes match the expected attributes provided. @@ -114,11 +128,21 @@ Evaluates whether a message's attributes match the expected attributes provided. boolean result of the evaluation and accompanied message - + + #### build`_`incoming`_`message ```python - | build_incoming_message(message_type: Type[Message], performative: Message.Performative, dialogue_reference: Optional[Tuple[str, str]] = None, message_id: Optional[int] = None, target: Optional[int] = None, to: Optional[Address] = None, sender: Optional[Address] = None, is_agent_to_agent_messages: Optional[bool] = None, **kwargs: Any, ,) -> Message +def build_incoming_message(message_type: Type[Message], + performative: Message.Performative, + dialogue_reference: Optional[Tuple[str, + str]] = None, + message_id: Optional[int] = None, + target: Optional[int] = None, + to: Optional[Address] = None, + sender: Optional[Address] = None, + is_agent_to_agent_messages: Optional[bool] = None, + **kwargs: Any) -> Message ``` Quickly create an incoming message with the provided attributes. @@ -141,11 +165,21 @@ For any attribute not provided, the corresponding default value in message is us the created incoming message - + + #### build`_`incoming`_`message`_`for`_`skill`_`dialogue ```python - | build_incoming_message_for_skill_dialogue(dialogue: Dialogue, performative: Message.Performative, message_type: Optional[Type[Message]] = None, dialogue_reference: Optional[Tuple[str, str]] = None, message_id: Optional[int] = None, target: Optional[int] = None, to: Optional[Address] = None, sender: Optional[Address] = None, **kwargs: Any, ,) -> Message +def build_incoming_message_for_skill_dialogue( + dialogue: Dialogue, + performative: Message.Performative, + message_type: Optional[Type[Message]] = None, + dialogue_reference: Optional[Tuple[str, str]] = None, + message_id: Optional[int] = None, + target: Optional[int] = None, + to: Optional[Address] = None, + sender: Optional[Address] = None, + **kwargs: Any) -> Message ``` Quickly create an incoming message with the provided attributes for a dialogue. @@ -173,21 +207,26 @@ the test will be, by design, insured to pass on these values. the created incoming message - + + #### prepare`_`skill`_`dialogue ```python - | prepare_skill_dialogue(dialogues: Dialogues, messages: Tuple[DialogueMessage, ...], counterparty: Optional[Address] = None, is_agent_to_agent_messages: Optional[bool] = None) -> Dialogue +def prepare_skill_dialogue( + dialogues: Dialogues, + messages: Tuple[DialogueMessage, ...], + counterparty: Optional[Address] = None, + is_agent_to_agent_messages: Optional[bool] = None) -> Dialogue ``` Quickly create a dialogue. The 'messages' argument is a tuple of DialogueMessages. For every DialogueMessage (performative, contents, is_incoming, target): -- if 'is_incoming' is not provided: for the first message it is assumed False (outgoing), -for any other message, it is the opposite of the one preceding it. -- if 'target' is not provided: for the first message it is assumed 0, -for any other message, it is the index of the message before it in the tuple of messages + 1. + - if 'is_incoming' is not provided: for the first message it is assumed False (outgoing), + for any other message, it is the opposite of the one preceding it. + - if 'target' is not provided: for the first message it is assumed 0, + for any other message, it is the index of the message before it in the tuple of messages + 1. **Arguments**: @@ -200,12 +239,13 @@ for any other message, it is the index of the message before it in the tuple of the created incoming message - + + #### setup ```python - | @classmethod - | setup(cls, **kwargs: Any) -> None +@classmethod +def setup(cls, **kwargs: Any) -> None ``` Set up the skill test case. diff --git a/docs/aries-cloud-agent-demo.md b/docs/aries-cloud-agent-demo.md index 975703d6e4..08266d258c 100644 --- a/docs/aries-cloud-agent-demo.md +++ b/docs/aries-cloud-agent-demo.md @@ -180,7 +180,7 @@ Now you can create **Alice_AEA** and **Faber_AEA** in terminals 3 and 4 respecti In the third terminal, fetch **Alice_AEA** and move into its project folder: ``` bash -aea fetch fetchai/aries_alice:0.32.2 +aea fetch fetchai/aries_alice:0.32.3 cd aries_alice ``` @@ -191,11 +191,11 @@ The following steps create Alice_AEA from scratch: ``` bash aea create aries_alice cd aries_alice -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/http_client:0.24.3 -aea add connection fetchai/webhook:0.20.3 -aea add skill fetchai/aries_alice:0.26.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/http_client:0.24.4 +aea add connection fetchai/webhook:0.20.4 +aea add skill fetchai/aries_alice:0.26.4 ```

@@ -257,14 +257,14 @@ Finally run **Alice_AEA**: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.2 -u public_uri` to retrieve the address.) We will refer to this as **Alice_AEA's P2P address**. +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.3 -u public_uri` to retrieve the address.) We will refer to this as **Alice_AEA's P2P address**. ### Faber_AEA In the fourth terminal, fetch **Faber_AEA** and move into its project folder: ``` bash -aea fetch fetchai/aries_faber:0.32.2 +aea fetch fetchai/aries_faber:0.32.3 cd aries_faber ``` @@ -275,11 +275,11 @@ The following steps create Faber_AEA from scratch: ``` bash aea create aries_faber cd aries_faber -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/http_client:0.24.3 -aea add connection fetchai/webhook:0.20.3 -aea add skill fetchai/aries_faber:0.24.2 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/http_client:0.24.4 +aea add connection fetchai/webhook:0.20.4 +aea add skill fetchai/aries_faber:0.24.3 ```

diff --git a/docs/build-aea-programmatically.md b/docs/build-aea-programmatically.md index 387fe82184..891f6163a9 100644 --- a/docs/build-aea-programmatically.md +++ b/docs/build-aea-programmatically.md @@ -62,7 +62,7 @@ We will use the stub connection to pass envelopes in and out of the AEA. Ensure ``` ## Initialise the AEA -We use the `AEABuilder` to readily build an AEA. By default, the `AEABuilder` adds the `fetchai/default:1.1.3`, `fetchai/state_update:1.1.3` and `fetchai/signing:1.1.3` protocols. +We use the `AEABuilder` to readily build an AEA. By default, the `AEABuilder` adds the `fetchai/default:1.1.4`, `fetchai/state_update:1.1.4` and `fetchai/signing:1.1.4` protocols. ``` python # Instantiate the builder and build the AEA # By default, the default protocol, error skill and stub connection are added diff --git a/docs/car-park-skills.md b/docs/car-park-skills.md index 2389e96ad4..8062a754f3 100644 --- a/docs/car-park-skills.md +++ b/docs/car-park-skills.md @@ -57,9 +57,9 @@ Install the AEA ManagerDorado block explorer and request some test tokens via `Get Funds`. @@ -97,7 +97,7 @@ Follow the Preliminaries and =1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea install aea build @@ -135,7 +135,7 @@ aea build Then, fetch the car data client AEA: ``` bash -aea fetch fetchai/car_data_buyer:0.33.2 +aea fetch fetchai/car_data_buyer:0.33.3 cd car_data_buyer aea install aea build @@ -148,19 +148,19 @@ The following steps create the car data client from scratch: ``` bash aea create car_data_buyer cd car_data_buyer -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/carpark_client:0.27.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/carpark_client:0.27.4 aea config set --type dict agent.dependencies \ '{ "aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea install aea build @@ -225,7 +225,7 @@ First, run the car data seller AEA: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.2 -u public_uri` to retrieve the address.) +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.3 -u public_uri` to retrieve the address.) This is the entry peer address for the local agent communication network created by the car data seller. Then, in the car data buyer, run this command (replace `SOME_ADDRESS` with the correct value as described above): diff --git a/docs/cli-vs-programmatic-aeas.md b/docs/cli-vs-programmatic-aeas.md index f92f024cfe..bb47bea29d 100644 --- a/docs/cli-vs-programmatic-aeas.md +++ b/docs/cli-vs-programmatic-aeas.md @@ -33,7 +33,7 @@ If you want to create the weather station AEA step by step you can follow this g Fetch the weather station AEA with the following command : ``` bash -aea fetch fetchai/weather_station:0.32.2 +aea fetch fetchai/weather_station:0.32.3 cd weather_station aea install aea build diff --git a/docs/config.md b/docs/config.md index 3e498fd02e..eafea32332 100644 --- a/docs/config.md +++ b/docs/config.md @@ -21,13 +21,13 @@ aea_version: '>=1.0.0, <2.0.0' # AEA framework version(s) compatib fingerprint: {} # Fingerprint of AEA project components. fingerprint_ignore_patterns: [] # Ignore pattern for the fingerprinting tool. connections: # The list of connection public ids the AEA project depends on (each public id must satisfy PUBLIC_ID_REGEX) -- fetchai/stub:0.21.1 +- fetchai/stub:0.21.2 contracts: [] # The list of contract public ids the AEA project depends on (each public id must satisfy PUBLIC_ID_REGEX). protocols: # The list of protocol public ids the AEA project depends on (each public id must satisfy PUBLIC_ID_REGEX). -- fetchai/default:1.1.3 +- fetchai/default:1.1.4 skills: # The list of skill public ids the AEA project depends on (each public id must satisfy PUBLIC_ID_REGEX). -- fetchai/error:0.18.3 -default_connection: fetchai/p2p_libp2p:0.27.2 # The default connection used for envelopes sent by the AEA (must satisfy PUBLIC_ID_REGEX). +- fetchai/error:0.18.4 +default_connection: fetchai/p2p_libp2p:0.27.3 # The default connection used for envelopes sent by the AEA (must satisfy PUBLIC_ID_REGEX). default_ledger: fetchai # The default ledger identifier the AEA project uses (must satisfy LEDGER_ID_REGEX) required_ledgers: [fetchai] # the list of identifiers of ledgers that the AEA project requires key pairs for (each item must satisfy LEDGER_ID_REGEX) default_routing: {} # The default routing scheme applied to envelopes sent by the AEA, it maps from protocol public ids to connection public ids (both keys and values must satisfy PUBLIC_ID_REGEX) diff --git a/docs/connect-a-frontend.md b/docs/connect-a-frontend.md index 2842e6690a..fcb8246fb8 100644 --- a/docs/connect-a-frontend.md +++ b/docs/connect-a-frontend.md @@ -3,7 +3,7 @@ This page lays out two options for connecting a front-end to an AEA. The followi How to connect front-end to your AEA ## Case 1 -The first option is to create a `HTTP Server` connection that handles incoming requests from a REST API. In this scenario, the REST API communicates with the AEA and requests are handled by the `HTTP Server` connection package. The REST API should send CRUD requests to the `HTTP Server` connection (`fetchai/http_server:0.23.3`) which translates these into Envelopes to be consumed by the correct skill. +The first option is to create a `HTTP Server` connection that handles incoming requests from a REST API. In this scenario, the REST API communicates with the AEA and requests are handled by the `HTTP Server` connection package. The REST API should send CRUD requests to the `HTTP Server` connection (`fetchai/http_server:0.23.4`) which translates these into Envelopes to be consumed by the correct skill. ## Case 2 -The second option is to create a front-end comprising a stand-alone `Multiplexer` with a `P2P` connection (`fetchai/p2p_libp2p:0.27.2`). In this scenario the Agent Communication Network can be used to send Envelopes from the AEA to the front-end. \ No newline at end of file +The second option is to create a front-end comprising a stand-alone `Multiplexer` with a `P2P` connection (`fetchai/p2p_libp2p:0.27.3`). In this scenario the Agent Communication Network can be used to send Envelopes from the AEA to the front-end. \ No newline at end of file diff --git a/docs/connection.md b/docs/connection.md index b1fe507bae..66f1bb641b 100644 --- a/docs/connection.md +++ b/docs/connection.md @@ -36,7 +36,7 @@ The developer needs to implement four public coroutines: - The `receive` coroutine is continuously called by the AEA framework. It either returns `None` or an envelope. The `receive` coroutine must implement the logic of data being received by the agent, and if necessary, its translation into a relevant protocol. -The framework provides a demo `stub` connection which implements an I/O reader and writer to send and receive messages between the agent and a local file. To gain inspiration and become familiar with the structure of connection packages, you may find it useful to check out `fetchai/stub:0.21.1`, `fetchai/http_server:0.23.3` or `fetchai/http_client:0.24.3` connections. The latter two connections are for external clients to connect with an agent, and for the agent to connect with external servers, respectively. +The framework provides a demo `stub` connection which implements an I/O reader and writer to send and receive messages between the agent and a local file. To gain inspiration and become familiar with the structure of connection packages, you may find it useful to check out `fetchai/stub:0.21.2`, `fetchai/http_server:0.23.4` or `fetchai/http_client:0.24.4` connections. The latter two connections are for external clients to connect with an agent, and for the agent to connect with external servers, respectively. ### Primary methods to develop - sync connection interface diff --git a/docs/contract.md b/docs/contract.md index 477d0cb33f..7186ef47fd 100644 --- a/docs/contract.md +++ b/docs/contract.md @@ -18,9 +18,9 @@ Interacting with contracts in almost all cases requires network access. Therefor Message flow for contract and ledger interactions -In particular, the `fetchai/ledger:0.21.2` connection can be used to execute contract related logic. The skills communicate with the `fetchai/ledger:0.21.2` connection via the `fetchai/contract_api:1.0.0` protocol. This protocol implements a request-response pattern to serve the four types of methods listed above: +In particular, the `fetchai/ledger:0.21.3` connection can be used to execute contract related logic. The skills communicate with the `fetchai/ledger:0.21.3` connection via the `fetchai/contract_api:1.0.0` protocol. This protocol implements a request-response pattern to serve the four types of methods listed above: -- the `get_deploy_transaction` message is used to request a deploy transaction for a specific contract. For instance, to request a deploy transaction for the deployment of the smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.2`: +- the `get_deploy_transaction` message is used to request a deploy transaction for a specific contract. For instance, to request a deploy transaction for the deployment of the smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.3`: ``` python contract_api_msg = ContractApiMessage( @@ -37,7 +37,7 @@ contract_api_msg = ContractApiMessage( Any additional arguments needed by the contract's constructor method should be added to `kwargs`. -This message will be handled by the `fetchai/ledger:0.21.2` connection and then a `raw_transaction` message will be returned with the matching raw transaction. To send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.21.2` connection using the `fetchai/ledger_api:1.0.0` protocol. For details on how to implement the message handling, see the handlers in the `erc1155_deploy` skill. +This message will be handled by the `fetchai/ledger:0.21.3` connection and then a `raw_transaction` message will be returned with the matching raw transaction. To send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.21.3` connection using the `fetchai/ledger_api:1.0.0` protocol. For details on how to implement the message handling, see the handlers in the `erc1155_deploy` skill.

CosmWasm based smart contract deployments

@@ -45,7 +45,7 @@ This message will be handled by the `fetchai/ledger:0.21.2` connection and then

-- the `get_raw_transaction` message is used to request any transaction for a specific contract which changes state in the contract. For instance, to request a transaction for the creation of token in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.2`: +- the `get_raw_transaction` message is used to request any transaction for a specific contract which changes state in the contract. For instance, to request a transaction for the creation of token in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.3`: ``` python contract_api_msg = ContractApiMessage( @@ -64,9 +64,9 @@ contract_api_msg = ContractApiMessage( ) ``` -This message will be handled by the `fetchai/ledger:0.21.2` connection and then a `raw_transaction` message will be returned with the matching raw transaction. For this to be executed correctly, the `fetchai/erc1155:0.23.2` contract package needs to implement the `get_create_batch_transaction` method with the specified key word arguments (see example in *Deploy your own*, below). Similarly to above, to send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.21.2` connection using the `fetchai/ledger_api:1.0.0` protocol. +This message will be handled by the `fetchai/ledger:0.21.3` connection and then a `raw_transaction` message will be returned with the matching raw transaction. For this to be executed correctly, the `fetchai/erc1155:0.23.2` contract package needs to implement the `get_create_batch_transaction` method with the specified key word arguments (see example in *Deploy your own*, below). Similarly to above, to send this transaction to the ledger for processing, we first sign the message with the decision maker and then send the signed transaction to the `fetchai/ledger:0.21.3` connection using the `fetchai/ledger_api:1.0.0` protocol. -- the `get_raw_message` message is used to request any contract method call for a specific contract which does not change state in the contract. For instance, to request a call to get a hash from some input data in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.2`: +- the `get_raw_message` message is used to request any contract method call for a specific contract which does not change state in the contract. For instance, to request a call to get a hash from some input data in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.3`: ``` python contract_api_msg = ContractApiMessage( @@ -89,10 +89,10 @@ contract_api_msg = ContractApiMessage( ), ) ``` -This message will be handled by the `fetchai/ledger:0.21.2` connection and then a `raw_message` message will be returned with the matching raw message. For this to be executed correctly, the `fetchai/erc1155:0.23.2` contract package needs to implement the `get_hash_single` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.21.2` connection using the `fetchai/ledger_api:1.0.0` protocol. In this case, signing is not required. +This message will be handled by the `fetchai/ledger:0.21.3` connection and then a `raw_message` message will be returned with the matching raw message. For this to be executed correctly, the `fetchai/erc1155:0.23.2` contract package needs to implement the `get_hash_single` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.21.3` connection using the `fetchai/ledger_api:1.0.0` protocol. In this case, signing is not required. -- the `get_state` message is used to request any contract method call to query state in the deployed contract. For instance, to request a call to get the balances in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.2`: +- the `get_state` message is used to request any contract method call to query state in the deployed contract. For instance, to request a call to get the balances in the deployed `erc1155` smart contract wrapped in the `fetchai/erc1155:0.23.2` package, we send the following message to the `fetchai/ledger:0.21.3`: ``` python contract_api_msg = ContractApiMessage( @@ -107,7 +107,7 @@ contract_api_msg = ContractApiMessage( ), ) ``` -This message will be handled by the `fetchai/ledger:0.21.2` connection and then a `state` message will be returned with the matching state. For this to be executed correctly, the `fetchai/erc1155:0.23.2` contract package needs to implement the `get_balance` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.21.2` connection using the `fetchai/ledger_api:1.0.0` protocol. In this case, signing is not required. +This message will be handled by the `fetchai/ledger:0.21.3` connection and then a `state` message will be returned with the matching state. For this to be executed correctly, the `fetchai/erc1155:0.23.2` contract package needs to implement the `get_balance` method with the specified key word arguments. We can then send the raw message to the `fetchai/ledger:0.21.3` connection using the `fetchai/ledger_api:1.0.0` protocol. In this case, signing is not required. ## Developing your own @@ -180,6 +180,6 @@ class MyContract(Contract): tx = cls._try_estimate_gas(ledger_api, tx) return tx ``` -Above, we implement a method to create a transaction, in this case a transaction to create a batch of tokens. The method will be called by the framework, specifically the `fetchai/ledger:0.21.2` connection once it receives a message (see bullet point 2 above). The method first gets the latest transaction nonce of the `deployer_address`, then constructs the contract instance, then uses the instance to build the transaction and finally updates the gas on the transaction. +Above, we implement a method to create a transaction, in this case a transaction to create a batch of tokens. The method will be called by the framework, specifically the `fetchai/ledger:0.21.3` connection once it receives a message (see bullet point 2 above). The method first gets the latest transaction nonce of the `deployer_address`, then constructs the contract instance, then uses the instance to build the transaction and finally updates the gas on the transaction. -It helps to look at existing contract packages, like `fetchai/erc1155:0.23.2`, and skills using them, like `fetchai/erc1155_client:0.11.0` and `fetchai/erc1155_deploy:0.31.3`, for inspiration and guidance. +It helps to look at existing contract packages, like `fetchai/erc1155:0.23.2`, and skills using them, like `fetchai/erc1155_client:0.11.0` and `fetchai/erc1155_deploy:0.31.4`, for inspiration and guidance. diff --git a/docs/core-components-1.md b/docs/core-components-1.md index fd9727eb79..23c85cd2e1 100644 --- a/docs/core-components-1.md +++ b/docs/core-components-1.md @@ -34,7 +34,7 @@ An `Envelope` is the core object * `Dialogues`, which define rules over `Message` sequences. -The framework provides one default `Protocol`, called `default` (current version `fetchai/default:1.1.3`). This `Protocol` provides a bare-bones implementation for an AEA `Protocol` which includes a `DefaultMessage` class and associated `DefaultSerializer` and `DefaultDialogue` classes. +The framework provides one default `Protocol`, called `default` (current version `fetchai/default:1.1.4`). This `Protocol` provides a bare-bones implementation for an AEA `Protocol` which includes a `DefaultMessage` class and associated `DefaultSerializer` and `DefaultDialogue` classes. Additional `Protocols`, for new types of interactions, can be added as packages. For more details on `Protocols` you can read the protocol guide. To learn how you can easily automate protocol definition, head to the guide for the protocol generator. @@ -44,7 +44,7 @@ Protocol specific `Messages`, wrapped in `Envelopes`, are sent and received to o A `Connection` wraps an SDK or API and provides an interface to networks, ledgers or other services. Where necessary, a `Connection` is responsible for translating between the framework specific `Envelope` with its contained `Message` and the external service or third-party protocol (e.g. `HTTP`). -The framework provides one default `Connection`, called `stub` (current version `fetchai/stub:0.21.1`). It implements an I/O reader and writer to send `Messages` to the agent from a local file. +The framework provides one default `Connection`, called `stub` (current version `fetchai/stub:0.21.2`). It implements an I/O reader and writer to send `Messages` to the agent from a local file. Additional `Connections` can be added as packages. For more details on `Connections` read the `Connection` guide . diff --git a/docs/erc1155-skills.md b/docs/erc1155-skills.md index 7e1b841921..9ff1c016ee 100644 --- a/docs/erc1155-skills.md +++ b/docs/erc1155-skills.md @@ -25,7 +25,7 @@ The scope of this guide is demonstrating how you can deploy a smart contract and Fetch the AEA that will deploy the contract: ``` bash -aea fetch fetchai/erc1155_deployer:0.34.2 +aea fetch fetchai/erc1155_deployer:0.34.3 cd erc1155_deployer aea install aea build @@ -39,22 +39,22 @@ Create the AEA that will deploy the contract. ``` bash aea create erc1155_deployer cd erc1155_deployer -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/erc1155_deploy:0.31.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/erc1155_deploy:0.31.4 aea config set --type dict agent.dependencies \ '{ "aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"}, "aea-ledger-ethereum": {"version": "<2.0.0,>=1.0.0"}, "aea-ledger-cosmos": {"version": "<2.0.0,>=1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/contract_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/contract_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea config set --type list vendor.fetchai.connections.p2p_libp2p.cert_requests \ '[{"identifier": "acn", "ledger_id": "ethereum", "not_after": "2023-01-01", "not_before": "2022-01-01", "public_key": "fetchai", "save_path": ".certs/conn_cert.txt"}]' @@ -95,7 +95,7 @@ aea issue-certificates In another terminal, fetch the client AEA which will receive some tokens from the deployer. ``` bash -aea fetch fetchai/erc1155_client:0.34.2 +aea fetch fetchai/erc1155_client:0.34.3 cd erc1155_client aea install aea build @@ -109,22 +109,22 @@ Create the AEA that will get some tokens from the deployer. ``` bash aea create erc1155_client cd erc1155_client -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/erc1155_client:0.29.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/erc1155_client:0.29.4 aea config set --type dict agent.dependencies \ '{ "aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"}, "aea-ledger-ethereum": {"version": "<2.0.0,>=1.0.0"}, "aea-ledger-cosmos": {"version": "<2.0.0,>=1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/contract_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/contract_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea config set --type list vendor.fetchai.connections.p2p_libp2p.cert_requests \ '[{"identifier": "acn", "ledger_id": "ethereum", "not_after": "2023-01-01", "not_before": "2022-01-01", "public_key": "fetchai", "save_path": ".certs/conn_cert.txt"}]' @@ -199,7 +199,7 @@ aea run Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of this address. -Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.2 -u public_uri` to retrieve the address. The output will be something like `/dns4/127.0.0.1/tcp/9000/p2p/16Uiu2HAm2JPsUX1Su59YVDXJQizYkNSe8JCusqRpLeeTbvY76fE5`. +Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.3 -u public_uri` to retrieve the address. The output will be something like `/dns4/127.0.0.1/tcp/9000/p2p/16Uiu2HAm2JPsUX1Su59YVDXJQizYkNSe8JCusqRpLeeTbvY76fE5`. This is the entry peer address for the local agent communication network created by the deployer. diff --git a/docs/generic-skills-step-by-step.md b/docs/generic-skills-step-by-step.md index eaa982b83d..8512a49ad1 100644 --- a/docs/generic-skills-step-by-step.md +++ b/docs/generic-skills-step-by-step.md @@ -11,16 +11,16 @@ Follow the Preliminaries and Preliminaries and =1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea install aea build @@ -96,7 +96,7 @@ aea build Then, in another terminal fetch the buyer AEA: ``` bash -aea fetch fetchai/generic_buyer:0.30.2 --alias my_buyer_aea +aea fetch fetchai/generic_buyer:0.30.3 --alias my_buyer_aea cd my_buyer_aea aea install aea build @@ -109,19 +109,19 @@ The following steps create the buyer from scratch: ``` bash aea create my_buyer_aea cd my_buyer_aea -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/generic_buyer:0.27.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/generic_buyer:0.27.4 aea config set --type dict agent.dependencies \ '{ "aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea install aea build @@ -252,7 +252,7 @@ First, run the seller AEA: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of this address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.2 -u public_uri` to retrieve the address.) +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of this address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.3 -u public_uri` to retrieve the address.) This is the entry peer address for the local agent communication network created by the seller. Then, configure the buyer to connect to this same local ACN by running the following command in the buyer terminal, replacing `SOME_ADDRESS` with the value you noted above: diff --git a/docs/gym-skill.md b/docs/gym-skill.md index 91c149f710..573203cdfa 100644 --- a/docs/gym-skill.md +++ b/docs/gym-skill.md @@ -32,7 +32,7 @@ pip install numpy gym First, fetch the gym AEA: ``` bash -aea fetch fetchai/gym_aea:0.26.2 --alias my_gym_aea +aea fetch fetchai/gym_aea:0.26.3 --alias my_gym_aea cd my_gym_aea aea install ``` @@ -49,12 +49,12 @@ cd my_gym_aea ### Add the gym skill ``` bash -aea add skill fetchai/gym:0.21.3 +aea add skill fetchai/gym:0.21.4 ``` ### Set gym connection as default ``` bash -aea config set agent.default_connection fetchai/gym:0.20.3 +aea config set agent.default_connection fetchai/gym:0.20.4 ``` ### Install the skill dependencies diff --git a/docs/http-connection-and-skill.md b/docs/http-connection-and-skill.md index 9127a0e9d1..226744c5f5 100644 --- a/docs/http-connection-and-skill.md +++ b/docs/http-connection-and-skill.md @@ -8,7 +8,7 @@ The HTTP server connection allows you to run a server inside the connection itse ## HTTP Client -The `fetchai/simple_data_request:0.14.3` skill demonstrates a simple use case of the HTTP Client connection. +The `fetchai/simple_data_request:0.14.4` skill demonstrates a simple use case of the HTTP Client connection. The `HttpRequestBehaviour` in `behaviours.py` periodically sends HTTP envelops to the HTTP client connection. Its `act()` method, periodically called, simply calls `_generate_http_request` which contains the logic for enqueueing an HTTP request envelop. @@ -26,13 +26,13 @@ cd my_aea Add the http server connection package: ``` bash -aea add connection fetchai/http_server:0.23.3 +aea add connection fetchai/http_server:0.23.4 ``` Update the default connection: ``` bash -aea config set agent.default_connection fetchai/http_server:0.23.3 +aea config set agent.default_connection fetchai/http_server:0.23.4 ``` Modify the `api_spec_path`: @@ -317,7 +317,7 @@ models: Run the fingerprinter (note, you will have to replace the author name with your author handle): ``` bash -aea fingerprint skill fetchai/http_echo:0.21.3 +aea fingerprint skill fetchai/http_echo:0.21.4 ``` diff --git a/docs/language-agnostic-definition.md b/docs/language-agnostic-definition.md index aa85e1ad4f..cdc670d413 100644 --- a/docs/language-agnostic-definition.md +++ b/docs/language-agnostic-definition.md @@ -71,7 +71,7 @@ message Envelope{
  • It MUST implement protocols according to their specification (see here for details). -
  • It SHOULD implement the fetchai/default:1.1.3 protocol which satisfies the following protobuf schema: +
  • It SHOULD implement the fetchai/default:1.1.4 protocol which satisfies the following protobuf schema: ``` proto syntax = "proto3"; @@ -121,7 +121,7 @@ message DefaultMessage{
  • It MUST have an identity in the form of, at a minimum, an address derived from a public key and its associated private key (where the elliptic curve must be of type SECP256k1).
  • -
  • It SHOULD implement handling of errors using the fetchai/default:1.1.3 protocol. The protobuf schema is given above. +
  • It SHOULD implement handling of errors using the fetchai/default:1.1.4 protocol. The protobuf schema is given above.
  • It MUST implement the following principles when handling messages:
      diff --git a/docs/ledger-integration.md b/docs/ledger-integration.md index 755c096077..27fae94d5d 100644 --- a/docs/ledger-integration.md +++ b/docs/ledger-integration.md @@ -146,7 +146,7 @@ Stargate World is our stable, public testnet for the Fetch Ledger v2. As such, m You can access more details on docs section. -The configurations can be specified for the `fetchai/ledger:0.21.2` connection. +The configurations can be specified for the `fetchai/ledger:0.21.3` connection. ## CosmWasm supporting chains diff --git a/docs/logging.md b/docs/logging.md index 35ac27615f..52cd984351 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -22,13 +22,13 @@ aea_version: 0.6.0 fingerprint: {} fingerprint_ignore_patterns: [] connections: -- fetchai/stub:0.21.1 +- fetchai/stub:0.21.2 contracts: [] protocols: -- fetchai/default:1.1.3 +- fetchai/default:1.1.4 skills: -- fetchai/error:0.18.3 -default_connection: fetchai/stub:0.21.1 +- fetchai/error:0.18.4 +default_connection: fetchai/stub:0.21.2 default_ledger: fetchai required_ledgers: - fetchai diff --git a/docs/ml-skills.md b/docs/ml-skills.md index a69f5cf55f..1bc8124f25 100644 --- a/docs/ml-skills.md +++ b/docs/ml-skills.md @@ -106,7 +106,7 @@ Follow this approach when using the `aea` CLI. First, fetch the data provider AEA: ``` bash -aea fetch fetchai/ml_data_provider:0.32.2 +aea fetch fetchai/ml_data_provider:0.32.3 cd ml_data_provider aea install aea build @@ -119,19 +119,19 @@ The following steps create the data provider from scratch: ``` bash aea create ml_data_provider cd ml_data_provider -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/ml_data_provider:0.27.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/ml_data_provider:0.27.4 aea config set --type dict agent.dependencies \ '{ "aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea install aea build @@ -144,7 +144,7 @@ aea build Then, fetch the model trainer AEA: ``` bash -aea fetch fetchai/ml_model_trainer:0.33.2 +aea fetch fetchai/ml_model_trainer:0.33.3 cd ml_model_trainer aea install aea build @@ -157,19 +157,19 @@ The following steps create the model trainer from scratch: ``` bash aea create ml_model_trainer cd ml_model_trainer -aea add connection fetchai/p2p_libp2p:0.27.2 -aea add connection fetchai/soef:0.27.3 -aea add connection fetchai/ledger:0.21.2 -aea add skill fetchai/ml_train:0.29.3 +aea add connection fetchai/p2p_libp2p:0.27.3 +aea add connection fetchai/soef:0.27.4 +aea add connection fetchai/ledger:0.21.3 +aea add skill fetchai/ml_train:0.29.4 aea config set --type dict agent.dependencies \ '{ "aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"} }' -aea config set agent.default_connection fetchai/p2p_libp2p:0.27.2 +aea config set agent.default_connection fetchai/p2p_libp2p:0.27.3 aea config set --type dict agent.default_routing \ '{ - "fetchai/ledger_api:1.1.3": "fetchai/ledger:0.21.2", - "fetchai/oef_search:1.1.3": "fetchai/soef:0.27.3" + "fetchai/ledger_api:1.1.4": "fetchai/ledger:0.21.3", + "fetchai/oef_search:1.1.4": "fetchai/soef:0.27.4" }' aea install aea build @@ -234,7 +234,7 @@ First, run the data provider AEA: aea run ``` -Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.2 -u public_uri` to retrieve the address.) +Once you see a message of the form `To join its network use multiaddr 'SOME_ADDRESS'` take note of the address. (Alternatively, use `aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.27.3 -u public_uri` to retrieve the address.) This is the entry peer address for the local agent communication network created by the ML data provider.