Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 2edbdc8

Browse files
authored
STYLE: Trim trailing whitespaces with pre-commit (#715)
1 parent 760cbe0 commit 2edbdc8

29 files changed

+193
-192
lines changed

.github/workflows/linting_and_hello_world.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
pip install flake8
2222
python -m flake8
2323
shell: bash
24-
if: always()
24+
if: always()
2525

2626
# This script also does "conda init" for all shells. For bash, this modifies .bashrc.
2727
# However, the default "bash" in a github workflow does not execute bashrc. Hence, all

.pre-commit-config.yaml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
# See https://github.com/pre-commit/pre-commit-hooks/blob/master/.pre-commit-config.yaml for an example with more hooks
44

5-
exclude: '^excluded_files_regex$'
65
repos:
7-
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.0.1
9-
hooks:
10-
- id: trailing-whitespace
11-
- id: end-of-file-fixer
12-
- id: check-yaml
13-
- id: check-added-large-files
14-
- id: check-ast
15-
- id: check-merge-conflict
16-
- id: debug-statements
17-
- id: mixed-line-ending
18-
args: [--fix=lf]
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.0.1
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-yaml
12+
- id: check-added-large-files
13+
- id: check-ast
14+
- id: check-merge-conflict
15+
- id: debug-statements
16+
- id: mixed-line-ending
17+
args:
18+
- --fix=lf
1919

20-
- repo: https://github.com/PyCQA/flake8
21-
rev: 3.9.2
22-
hooks:
23-
- id: flake8
24-
additional_dependencies: [flake8-typing-imports==1.7.0]
20+
- repo: https://github.com/PyCQA/flake8
21+
rev: 3.9.2
22+
hooks:
23+
- id: flake8
24+
additional_dependencies:
25+
- flake8-typing-imports==1.7.0
2526

26-
- repo: https://github.com/pre-commit/mirrors-autopep8
27-
rev: v1.5.7
28-
hooks:
29-
- id: autopep8
27+
- repo: https://github.com/pre-commit/mirrors-autopep8
28+
rev: v1.5.7
29+
hooks:
30+
- id: autopep8

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"Tests"
55
],
66
"python.testing.unittestEnabled": false,
7-
"python.testing.pytestEnabled": true
8-
}
7+
"python.testing.pytestEnabled": true,
8+
"files.trimTrailingWhitespace": true
9+
}

InnerEye/ML/SSL/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def create_ssl_encoder(encoder_name: str, use_7x7_first_conv_in_resnet: bool = T
3939
"""
4040
Creates SSL encoder.
4141
:param encoder_name: available choices: resnet18, resnet50, resnet101 and densenet121.
42-
:param use_7x7_first_conv_in_resnet: If True, use a 7x7 kernel (default) in the first layer of resnet.
42+
:param use_7x7_first_conv_in_resnet: If True, use a 7x7 kernel (default) in the first layer of resnet.
4343
If False, replace first layer by a 3x3 kernel. This is required for small CIFAR 32x32 images to not shrink them.
4444
"""
4545
from pl_bolts.models.self_supervised.resnets import resnet18, resnet50, resnet101

InnerEye/ML/configs/classification/DummyClassification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class DummyClassification(ScalarModelBase):
15-
"A config file for dummy image classification model for debugging purposes"
15+
"A config file for dummy image classification model for debugging purposes"
1616

1717
def __init__(self) -> None:
1818
num_epochs = 4

InnerEye/ML/configs/other/HelloContainer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, raw_data: List[List[float]]) -> None:
3939
must be numeric data which can be converted into a tensor. See the static method
4040
from_path_and_indexes for an example call.
4141
"""
42-
super().__init__()
42+
super().__init__()
4343
self.data = torch.tensor(raw_data, dtype=torch.float)
4444

4545
def __len__(self) -> int:
@@ -253,9 +253,9 @@ def create_model(self) -> LightningModule:
253253
return HelloRegression()
254254

255255
# This method must be overridden by any subclass of LightningContainer. It returns a data module, which
256-
# in turn contains 3 data loaders for training, validation, and test set.
257-
#
258-
# If the container is used for cross validation then this method must handle the cross validation splits.
256+
# in turn contains 3 data loaders for training, validation, and test set.
257+
#
258+
# If the container is used for cross validation then this method must handle the cross validation splits.
259259
# Because this deals with data loaders, not loaded data, we cannot check automatically that cross validation is
260260
# handled correctly within the LightningContainer base class, i.e. if you forget to do the cross validation split
261261
# in your subclass nothing will fail, but each child run will be identical since they will each be given the full

InnerEye/ML/configs/segmentation/HelloWorld.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class HelloWorld(SegmentationModelBase):
2828
2929
* This model can be trained from the commandline: python InnerEye/runner.py --model=HelloWorld
3030
31-
* If you want to test that your AzureML workspace is working, please follow the instructions in
31+
* If you want to test that your AzureML workspace is working, please follow the instructions in
3232
<repo_root>/docs/hello_world_model.md.
3333
3434
In this example, the model is trained on 2 input image channels channel1 and channel2, and

InnerEye/ML/dataset/scalar_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def _load_single_data_source(_rows: pd.DataFrame,
498498
is_classification_dataset=self.is_classification_dataset,
499499
num_classes=self.num_classes,
500500
sequence_position_numeric=_sequence_position_numeric
501-
)
501+
)
502502
if len(self.expected_channels) > 0:
503503
missing_channels = self.expected_channels - set(rows[self.channel_column])
504504
if len(missing_channels) > 0:

InnerEye/ML/lightning_container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def get_cross_validation_hyperdrive_config(self, run_config: ScriptRunConfig) ->
295295
"""
296296
Returns a configuration for AzureML Hyperdrive that varies the cross validation split index.
297297
Because this adds a val/Loss metric it is important that when subclassing LightningContainer
298-
your implementeation of LightningModule logs val/Loss. There is an example of this in
298+
your implementation of LightningModule logs val/Loss. There is an example of this in
299299
HelloRegression's validation_step method.
300300
:param run_config: The AzureML run configuration object that training for an individual model.
301301
:return: A hyperdrive configuration object.

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at
1414

1515
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
1616

17-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
1818

1919
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
2020

0 commit comments

Comments
 (0)