Skip to content

Commit

Permalink
Merge pull request #1363 from ydm/master
Browse files Browse the repository at this point in the history
Check if re.findall actually matches
  • Loading branch information
iamdefinitelyahuman authored Dec 4, 2021
2 parents 0fa4477 + dfa55ce commit 5ca0352
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions brownie/project/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,13 @@ def get_contract_names(full_source: str) -> List:

contract_names = []
for source in contracts:
type_, name, _ = re.findall(
matches = re.findall(
r"(abstract contract|contract|library|interface)\s+(\S*)\s*(?:is\s+([\s\S]*?)|)(?:{)",
source,
)[0]
contract_names.append((name, type_))
)
if matches:
type_, name, _ = matches[0]
contract_names.append((name, type_))
return contract_names


Expand Down

0 comments on commit 5ca0352

Please sign in to comment.