Skip to content

Commit

Permalink
MAINT: remove usage of removed astropy functionality _find_home()
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Nov 28, 2024
1 parent c488c62 commit e5d4555
Show file tree
Hide file tree
Showing 24 changed files with 51 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# This will be used to select tests whose
# returned values depend on the configuration
# of my personal cache directory files
from astropy.config.paths import _find_home
from pathlib import Path
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np
import pytest
from astropy.config.paths import _find_home
from pathlib import Path

from ....custom_exceptions import HalotoolsError
from ....empirical_models import (
Expand All @@ -26,7 +26,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
import pytest
from astropy.config.paths import _find_home
from pathlib import Path

from ...factories import PrebuiltHodModelFactory

Expand All @@ -19,7 +19,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import numpy as np
from astropy.config.paths import _find_home
from pathlib import Path
import pytest

from ...biased_nfw_phase_space import BiasedNFWPhaseSpace
Expand All @@ -17,7 +17,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# This will be used to select tests whose
# returned values depend on the configuration
# of my personal cache directory files
from astropy.config.paths import _find_home
from pathlib import Path
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pytest
from astropy.utils.misc import NumpyRNGContext
from astropy.config.paths import _find_home
from pathlib import Path

from ..pairs import wnpairs as pure_python_weighted_pairs
from ..marked_npairs_3d import marked_npairs_3d, _func_signature_int_from_wfunc
Expand All @@ -30,7 +30,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pytest
from astropy.utils.misc import NumpyRNGContext
from astropy.config.paths import _find_home
from pathlib import Path

from ..pairs import xy_z_wnpairs as pure_python_weighted_pairs
from ..marked_npairs_xy_z import marked_npairs_xy_z
Expand Down Expand Up @@ -33,7 +33,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pytest
from astropy.utils.misc import NumpyRNGContext
from astropy.config.paths import _find_home
from pathlib import Path

from ..npairs_3d import npairs_3d
from ..pairs import npairs as pure_python_brute_force_npairs_3d
Expand All @@ -22,7 +22,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import os
from astropy.config.paths import _find_home
halotools_cache_dirname = os.path.join(_find_home(), '.astropy', 'cache', 'halotools')
from pathlib import Path
halotools_cache_dirname = os.path.join(Path.home(), '.astropy', 'cache', 'halotools')
halotool_unit_testing_dirname = os.path.join(halotools_cache_dirname, 'unit_testing_files')


Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
unicode_literals)

import os
from astropy.config.paths import _find_home
from pathlib import Path

try:
halotools_cache_dirname = os.path.join(_find_home(), '.astropy', 'cache', 'halotools')
halotools_cache_dirname = os.path.join(Path.home(), '.astropy', 'cache', 'halotools')
os.makedirs(halotools_cache_dirname)
except OSError:
pass
Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/tests/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from astropy.table import Table
from astropy.table import vstack as table_vstack

from astropy.config.paths import _find_home
from pathlib import Path

detected_home = _find_home()
detected_home = Path.home()

__all__ = ('add_new_row_to_cache_log', )

Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/tests/test_cached_halo_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import shutil
from unittest import TestCase

from astropy.config.paths import _find_home
from pathlib import Path
from astropy.table import Table
from astropy.tests.helper import pytest

Expand Down Expand Up @@ -35,7 +35,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
6 changes: 3 additions & 3 deletions halotools/sim_manager/tests/test_download_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from unittest import TestCase

import numpy as np
from astropy.config.paths import _find_home
from pathlib import Path
from astropy.table import Table
from astropy.tests.helper import pytest

Expand All @@ -20,7 +20,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand All @@ -32,7 +32,7 @@

class TestDownloadManager(TestCase):
def setUp(self):
homedir = _find_home()
homedir = Path.home()

self.downman = DownloadManager()

Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/tests/test_halo_table_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
except ImportError:
HAS_H5PY = False

from astropy.config.paths import _find_home
from pathlib import Path

from . import helper_functions

Expand All @@ -31,7 +31,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from astropy.table import Table

from astropy.config.paths import _find_home
from pathlib import Path

try:
import h5py
Expand All @@ -28,7 +28,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/tests/test_load_default_halocat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals


from astropy.config.paths import _find_home
from pathlib import Path
import pytest

from ..cached_halo_catalog import CachedHaloCatalog
Expand All @@ -13,7 +13,7 @@
from ...utils.python_string_comparisons import compare_strings_py23_safe

aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/tests/test_ptcl_table_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
except ImportError:
HAS_H5PY = False

from astropy.config.paths import _find_home
from pathlib import Path
from astropy.table import Table

from . import helper_functions
Expand All @@ -33,7 +33,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
except ImportError:
HAS_H5PY = False

from astropy.config.paths import _find_home
from pathlib import Path

from . import helper_functions
from ..ptcl_table_cache_log_entry import PtclTableCacheLogEntry
Expand All @@ -25,7 +25,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
6 changes: 3 additions & 3 deletions halotools/sim_manager/tests/test_rockstar_hlist_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
from astropy.table import Table
from astropy.utils.misc import NumpyRNGContext
from astropy.config.paths import _find_home
from pathlib import Path
from astropy.utils.data import get_pkg_data_filename
from collections import OrderedDict

Expand All @@ -30,7 +30,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down Expand Up @@ -59,7 +59,7 @@ class TestRockstarHlistReader(TestCase):

def setUp(self):

self.tmpdir = os.path.join(_find_home(), '.tmp_testingdir')
self.tmpdir = os.path.join(Path.home(), '.tmp_testingdir')
try:
os.makedirs(self.tmpdir)
except OSError:
Expand Down
4 changes: 2 additions & 2 deletions halotools/sim_manager/tests/test_supported_sims.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

import numpy as np
import pytest
from astropy.config.paths import _find_home
from pathlib import Path

from ...custom_exceptions import HalotoolsError
from ..cached_halo_catalog import CachedHaloCatalog, InvalidCacheLogEntry

slow = pytest.mark.slow

aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
6 changes: 3 additions & 3 deletions halotools/sim_manager/tests/test_tabular_ascii_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from astropy.table import Table

from astropy.config.paths import _find_home
from pathlib import Path

from ..tabular_ascii_reader import TabularAsciiReader

Expand All @@ -17,7 +17,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = '/Users/aphearin'
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand All @@ -39,7 +39,7 @@ class TestTabularAsciiReader(TestCase):

def setUp(self):

self.tmpdir = os.path.join(_find_home(), '.temp_halotools_testing_dir')
self.tmpdir = os.path.join(Path.home(), '.temp_halotools_testing_dir')
try:
os.makedirs(self.tmpdir)
except OSError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import shutil

from astropy.config.paths import _find_home
from pathlib import Path
import pytest

try:
Expand Down Expand Up @@ -35,7 +35,7 @@
# returned values depend on the configuration
# of my personal cache directory files
aph_home = "/Users/aphearin"
detected_home = _find_home()
detected_home = Path.home()
if aph_home == detected_home:
APH_MACHINE = True
else:
Expand Down
Loading

0 comments on commit e5d4555

Please sign in to comment.