Skip to content

Commit

Permalink
Ruff fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Mar 27, 2024
1 parent 58a9d0e commit 52ae086
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 24 deletions.
1 change: 0 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
1 change: 1 addition & 0 deletions pygac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"install').")

import logging

from pygac.configuration import get_config, read_config_file # noqa
from pygac.runner import get_reader_class, process_file # noqa

Expand Down
1 change: 1 addition & 0 deletions pygac/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import logging
import os
import sys

try:
import configparser
except ImportError:
Expand Down
5 changes: 3 additions & 2 deletions pygac/correct_tsm_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
an orbit contain corrupt data. This module identifies affected pixels and flags
them with fill values."""

import numpy as np
import bottleneck as bn
import datetime

import bottleneck as bn
import numpy as np

TSM_AFFECTED_INTERVALS_POD = {
3: [(datetime.datetime(2001, 10, 19, 4, 50), datetime.datetime(2001, 10, 19, 13, 38)),
(datetime.datetime(2001, 10, 19, 16, 58),
Expand Down
2 changes: 1 addition & 1 deletion pygac/gac_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import h5py
import numpy as np

from pygac.utils import slice_channel, strip_invalid_lat, check_user_scanlines
from pygac.utils import check_user_scanlines, slice_channel, strip_invalid_lat

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pygac/gac_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

import numpy as np

from pygac.pod_reader import PODReader, main_pod
from pygac.gac_reader import GACReader
from pygac.pod_reader import PODReader, main_pod

LOG = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions pygac/gac_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

import logging

from pygac.reader import Reader, ReaderError
import pygac.pygac_geotiepoints as gtp

from pygac.reader import Reader, ReaderError

LOG = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions pygac/klm_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import datetime
import logging

try:
from enum import IntFlag
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion pygac/lac_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

import numpy as np

from pygac.pod_reader import PODReader, main_pod
from pygac.lac_reader import LACReader
from pygac.pod_reader import PODReader, main_pod

LOG = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions pygac/lac_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@

import logging

from pygac.reader import Reader, ReaderError
import pygac.pygac_geotiepoints as gtp

from pygac.reader import Reader, ReaderError

LOG = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion pygac/pygac_geotiepoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


import geotiepoints as gtp

import numpy as np


Expand Down
3 changes: 1 addition & 2 deletions pygac/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ class for a given file.
import logging
import os

from pygac.configuration import get_config
from pygac.gac_klm import GACKLMReader
from pygac.gac_pod import GACPODReader
from pygac.lac_klm import LACKLMReader
from pygac.lac_pod import LACPODReader
from pygac.utils import file_opener
from pygac.configuration import get_config


LOG = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions pygac/tests/test_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

import numpy as np

from pygac.utils import (get_absolute_azimuth_angle_diff,
centered_modulus)
from pygac.utils import centered_modulus, get_absolute_azimuth_angle_diff


class TestAngles(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions pygac/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
"""Test the I/O."""

import unittest

try:
import mock
except ImportError:
from unittest import mock
import numpy as np
import numpy.testing

import pygac.gac_io as gac_io
import pygac.utils as utils

Expand Down
6 changes: 4 additions & 2 deletions pygac/tests/test_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@
"""Test module for the pod reading."""

import datetime as dt
import sys
import unittest

import numpy as np
import numpy.testing
import sys

try:
from unittest import mock
except ImportError:
import mock

from pygac.clock_offsets_converter import txt as clock_offsets_txt
from pygac.reader import ReaderError, NoTLEData
from pygac.gac_pod import GACPODReader
from pygac.lac_pod import LACPODReader
from pygac.reader import NoTLEData, ReaderError
from pygac.tests.utils import CalledWithArray


Expand Down
4 changes: 3 additions & 1 deletion pygac/tests/test_slerp.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@


import unittest
from pygac.slerp import slerp

import numpy as np

from pygac.slerp import slerp


class TestSlerp(unittest.TestCase):

Expand Down
3 changes: 2 additions & 1 deletion pygac/tests/test_tsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
"""Test TSM module."""

import unittest
import pygac.correct_tsm_issue as tsm

import numpy as np
import numpy.testing

import pygac.correct_tsm_issue as tsm


class TSMTest(unittest.TestCase):
"""Test TSM module."""
Expand Down
2 changes: 1 addition & 1 deletion pygac/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import numpy as np

from pygac.utils import file_opener, calculate_sun_earth_distance_correction
from pygac.utils import calculate_sun_earth_distance_correction, file_opener


class TestUtils(unittest.TestCase):
Expand Down
7 changes: 3 additions & 4 deletions pygac/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import gzip
import io
import logging

from contextlib import contextmanager, nullcontext

import numpy as np
Expand Down Expand Up @@ -199,9 +198,9 @@ def _slice(ch, start_line, end_line, update=None):
ch_slc = ch[start_line:end_line + 1, :].copy()

if update:
updated = [_update_scanline(l, start_line, end_line)
if l is not None else None
for l in update]
updated = [_update_scanline(line, start_line, end_line)
if line is not None else None
for line in update]
return ch_slc, updated

return ch_slc
Expand Down

0 comments on commit 52ae086

Please sign in to comment.