Skip to content

Conversation

@rmi7
Copy link
Contributor

@rmi7 rmi7 commented Mar 17, 2022

fixes #246

@rmi7 rmi7 requested a review from montyly March 17, 2022 16:32
root_file_path = None
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if root_file_path is not None: # already found target contract
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing this to != will make the mypy error go away. But then pylint will error saying it needs to be is not..

Comment on lines +420 to +433
root_file_path = None
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if root_file_path is not None: # already found target contract
break
for node in file_ast["nodes"]:
if node["nodeType"] == "ContractDefinition" and node["name"] == root_contract_name:
root_file_path = file_path
base_path = file_path.replace(file_ast["absolutePath"], "")
break

if root_file_path is None:
# we could not find a contract with that name in any of the files
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
root_file_path = None
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if root_file_path is not None: # already found target contract
break
for node in file_ast["nodes"]:
if node["nodeType"] == "ContractDefinition" and node["name"] == root_contract_name:
root_file_path = file_path
base_path = file_path.replace(file_ast["absolutePath"], "")
break
if root_file_path is None:
# we could not find a contract with that name in any of the files
return
root_file_path = None
found = False
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if found: # already found target contract
break
for node in file_ast["nodes"]:
if node["nodeType"] == "ContractDefinition" and node["name"] == root_contract_name:
root_file_path = file_path
found = True
base_path = file_path.replace(file_ast["absolutePath"], "")
break
if not found:
# we could not find a contract with that name in any of the files
return

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alexander Remie seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants