Skip to content

Commit

Permalink
pre-commit: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Isken committed Oct 10, 2022
1 parent 2ce80c4 commit 0d3894b
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 34 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/black.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Lint

on: [push, pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
19 changes: 13 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
name: black
language: system
types: [python]
entry: black
# language_version: python3.6
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
1 change: 0 additions & 1 deletion lightguide/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pkg_resources


__version__ = pkg_resources.get_distribution("lightguide").version
2 changes: 1 addition & 1 deletion lightguide/filters.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .lightguide import * # noqa
from .afk_filter_python import * # noqa
from .lightguide import * # noqa
9 changes: 4 additions & 5 deletions lightguide/gf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import numpy as np

from scipy import interpolate, ndimage, signal
from collections.abc import Iterable

from pyrocko.guts import Object, Float, List, Tuple, String, Timestamp, Bool
import numpy as np
import pyrocko.orthodrome as od
from pyrocko import gf
from pyrocko.guts import Bool, Float, List, Object, String, Timestamp, Tuple
from pyrocko.model import Location
import pyrocko.orthodrome as od
from scipy import interpolate, ndimage, signal

r2d = 180.0 / np.pi
km = 1e3
Expand Down
2 changes: 1 addition & 1 deletion lightguide/lightguide.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import numpy.typing as npt
import numpy as np
import numpy.typing as npt

def triangular_taper(
window_size: tuple[int, int], plateau: tuple[int, int]
Expand Down
3 changes: 2 additions & 1 deletion lightguide/restitution.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

from typing import TYPE_CHECKING

import numpy as np
from scipy import signal
from .utils import traces_to_numpy_and_meta

from .utils import traces_to_numpy_and_meta

if TYPE_CHECKING:
from pyrocko.trace import Trace
Expand Down
9 changes: 4 additions & 5 deletions lightguide/utils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
from __future__ import annotations
from enum import Enum
from tempfile import SpooledTemporaryFile

import time
import logging
import time
from enum import Enum
from functools import wraps
from pathlib import Path
from tempfile import SpooledTemporaryFile
from typing import Any, Callable
import requests

import numpy as np
import numpy.typing as npt
import requests
from pyrocko.trace import Trace
from scipy.signal import butter, lfilter


# create console handler
ch = logging.StreamHandler()
formatter = logging.Formatter("\x1b[80D\x1b[1A\x1b[K%(message)s")
Expand Down
1 change: 1 addition & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from lightguide import gf

km = 1e3
Expand Down
1 change: 1 addition & 0 deletions test/test_afk_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as num
import pytest

from lightguide import filters


Expand Down
3 changes: 2 additions & 1 deletion test/test_gf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import numpy as np
import pytest
from lightguide import gf
from pyrocko import trace
from pyrocko.model import Location

from lightguide import gf

km = 1e3


Expand Down
4 changes: 2 additions & 2 deletions test/test_restitution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from lightguide import restitution as res

from pyrocko import trace

from lightguide import restitution as res


def test_strainrate_to_strain(syn_das_data, show_plot):
syn_e = syn_das_data(quantity="strain", sample_rate=5.0, smoothing_sigma=100.0)
Expand Down
4 changes: 3 additions & 1 deletion test/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from pathlib import Path
from lightguide.utils import download_http, download_numpy, ExampleData

import numpy as np

from lightguide.utils import ExampleData, download_http, download_numpy

URLS = [url for k, url in ExampleData.__dict__.items() if not k.startswith("_")]


Expand Down

0 comments on commit 0d3894b

Please sign in to comment.