diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13dbf7d2be..f8cf58f27f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: mixed-line-ending args: ['--fix=no'] - repo: https://github.com/pycqa/flake8 - rev: '6.0.0' + rev: '6.1.0' hooks: - id: flake8 additional_dependencies: diff --git a/.readthedocs.yml b/.readthedocs.yml index 18e3b73168..88f2b9fa22 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.10" + python: "3.11" # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/docs/conf.py b/docs/conf.py index cd81d45497..79ea4d4ae1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,6 +48,7 @@ "sphinx.ext.coverage", "sphinx.ext.viewcode", "sphinx.ext.napoleon", + "sphinx_rtd_theme", ] # set this to properly handle multiple input params with the same type/shape @@ -154,9 +155,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -# html_theme = 'alabaster' -html_theme = "default" -html_theme_options = {"rightsidebar": "false", "relbarbgcolor": "black"} +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme diff --git a/docs/requirements.txt b/docs/requirements.txt index 2d306efc73..8d5c244f20 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,2 @@ -sphinx>=1.3 -sphinx_rtd_theme==0.5.2 +sphinx>=6.2 +sphinx_rtd_theme==1.2.2 diff --git a/pyuvdata/utils.py b/pyuvdata/utils.py index 8ef2fcbc1f..680264c1ca 100644 --- a/pyuvdata/utils.py +++ b/pyuvdata/utils.py @@ -5061,13 +5061,13 @@ def parse_ants(uv, ant_str, print_toggle=False, x_orientation=None): for ant_i in ant_i_list: include_i = True - if type(ant_i) == str and ant_i.startswith("-"): + if isinstance(ant_i, str) and ant_i.startswith("-"): ant_i = ant_i[1:] # nibble the - off the string include_i = False for ant_j in ant_j_list: include_j = True - if type(ant_j) == str and ant_j.startswith("-"): + if isinstance(ant_j, str) and ant_j.startswith("-"): ant_j = ant_j[1:] include_j = False diff --git a/pyuvdata/uvdata/aipy_extracts.py b/pyuvdata/uvdata/aipy_extracts.py index a539da502e..9c3d46e4ef 100644 --- a/pyuvdata/uvdata/aipy_extracts.py +++ b/pyuvdata/uvdata/aipy_extracts.py @@ -155,7 +155,7 @@ def parse_ants(ant_str, nants): ajs = m[6].split(",") for i in ais: - if type(i) == str and i.startswith("-"): + if isinstance(i, str) and i.startswith("-"): i = i[1:] # nibble the - off the string include_i = 0 else: @@ -164,7 +164,7 @@ def parse_ants(ant_str, nants): for j in ajs: include = None - if type(j) == str and j.startswith("-"): + if isinstance(j, str) and j.startswith("-"): j = j[1:] include_j = 0 else: @@ -217,7 +217,7 @@ def uv_selector(uv, ants=-1, pol_str=-1): None """ if ants != -1: - if type(ants) == str: + if isinstance(ants, str): ants = parse_ants(ants, uv["nants"]) for cnt, (bl, include, pol) in enumerate(ants): @@ -421,7 +421,7 @@ def _rdhd(self, name): if len(rv) == 1: return rv[0] - elif type(rv) == str: + elif isinstance(rv, str): return rv else: return np.array(rv) diff --git a/pyuvdata/uvdata/mir_meta_data.py b/pyuvdata/uvdata/mir_meta_data.py index 240a2fdf51..0dfda7c0b8 100644 --- a/pyuvdata/uvdata/mir_meta_data.py +++ b/pyuvdata/uvdata/mir_meta_data.py @@ -727,7 +727,7 @@ def __add__( If attempting to combine this object with another of a different type. """ # First up, make sure we have two objects of the same dtype - if type(self) != type(other): + if not isinstance(other, self.__class__): raise ValueError("Both objects must be of the same type.") if other._data is None: @@ -1584,7 +1584,7 @@ def _generate_new_header_keys(self, other): If the two objects are not of the same type. """ # First up, make sure we have two objects of the same dtype - if type(self) != type(other): + if not isinstance(other, self.__class__): raise ValueError("Both objects must be of the same type.") # If no data are loaded, or if there is no header key, then this is basically @@ -1917,7 +1917,7 @@ def _add_check(self, other, merge=None, overwrite=None, discard_flagged=False): but the header keys (and their respective index positions) are different. """ # First up, make sure we have two objects of the same dtype - if type(self) != type(other): + if not isinstance(other, self.__class__): raise ValueError("Both objects must be of the same type.") if merge and discard_flagged: @@ -2927,7 +2927,7 @@ def _generate_new_header_keys(self, other): If the two objects are not of the same type. """ # First up, make sure we have two objects of the same dtype - if type(self) != type(other): + if not isinstance(other, self.__class__): raise ValueError("Both objects must be of the same type.") index_dict = {} diff --git a/pyuvdata/uvdata/miriad.py b/pyuvdata/uvdata/miriad.py index a0b08ac30c..98ca7b6077 100644 --- a/pyuvdata/uvdata/miriad.py +++ b/pyuvdata/uvdata/miriad.py @@ -670,7 +670,7 @@ def _read_miriad_metadata(self, uv, correct_lat_lon=True): # keep all single valued extra_variables as extra_keywords for key in check_variables.keys(): - if type(check_variables[key]) == str: + if isinstance(check_variables[key], str): value = check_variables[key].replace("\x00", "") # check for booleans encoded as strings if value == "True": @@ -690,7 +690,7 @@ def _read_miriad_metadata(self, uv, correct_lat_lon=True): key not in ["vartable", "history", "obstype"] and key not in other_miriad_variables ): - if type(uv[key]) == str: + if isinstance(uv[key], str): value = uv[key].replace("\x00", "") value = uv[key].replace("\x01", "") if value == "True": @@ -1988,7 +1988,7 @@ def write_miriad( value = float(value) elif issubclass(value.dtype.type, np.complexfloating): raise_type_error = True - elif type(value) == bool: + elif isinstance(value, bool): value = str(value) elif type(value) not in types.keys(): raise_type_error = True