Skip to content

Commit

Permalink
Merge pull request #26 from iamdefinitelyahuman/library-name
Browse files Browse the repository at this point in the history
v1.2.10
  • Loading branch information
iamdefinitelyahuman committed Jan 29, 2024
2 parents abc957c + 1cff6c0 commit 6b49342
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 43 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Python 3.8
- name: Setup Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.12

- name: Install Tox
run: pip install tox wheel
Expand All @@ -30,7 +30,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-minor: [6, 7, 8, 9]
python-minor: [10, 11, 12]

steps:
- uses: actions/checkout@v2
Expand All @@ -50,4 +50,4 @@ jobs:
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dist/
coverage.xml
.mypy_cache/
.tox/
venv
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/iamdefinitelyahuman/py-solc-ast)

## [1.2.10](https://github.com/iamdefinitelyahuman/py-solc-ast/releases/tag/v1.2.10) - 2024-01-29
### Fixed
- simplify / fix issue with retrieving library names from `UsingForDirective`

## [1.2.9](https://github.com/iamdefinitelyahuman/py-solc-ast/releases/tag/v1.2.9) - 2021-07-26
### Fixed
- fix issue with inheritance in Solidity >= 0.8.3
Expand Down
16 changes: 8 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
black==19.10b0
bumpversion==0.5.3
flake8==3.7.9
isort==4.3.21
pytest==5.4.1
pytest-cov==2.7.1
twine==1.13.0
wheel==0.33.4
black==24.1.1
bumpversion==0.6.0
flake8==7.0.0
isort==5.13.2
pytest==8.0.0
pytest-cov==4.1.0
twine==4.0.2
wheel==0.42.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.2.9
current_version = 1.2.10

[bumpversion:file:setup.py]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="py-solc-ast",
version="1.2.9",
version="1.2.10",
description="A tool for exploring the abstract syntax tree generated by solc.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
19 changes: 2 additions & 17 deletions solcast/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ def set_dependencies(source_nodes):
# add immediate dependencies
for contract in contract_list:
contract.dependencies = set()
contract.libraries = dict(
(_get_type_name(i.typeName), i.libraryName.name)
for i in contract.nodes
if i.nodeType == "UsingForDirective"
)
contract.libraries = dict()

# listed dependencies
for key in contract.contractDependencies:
Expand All @@ -28,7 +24,7 @@ def set_dependencies(source_nodes):
# using .. for libraries
for node in contract.children(filters={"nodeType": "UsingForDirective"}):
ref_node = symbol_map[node.libraryName.referencedDeclaration]
contract.libraries[_get_type_name(node.typeName)] = ref_node
contract.libraries[node.libraryName.name] = ref_node
contract.dependencies.add(ref_node)

# imported contracts used as types in assignment
Expand Down Expand Up @@ -78,7 +74,6 @@ def set_dependencies(source_nodes):

# convert dependency sets to lists
for contract in contract_list:

if contract in contract.dependencies:
# a contract should not list itself as a dependency
contract.dependencies.remove(contract)
Expand All @@ -104,13 +99,3 @@ def get_symbol_map(source_nodes):
pass

return symbol_map


def _get_type_name(node):
if node is None:
return None
if hasattr(node, "name"):
return node.name
if hasattr(node, "typeDescriptions"):
return node.typeDescriptions["typeString"]
return None
3 changes: 0 additions & 3 deletions solcast/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


def from_standard_output_json(path):

"""
Generates SourceUnit objects from a standard output json file.
Expand All @@ -21,7 +20,6 @@ def from_standard_output_json(path):


def from_standard_output(output_json):

"""
Generates SourceUnit objects from a standard output json as a dict.
Expand All @@ -35,7 +33,6 @@ def from_standard_output(output_json):


def from_ast(ast):

"""
Generates a SourceUnit object from the given AST. Dependencies are not set.
"""
Expand Down
1 change: 1 addition & 0 deletions tests/test_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import pytest

import solcast

JSON_PATHS = list(Path("tests/compiled").glob("*.json"))
Expand Down
17 changes: 8 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
[tox]
envlist =
lint
py{36,37,38, 39}
py{310,311,312}

[travis]
python =
3.6: lint, py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: lint,py312

[testenv:lint]
deps =
flake8==3.7.9
black==19.10b0
isort==4.3.21
flake8==7.0.0
black==24.1.1
isort==5.13.2
basepython=python3
extras=linter
commands =
flake8 {toxinidir}/solcast {toxinidir}/tests
black --check {toxinidir}/solcast {toxinidir}/tests
isort --check-only --diff --recursive {toxinidir}/solcast {toxinidir}/tests

[testenv:py{36,37,38, 39}]
[testenv:py{310,311,312}]
deps =
pytest
pytest-cov
Expand Down

0 comments on commit 6b49342

Please sign in to comment.