Skip to content

Commit

Permalink
Refactor copyright notice
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed Jul 30, 2024
1 parent 5faea53 commit 23407ef
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 76 deletions.
4 changes: 1 addition & 3 deletions aurora/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from aurora.model.aurora import Aurora, AuroraSmall

Expand Down
4 changes: 1 addition & 3 deletions aurora/area.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

import torch

Expand Down
4 changes: 1 addition & 3 deletions aurora/batch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

import dataclasses
from datetime import datetime
Expand Down
4 changes: 1 addition & 3 deletions aurora/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""
4 changes: 1 addition & 3 deletions aurora/model/aurora.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from datetime import timedelta
from functools import partial
Expand Down
4 changes: 1 addition & 3 deletions aurora/model/film.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

import torch
from torch import nn
Expand Down
4 changes: 1 addition & 3 deletions aurora/model/fourier.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

import math

Expand Down
4 changes: 1 addition & 3 deletions aurora/model/groupedpatchembed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

import math
from collections.abc import Iterable
Expand Down
4 changes: 1 addition & 3 deletions aurora/model/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from typing import TypeVar

Expand Down
4 changes: 1 addition & 3 deletions aurora/model/lora.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

import math
from typing import Literal
Expand Down
10 changes: 5 additions & 5 deletions aurora/model/perceiver.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Basic blocks for the Perceiver architecture.
The code borrows elements from the following repositories:
https://github.com/lucidrains/perceiver-pytorch/blob/main/perceiver_pytorch/perceiver_pytorch.py
https://github.com/mlfoundations/open_flamingo/blob/main/open_flamingo/src/helpers.py
The code borrows elements from the following files:
https://github.com/lucidrains/perceiver-pytorch/blob/main/perceiver_pytorch/perceiver_pytorch.py
https://github.com/mlfoundations/open_flamingo/blob/main/open_flamingo/src/helpers.py
"""

import torch
Expand Down
4 changes: 1 addition & 3 deletions aurora/model/perceiver_decoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from datetime import timedelta

Expand Down
4 changes: 1 addition & 3 deletions aurora/model/perceiver_encoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from datetime import timedelta

Expand Down
3 changes: 1 addition & 2 deletions aurora/model/pos_encode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.
TODO(Johannes): not sure what to do with the licensing, now all used functions have been newly
written by myself
Expand Down
11 changes: 6 additions & 5 deletions aurora/model/swin_3d_block.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Code adapted from
https://github.com/microsoft/Swin-Transformer/blob/main/models/swin_transformer_v2.py
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
# --------------------------------------------------------
# Code adapted from https://github.com/microsoft/Swin-Transformer/blob/main/models/swin_transformer_v2.py
# --------------------------------------------------------

import itertools
from functools import lru_cache
Expand Down
11 changes: 2 additions & 9 deletions aurora/model/swin_block.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
--------------------------------------------------------
Swin Transformer V2
Copyright (c) 2022 Microsoft
Licensed under The MIT License [see LICENSE for details]
Written by Ze Liu
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Code adapted from
https://github.com/microsoft/Swin-Transformer/blob/main/models/swin_transformer_v2.py
--------------------------------------------------------
which was written by Ze Liu.
"""

from functools import lru_cache
Expand Down
3 changes: 1 addition & 2 deletions aurora/model/vit_block.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Extends TIMM transformer block with compute and memory efficient FlashAttention
Expand Down
7 changes: 0 additions & 7 deletions tests/test_core.py

This file was deleted.

13 changes: 3 additions & 10 deletions tests/test_headers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
"""
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from pathlib import Path

Expand All @@ -9,10 +7,7 @@
SKIP_FILES: set[str] = {"_version.py"}
"""set[str]: These files are not required to have a copyright notice."""

COPYRIGHT_NOTICE: list[str] = [
'"""',
"Copyright (c) Microsoft Corporation. Licensed under the MIT license.",
]
COPYRIGHT_NOTICE: str = '"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.'


@pytest.mark.parametrize("python_file", Path(__file__).parents[1].rglob("**/*.py"))
Expand All @@ -23,7 +18,5 @@ def test_presence_of_copyright_header(python_file: Path) -> None:
with open(python_file) as f:
lines = list(f.read().splitlines())

contains_notice = len(lines) >= len(COPYRIGHT_NOTICE)
contains_notice &= all(x.strip() == y.strip() for x, y in zip(lines, COPYRIGHT_NOTICE))
if not contains_notice:
if not lines or not lines[0].startswith(COPYRIGHT_NOTICE):
raise AssertionError(f"`{python_file}` must start with the copyright notice.")
1 change: 1 addition & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

0 comments on commit 23407ef

Please sign in to comment.