Skip to content

Commit

Permalink
Update black in pre-commit.
Browse files Browse the repository at this point in the history
Closes #1223.
  • Loading branch information
grahamgower committed Apr 22, 2022
1 parent 6655f5e commit 94cc1d5
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black
language_version: python3
Expand Down
2 changes: 1 addition & 1 deletion docs/selection_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def adaptive_introgression(seed):
model,
contig,
samples,
seed=rng.randrange(1, 2 ** 32),
seed=rng.randrange(1, 2**32),
extended_events=extended_events,
slim_scaling_factor=10,
slim_burn_in=0.1,
Expand Down
2 changes: 1 addition & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black
black>=22.1.0
blacken-docs
codecov
coverage
Expand Down
2 changes: 1 addition & 1 deletion stdpopsim/catalog/AraTha/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
common_name="A. thaliana",
genome=_genome,
generation_time=1.0,
population_size=10 ** 4,
population_size=10**4,
citations=[
stdpopsim.Citation(
doi="https://doi.org/10.1890/0012-9658(2002)083[1006:GTINSO]2.0.CO;2",
Expand Down
16 changes: 8 additions & 8 deletions stdpopsim/catalog/HomSap/demographic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,14 +1500,14 @@ def _AJ():

# effective population sizes
NANC = 7300 # not inferred. Value taken from Gutenkunst et al. 2009
NYRI = 10 ** 4.26
NCHB = 10 ** 3.61
NCEU = 10 ** 4.52
NM = 10 ** 5.64
NJ = 10 ** 5.55
NAg = 10 ** 3.04
NWA = 10 ** 3.82
NEA = 10 ** 6.29
NYRI = 10**4.26
NCHB = 10**3.61
NCEU = 10**4.52
NM = 10**5.64
NJ = 10**5.55
NAg = 10**3.04
NWA = 10**3.82
NEA = 10**6.29

# admixture proportion from European to Ashkenazi Jews.
m = 0.17
Expand Down
2 changes: 1 addition & 1 deletion stdpopsim/catalog/HomSap/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
common_name="Human",
genome=_genome,
generation_time=30,
population_size=10 ** 4,
population_size=10**4,
citations=[
_tremblay2000.because(stdpopsim.CiteReason.GEN_TIME),
_takahata1993.because(stdpopsim.CiteReason.POP_SIZE),
Expand Down
2 changes: 1 addition & 1 deletion stdpopsim/engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def simulate(
self._warn_mutation_rate_mismatch(contig, demographic_model)

rng = np.random.default_rng(seed)
seeds = rng.integers(1, 2 ** 31 - 1, size=2)
seeds = rng.integers(1, 2**31 - 1, size=2)

ts = msprime.sim_ancestry(
samples=samples,
Expand Down
16 changes: 8 additions & 8 deletions stdpopsim/qc/HomSap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,14 +1114,14 @@ def GladsteinAshkSubstructure():

# Population sizes from supp tab 3
N_ANC = 7300
N_YRI = 10 ** 4.26
N_CEU = 10 ** 4.52
N_CHB = 10 ** 3.61
N_WA = 10 ** 3.82
N_EA = 10 ** 6.29
N_Ag = 10 ** 3.04
N_J = 10 ** 5.55
N_M = 10 ** 5.64
N_YRI = 10**4.26
N_CEU = 10**4.52
N_CHB = 10**3.61
N_WA = 10**3.82
N_EA = 10**6.29
N_Ag = 10**3.04
N_J = 10**5.55
N_M = 10**5.64

# Migration rate from CEU to ASHK ancestral pop
m = 0.17
Expand Down
4 changes: 2 additions & 2 deletions stdpopsim/slim_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ def _recap_and_rescale(self, ts, seed, recap_epoch, contig, slim_scaling_factor)
ts = tables.tree_sequence()

rng = random.Random(seed)
s0 = rng.randrange(1, 2 ** 32)
s0 = rng.randrange(1, 2**32)
population_configurations = [
msprime.PopulationConfiguration(
initial_size=pop.start_size,
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def _recap_and_rescale(self, ts, seed, recap_epoch, contig, slim_scaling_factor)
assert len(dfe["proportions"]) == len(dfe["mutation_types"])
for prop, mt in zip(dfe["proportions"], dfe["mutation_types"]):
if mt["is_neutral"]:
mut_seed = rng.randrange(1, 2 ** 32)
mut_seed = rng.randrange(1, 2**32)
# Figuring out SLiM mutation id metadata

def _get_next_id(ts):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_AraTha.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TestSpecies(test_species.SpeciesTestBase):
species = stdpopsim.get_species("AraTha")

def test_basic_attributes(self):
assert self.species.population_size == 10 ** 4
assert self.species.population_size == 10**4
assert self.species.generation_time == 1


Expand Down
2 changes: 1 addition & 1 deletion tests/test_HomSap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestSpecies(test_species.SpeciesTestBase):
species = stdpopsim.get_species("HomSap")

def test_basic_attributes(self):
assert self.species.population_size == 10 ** 4
assert self.species.population_size == 10**4
assert self.species.generation_time == 30


Expand Down
2 changes: 1 addition & 1 deletion tests/test_PonAbe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TestSpecies(test_species.SpeciesTestBase):
species = stdpopsim.get_species("PonAbe")

def test_basic_attributes(self):
assert self.species.population_size == 1.79 * 10 ** 4
assert self.species.population_size == 1.79 * 10**4
assert self.species.generation_time == 20


Expand Down
2 changes: 1 addition & 1 deletion validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def do_simulations(rng, path, num_replicates, executor, key):
out_dir = path / "trees" / key
out_dir.mkdir(parents=True, exist_ok=True)
func = functools.partial(simulation_functions[key], out_dir)
seeds = (rng.randrange(1, 2 ** 32) for _ in range(num_replicates))
seeds = (rng.randrange(1, 2**32) for _ in range(num_replicates))
res = list(executor.map(func, seeds))
files, times = zip(*res)
# dump timing info to a file
Expand Down

0 comments on commit 94cc1d5

Please sign in to comment.