Skip to content

Commit

Permalink
Remove trailing comma after kwargs, remove uneeded imports, update se…
Browse files Browse the repository at this point in the history
…tup to include older python version
  • Loading branch information
mhuen committed Apr 11, 2024
1 parent 0824e55 commit 29f3b06
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 28 deletions.
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=61.0"]
requires = ["setuptools>=44.0"] # Note: unfortunately need python >=2.7
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -13,7 +13,7 @@ authors = [
maintainers = [
{ name = "Mirco Huennefeld", email = "[email protected]" },
]
requires-python = ">=3.7"
requires-python = ">=2.7" # Note: unfortunately need python >=2.7

dependencies = ["numpy", "matplotlib", "tensorflow"]

Expand Down Expand Up @@ -48,7 +48,10 @@ version = {attr = "tfscripts.__version__"}

[tool.black]
line-length = 79
target-version = ["py38"]
# technically, black does not support python2.
# This is all python versions black knows of and gets
# rid of the trailing comma bug
target-version = ["py33", "py34", "py35", "py36", "py37", "py38", "py39", "py310", "py311"]

[tool.ruff]
# select = ["ALL"]
Expand All @@ -65,7 +68,7 @@ ignore = [
"T20", # flake8-print
"TCH", # flake8-type-checking
"S101", # assert-used
"F401", # imported but unused. NOTE: sooner or later, we should not ignore this
"COM812", # trailing comma to not insert after **kwargs, which is a syntax error prior to py3.6
]
line-length = 79
target-version = "py38"
Expand Down
1 change: 0 additions & 1 deletion test/test_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import unittest
import numpy as np
import tensorflow as tf
from itertools import product

from tfscripts import layers

Expand Down
1 change: 1 addition & 0 deletions tfscripts/compat/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# ruff: noqa: F401
from tfscripts import __version__, __description__, __url__
from tfscripts import FLOAT_PRECISION
2 changes: 0 additions & 2 deletions tfscripts/compat/v1/hex/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@

from __future__ import division, print_function

import numpy as np
import tensorflow as tf

# tfscripts.compat.v1 specific imports
from tfscripts.compat.v1.weights import (
new_weights,
new_biases,
new_kernel_weights,
)
from tfscripts.compat.v1.hex.visual import print_hex_data
from tfscripts.compat.v1.hex import rotation
Expand Down
1 change: 0 additions & 1 deletion tfscripts/compat/v1/hex/icecube.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from __future__ import division, print_function

import numpy as np
import tensorflow as tf

# tfscripts.compat.v1 specific imports
Expand Down
10 changes: 3 additions & 7 deletions tfscripts/compat/v1/hex/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@
from __future__ import division, print_function

import numpy as np
import tensorflow as tf
import matplotlib

try:
import _tkinter
except ImportError:
import importlib

if not importlib.util.find_spec("_tkinter"):
matplotlib.use("AGG")
import matplotlib.pyplot as plt

# tfscripts.compat.v1 specific imports
from tfscripts.compat.v1.hex.rotation import get_rotated_corner_weights

# constants
from tfscripts.compat.v1 import FLOAT_PRECISION


def print_hex_data(hex_data):
"""Print hexagonal kernel data to console
Expand Down
2 changes: 0 additions & 2 deletions tfscripts/compat/v1/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from tfscripts.compat.v1.weights import (
new_weights,
new_biases,
new_kernel_weights,
)
from tfscripts.compat.v1 import conv
from tfscripts.compat.v1 import core
Expand Down Expand Up @@ -343,7 +342,6 @@ def new_conv_nd_layer(
# Create new weights aka. filters with the given shape.
if method.lower() == "convolution":
if weights is None:
# weights = new_kernel_weights(shape=shape)
weights = new_weights(shape=shape)

# Create new biases, one for each filter.
Expand Down
2 changes: 1 addition & 1 deletion tfscripts/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import tensorflow as tf

# tfscripts specific imports
from tfscripts.weights import new_weights, new_locally_connected_weights
from tfscripts.weights import new_locally_connected_weights

# constants
from tfscripts import FLOAT_PRECISION
Expand Down
1 change: 0 additions & 1 deletion tfscripts/hex/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from __future__ import division, print_function

import logging
import numpy as np
import tensorflow as tf

# tfscripts specific imports
Expand Down
1 change: 0 additions & 1 deletion tfscripts/hex/icecube.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from __future__ import division, print_function

import numpy as np
import tensorflow as tf

# tfscripts specific imports
Expand Down
7 changes: 3 additions & 4 deletions tfscripts/hex/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
from __future__ import division, print_function

import numpy as np
import tensorflow as tf
import matplotlib

try:
import _tkinter
except ImportError:
import importlib

if not importlib.util.find_spec("_tkinter"):
matplotlib.use("AGG")
import matplotlib.pyplot as plt

Expand Down
3 changes: 1 addition & 2 deletions tfscripts/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tensorflow as tf

# tfscripts specific imports
from tfscripts.weights import new_weights, new_biases, new_kernel_weights
from tfscripts.weights import new_weights, new_biases
from tfscripts.weights import new_locally_connected_weights
from tfscripts import conv
from tfscripts import core
Expand Down Expand Up @@ -361,7 +361,6 @@ def __init__(
# Create new weights aka. filters with the given shape.
if method.lower() == "convolution":
if weights is None:
# weights = new_kernel_weights(shape=shape)
weights = new_weights(
shape=shape, float_precision=float_precision
)
Expand Down
3 changes: 1 addition & 2 deletions tfscripts/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from copy import deepcopy
import json
import numpy as np
import tensorflow as tf

Expand Down Expand Up @@ -272,7 +271,7 @@ def __init__(
use_nth_fc_layer_as_input=None,
min_sigma_value=1e-3,
verbose=False,
**kwargs,
**kwargs
):
"""Gaussian Uncertainty NN (Dense NN Model)
Expand Down

0 comments on commit 29f3b06

Please sign in to comment.