Skip to content

Commit d2fd93f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 75c4a7d commit d2fd93f

File tree

35 files changed

+23
-43
lines changed

35 files changed

+23
-43
lines changed

draugr/drawers/mpl_drawers/discrete_scroll_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
class DiscreteScrollPlot(MplDrawer):
2626
"""
2727
Waterfall plot
28-
only supports a single trajectory at a time, do not supply parallel trajectories to draw method, will get truncated to num actions, effectively dropping actions for other envs than the first."""
28+
only supports a single trajectory at a time, do not supply parallel trajectories to draw method, will get truncated to num actions, effectively dropping actions for other envs than the first.
29+
"""
2930

3031
@passes_kws_to(MplDrawer.__init__)
3132
def __init__(
@@ -43,7 +44,6 @@ def __init__(
4344
figure_size: Tuple[int, int] = None,
4445
**kwargs
4546
):
46-
4747
super().__init__(render=render, figure_size=figure_size, **kwargs)
4848
if not render:
4949
return

draugr/drawers/mpl_drawers/spectral/fast_fourier_transform_spectrogram.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
class FastFourierTransformSpectrogramPlot(MplDrawer):
2727
"""
2828
TODO: CENTER Align fft maybe, to mimick librosa stft
29-
Short Time Fourier Transform (STFT), with step size of 1 and window lenght of n_fft, and no window function ( TODO: Hanning Smoothing)"""
29+
Short Time Fourier Transform (STFT), with step size of 1 and window lenght of n_fft, and no window function ( TODO: Hanning Smoothing)
30+
"""
3031

