Skip to content

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 31, 2020

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^

@sourcery-ai sourcery-ai bot requested a review from andife October 31, 2020 06:59
model.train()

for epoch in range(epochs):
for _ in range(epochs):
Copy link
Author

Choose a reason for hiding this comment

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

Lines 66-66 refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

model.train()

for epoch in range(epochs):
for _ in range(epochs):
Copy link
Author

Choose a reason for hiding this comment

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

Lines 64-64 refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

model.train()

for epoch in range(epochs):
for _ in range(epochs):
Copy link
Author

Choose a reason for hiding this comment

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

Lines 62-62 refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

model.train()

for epoch in range(epochs):
for _ in range(epochs):
Copy link
Author

Choose a reason for hiding this comment

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

Lines 63-63 refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

model.train()

for epoch in range(epochs):
for _ in range(epochs):
Copy link
Author

Choose a reason for hiding this comment

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

Lines 62-62 refactored with the following changes:

  • Replace unused for index with underscore (for-index-underscore)

def _calculate_hidden_state(self, Z, H, H_tilde):
H = Z*H + (1-Z)*H_tilde
return H
return Z*H + (1-Z)*H_tilde
Copy link
Author

Choose a reason for hiding this comment

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

Function GConvGRU._calculate_hidden_state refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

T = torch.tanh(T)
C = F*C + I*T
return C
return F*C + I*T
Copy link
Author

Choose a reason for hiding this comment

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

Function GConvLSTM._calculate_cell_state refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment on lines -188 to +187
H = O * torch.tanh(C)
return H
return O * torch.tanh(C)
Copy link
Author

Choose a reason for hiding this comment

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

Function GConvLSTM._calculate_hidden_state refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

T = torch.tanh(T)
C = F*C + I*T
return C
return F*C + I*T
Copy link
Author

Choose a reason for hiding this comment

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

Function LRGCN._calculate_cell_state refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

Comment on lines -130 to +129
H = O * torch.tanh(C)
return H
return O * torch.tanh(C)
Copy link
Author

Choose a reason for hiding this comment

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

Function LRGCN._calculate_hidden_state refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Oct 31, 2020

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.12%.

Quality metrics Before After Change
Complexity 0.12 ⭐ 0.12 ⭐ 0.00
Method Length 39.81 ⭐ 39.56 ⭐ -0.25 👍
Working memory 7.32 🙂 7.29 🙂 -0.03 👍
Quality 83.80% 83.92% 0.12% 👍
Other metrics Before After Change
Lines 855 847 -8
Changed files Quality Before Quality After Quality Change
examples/evolvegcnh_example.py 81.57% ⭐ 81.57% ⭐ 0.00%
examples/evolvegcno_example.py 82.03% ⭐ 82.03% ⭐ 0.00%
examples/gclstm_example.py 82.18% ⭐ 82.18% ⭐ 0.00%
examples/gconvgru_example.py 81.59% ⭐ 81.59% ⭐ 0.00%
examples/gconvlstm_example.py 82.18% ⭐ 82.18% ⭐ 0.00%
torch_geometric_temporal/nn/recurrent/evolvegcno.py 84.51% ⭐ 84.63% ⭐ 0.12% 👍
torch_geometric_temporal/nn/recurrent/gc_lstm.py 84.38% ⭐ 84.60% ⭐ 0.22% 👍
torch_geometric_temporal/nn/recurrent/gconv_gru.py 86.11% ⭐ 86.15% ⭐ 0.04% 👍
torch_geometric_temporal/nn/recurrent/gconv_lstm.py 83.60% ⭐ 83.82% ⭐ 0.22% 👍
torch_geometric_temporal/nn/recurrent/lrgcn.py 85.79% ⭐ 86.03% ⭐ 0.24% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
torch_geometric_temporal/nn/recurrent/gc_lstm.py GCLSTM._calculate_cell_state 0 49 ⭐ 12 😞 73.02% 🙂 Extract out complex expressions
examples/evolvegcnh_example.py create_mock_data 0 49 ⭐ 11 😞 74.75% 🙂 Extract out complex expressions
examples/evolvegcno_example.py create_mock_data 0 49 ⭐ 11 😞 74.75% 🙂 Extract out complex expressions
examples/gclstm_example.py create_mock_data 0 49 ⭐ 11 😞 74.75% 🙂 Extract out complex expressions
examples/gconvgru_example.py create_mock_data 0 49 ⭐ 11 😞 74.75% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
46.2% 46.2% Duplication

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