From bd1f7689b5b66cfeee2aebfc80468bc413fbf077 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Tue, 17 Jan 2023 14:53:54 +0000 Subject: [PATCH 1/6] Actions updates --- .github/workflows/pythonapp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 701a8f7..93043d0 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -15,10 +15,10 @@ jobs: timeout-minutes: 5 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} From 9502e9773d1bd5078bad888bdb100e6fc915cb77 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Tue, 17 Jan 2023 14:57:16 +0000 Subject: [PATCH 2/6] Update actions file --- .github/workflows/pythonapp.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 93043d0..16156ec 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -8,26 +8,21 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.10] + runs-on: ubuntu-22.04 timeout-minutes: 5 steps: - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install flake8 matplotlib pytest requests - - name: Lint with flake8 + - name: Lint with flake8 (non-blocking) run: flake8 --exit-zero --statistics *.py - name: Run unit tests using pytest From 3b7a1671419dcb507c2fc23f2332f4e32a0d5000 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Tue, 17 Jan 2023 14:58:49 +0000 Subject: [PATCH 3/6] Revert CI line length --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From d47de4e13f82bdb4a32fbff6eb860c7a6cb0c030 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Thu, 11 Jan 2024 16:10:22 +0000 Subject: [PATCH 4/6] - Minor edtits - Bump Ubuntu and Python versions in CI - Remove Gitlab CI file --- .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 ++-- 6 files changed, 12 insertions(+), 24 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 16156ec..9a4ac3b 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -8,14 +8,14 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest timeout-minutes: 5 steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies run: | 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)] From 62b31882d653025aac98c3e96193adf0306270e7 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Thu, 11 Jan 2024 16:17:07 +0000 Subject: [PATCH 5/6] Update action versions --- .github/workflows/pythonapp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 9a4ac3b..1c1de08 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -12,8 +12,8 @@ jobs: timeout-minutes: 5 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' From e41eff4f30785feb65467b5432c7a400499a8c24 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Thu, 11 Jan 2024 16:20:51 +0000 Subject: [PATCH 6/6] Fix action versions --- .github/workflows/pythonapp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'