From daa3a9cade431b21bbc48b690c16dcb8746f3dce Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 21 Dec 2022 03:39:52 +0300 Subject: gn3: (gn3.random -> gn3.chancy): Rename module to avoid conflicts. Rename the `gn3.random` module to gn3.chancy to avoid conflicts with Python's `random` module. * gn3/random.py -> gn3/chancy.py: rename module * gn3/commands.py: update import * gn3/computations/partial_correlations.py: update import * gn3/computations/qtlreaper.py: update import * gn3/computations/rust_correlation.py: update import * gn3/db/correlations.py: update import * gn3/db/traits.py: update import * gn3/heatmaps.py: update import * tests/integration/conftest.py: update import --- gn3/chancy.py | 11 +++++++++++ gn3/commands.py | 2 +- gn3/computations/partial_correlations.py | 2 +- gn3/computations/qtlreaper.py | 2 +- gn3/computations/rust_correlation.py | 2 +- gn3/db/correlations.py | 2 +- gn3/db/traits.py | 2 +- gn3/heatmaps.py | 2 +- gn3/random.py | 11 ----------- 9 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 gn3/chancy.py delete mode 100644 gn3/random.py (limited to 'gn3') diff --git a/gn3/chancy.py b/gn3/chancy.py new file mode 100644 index 0000000..f0ba574 --- /dev/null +++ b/gn3/chancy.py @@ -0,0 +1,11 @@ +""" +Functions to generate complex random data. +""" +import random +import string + +def random_string(length): + """Generate a random string of length `length`.""" + return "".join( + random.choices( + string.ascii_letters + string.digits, k=length)) diff --git a/gn3/commands.py b/gn3/commands.py index d45d9e8..0e78fd2 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -16,7 +16,7 @@ from typing import Sequence from uuid import uuid4 from redis.client import Redis # Used only in type hinting -from gn3.random import random_string +from gn3.chancy import random_string from gn3.exceptions import RedisConnectionError diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 597c5a3..9f02ad2 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -17,7 +17,7 @@ import pingouin from scipy.stats import pearsonr, spearmanr from gn3.settings import TEXTDIR -from gn3.random import random_string +from gn3.chancy import random_string from gn3.function_helpers import compose from gn3.data_helpers import parse_csv_line from gn3.db.datasets import retrieve_trait_dataset diff --git a/gn3/computations/qtlreaper.py b/gn3/computations/qtlreaper.py index b61bdae..981a9c8 100644 --- a/gn3/computations/qtlreaper.py +++ b/gn3/computations/qtlreaper.py @@ -6,7 +6,7 @@ import os import subprocess from typing import Union -from gn3.random import random_string +from gn3.chancy import random_string from gn3.settings import TMPDIR, REAPER_COMMAND def generate_traits_file(samples, trait_values, traits_filename): diff --git a/gn3/computations/rust_correlation.py b/gn3/computations/rust_correlation.py index bd6fe97..546da0e 100644 --- a/gn3/computations/rust_correlation.py +++ b/gn3/computations/rust_correlation.py @@ -10,7 +10,7 @@ import csv import os from gn3.computations.qtlreaper import create_output_directory -from gn3.random import random_string +from gn3.chancy import random_string from gn3.settings import CORRELATION_COMMAND from gn3.settings import TMPDIR diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index a8a72bc..aec8eac 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -6,7 +6,7 @@ import os from functools import reduce from typing import Any, Dict, Tuple, Union, Optional -from gn3.random import random_string +from gn3.chancy import random_string from gn3.data_helpers import partition_all from gn3.db.species import translate_to_mouse_gene_id diff --git a/gn3/db/traits.py b/gn3/db/traits.py index f722e24..fa13fcc 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -4,7 +4,7 @@ from functools import reduce from typing import Any, Dict, Sequence from gn3.settings import TMPDIR -from gn3.random import random_string +from gn3.chancy import random_string from gn3.function_helpers import compose from gn3.db.datasets import retrieve_trait_dataset diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index 91437bb..882a3c7 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -12,7 +12,7 @@ import plotly.figure_factory as ff # type: ignore from plotly.subplots import make_subplots # type: ignore from gn3.settings import TMPDIR -from gn3.random import random_string +from gn3.chancy import random_string from gn3.computations.slink import slink from gn3.db.traits import export_trait_data from gn3.computations.correlations2 import compute_correlation diff --git a/gn3/random.py b/gn3/random.py deleted file mode 100644 index f0ba574..0000000 --- a/gn3/random.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -Functions to generate complex random data. -""" -import random -import string - -def random_string(length): - """Generate a random string of length `length`.""" - return "".join( - random.choices( - string.ascii_letters + string.digits, k=length)) -- cgit v1.2.3