diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28029536b..fc32dd096 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black language_version: python3 diff --git a/docs/selection_example.py b/docs/selection_example.py index 7949aff36..4a14decca 100644 --- a/docs/selection_example.py +++ b/docs/selection_example.py @@ -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, diff --git a/requirements/development.txt b/requirements/development.txt index aedb42b56..383ceeeb6 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,4 +1,4 @@ -black +black>=22.1.0 blacken-docs codecov coverage diff --git a/stdpopsim/catalog/AraTha/species.py b/stdpopsim/catalog/AraTha/species.py index 22362458a..974996a6e 100644 --- a/stdpopsim/catalog/AraTha/species.py +++ b/stdpopsim/catalog/AraTha/species.py @@ -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", diff --git a/stdpopsim/catalog/HomSap/demographic_models.py b/stdpopsim/catalog/HomSap/demographic_models.py index a3dfa68a8..bdb3a3acb 100644 --- a/stdpopsim/catalog/HomSap/demographic_models.py +++ b/stdpopsim/catalog/HomSap/demographic_models.py @@ -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 diff --git a/stdpopsim/catalog/HomSap/species.py b/stdpopsim/catalog/HomSap/species.py index d4f521bf8..db831416a 100644 --- a/stdpopsim/catalog/HomSap/species.py +++ b/stdpopsim/catalog/HomSap/species.py @@ -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), diff --git a/stdpopsim/engines.py b/stdpopsim/engines.py index 48a278cc5..a79f7a80a 100644 --- a/stdpopsim/engines.py +++ b/stdpopsim/engines.py @@ -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, diff --git a/stdpopsim/qc/HomSap.py b/stdpopsim/qc/HomSap.py index 924399503..4404f78e0 100644 --- a/stdpopsim/qc/HomSap.py +++ b/stdpopsim/qc/HomSap.py @@ -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 diff --git a/stdpopsim/slim_engine.py b/stdpopsim/slim_engine.py index c4876d83d..7ebc50aa2 100644 --- a/stdpopsim/slim_engine.py +++ b/stdpopsim/slim_engine.py @@ -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, @@ -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): diff --git a/tests/test_AraTha.py b/tests/test_AraTha.py index 40400f66f..83c1ba0e3 100644 --- a/tests/test_AraTha.py +++ b/tests/test_AraTha.py @@ -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 diff --git a/tests/test_HomSap.py b/tests/test_HomSap.py index 0c35de0fa..1b85a9f35 100644 --- a/tests/test_HomSap.py +++ b/tests/test_HomSap.py @@ -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 diff --git a/tests/test_PonAbe.py b/tests/test_PonAbe.py index c04990bdb..162b6b3aa 100644 --- a/tests/test_PonAbe.py +++ b/tests/test_PonAbe.py @@ -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 diff --git a/validation.py b/validation.py index 990149e90..24d8a64fb 100755 --- a/validation.py +++ b/validation.py @@ -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