Skip to content

Commit

Permalink
Rename logging->custom_logging
Browse files Browse the repository at this point in the history
needed because geopandas has a conflicting logging important apparently
  • Loading branch information
Dobson committed May 9, 2024
1 parent 45b9f61 commit 09a9830
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion swmmanywhere/logging.py → swmmanywhere/custom_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>>> import os
>>> os.environ["SWMMANYWHERE_VERBOSE"] = "true"
>>> # logging is now enabled in any swmmanywhere module
>>> from swmmanywhere.logging import logger # You can now log yourself
>>> from swmmanywhere.custom_logging import logger # You can now log yourself
>>> logger.info("This is an info message.") # Write to stdout # doctest: +SKIP
This is an info message.
>>> logger.add("file.log") # Add a log file # doctest: +SKIP
Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/geospatial_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import pysheds # noqa: E402
from pysheds import grid as pgrid # noqa: E402

from swmmanywhere.logging import logger # noqa: E402
from swmmanywhere.custom_logging import logger # noqa: E402

TransformerFromCRS = lru_cache(pyproj.transformer.Transformer.from_crs)

Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/graph_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from swmmanywhere import geospatial_utilities as go
from swmmanywhere import parameters, shortest_path_utils
from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger


def load_graph(fid: Path) -> nx.Graph:
Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/metric_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import shapely
from scipy import stats

from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger
from swmmanywhere.parameters import MetricEvaluation


Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/paper/experimenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
os.environ['OMP_NUM_THREADS'] = '1'

from swmmanywhere import swmmanywhere # noqa: E402
from swmmanywhere.logging import logger # noqa: E402
from swmmanywhere.custom_logging import logger # noqa: E402
from swmmanywhere.parameters import get_full_parameters_flat # noqa: E402

os.environ['SWMMANYWHERE_VERBOSE'] = "true"
Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/paper/perform_sa.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from SALib.analyze import sobol
from tqdm import tqdm

from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger
from swmmanywhere.paper import experimenter
from swmmanywhere.paper import plotting as swplt
from swmmanywhere.preprocessing import check_bboxes
Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import yaml
from geopy.geocoders import Nominatim

from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger


def get_country(x: float,
Expand Down
2 changes: 1 addition & 1 deletion swmmanywhere/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from swmmanywhere import geospatial_utilities as go
from swmmanywhere import graph_utilities as gu
from swmmanywhere import parameters, prepare_data
from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger


def next_directory(keyword: str, directory: Path) -> int:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_graph_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from shapely import geometry as sgeom

from swmmanywhere import parameters
from swmmanywhere.custom_logging import logger
from swmmanywhere.graph_utilities import graphfcns as gu
from swmmanywhere.graph_utilities import iterate_graphfcns, load_graph, save_graph
from swmmanywhere.logging import logger


def load_street_network():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path
from tempfile import NamedTemporaryFile

from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger


def test_logger():
Expand Down Expand Up @@ -48,7 +48,7 @@ def test_logger_disable():

def test_logger_reimport():
"""Reimport logger to check that changes from disable are persistent."""
from swmmanywhere.logging import logger
from swmmanywhere.custom_logging import logger
with NamedTemporaryFile(suffix='.log',
mode = 'w+b',
delete=False) as temp_file:
Expand Down

0 comments on commit 09a9830

Please sign in to comment.