3132
def __init__(
3233
self,

draugr/drawers/opencv_drawers/opencv_image_stream.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class OpencvImageStream(Drawer):
2828
def __init__(
2929
self, title: str = "NoName", render: bool = True, **kwargs: MutableMapping
3030
):
31-
3231
super().__init__(**kwargs)
3332
if not render:
3433
return

draugr/matlab_utilities/conversion.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
from typing import Any
1313

1414
try:
15-
1615
import matlab
1716
except ImportError:
18-
1917
raise ImportError("Matlab engine not installed")
2018
import numpy
2119
from scipy import sparse
@@ -181,7 +179,6 @@ def ndarray_to_matlab(numpy_array):
181179
order = "C"
182180

183181
if numpy.iscomplexobj(numpy_array): # complex case
184-
185182
matlab_array = matlab.double(
186183
initializer=None, size=(1, num_elements), is_complex=True
187184
) # create empty matlab.mlarray

draugr/metrics/metric_collection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def append(self, *args: Sequence, **kwargs: MutableMapping):
5252
:type args:
5353
:param kwargs:
5454
:type kwargs:"""
55-
for (arg, (k, v)) in zip(args, self._metrics.items()):
55+
for arg, (k, v) in zip(args, self._metrics.items()):
5656
self._metrics[k].append(arg)
5757

58-
for (k, v) in kwargs:
58+
for k, v in kwargs:
5959
self._metrics[k].append(v)
6060

6161
def remove_metric(self, name):

draugr/multiprocessing_utilities/pooled_queue_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class PooledQueueProcessor(object):
5555
This is a workaround of Pythons extremely slow interprocess communication pipes.
5656
The ideal solution would be to use a multiprocessing.queue, but it apparently communication is band
5757
limited.
58-
This solution has processes complete tasks (batches) and a thread add the results to a queue.queue."""
58+
This solution has processes complete tasks (batches) and a thread add the results to a queue.queue.
59+
"""
5960

6061
def __init__(
6162
self,
@@ -68,7 +69,6 @@ def __init__(
6869
fill_at_construction=True,
6970
blocking=True,
7071
):
71-
7272
if kwargs is None:
7373
kwargs = {}
7474

draugr/opencv_utilities/color_space/edge.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def to_edge(
4343

4444
ksize = kwargs.get("ksize", max(next_odd(max(*(img.shape)) // 100), 5))
4545
if method == ToEdgeMethodEnum.morph_gradient:
46-
4746
return cv2.morphologyEx(
4847
img,
4948
MorphTypeEnum.gradient.value,

draugr/opencv_utilities/color_space/noise.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def noise_filter(
4545
sigmaSpace=kwargs.get("sigmaSpace", 17),
4646
)
4747
elif method == NoiseFilterMethodEnum.gaussian_blur:
48-
4948
return cv2.GaussianBlur(
5049
img,
5150
ksize=(ksize, ksize),

draugr/opencv_utilities/drawing/masks/gauss_circles.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def ellipse_bbox(h, k, a, b, theta):
3939

4040
# ----------------------------------------------------------------------------
4141

42+
4243
# Rotated elliptical gradient - slow, Python-only approach
4344
def make_gradient_v1(width, height, h, k, a, b, theta):
4445
"""
@@ -76,6 +77,7 @@ def make_gradient_v1(width, height, h, k, a, b, theta):
7677

7778
# ----------------------------------------------------------------------------
7879

80+
7981
# Rotated elliptical gradient - faster, vectorized numpy approach
8082
def make_gradient_v2(width, height, h, k, a, b, theta):
8183
"""
@@ -111,7 +113,6 @@ def make_gradient_v2(width, height, h, k, a, b, theta):
111113

112114
# ============================================================================
113115
if __name__ == "__main__":
114-
115116
from pathlib import Path
116117
from warg import ensure_existence
117118
from draugr.opencv_utilities import show_image

draugr/opencv_utilities/windows/color_picker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def interactive_hsv_color_picker(
5656
img = cv2.imread(str(p))
5757
output = img
5858
while 1:
59-
6059
h_min = cv2.getTrackbarPos(hmin_label, window_label)
6160
h_max = cv2.getTrackbarPos(hmax_label, window_label)
6261

draugr/os_utilities/mac_utilities/dark_mode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
import ctypes.util
1313

1414
try: # macOS Big Sur+ use "a built-in dynamic linker cache of all system-provided libraries"
15-
1615
appkit = ctypes.cdll.LoadLibrary("AppKit.framework/AppKit")
1716
objc = ctypes.cdll.LoadLibrary("libobjc.dylib")
1817
except OSError: # revert to full path for older OS versions and hardened programs
19-
2018
appkit = ctypes.cdll.LoadLibrary(ctypes.util.find_library("AppKit"))
2119
objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("objc"))
2220

draugr/os_utilities/windows_utilities/task_scheduler/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def set_task_activity(
207207

208208

209209
if __name__ == "__main__":
210-
211210
print(f"{socket.gethostname()}\{getpass.getuser()}")
212211

213212
if True:

draugr/pandas_utilities/misc_utilities.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def duplicate_columns(frame: pandas.DataFrame) -> List[str]:
6262
duplicates = []
6363

6464
for t, v in groups.items():
65-
6665
cs = frame[v].columns
6766
vs = frame[v]
6867
lcs = len(cs)

draugr/python_utilities/function_wrappers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def str_to_bool(s: str, preds: Tuple[str, ...] = ("true", "1")) -> bool:
162162
str2bool = str_to_bool
163163

164164
if __name__ == "__main__":
165-
166165
c = namedtuple("C", ("a", "b"))
167166

168167
@wrap_args(c)

draugr/stopping/stopping_key.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def add_early_stopping_key_combination(
4545
verbose: bool = False,
4646
combinations: Iterable = default_combinations,
4747
): # -> keyboard.Listener:
48-
4948
"""
5049
5150
:param combinations:

draugr/tensorboard_utilities/experimental/confusion_matrix.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def asda():
168168

169169
def plot_to_image(figure):
170170
"""Converts the matplotlib plot specified by 'figure' to a PNG image and
171-
returns it. The supplied figure is closed and inaccessible after this call."""
171+
returns it. The supplied figure is closed and inaccessible after this call.
172+
"""
172173
# Save the plot to a PNG in memory.
173174
buf = io.BytesIO()
174175
pyplot.savefig(buf, format="png")

draugr/tensorboard_utilities/exporting/file_export.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(self, *args: Sequence, **kwargs: MutableMapping):
2323
raise ValueError("No file provided")
2424

2525
def export(self):
26-
2726
self.file.write("")
2827
super().export()
2928

draugr/torch_utilities/architectures/mlp_variants/concatination.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def __init__(
5454
fusion_hidden_multiplier: int = 10,
5555
**kwargs: MutableMapping
5656
):
57-
5857
forward_shape, *res = input_shape
5958
self._residual_shape = res
6059

draugr/torch_utilities/evaluation/cross_validation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def cross_validation_generator(
2222
*datasets: Dataset, n_splits: int = 10
2323
) -> Tuple[Subset, Subset]:
2424
"""
25-
Learning the parameters of a prediction function and testing it on the same data is a methodological mistake: a model that would just repeat the labels of the samples that it has just seen would have a perfect score but would fail to predict anything useful on yet-unseen data. This situation is called overfitting. To avoid it, it is common practice when performing a (supervised) machine learning experiment to hold out part of the available data as a test set"""
25+
Learning the parameters of a prediction function and testing it on the same data is a methodological mistake: a model that would just repeat the labels of the samples that it has just seen would have a perfect score but would fail to predict anything useful on yet-unseen data. This situation is called overfitting. To avoid it, it is common practice when performing a (supervised) machine learning experiment to hold out part of the available data as a test set
26+
"""
2627

2728
cum = ConcatDataset(datasets)
2829
for train_index, val_index in KFold(n_splits=n_splits).split(cum):

draugr/torch_utilities/exporting/latex_tables.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,4 @@ def iasjduh() -> None:
110110

111111

112112
if __name__ == "__main__":
113-
114113
adasdassijd()

draugr/torch_utilities/operations/torch_transforms/batch_transforms.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class BatchNormalize:
4141
std (sequence): Sequence of standard deviations for each channel.
4242
inplace(bool,optional): Bool to make this operation in-place.
4343
dtype (torch.dtype,optional): The data type of tensors to which the transform will be applied.
44-
device (torch.device,optional): The device of tensors to which the transform will be applied."""
44+
device (torch.device,optional): The device of tensors to which the transform will be applied.
45+
"""
4546

4647
def __init__(self, mean, std, inplace=False, dtype=torch.float, device="cpu"):
4748
self.mean = torch.as_tensor(mean, dtype=dtype, device=device)[
@@ -96,7 +97,8 @@ class BatchRandomCrop:
9697
padding (int, optional): Optional padding on each border of the image.
9798
Default is None, i.e no padding.
9899
dtype (torch.dtype,optional): The data type of tensors to which the transform will be applied.
99-
device (torch.device,optional): The device of tensors to which the transform will be applied."""
100+
device (torch.device,optional): The device of tensors to which the transform will be applied.
101+
"""
100102

101103
def __init__(self, size, padding=None, dtype=torch.float, device="cpu"):
102104
self.size = size

draugr/torch_utilities/optimisation/parameters/complexity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ def remove_flops_counter_hook_function(module) -> None:
590590

591591
# --- Masked flops counting
592592

593+
593594
# Also being run in the initialization
594595
def add_flops_mask_variable_or_reset(module) -> None:
595596
"""

draugr/torch_utilities/writers/tensorboard/tensorboard_pytorch_writer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ def image(
564564
**kwargs,
565565
)
566566
else:
567-
568567
raise NotImplementedError(
569568
f"{multi_channel_method} is not implemented"
570569
)
@@ -607,7 +606,6 @@ def _open(self):
607606
PTW = TensorBoardPytorchWriter
608607

609608
if __name__ == "__main__":
610-
611609
with TensorBoardPytorchWriter(PROJECT_APP_PATH.user_log / "test") as writer:
612610
writer.scalar("What", 4)
613611

draugr/visualisation/matplotlib_utilities/quirks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def scatter_auto_mark(
114114
if isinstance(marker, mmarkers.MarkerStyle):
115115
marker_obj = marker
116116
else:
117-
118117
marker_obj = mmarkers.MarkerStyle(marker, fillstyle=fillstyle)
119118
path = marker_obj.get_path().transformed(marker_obj.get_transform())
120119
paths.append(path)

draugr/writers/mixins/embed_writer_mixin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
class EmbedWriterMixin(ABC):
1616
"""
17-
Writer mixin that provides an interface for 'writing' embeds/projections(2d,3d) for interactive visualisation"""
17+
Writer mixin that provides an interface for 'writing' embeds/projections(2d,3d) for interactive visualisation
18+
"""
1819

1920
@abstractmethod
2021
def embed(

draugr/writers/terminal/console_writer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def _scalar(self, tag: str, value: float, step: int):
2626

2727

2828
if __name__ == "__main__":
29-
3029
with ConsoleWriter() as w:
3130
for i in range(10):
3231
w.scalar("lol", i)

samples/drawers/video_stream/opencv_drawer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ def asdasf() -> None:
2626

2727

2828
if __name__ == "__main__":
29-
3029
asdasf()

samples/drawers/video_stream/pygame_drawer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def surface_to_numpy(surface) -> numpy.ndarray:
2828

2929

3030
if __name__ == "__main__":
31-
3231
# Screen settings
3332
SCREEN = [640, 360]
3433

@@ -43,7 +42,6 @@ def surface_to_numpy(surface) -> numpy.ndarray:
4342
cam.start()
4443

4544
while 1: # Ze loop
46-
4745
time.sleep(1 / 120) # 60 frames per second
4846

4947
image = cam.get_image() # Get current webcam image

samples/drawers/video_stream/qt_drawer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,4 @@ def open(self):
7070

7171

7272
if __name__ == "__main__":
73-
7473
aushduah()

samples/drawers/video_stream/wx_drawer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,4 @@ def __init__(self):
9696

9797

9898
if __name__ == "__main__":
99-
10099
uahsduiasdj()

samples/opencv_samples/tkinter_app/tk_hough_circles.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,11 @@ def load_config(directory, file):
122122
"""
123123
global config
124124
try:
125-
126125
xml_file = f"{directory}/{os.path.splitext(file)[0]}.xml"
127126
if os.path.exists(xml_file):
128127
root = ET.parse(xml_file).getroot()
129128
settings = root.find("config")
130129
if settings:
131-
132130
for setting in settings:
133131
config[setting.tag] = int(setting.text)
134132
else:

samples/os_utilities/systemd_samples/scripts/busy_script.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def asd() -> None:
2929

3030

3131
if __name__ == "__main__":
32-
3332
if False:
3433
from pathlib import Path
3534

samples/progress_bar/progress_bar_sample.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99

1010
if __name__ == "__main__":
11-
1211
from draugr.visualisation.progress import progress_bar
1312

1413
for a in progress_bar(range(100)):

samples/torch_samples/hyperparameter_tuning_with_hparams.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
#
115115
# The model will be quite simple: two dense layers with a dropout layer between them. The training code will look familiar, although the hyperparameters are no longer hardcoded. Instead, the hyperparameters are provided in an `hparams` dictionary and used throughout the training function:
116116

117+
117118
# %%
118119
def train_test_model(hparams):
119120
"""description"""
@@ -141,6 +142,7 @@ def train_test_model(hparams):
141142
# %% [markdown]
142143
# For each run, log an hparams summary with the hyperparameters and final accuracy:
143144

145+
144146
# %%
145147
def run(run_dir, hparams):
146148
"""description"""

tests/integration_tests/catch_keyboard_interrupt_drawer_close.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99

1010
if __name__ == "__main__":
11-
1211
import numpy
1312
import pytest
1413

0 commit comments

Comments
 (0)