Skip to content

Commit

Permalink
Lintering
Browse files Browse the repository at this point in the history
- set ignore RET504 rule for ruff
- some lintering
  • Loading branch information
vapavlo committed May 11, 2024
1 parent de384a2 commit 18cca68
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 3 additions & 5 deletions custom_models/cell/cin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import torch
import torch.nn.functional as F
from topomodelx.nn.cell.cwn_layer import CWNLayer
import torch.nn as nn
from topomodelx.base.conv import Conv
from torch_geometric.nn.models import MLP


class CWN(torch.nn.Module):
Expand Down Expand Up @@ -109,11 +112,6 @@ def forward(

"""Implementation of CWN layer from Bodnar et al.: Weisfeiler and Lehman Go Cellular: CW Networks."""

import torch.nn as nn
import torch.nn.functional as F
from topomodelx.base.conv import Conv
from torch_geometric.nn.models import MLP


class CWNLayer(nn.Module):
r"""Layer of a CW Network (CWN).
Expand Down
6 changes: 3 additions & 3 deletions custom_models/cell/cwn_dcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class MLP(nn.Module):
def __init__(self, layers_size, dropout=0.0, final_activation=False):
super(MLP, self).__init__()
super().__init__()
layers = []
for li in range(1, len(layers_size)):
layers.append(nn.Dropout(p=dropout))
Expand All @@ -22,7 +22,7 @@ def forward(self, x, e=None):

class CW(nn.Module):
def __init__(self, F_in, F_out):
super(CW, self).__init__()
super().__init__()
self.har = nn.Linear(F_in, F_out)
self.sol = GCNConv(F_in, F_out, add_self_loops=False)
self.irr = GCNConv(F_in, F_out, add_self_loops=False)
Expand All @@ -36,7 +36,7 @@ def forward(self, xe, Lu, Ld):

class CWNDCM(nn.Module):
def __init__(self, in_channels, n_layers=2, dropout=0.0, last_act=False):
super(CWNDCM, self).__init__()
super().__init__()
self.d = dropout
self.convs = nn.ModuleList()
self.last_act = last_act
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ select = [
"PERF", # performance rules
"RUF", # miscellaneous rules
]
ignore = ["E501"] # line too long
ignore = [
"E501", # line too long
"RET504" # Unnecessary assignment before return
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"
Expand Down

0 comments on commit 18cca68

Please sign in to comment.