Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • duncan.meacher/gwdatafind
  • duncanmmacleod/gwdatafind
  • computing/gwdatafind/client
3 results
Show changes
Commits on Source (10)
Showing with 71 additions and 101 deletions
; vim: set ft=dosini :
[flake8]
select =
# pydocstyle
D,
# pycodestyle errors
E,
# pyflakes
F,
# radon
R,
# bandit security
S,
# pycodestyle warnings
W,
ignore =
# one line docstring should fit on one line
D200,
# blank link after class docstring
D203, D204
# missing docstring in magic method
D105
# missing whitespace around arithmetic operator
E226,
# use of assert
S101,
# line break before binary operator, use W504
W503,
exclude =
# non source files
__pycache__,
.eggs/,
.git/,
build/,
docs/,
venv/,
# deprecated modules
gwdatafind/http.py,
# ignore codes per-file
per-file-ignores =
# unused import in __init__
__init__.py: F401, F403
# missing docstring in test function
test_*.py: D10
# maximum acceptable code complexity value
radon-max-cc = 5
......@@ -3,13 +3,9 @@ include:
- component: $CI_SERVER_FQDN/computing/gitlab/components/python/all@1
inputs:
code_quality_analyzer: ruff
install_extra: "test"
run_advanced_sast: true
- component: $CI_SERVER_FQDN/computing/gitlab/components/python/code-quality@1
inputs:
requirements: >-
flake8-docstrings
radon
# -- Debian packaging ---------------
......
# -*- coding: utf-8 -*-
#
# gwdatafind documentation build configuration file
......@@ -6,7 +5,7 @@ import glob
import os.path
import re
from gwdatafind import __version__ as VERSION
from gwdatafind import __version__ as gwdatafind_version
extensions = [
'sphinx.ext.intersphinx',
......@@ -22,14 +21,14 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'gwdatafind'
copyright = u'2018-2021, Cardiff University'
author = u'Duncan Macleod'
project = "gwdatafind"
copyright = "2018-2021, Cardiff University"
author = "Duncan Macleod"
# The short X.Y version.
version = re.split(r'[\w-]', VERSION)[0]
version = re.split(r'[\w-]', gwdatafind_version)[0]
# The full version, including alpha/beta/rc tags.
release = VERSION
release = gwdatafind_version
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2017-2022)
#
# This file is part of GWDataFind.
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2017-2022)
#
# This file is part of GWDataFind.
......@@ -25,8 +24,14 @@ import sys
from ligo import segments
from . import (__version__, ui)
from .io import (lal_cache, format_cache)
from . import (
__version__,
ui,
)
from .io import (
format_cache,
lal_cache,
)
from .utils import get_default_host
__author__ = 'Duncan Macleod <duncan.macleod@ligo.org>'
......@@ -51,13 +56,13 @@ class DataFindArgumentParser(argparse.ArgumentParser):
"""Create a new `DataFindArgumentParser`.
"""
kwargs.setdefault("formatter_class", DataFindFormatter)
super(DataFindArgumentParser, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._optionals.title = "Optional arguments"
def parse_args(self, *args, **kwargs):
"""Parse arguments with an extra sanity check.
"""
args = super(DataFindArgumentParser, self).parse_args(*args, **kwargs)
args = super().parse_args(*args, **kwargs)
args.show_urls = not any((args.ping, args.show_observatories,
args.show_types, args.show_times,
args.filename, args.latest))
......
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2015 Scott Koranda, 2015+ Duncan Macleod
#
# This program is free software; you can redistribute it and/or modify it
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This file is part of GWDataFind.
......
# -*- coding: utf-8 -*-
# Copyright (C) Scott Koranda (2012-2015)
# Lousiana State University (2015-2017)
# Cardiff University (2017-2022)
......@@ -31,7 +30,10 @@ from urllib.parse import urlparse
from ligo import segments
from . import api
from .utils import (get_default_host, file_segment)
from .utils import (
file_segment,
get_default_host,
)
__author__ = 'Duncan Macleod <duncan.macleod@ligo.org>'
__all__ = ['HTTPConnection', 'HTTPSConnection']
......@@ -279,7 +281,7 @@ class HTTPConnection(http_client.HTTPConnection):
path = api.find_times_path(
site,
frametype,
gpsstart or int(1),
gpsstart or 1,
gpsend or int(2e9),
)
segmentlist = self.get_json(path)
......@@ -412,7 +414,7 @@ class HTTPConnection(http_client.HTTPConnection):
return urls
# warn or error on missing
msg = "Missing segments: \n%s" % "\n".join(map(str, missing))
msg = "Missing segments: \n{}".format("\n".join(map(str, missing)))
if on_gaps == "warn":
warnings.warn(msg)
return urls
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2022)
#
# This file is part of GWDataFind.
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This file is part of GWDataFind.
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This program is free software; you can redistribute it and/or modify it
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This file is part of GWDataFind.
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This program is free software; you can redistribute it and/or modify it
......@@ -24,8 +23,10 @@ from unittest import mock
from urllib.error import HTTPError
import pytest
from ligo.segments import (segment, segmentlist)
from ligo.segments import (
segment,
segmentlist,
)
from ..http import (
HTTPConnection,
......@@ -43,7 +44,7 @@ def fake_response(output, status=200):
return resp
class TestHTTPConnection(object):
class TestHTTPConnection:
CONNECTION = HTTPConnection
@classmethod
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This file is part of GWDataFind.
......@@ -25,7 +24,6 @@ from io import StringIO
from unittest import mock
import pytest
from ligo.segments import segment
from .. import __main__ as main
......@@ -334,7 +332,7 @@ def test_postprocess_cache_gaps(capsys):
assert main.postprocess_cache(URLS, args, out) == 1
_, err = capsys.readouterr()
segs = "\n".join(f"{seg[0]:d} {seg[1]:d}" for seg in GAPS)
assert err == "Missing segments:\n\n{}\n".format(segs)
assert err == f"Missing segments:\n\n{segs}\n"
args.gpsstart = 4
args.gpsend = 7
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This file is part of GWDataFind.
......@@ -21,10 +20,12 @@ from functools import partial
from unittest import mock
import pytest
from ligo import segments
from .. import (api, ui)
from .. import (
api,
ui,
)
from . import yield_fixture
__author__ = 'Duncan Macleod <duncan.macleod@ligo.org>'
......
# -*- coding: utf-8 -*-
# Copyright (C) Scott Koranda (2012-2015)
# Louisiana State University (2015-2017)
# Cardiff University (2017-2022)
......
# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2018-2022)
#
# This file is part of GWDataFind.
......@@ -29,9 +28,7 @@ from urllib.parse import urlparse
from warnings import warn
import requests
from igwn_auth_utils.requests import get as _get
from ligo import segments
from . import api
......@@ -83,7 +80,11 @@ def connect(host=None, port=None): # pragma: no cover
a newly opened connection
"""
import ssl
from .http import (HTTPConnection, HTTPSConnection)
from .http import (
HTTPConnection,
HTTPSConnection,
)
from .utils import find_credential
warn(
......
# -*- coding: utf-8 -*-
# Copyright (C) Scott Koranda (2012-2015)
# Louisiana State University (2015-2017)
# Cardiff University (2017-2022)
......@@ -23,9 +22,8 @@
import os
import warnings
from ligo.segments import segment
from igwn_auth_utils import x509 as igwn_x509
from ligo.segments import segment
def get_default_host():
......
......@@ -55,12 +55,6 @@ test = [
"pytest-cov",
"requests-mock",
]
lint = [
"flake8",
"flake8-bandit",
"flake8-docstrings",
"radon",
]
[project.urls]
"Homepage" = "https://gwdatafind.readthedocs.io"
......@@ -93,8 +87,38 @@ source = ["gwdatafind"]
[tool.pytest.ini_options]
addopts = "-r a --color=yes"
filterwarnings = [
"error",
"ignore:.*pkg_resources"
"error",
"ignore:.*pkg_resources"
]
[tool.ruff.lint]
select = [
# mccabe
"C90",
# pycodestyle errors
"E",
# flake8-executable
"EXE",
# pyflakes
"F",
# isort
"I",
# pep8-naming
"N",
# pyupgrade
"UP",
# pycodestyle warnings
"W",
]
[tool.ruff.lint.isort]
combine-as-imports = true
force-wrap-aliases = true
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401", # unused-import
"F403", # undefined-local-with-import-star
]
[tool.setuptools]
......