Skip to content

Commit 1d1c2c5

Browse files
author
Wittgen
committed
change COPYRIGHT, add docstrings
1 parent 2b3f8e0 commit 1d1c2c5

File tree

9 files changed

+111
-9
lines changed

9 files changed

+111
-9
lines changed

.github/workflows/lint.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.8
19+
20+
- name: Install
21+
run: pip install -r <(curl https://raw.githubusercontent.com/lsst/linting/main/requirements.txt)
22+
23+
- name: Run linter
24+
run: flake8

COPYRIGHT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Copyright 2022 Association of Universities for Research in Astronomy, Inc. (AURA)
1+
Copyright 2022 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory

Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
#
2+
# Developed for the LSST Data Management System.
3+
# This product includes software developed by the LSST Project
4+
# (https://www.lsst.org).
5+
# See the COPYRIGHT file at the top-level directory of this distribution
6+
# for details of code ownership.
7+
#
8+
# This program is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation, either version 3 of the License, or
11+
# (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
121
# Makefile for Sphinx documentation
222
#
323

rubin_changelog/changelog.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939

4040

4141
class ChangeLog:
42+
"""Retrieve, process and output changelog data"""
43+
4244
def __init__(self, max_workers: int = 5):
45+
"""
46+
:param max_workers: `int`
47+
max number of parallel worker threads to query GitHub data
48+
"""
4349
self._github_cache = None
4450
self._max_workers = max_workers
4551

@@ -131,12 +137,10 @@ def get_package_repos(self, products: SortedList, release: ReleaseType) -> Sorte
131137

132138
@staticmethod
133139
def _ticket_number(title: str) -> int:
134-
match = re.search(r'DM[\s*|-]\d+', title.upper())
140+
match = re.search(r'DM[\s*|-](\d+)', title.upper())
135141
ticket = None
136142
if match:
137-
res = re.findall(r"DM[\s|-]*(\d+)", match[0])
138-
if len(res) == 1:
139-
ticket = res[0]
143+
ticket = int(match[1])
140144
return ticket
141145

142146
def get_merged_tickets(self, repos: Dict) -> SortedDict:

rubin_changelog/eups.py

+32-1
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,27 @@
3434

3535

3636
class EupsData:
37+
"""Retrieve EUPS release data"""
38+
3739
def __init__(self, connections: int = 10):
40+
"""
41+
:param connections: `int`
42+
number of parallel URL requests
43+
"""
3844
self._url = 'https://eups.lsst.codes/stack/src/tags/'
3945
self._connection_mgr = urllib3.PoolManager(maxsize=connections)
4046
self._connections = connections
4147

4248
@staticmethod
43-
def _process_list(data) -> List[Dict[str, str]]:
49+
def _process_list(data: bytes) -> List[Dict[str, str]]:
50+
"""
51+
process a EUPS data file
52+
:param data: `bytes`
53+
data from URL response
54+
:return:
55+
List of EUPS product dicts
56+
{ 'package': package, 'flavor': flavor, 'version': version }
57+
"""
4458
lines = data.split(b"\n")
4559
result = list()
4660
for line in lines:
@@ -60,6 +74,11 @@ def _process_list(data) -> List[Dict[str, str]]:
6074
return result
6175

6276
def _get_url_paths(self) -> List[str]:
77+
"""
78+
get list with url of .list files
79+
:return: `List[str]`
80+
List of URLs
81+
"""
6382
ext = '.list'
6483
params = {}
6584
response = requests.get(self._url, params=params)
@@ -73,6 +92,11 @@ def _get_url_paths(self) -> List[str]:
7392
return parent
7493

7594
def _download(self, url: str) -> SortedDict:
95+
"""
96+
download EUPS .list files
97+
:param url: `str` URL
98+
:return: `SortedDict`
99+
"""
76100
response = self._connection_mgr.request('GET', url)
77101
name = url.split('/')[-1].split('.')[0]
78102
rtag = Tag(name)
@@ -84,6 +108,13 @@ def _download(self, url: str) -> SortedDict:
84108
return SortedDict()
85109

86110
def get_releases(self, release: ReleaseType) -> SortedDict:
111+
"""
112+
Retrieve release information from EUPS
113+
:param release: `ReleaseType`
114+
filter by WEEKLY or REGULAR
115+
:return: `SortedDict`
116+
EUPS release data
117+
"""
87118
urls = self._get_url_paths()
88119
result = SortedDict()
89120
release_list = SortedDict()

rubin_changelog/github.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818
# You should have received a copy of the GNU General Public License
1919
# along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
2021
from typing import List
2122

2223
from gql import Client, gql

rubin_changelog/jira.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ def get_tickets(self) -> Dict[str, str]:
4545
url = self._url
4646
results = dict()
4747
while True:
48-
req_url = "".join([f"{url}?jql=project=DM&startAt={start_at}",
49-
f"&maxResults={per_page}",
50-
"&fields=key,summary"])
48+
req_url = (f"{url}?jql=project=DM&startAt={start_at}"
49+
f"&maxResults={per_page}"
50+
"&fields=key,summary")
5151
res = requests.get(req_url, headers=self._headers)
5252
res_json = res.json()
5353
total = res_json['total']

rubin_changelog/rst.py

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333

3434
class Writer:
35+
"""Create RST output files"""
36+
3537
def __init__(self, outputdir: str):
3638
self._outputdir = outputdir
3739

source/conf.py

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
#
2+
# Developed for the LSST Data Management System.
3+
# This product includes software developed by the LSST Project
4+
# (https://www.lsst.org).
5+
# See the COPYRIGHT file at the top-level directory of this distribution
6+
# for details of code ownership.
7+
#
8+
# This program is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation, either version 3 of the License, or
11+
# (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
121
# Configuration file for the Sphinx documentation builder.
222
#
323
# This file only contains a selection of the most common options. For a full

0 commit comments

Comments
 (0)