From 999e35d2f1e8e32241a2dd28da3cfd8f7f63a977 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Thu, 11 Jan 2024 16:22:41 +0000 Subject: [PATCH] CI updates (#7) * Actions updates * Update actions file * Revert CI line length * - Minor edtits - Bump Ubuntu and Python versions in CI - Remove Gitlab CI file * Update action versions * Fix action versions --- .github/workflows/pythonapp.yml | 4 ++-- .gitlab-ci.yml | 19 ------------------- floodsystem/datafetcher.py | 6 ++++++ floodsystem/station.py | 1 + floodsystem/stationdata.py | 2 +- floodsystem/utils.py | 4 ++-- setup.cfg | 2 +- 7 files changed, 13 insertions(+), 25 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index c42dc13..1c1de08 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -12,8 +12,8 @@ jobs: timeout-minutes: 5 steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 5d2c10b..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -image: python:3.7 - -test: - script: - # Install Python packages required to run code. Add any additional - # packages your code needs require here. - - pip install dateutils flake8 matplotlib numpy pytest requests - - # flake8 static code and style testing. Enable for extra testing. - # - python -m flake8 . - - # Run unit tests - - python -m pytest -v . - - # Run deliverables. Add your deliverables to the test system here. - - python Task1A.py - - - python Task2A.py - - python Task2D.py diff --git a/floodsystem/datafetcher.py b/floodsystem/datafetcher.py index 4738bff..2a87582 100644 --- a/floodsystem/datafetcher.py +++ b/floodsystem/datafetcher.py @@ -46,6 +46,12 @@ def fetch_station_data(use_cache=True): retrieval over the Internet and avoids excessive calls to the Environment Agency service. + Args: + use_cache: If ``True``, use file cache. Otherwise fetch data + over the Internet. + + Returns: + River level data. """ # URL for retrieving data for active stations with river level diff --git a/floodsystem/station.py b/floodsystem/station.py index cee0c85..63ab9db 100644 --- a/floodsystem/station.py +++ b/floodsystem/station.py @@ -12,6 +12,7 @@ class MonitoringStation: def __init__(self, station_id, measure_id, label, coord, typical_range, river, town): + """Create a monitoring station.""" self.station_id = station_id self.measure_id = measure_id diff --git a/floodsystem/stationdata.py b/floodsystem/stationdata.py index 1e3e61e..fc4ec4f 100644 --- a/floodsystem/stationdata.py +++ b/floodsystem/stationdata.py @@ -1,7 +1,7 @@ # Copyright (C) 2018 Garth N. Wells # # SPDX-License-Identifier: MIT -"""This module provides interface for extracting statiob data from +"""This module provides interface for extracting station data from JSON objects fetched from the Internet and """ diff --git a/floodsystem/utils.py b/floodsystem/utils.py index f049d01..8771173 100644 --- a/floodsystem/utils.py +++ b/floodsystem/utils.py @@ -10,12 +10,12 @@ def sorted_by_key(x, i, reverse=False): """For a list of lists/tuples, return list sorted by the ith component of the list/tuple, E.g. - Sort on first entry of tuple: + Sort on first entry of tuple:: > sorted_by_key([(1, 2), (5, 1]), 0) >>> [(1, 2), (5, 1)] - Sort on second entry of tuple: + Sort on second entry of tuple:: > sorted_by_key([(1, 2), (5, 1]), 1) >>> [(5, 1), (1, 2)] diff --git a/setup.cfg b/setup.cfg index 812952b..5082c4a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [flake8] -max-line-length = 60 +max-line-length = 120 exclude = .git # Line length ignore = W503