diff --git a/docs/conf.py b/docs/conf.py index 7bc2b380f7f60872d6fc3c9864af40ec68b5345f..7ab859922654b4d8f37acdbdfd69cf860fd47cf5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- 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. diff --git a/gwdatafind/__init__.py b/gwdatafind/__init__.py index d334e86654f56751c095497b526278e93514ad1b..c364be07aa2144e3dbf908590ecc17517de115e7 100644 --- a/gwdatafind/__init__.py +++ b/gwdatafind/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Cardiff University (2017-2022) # # This file is part of GWDataFind. diff --git a/gwdatafind/__main__.py b/gwdatafind/__main__.py index df297c79403f859ac56d4dd0748433e3138632dc..ebf7115d013f12ed78a3e01c50dcbab2f8eb3091 100644 --- a/gwdatafind/__main__.py +++ b/gwdatafind/__main__.py @@ -1,4 +1,3 @@ -# -*- 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)) diff --git a/gwdatafind/api.py b/gwdatafind/api.py index da116eecdd869c261ffa902fa8c681c852209676..0475d2dd3b780678d48ddc769681d9bff5312f8e 100644 --- a/gwdatafind/api.py +++ b/gwdatafind/api.py @@ -1,4 +1,3 @@ -# -*- 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 diff --git a/gwdatafind/conftest.py b/gwdatafind/conftest.py index 3e1b9b68880658d000fdfbef5940c63fe78c8f0f..f683adc85a9188f07e3bb092ab58bc8029665203 100644 --- a/gwdatafind/conftest.py +++ b/gwdatafind/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Cardiff University (2018-2022) # # This file is part of GWDataFind. diff --git a/gwdatafind/http.py b/gwdatafind/http.py index 1e039ab9cc01b176179b80e74c11e596924b68ea..be88edd5d877b0df9a6903c2bc2f6ac52017efcf 100644 --- a/gwdatafind/http.py +++ b/gwdatafind/http.py @@ -1,4 +1,3 @@ -# -*- 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 diff --git a/gwdatafind/io.py b/gwdatafind/io.py index c7ce1577b57e2b821ceae594c3bfa042586b9b90..02f0242bf19e47f5a69562a3727e6a23e26bd635 100644 --- a/gwdatafind/io.py +++ b/gwdatafind/io.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Cardiff University (2022) # # This file is part of GWDataFind. diff --git a/gwdatafind/tests/__init__.py b/gwdatafind/tests/__init__.py index 70cb1babebf3adc8e6c16571c111c62d3b5cea67..d6c2a0c54bbf18dfa62d02e97bdb841466d7e050 100644 --- a/gwdatafind/tests/__init__.py +++ b/gwdatafind/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Cardiff University (2018-2022) # # This file is part of GWDataFind. diff --git a/gwdatafind/tests/conftest.py b/gwdatafind/tests/conftest.py index d10e6db6f94875ac49dbb46ebbafb878480721d7..3481da700dfeca6b1496ead26c2bf32a8154ae38 100644 --- a/gwdatafind/tests/conftest.py +++ b/gwdatafind/tests/conftest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Cardiff University (2018-2022) # # This program is free software; you can redistribute it and/or modify it diff --git a/gwdatafind/tests/test_api.py b/gwdatafind/tests/test_api.py index 6b8a152b362af92214d487250aca4d5e70330df4..ec6dc1ca4e20931669720464d8868722fbd68b48 100644 --- a/gwdatafind/tests/test_api.py +++ b/gwdatafind/tests/test_api.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Cardiff University (2018-2022) # # This file is part of GWDataFind. diff --git a/gwdatafind/tests/test_http.py b/gwdatafind/tests/test_http.py index add847e5a211a7d7377aa99a275197af436d8488..54323053d846f5a84aaef387f4cfd526b588051e 100644 --- a/gwdatafind/tests/test_http.py +++ b/gwdatafind/tests/test_http.py @@ -1,4 +1,3 @@ -# -*- 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 diff --git a/gwdatafind/tests/test_main.py b/gwdatafind/tests/test_main.py index 46bc2d389ae68fdbbe6de9a53282114119579089..7d7f47a1205bbf740e689e94305c705d80756a13 100644 --- a/gwdatafind/tests/test_main.py +++ b/gwdatafind/tests/test_main.py @@ -1,4 +1,3 @@ -# -*- 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 diff --git a/gwdatafind/tests/test_ui.py b/gwdatafind/tests/test_ui.py index 299704ed7a6021ad9d8d80880a1c945882bb2743..9da926aaaa3e9326f277d25e6b851e2648d42b20 100644 --- a/gwdatafind/tests/test_ui.py +++ b/gwdatafind/tests/test_ui.py @@ -1,4 +1,3 @@ -# -*- 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>' diff --git a/gwdatafind/tests/test_utils.py b/gwdatafind/tests/test_utils.py index 72f2d3e21d2f1740f86497074cd28179ad683191..7d008bd9fe57202e18bd7106517505f39f4a1d8d 100644 --- a/gwdatafind/tests/test_utils.py +++ b/gwdatafind/tests/test_utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) Scott Koranda (2012-2015) # Louisiana State University (2015-2017) # Cardiff University (2017-2022) diff --git a/gwdatafind/ui.py b/gwdatafind/ui.py index 1dfdfe7d4aac179dac267eeb956e4337db97f4c3..7d0ca71106dafc704a3a83364f6a3d34dace7a89 100644 --- a/gwdatafind/ui.py +++ b/gwdatafind/ui.py @@ -1,4 +1,3 @@ -# -*- 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( diff --git a/gwdatafind/utils.py b/gwdatafind/utils.py index 447b936b65959a78231f440cf6efae060095aba1..7ff95e29d3648a1613f1d6c17940043c1bf76493 100644 --- a/gwdatafind/utils.py +++ b/gwdatafind/utils.py @@ -1,4 +1,3 @@ -# -*- 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():