diff --git a/doc/pages/genetic_values.md b/doc/pages/genetic_values.md index a2d96f492..a6fe60822 100644 --- a/doc/pages/genetic_values.md +++ b/doc/pages/genetic_values.md @@ -9,20 +9,20 @@ For some background, see {ref}`definitions`. ```{eval-rst} .. autoclass:: fwdpy11.Additive - :members: asdict, fromdict, asblack, shape, genetic_values, maps_to_fitness, maps_to_trait_value + :members: asdict, fromdict, shape, genetic_values, maps_to_fitness, maps_to_trait_value ``` ```{eval-rst} .. autoclass:: fwdpy11.Multiplicative - :members: asdict, fromdict, asblack, shape, genetic_values, maps_to_fitness, maps_to_trait_value + :members: asdict, fromdict, shape, genetic_values, maps_to_fitness, maps_to_trait_value ``` ```{eval-rst} .. autoclass:: fwdpy11.GBR - :members: asdict, fromdict, asblack, shape, genetic_values, maps_to_fitness, maps_to_trait_value + :members: asdict, fromdict, shape, genetic_values, maps_to_fitness, maps_to_trait_value ``` ```{eval-rst} .. autoclass:: fwdpy11.AdditivePleiotropy - :members: asdict, fromdict, asblack, shape, genetic_values, maps_to_fitness, maps_to_trait_value + :members: asdict, fromdict, shape, genetic_values, maps_to_fitness, maps_to_trait_value ``` diff --git a/doc/pages/gvalue_to_fitness.md b/doc/pages/gvalue_to_fitness.md index 93f18f7a2..95180514a 100644 --- a/doc/pages/gvalue_to_fitness.md +++ b/doc/pages/gvalue_to_fitness.md @@ -15,12 +15,12 @@ ```{eval-rst} .. autoclass:: fwdpy11.Optimum - :members: asdict, fromdict, asblack + :members: asdict, fromdict ``` ```{eval-rst} .. autoclass:: fwdpy11.PleiotropicOptima - :members: asdict, fromdict, asblack + :members: asdict, fromdict ``` diff --git a/doc/pages/gvaluenoise.md b/doc/pages/gvaluenoise.md index 2a5527c45..ac129662c 100644 --- a/doc/pages/gvaluenoise.md +++ b/doc/pages/gvaluenoise.md @@ -12,7 +12,7 @@ ```{eval-rst} .. autoclass:: fwdpy11.GaussianNoise - :members: asdict, fromdict, asblack + :members: asdict, fromdict ``` diff --git a/doc/short_vignettes/mutationdominance_vignette.md b/doc/short_vignettes/mutationdominance_vignette.md index 4e751364b..14ed6acd5 100644 --- a/doc/short_vignettes/mutationdominance_vignette.md +++ b/doc/short_vignettes/mutationdominance_vignette.md @@ -104,7 +104,7 @@ for s in np.arange(0.1, 1, 0.1): ```{code-cell} des = fwdpy11.DiscreteDESD(beg=0, end=1, weight=1, joint_dist=joint_dist) -print(des.asblack()) +print(des) ``` The result is that mutations with smaller effect sizes are more common (larger weights) and more dominant. diff --git a/doc/short_vignettes/workingexample_fitness.md b/doc/short_vignettes/workingexample_fitness.md index 21483a12a..2a6f9344b 100644 --- a/doc/short_vignettes/workingexample_fitness.md +++ b/doc/short_vignettes/workingexample_fitness.md @@ -40,7 +40,7 @@ params = fwdpy11.ModelParams(**p) Let's take a look at what he have: ```{code-cell} -print(params.asblack()) +print(params) ``` Let's explain a few new things: diff --git a/doc/short_vignettes/workingexample_trait.md b/doc/short_vignettes/workingexample_trait.md index b79e373ca..520720ebd 100644 --- a/doc/short_vignettes/workingexample_trait.md +++ b/doc/short_vignettes/workingexample_trait.md @@ -44,7 +44,7 @@ params = fwdpy11.ModelParams(**p) ``` ```{code-cell} -print(params.asblack()) +print(params) ``` ## Modifying model parameters diff --git a/fwdpy11/_types/demographic_model_citation.py b/fwdpy11/_types/demographic_model_citation.py index 3c9500ce9..e17f11115 100644 --- a/fwdpy11/_types/demographic_model_citation.py +++ b/fwdpy11/_types/demographic_model_citation.py @@ -3,13 +3,11 @@ from deprecated import deprecated from fwdpy11.class_decorators import ( - attr_add_asblack, attr_class_pickle, attr_class_to_from_dict, ) -@attr_add_asblack @attr_class_pickle @attr_class_to_from_dict @attr.s(kw_only=True, frozen=True, auto_attribs=True, repr_ns="fwdpy11") diff --git a/fwdpy11/_types/demographic_model_details.py b/fwdpy11/_types/demographic_model_details.py index d7963de01..90a80bd68 100644 --- a/fwdpy11/_types/demographic_model_details.py +++ b/fwdpy11/_types/demographic_model_details.py @@ -4,7 +4,6 @@ from deprecated import deprecated from ..class_decorators import ( - attr_add_asblack, attr_class_pickle, attr_class_to_from_dict_no_recurse, ) @@ -14,7 +13,6 @@ from .forward_demes_graph import ForwardDemesGraph -@attr_add_asblack @attr_class_pickle @attr_class_to_from_dict_no_recurse @attr.s(kw_only=True, frozen=True, auto_attribs=True, repr_ns="fwdpy11") diff --git a/fwdpy11/_types/model_params.py b/fwdpy11/_types/model_params.py index ac9f7b27e..7da9e375d 100644 --- a/fwdpy11/_types/model_params.py +++ b/fwdpy11/_types/model_params.py @@ -26,7 +26,6 @@ import fwdpy11 import numpy as np from fwdpy11.class_decorators import ( - attr_add_asblack, attr_class_to_from_dict_no_recurse, ) @@ -34,7 +33,6 @@ from fwdpy11._types.forward_demes_graph import ForwardDemesGraph -@attr_add_asblack @attr_class_to_from_dict_no_recurse @attr.s(kw_only=True, frozen=True, slots=True, repr_ns="fwdpy11") class MutationAndRecombinationRates(object): @@ -112,7 +110,6 @@ def validate_timings( return gvalue.validate_timings(deme, demography) -@attr_add_asblack @attr_class_to_from_dict_no_recurse @attr.s(kw_only=True, frozen=True, slots=True, repr_ns="fwdpy11") class ModelParams(object): diff --git a/fwdpy11/class_decorators.py b/fwdpy11/class_decorators.py index 433d7320e..51db3229a 100644 --- a/fwdpy11/class_decorators.py +++ b/fwdpy11/class_decorators.py @@ -117,31 +117,6 @@ def setstate(self, d): return _add_getstate(cls) -def attr_add_asblack(cls): - """ - The default __repr__ from attrs isn't readable - for complex classes. This adds a method - for pretty-printing out the class using black's - formatting rules - """ - - def _asblack(self): - """ - Return a string representation formatted with black - """ - import black - - # The try/except is to handle black's changing API - try: - return black.format_str(str(self), mode=black.Mode()) - except AttributeError: - return black.format_str(str(self), mode=black.FileMode()) - - cls.asblack = _asblack - - return cls - - def region_custom_repr(cls): """ Custom repr to correctly display weight for region instances diff --git a/fwdpy11/genetic_map_unit.py b/fwdpy11/genetic_map_unit.py index 080952a5c..cdbb6cc1d 100644 --- a/fwdpy11/genetic_map_unit.py +++ b/fwdpy11/genetic_map_unit.py @@ -24,7 +24,6 @@ import fwdpy11._fwdpy11 from .class_decorators import ( - attr_add_asblack, attr_class_pickle_with_super, attr_class_to_from_dict, ) @@ -35,7 +34,6 @@ def _is_integer_if_discrete(self, attribute, value): attr.validators.instance_of(int)(self, attribute, value) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -90,7 +88,6 @@ def __attrs_post_init__(self): ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -203,7 +200,6 @@ def __attrs_post_init__(self): ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -257,7 +253,6 @@ def __attrs_post_init__(self): ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -315,7 +310,6 @@ def __attrs_post_init__(self): ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") diff --git a/fwdpy11/genetic_values.py b/fwdpy11/genetic_values.py index e5545c95e..9c321ee31 100644 --- a/fwdpy11/genetic_values.py +++ b/fwdpy11/genetic_values.py @@ -43,7 +43,6 @@ _PyDiploidGeneticValue, ) from .class_decorators import ( - attr_add_asblack, attr_class_pickle_with_super, attr_class_to_from_dict, attr_class_to_from_dict_no_recurse, @@ -56,7 +55,6 @@ class TimingError(Exception): pass -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -96,7 +94,6 @@ def __attrs_post_init__(self): super(Optimum, self).__init__(self.optimum, self.VS, self.when) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11", eq=False) @@ -225,7 +222,6 @@ def validate_timings(self, deme: int, demography: ForwardDemesGraph) -> None: raise TimingError(msg) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -243,7 +239,6 @@ def __attrs_post_init__(self): super(NoNoise, self).__init__() -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -272,7 +267,6 @@ def __attrs_post_init__(self): super(GaussianNoise, self).__init__(self.sd, self.mean) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -324,7 +318,6 @@ def validate_timings(self, deme: int, demography: ForwardDemesGraph) -> None: self.gvalue_to_fitness.validate_timings(deme, demography) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -376,7 +369,6 @@ def validate_timings(self, deme: int, demography: ForwardDemesGraph) -> None: self.gvalue_to_fitness.validate_timings(deme, demography) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -417,7 +409,6 @@ def validate_timings(self, deme: int, demography: ForwardDemesGraph) -> None: self.gvalue_to_fitness.validate_timings(deme, demography) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") diff --git a/fwdpy11/mutation_dominance.py b/fwdpy11/mutation_dominance.py index c3c9d7e97..56908d016 100644 --- a/fwdpy11/mutation_dominance.py +++ b/fwdpy11/mutation_dominance.py @@ -22,13 +22,11 @@ import fwdpy11._fwdpy11 from .class_decorators import ( - attr_add_asblack, attr_class_to_from_dict, attr_class_pickle_with_super, ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -48,7 +46,6 @@ def __attrs_post_init__(self): super(FixedDominance, self).__init__(fwdpy11._fwdpy11._fixed_dominance(self.h)) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -70,7 +67,6 @@ def __attrs_post_init__(self): ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") @@ -95,7 +91,6 @@ def __attrs_post_init__(self): ) -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr_ns="fwdpy11") diff --git a/fwdpy11/regions.py b/fwdpy11/regions.py index 888f73d2e..1249f1f02 100644 --- a/fwdpy11/regions.py +++ b/fwdpy11/regions.py @@ -25,7 +25,6 @@ import fwdpy11._fwdpy11 from .class_decorators import ( - attr_add_asblack, attr_class_pickle_with_super, attr_class_to_from_dict, attr_class_to_from_dict_no_recurse, @@ -34,7 +33,6 @@ @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -85,7 +83,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -146,7 +143,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -209,7 +205,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -274,7 +269,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -335,7 +329,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -446,7 +439,6 @@ def mv( @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -511,7 +503,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(eq=False, auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -603,7 +594,6 @@ def __eq__(self, other): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(eq=False, auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") @@ -639,7 +629,6 @@ def __attrs_post_init__(self): @region_custom_repr -@attr_add_asblack @attr_class_pickle_with_super @attr_class_to_from_dict_no_recurse @attr.s(eq=False, auto_attribs=True, frozen=True, repr=False, repr_ns="fwdpy11") diff --git a/pyproject.toml b/pyproject.toml index 3723a3527..ddc9c4db9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,6 @@ classifiers = [ dynamic = ["version"] dependencies = [ "attrs >= 20.3.0, < 24.1.0", - "black", "numpy>=1.23.5", "tskit >= 0.5.6", "demes ~= 0.2.2", diff --git a/requirements/conda_minimal_deps.txt b/requirements/conda_minimal_deps.txt index e0179117c..6d47bc9c7 100644 --- a/requirements/conda_minimal_deps.txt +++ b/requirements/conda_minimal_deps.txt @@ -2,7 +2,6 @@ pybind11==2.11.1 numpy scipy attrs>=0.19.2 -black tskit msprime gsl diff --git a/requirements/minimal_install_requirements.txt b/requirements/minimal_install_requirements.txt index 96f30f2b4..50ed53fa2 100644 --- a/requirements/minimal_install_requirements.txt +++ b/requirements/minimal_install_requirements.txt @@ -1,4 +1,3 @@ -black attrs < 20.4 demes == 0.2.2 numpy >= 1.23.5 diff --git a/tests/test_class_decorators.py b/tests/test_class_decorators.py index 47b813a1d..09d8dbc23 100644 --- a/tests/test_class_decorators.py +++ b/tests/test_class_decorators.py @@ -25,7 +25,6 @@ @fwdpy11.class_decorators.attr_class_to_from_dict -@fwdpy11.class_decorators.attr_add_asblack @attr.s(auto_attribs=True) class FauxClass(object): a: float @@ -37,12 +36,6 @@ class TestClassDecorators(unittest.TestCase): def setUpClass(self): self.f = FauxClass(1.0, 3.0) - def test_black_pretty_print(self): - try: - _ = self.f.asblack() - except: # NOQA - self.fail("self.f.asblack() raised unexpected exception") - def test_to_from_dict(self): d = self.f.asdict() self.assertEqual(d["a"], self.f.a)