diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 383cbc5c..cccf6264 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.3.0 hooks: # list of supported hooks: https://pre-commit.com/hooks.html - id: trailing-whitespace @@ -24,7 +24,7 @@ repos: "satflow", ] - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 args: @@ -42,14 +42,14 @@ repos: - id: isort args: [--profile, black, --line-length, "100", "satflow"] - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.6.0 hooks: - id: black args: [--line-length, "100"] # yaml formatting - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.5.1 + rev: v2.7.1 hooks: - id: prettier types: [yaml] diff --git a/satflow/models/gan/discriminators.py b/satflow/models/gan/discriminators.py index ffc3e2a6..96b989b7 100644 --- a/satflow/models/gan/discriminators.py +++ b/satflow/models/gan/discriminators.py @@ -170,7 +170,7 @@ def __init__( nf_mult_prev = 1 for n in range(1, n_layers): # gradually increase the number of filters nf_mult_prev = nf_mult - nf_mult = min(2 ** n, 8) + nf_mult = min(2**n, 8) if conv_type == "antialiased": block = [ conv2d( @@ -201,7 +201,7 @@ def __init__( sequence += block nf_mult_prev = nf_mult - nf_mult = min(2 ** n_layers, 8) + nf_mult = min(2**n_layers, 8) sequence += [ conv2d( ndf * nf_mult_prev, diff --git a/satflow/models/gan/generators.py b/satflow/models/gan/generators.py index b2d92e90..2e2ded7e 100644 --- a/satflow/models/gan/generators.py +++ b/satflow/models/gan/generators.py @@ -113,7 +113,7 @@ def __init__( n_downsampling = 2 for i in range(n_downsampling): # add downsampling layers - mult = 2 ** i + mult = 2**i if conv_type == "antialiased": block = [ conv2d( @@ -144,7 +144,7 @@ def __init__( model += block - mult = 2 ** n_downsampling + mult = 2**n_downsampling for i in range(n_blocks): # add ResNet blocks model += [ diff --git a/satflow/models/layers/Attention.py b/satflow/models/layers/Attention.py index 49b10aa8..ef543152 100644 --- a/satflow/models/layers/Attention.py +++ b/satflow/models/layers/Attention.py @@ -122,7 +122,7 @@ def __init__(self, in_dim, activation=F.relu, pooling_factor=2): # TODO for bet self.value_conv = nn.Conv3d(in_channels=in_dim, out_channels=in_dim, kernel_size=1) self.pooling = nn.MaxPool3d(kernel_size=2, stride=pooling_factor) - self.pooling_factor = pooling_factor ** 3 + self.pooling_factor = pooling_factor**3 self.gamma = nn.Parameter(torch.zeros(1)) diff --git a/satflow/models/layers/Discriminator.py b/satflow/models/layers/Discriminator.py index bea39e3c..097fa5d3 100644 --- a/satflow/models/layers/Discriminator.py +++ b/satflow/models/layers/Discriminator.py @@ -168,7 +168,7 @@ def __init__( ): super().__init__() - gain = 2 ** 0.5 + gain = 2**0.5 self.conv0 = SpectralNorm( nn.Conv2d( @@ -329,7 +329,7 @@ def __init__( ): super().__init__() - gain = 2 ** 0.5 + gain = 2**0.5 self.conv0 = SpectralNorm( nn.Conv3d( @@ -393,7 +393,7 @@ class TemporalDiscriminator(nn.Module): def __init__(self, chn=128, n_class=4): super().__init__() - gain = 2 ** 0.5 + gain = 2**0.5 self.pre_conv = nn.Sequential( SpectralNorm(nn.Conv3d(3, 2 * chn, 3, padding=1)),