Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored master branch #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Nov 20, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from huths0lo November 20, 2023 13:50
cp = plt.Program("1.0.0", validator)
return cp
return plt.Program("1.0.0", validator)
Copy link
Author

Choose a reason for hiding this comment

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

Function UPLCCompiler.visit_Module refactored with the following changes:

Comment on lines -799 to +798
if ifs is None:
ifs = self.visit(ifexpr)
else:
ifs = plt.And(ifs, self.visit(ifexpr))
ifs = self.visit(ifexpr) if ifs is None else plt.And(ifs, self.visit(ifexpr))
Copy link
Author

Choose a reason for hiding this comment

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

Function UPLCCompiler.visit_ListComp refactored with the following changes:

Comment on lines -498 to +502
[
txi.resolved.value.get(token.policy_id, {b"": 0}).get(token.token_name, 0)
for txi in txins
if txi.resolved.address == address
]
txi.resolved.value.get(token.policy_id, {b"": 0}).get(
token.token_name, 0
)
for txi in txins
if txi.resolved.address == address
Copy link
Author

Choose a reason for hiding this comment

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

Function all_tokens_unlocked_from_address refactored with the following changes:

Comment on lines -511 to +513
[
txo.value.get(token.policy_id, {b"": 0}).get(token.token_name, 0)
for txo in txouts
if txo.address == address and txo.datum == output_datum
]
txo.value.get(token.policy_id, {b"": 0}).get(token.token_name, 0)
for txo in txouts
if txo.address == address and txo.datum == output_datum
Copy link
Author

Choose a reason for hiding this comment

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

Function all_tokens_locked_at_address_with_datum refactored with the following changes:

[
txo.value.get(token.policy_id, {b"": 0}).get(token.token_name, 0)
for txo in txouts
if txo.address == address
]
txo.value.get(token.policy_id, {b"": 0}).get(token.token_name, 0)
for txo in txouts
if txo.address == address
Copy link
Author

Choose a reason for hiding this comment

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

Function all_tokens_locked_at_address refactored with the following changes:

for scope in reversed(self.guaranteed_avail_names):
if name in scope:
return True
return False
return any(name in scope for scope in reversed(self.guaranteed_avail_names))
Copy link
Author

Choose a reason for hiding this comment

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

Function OptimizeRemoveDeadvars.guaranteed refactored with the following changes:

  • Use any() instead of for loop (use-any)

hex_str = "0" + hex_str
hex_str = f"0{hex_str}"
Copy link
Author

Choose a reason for hiding this comment

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

Function bs_from_int refactored with the following changes:

Comment on lines -50 to +51
# sort by most used
varmap = {}
varnames = sorted(collector.vars.items(), key=lambda x: x[1], reverse=True)
for i, (v, _) in enumerate(varnames):
varmap[v] = bs_from_int(i)
varmap = {v: bs_from_int(i) for i, (v, _) in enumerate(varnames)}
Copy link
Author

Choose a reason for hiding this comment

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

Function OptimizeVarlen.visit_Module refactored with the following changes:

This removes the following comments ( why? ):

# sort by most used

a = Assign(
return Assign(
Copy link
Author

Choose a reason for hiding this comment

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

Function RewriteAugAssign.visit_AugAssign refactored with the following changes:

node.names[0].asname == None
node.names[0].asname is None
Copy link
Author

Choose a reason for hiding this comment

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

Function RewriteImport.visit_ImportFrom refactored with the following changes:

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.

0 participants