From f2eb8a35b2d488c89bf8d58f99942dbe878b1923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Thu, 2 Jul 2020 08:58:23 +0200 Subject: [PATCH] sty: run isort -rc . --- conftest.py | 1 - scripts/iyt | 8 +- scripts/pr_backport.py | 5 +- setup.py | 27 +++-- setupext.py | 7 +- tests/nose_runner.py | 18 +-- tests/report_failed_answers.py | 1 + .../absorption_spectrum/api.py | 3 +- .../cosmological_observation/api.py | 3 +- yt/analysis_modules/halo_analysis/api.py | 3 +- yt/analysis_modules/halo_finding/api.py | 3 +- yt/analysis_modules/halo_mass_function/api.py | 3 +- yt/analysis_modules/photon_simulator/api.py | 3 +- yt/analysis_modules/ppv_cube/api.py | 3 +- yt/analysis_modules/radmc3d_export/api.py | 3 +- yt/analysis_modules/star_analysis/api.py | 3 +- yt/analysis_modules/sunrise_export/api.py | 3 +- yt/analysis_modules/sunyaev_zeldovich/api.py | 3 +- .../two_point_functions/api.py | 3 +- yt/api.py | 1 - yt/config.py | 2 +- yt/convenience.py | 14 +-- yt/data_objects/api.py | 45 ++----- .../construction_data_containers.py | 91 +++++++-------- yt/data_objects/data_containers.py | 92 +++++++-------- yt/data_objects/derived_quantities.py | 16 ++- yt/data_objects/grid_patch.py | 22 ++-- yt/data_objects/image_array.py | 7 +- yt/data_objects/level_sets/api.py | 31 ++--- yt/data_objects/level_sets/clump_handling.py | 29 ++--- .../level_sets/clump_info_items.py | 3 +- yt/data_objects/level_sets/clump_tools.py | 1 + .../level_sets/clump_validators.py | 9 +- yt/data_objects/level_sets/contour_finder.py | 17 +-- .../level_sets/tests/test_clump_finding.py | 25 ++-- yt/data_objects/octree_subset.py | 22 ++-- yt/data_objects/particle_container.py | 15 ++- yt/data_objects/particle_filters.py | 3 +- yt/data_objects/particle_trajectories.py | 17 +-- yt/data_objects/particle_unions.py | 1 + yt/data_objects/profiles.py | 50 ++++---- yt/data_objects/region_expression.py | 2 + yt/data_objects/selection_data_containers.py | 67 ++++++----- yt/data_objects/static_output.py | 110 ++++++++---------- yt/data_objects/tests/test_bbox.py | 5 +- yt/data_objects/tests/test_boolean_regions.py | 5 +- yt/data_objects/tests/test_chunking.py | 9 +- yt/data_objects/tests/test_clone.py | 6 +- yt/data_objects/tests/test_compose.py | 10 +- yt/data_objects/tests/test_connected_sets.py | 1 + yt/data_objects/tests/test_covering_grid.py | 20 ++-- yt/data_objects/tests/test_cutting_plane.py | 5 +- yt/data_objects/tests/test_data_collection.py | 6 +- yt/data_objects/tests/test_data_containers.py | 10 +- yt/data_objects/tests/test_dataset_access.py | 15 +-- .../tests/test_derived_quantities.py | 21 ++-- yt/data_objects/tests/test_ellipsoid.py | 5 +- .../tests/test_exclude_functions.py | 3 +- yt/data_objects/tests/test_extract_regions.py | 14 ++- yt/data_objects/tests/test_firefly.py | 5 +- yt/data_objects/tests/test_fluxes.py | 4 +- yt/data_objects/tests/test_glue.py | 1 + yt/data_objects/tests/test_image_array.py | 10 +- yt/data_objects/tests/test_numpy_ops.py | 3 +- yt/data_objects/tests/test_octree.py | 10 +- yt/data_objects/tests/test_ortho_rays.py | 4 +- yt/data_objects/tests/test_particle_filter.py | 5 +- .../tests/test_particle_trajectories.py | 10 +- yt/data_objects/tests/test_pickle.py | 6 +- yt/data_objects/tests/test_points.py | 3 +- yt/data_objects/tests/test_profiles.py | 29 +++-- yt/data_objects/tests/test_projection.py | 12 +- yt/data_objects/tests/test_rays.py | 13 +-- yt/data_objects/tests/test_refinement.py | 8 +- yt/data_objects/tests/test_regions.py | 6 +- yt/data_objects/tests/test_slice.py | 7 +- .../tests/test_sph_data_objects.py | 6 +- yt/data_objects/tests/test_spheres.py | 10 +- yt/data_objects/tests/test_streamlines.py | 6 +- yt/data_objects/tests/test_time_series.py | 7 +- yt/data_objects/time_series.py | 46 ++++---- yt/data_objects/unions.py | 1 + yt/data_objects/unstructured_mesh.py | 12 +- yt/exthook.py | 1 - yt/fields/angular_momentum.py | 17 ++- yt/fields/api.py | 56 ++++----- yt/fields/astro_fields.py | 6 +- yt/fields/cosmology_fields.py | 11 +- yt/fields/derived_field.py | 29 +++-- yt/fields/domain_context.py | 1 - yt/fields/field_detector.py | 9 +- yt/fields/field_exceptions.py | 1 - yt/fields/field_functions.py | 4 +- yt/fields/field_info_container.py | 38 +++--- yt/fields/field_type_container.py | 9 +- yt/fields/fluid_fields.py | 32 ++--- yt/fields/fluid_vector_fields.py | 19 +-- yt/fields/geometric_fields.py | 30 +++-- yt/fields/interpolated_fields.py | 11 +- yt/fields/local_fields.py | 9 +- yt/fields/magnetic_field.py | 11 +- yt/fields/my_plugin_fields.py | 7 +- yt/fields/particle_fields.py | 60 ++++------ yt/fields/species_fields.py | 21 ++-- yt/fields/tests/test_angular_momentum.py | 5 +- yt/fields/tests/test_field_access.py | 16 +-- yt/fields/tests/test_field_name_container.py | 7 +- yt/fields/tests/test_fields.py | 47 ++++---- yt/fields/tests/test_fields_plugins.py | 7 +- yt/fields/tests/test_magnetic_fields.py | 6 +- yt/fields/tests/test_particle_fields.py | 7 +- yt/fields/tests/test_species_fields.py | 12 +- yt/fields/tests/test_sph_fields.py | 9 +- yt/fields/tests/test_vector_fields.py | 9 +- yt/fields/tests/test_xray_fields.py | 13 ++- yt/fields/vector_operations.py | 29 ++--- yt/fields/xray_emission_fields.py | 19 ++- yt/frontends/_skeleton/__init__.py | 1 - yt/frontends/_skeleton/api.py | 13 +-- yt/frontends/_skeleton/data_structures.py | 13 +-- yt/frontends/_skeleton/fields.py | 3 +- yt/frontends/_skeleton/io.py | 3 +- yt/frontends/adaptahop/api.py | 12 +- yt/frontends/adaptahop/data_structures.py | 28 +++-- yt/frontends/adaptahop/fields.py | 3 +- yt/frontends/adaptahop/io.py | 17 +-- yt/frontends/adaptahop/tests/test_outputs.py | 6 +- yt/frontends/ahf/__init__.py | 1 - yt/frontends/ahf/api.py | 11 +- yt/frontends/ahf/data_structures.py | 15 +-- yt/frontends/ahf/fields.py | 3 +- yt/frontends/ahf/io.py | 12 +- yt/frontends/ahf/tests/test_outputs.py | 15 ++- yt/frontends/amrvac/__init__.py | 1 + yt/frontends/amrvac/api.py | 13 +-- yt/frontends/amrvac/data_structures.py | 22 ++-- yt/frontends/amrvac/datfile_utils.py | 1 + yt/frontends/amrvac/fields.py | 7 +- yt/frontends/amrvac/io.py | 8 +- yt/frontends/amrvac/tests/test_outputs.py | 18 +-- .../amrvac/tests/test_read_amrvac_namelist.py | 5 +- yt/frontends/api.py | 7 +- yt/frontends/arepo/api.py | 9 +- yt/frontends/arepo/data_structures.py | 7 +- yt/frontends/arepo/fields.py | 10 +- yt/frontends/arepo/io.py | 5 +- yt/frontends/arepo/tests/test_outputs.py | 8 +- yt/frontends/art/__init__.py | 1 - yt/frontends/art/api.py | 22 ++-- yt/frontends/art/data_structures.py | 61 +++++----- yt/frontends/art/fields.py | 3 +- yt/frontends/art/io.py | 31 +++-- yt/frontends/art/tests/test_outputs.py | 27 ++--- yt/frontends/artio/__init__.py | 1 - yt/frontends/artio/api.py | 12 +- yt/frontends/artio/data_structures.py | 43 +++---- yt/frontends/artio/fields.py | 11 +- yt/frontends/artio/io.py | 3 +- yt/frontends/artio/tests/test_outputs.py | 24 ++-- yt/frontends/athena/api.py | 14 +-- yt/frontends/athena/data_structures.py | 30 ++--- yt/frontends/athena/definitions.py | 1 - yt/frontends/athena/fields.py | 6 +- yt/frontends/athena/io.py | 7 +- yt/frontends/athena/tests/test_outputs.py | 25 ++-- yt/frontends/athena_pp/api.py | 14 +-- yt/frontends/athena_pp/data_structures.py | 34 +++--- yt/frontends/athena_pp/definitions.py | 1 - yt/frontends/athena_pp/fields.py | 6 +- yt/frontends/athena_pp/io.py | 9 +- yt/frontends/athena_pp/tests/test_outputs.py | 25 ++-- yt/frontends/boxlib/__init__.py | 1 - yt/frontends/boxlib/api.py | 44 ++++--- yt/frontends/boxlib/data_structures.py | 35 +++--- yt/frontends/boxlib/definitions.py | 1 - yt/frontends/boxlib/fields.py | 10 +- yt/frontends/boxlib/io.py | 9 +- yt/frontends/boxlib/tests/test_outputs.py | 32 ++--- yt/frontends/chombo/api.py | 42 ++++--- yt/frontends/chombo/data_structures.py | 41 +++---- yt/frontends/chombo/definitions.py | 1 - yt/frontends/chombo/fields.py | 13 ++- yt/frontends/chombo/io.py | 11 +- yt/frontends/chombo/tests/test_outputs.py | 19 ++- yt/frontends/eagle/api.py | 13 +-- yt/frontends/eagle/data_structures.py | 12 +- yt/frontends/eagle/fields.py | 6 +- yt/frontends/eagle/io.py | 4 +- yt/frontends/eagle/tests/test_outputs.py | 7 +- yt/frontends/enzo/answer_testing_support.py | 19 +-- yt/frontends/enzo/api.py | 41 +++---- yt/frontends/enzo/data_structures.py | 39 +++---- yt/frontends/enzo/fields.py | 8 +- yt/frontends/enzo/io.py | 9 +- yt/frontends/enzo/misc.py | 14 ++- yt/frontends/enzo/simulation_handling.py | 41 +++---- yt/frontends/enzo/tests/test_outputs.py | 29 ++--- yt/frontends/enzo_p/api.py | 15 +-- yt/frontends/enzo_p/data_structures.py | 54 ++++----- yt/frontends/enzo_p/fields.py | 9 +- yt/frontends/enzo_p/io.py | 9 +- yt/frontends/enzo_p/misc.py | 4 +- yt/frontends/enzo_p/tests/test_misc.py | 14 ++- yt/frontends/enzo_p/tests/test_outputs.py | 22 ++-- yt/frontends/exodus_ii/__init__.py | 1 - yt/frontends/exodus_ii/api.py | 22 ++-- yt/frontends/exodus_ii/data_structures.py | 25 ++-- yt/frontends/exodus_ii/fields.py | 3 +- yt/frontends/exodus_ii/io.py | 7 +- yt/frontends/exodus_ii/simulation_handling.py | 19 +-- yt/frontends/exodus_ii/tests/test_outputs.py | 15 +-- yt/frontends/exodus_ii/util.py | 9 +- yt/frontends/fits/api.py | 30 ++--- yt/frontends/fits/data_structures.py | 48 +++----- yt/frontends/fits/fields.py | 3 +- yt/frontends/fits/io.py | 4 +- yt/frontends/fits/misc.py | 12 +- yt/frontends/fits/tests/test_outputs.py | 26 ++--- yt/frontends/flash/__init__.py | 1 - yt/frontends/flash/api.py | 21 ++-- yt/frontends/flash/data_structures.py | 26 ++--- yt/frontends/flash/fields.py | 3 +- yt/frontends/flash/io.py | 10 +- yt/frontends/flash/tests/test_outputs.py | 29 ++--- yt/frontends/gadget/api.py | 15 +-- yt/frontends/gadget/data_structures.py | 33 +++--- yt/frontends/gadget/fields.py | 5 +- yt/frontends/gadget/io.py | 10 +- yt/frontends/gadget/simulation_handling.py | 42 +++---- yt/frontends/gadget/testing.py | 11 +- yt/frontends/gadget/tests/test_outputs.py | 15 +-- yt/frontends/gadget_fof/__init__.py | 1 - yt/frontends/gadget_fof/api.py | 26 ++--- yt/frontends/gadget_fof/data_structures.py | 37 +++--- yt/frontends/gadget_fof/fields.py | 3 +- yt/frontends/gadget_fof/io.py | 13 +-- yt/frontends/gadget_fof/tests/test_outputs.py | 23 ++-- yt/frontends/gamer/__init__.py | 1 - yt/frontends/gamer/api.py | 13 +-- yt/frontends/gamer/data_structures.py | 23 ++-- yt/frontends/gamer/fields.py | 2 +- yt/frontends/gamer/io.py | 9 +- yt/frontends/gamer/tests/test_outputs.py | 16 +-- yt/frontends/gdf/api.py | 15 +-- yt/frontends/gdf/data_structures.py | 39 +++---- yt/frontends/gdf/definitions.py | 1 - yt/frontends/gdf/fields.py | 3 +- yt/frontends/gdf/io.py | 9 +- yt/frontends/gdf/tests/test_outputs.py | 14 +-- yt/frontends/gizmo/api.py | 7 +- yt/frontends/gizmo/data_structures.py | 7 +- yt/frontends/gizmo/fields.py | 16 +-- yt/frontends/gizmo/tests/test_outputs.py | 8 +- yt/frontends/halo_catalog/__init__.py | 1 - yt/frontends/halo_catalog/api.py | 11 +- yt/frontends/halo_catalog/data_structures.py | 23 ++-- yt/frontends/halo_catalog/fields.py | 3 +- yt/frontends/halo_catalog/io.py | 12 +- .../halo_catalog/tests/test_outputs.py | 19 +-- yt/frontends/http_stream/api.py | 7 +- yt/frontends/http_stream/data_structures.py | 17 ++- yt/frontends/http_stream/io.py | 11 +- yt/frontends/moab/__init__.py | 1 - yt/frontends/moab/api.py | 21 ++-- yt/frontends/moab/data_structures.py | 20 ++-- yt/frontends/moab/definitions.py | 1 - yt/frontends/moab/fields.py | 4 +- yt/frontends/moab/io.py | 1 + yt/frontends/moab/tests/test_c5.py | 20 ++-- yt/frontends/open_pmd/__init__.py | 1 - yt/frontends/open_pmd/api.py | 17 +-- yt/frontends/open_pmd/data_structures.py | 13 +-- yt/frontends/open_pmd/fields.py | 8 +- yt/frontends/open_pmd/io.py | 4 +- yt/frontends/open_pmd/tests/test_outputs.py | 21 ++-- yt/frontends/owls/api.py | 16 +-- yt/frontends/owls/data_structures.py | 11 +- yt/frontends/owls/fields.py | 17 +-- yt/frontends/owls/io.py | 4 +- yt/frontends/owls/owls_ion_tables.py | 3 +- yt/frontends/owls/simulation_handling.py | 4 +- yt/frontends/owls/tests/test_outputs.py | 12 +- yt/frontends/owls_subfind/__init__.py | 1 - yt/frontends/owls_subfind/api.py | 12 +- yt/frontends/owls_subfind/data_structures.py | 33 +++--- yt/frontends/owls_subfind/fields.py | 3 +- yt/frontends/owls_subfind/io.py | 10 +- .../owls_subfind/tests/test_outputs.py | 14 ++- yt/frontends/ramses/__init__.py | 1 - yt/frontends/ramses/api.py | 16 +-- yt/frontends/ramses/data_structures.py | 43 +++---- yt/frontends/ramses/definitions.py | 4 +- yt/frontends/ramses/field_handlers.py | 7 +- yt/frontends/ramses/fields.py | 31 +++-- yt/frontends/ramses/hilbert.py | 1 + yt/frontends/ramses/io.py | 17 ++- yt/frontends/ramses/particle_handlers.py | 5 +- yt/frontends/ramses/tests/test_hilbert.py | 8 +- yt/frontends/ramses/tests/test_outputs.py | 36 +++--- yt/frontends/rockstar/__init__.py | 1 - yt/frontends/rockstar/api.py | 12 +- yt/frontends/rockstar/data_structures.py | 25 ++-- yt/frontends/rockstar/fields.py | 3 +- yt/frontends/rockstar/io.py | 14 +-- yt/frontends/rockstar/tests/test_outputs.py | 15 ++- yt/frontends/sdf/__init__.py | 1 - yt/frontends/sdf/api.py | 11 +- yt/frontends/sdf/data_structures.py | 26 ++--- yt/frontends/sdf/fields.py | 5 +- yt/frontends/sdf/io.py | 5 +- yt/frontends/sdf/tests/test_outputs.py | 8 +- yt/frontends/sph/__init__.py | 1 - yt/frontends/sph/api.py | 1 - yt/frontends/sph/data_structures.py | 13 +-- yt/frontends/sph/fields.py | 7 +- yt/frontends/sph/io.py | 4 +- yt/frontends/stream/api.py | 40 +++---- yt/frontends/stream/data_structures.py | 101 ++++++---------- yt/frontends/stream/fields.py | 3 +- yt/frontends/stream/io.py | 7 +- yt/frontends/stream/tests/test_outputs.py | 22 ++-- .../stream/tests/test_stream_amrgrids.py | 8 +- .../stream/tests/test_stream_hexahedral.py | 12 +- .../stream/tests/test_stream_octree.py | 3 +- .../stream/tests/test_stream_particles.py | 17 ++- .../stream/tests/test_stream_unstructured.py | 3 +- yt/frontends/stream/tests/test_update_data.py | 6 +- yt/frontends/swift/api.py | 11 +- yt/frontends/swift/data_structures.py | 15 ++- yt/frontends/swift/io.py | 6 +- yt/frontends/swift/tests/test_outputs.py | 6 +- yt/frontends/tipsy/api.py | 12 +- yt/frontends/tipsy/data_structures.py | 28 ++--- yt/frontends/tipsy/fields.py | 1 + yt/frontends/tipsy/io.py | 20 ++-- yt/frontends/tipsy/tests/test_outputs.py | 15 ++- yt/frontends/ytdata/__init__.py | 1 - yt/frontends/ytdata/api.py | 47 ++++---- yt/frontends/ytdata/data_structures.py | 76 +++++------- yt/frontends/ytdata/fields.py | 3 +- yt/frontends/ytdata/io.py | 23 ++-- yt/frontends/ytdata/tests/test_old_outputs.py | 57 +++++---- yt/frontends/ytdata/tests/test_outputs.py | 64 +++++----- yt/frontends/ytdata/utilities.py | 10 +- yt/funcs.py | 42 +++---- yt/geometry/api.py | 7 +- yt/geometry/coordinates/api.py | 27 ++--- .../coordinates/cartesian_coordinates.py | 40 ++++--- yt/geometry/coordinates/coordinate_handler.py | 16 +-- .../coordinates/cylindrical_coordinates.py | 19 +-- .../coordinates/geographic_coordinates.py | 12 +- .../coordinates/spec_cube_coordinates.py | 8 +- .../coordinates/spherical_coordinates.py | 12 +- .../tests/test_axial_pixelization.py | 7 +- .../tests/test_cartesian_coordinates.py | 4 +- .../tests/test_cylindrical_coordinates.py | 9 +- .../tests/test_geographic_coordinates.py | 5 +- .../tests/test_polar_coordinates.py | 5 +- .../tests/test_spherical_coordinates.py | 5 +- yt/geometry/geometry_handler.py | 17 +-- yt/geometry/grid_geometry_handler.py | 16 ++- yt/geometry/object_finding_mixin.py | 15 +-- yt/geometry/oct_geometry_handler.py | 6 +- yt/geometry/particle_geometry_handler.py | 17 ++- yt/geometry/tests/fake_octree.py | 5 +- yt/geometry/tests/test_grid_container.py | 9 +- yt/geometry/tests/test_neighbor_search.py | 8 +- yt/geometry/tests/test_particle_deposit.py | 15 +-- yt/geometry/tests/test_particle_octree.py | 25 ++-- yt/geometry/unstructured_mesh_handler.py | 6 +- yt/mods.py | 7 +- yt/pmods.py | 5 +- yt/startup_tasks.py | 15 +-- yt/testing.py | 25 ++-- yt/tests/test_load_from_path.py | 4 +- yt/tests/test_testing.py | 2 +- yt/units/__init__.py | 16 +-- yt/units/physical_constants.py | 3 +- yt/units/tests/test_magnetic_code_units.py | 2 + yt/units/unit_registry.py | 2 +- yt/units/unit_symbols.py | 4 +- yt/units/unit_systems.py | 1 + yt/units/yt_array.py | 4 +- yt/utilities/amr_kdtree/__init__.py | 1 - yt/utilities/amr_kdtree/amr_kdtools.py | 1 + yt/utilities/amr_kdtree/amr_kdtree.py | 23 ++-- yt/utilities/answer_testing/__init__.py | 1 - yt/utilities/answer_testing/answer_tests.py | 5 +- yt/utilities/answer_testing/api.py | 1 - yt/utilities/answer_testing/framework.py | 56 ++++----- .../answer_testing/level_sets_tests.py | 7 +- yt/utilities/answer_testing/utils.py | 13 +-- yt/utilities/api.py | 1 - yt/utilities/chemical_formulas.py | 1 + yt/utilities/command_line.py | 54 +++++---- yt/utilities/configure.py | 7 +- yt/utilities/cosmology.py | 23 ++-- yt/utilities/definitions.py | 18 ++- yt/utilities/exceptions.py | 1 + yt/utilities/file_handler.py | 4 +- yt/utilities/fits_image.py | 11 +- yt/utilities/flagging_methods.py | 3 +- yt/utilities/fortran_utils.py | 3 +- .../grid_data_format/conversion/__init__.py | 2 +- .../conversion/conversion_athena.py | 5 +- .../scripts/convert_distributed_athena.py | 5 +- .../scripts/convert_single_athena.py | 6 +- .../grid_data_format/tests/test_writer.py | 19 ++- yt/utilities/grid_data_format/writer.py | 14 ++- yt/utilities/initial_conditions.py | 1 + yt/utilities/io_handler.py | 8 +- yt/utilities/lib/api.py | 16 +-- yt/utilities/lib/cykdtree/__init__.py | 3 +- yt/utilities/lib/cykdtree/plot.py | 1 + yt/utilities/lib/cykdtree/tests/__init__.py | 11 +- yt/utilities/lib/cykdtree/tests/scaling.py | 8 +- .../lib/cykdtree/tests/test_kdtree.py | 8 +- yt/utilities/lib/cykdtree/tests/test_plot.py | 3 +- yt/utilities/lib/cykdtree/tests/test_utils.py | 4 +- .../lib/tests/test_allocation_container.py | 7 +- .../lib/tests/test_alt_ray_tracers.py | 9 +- yt/utilities/lib/tests/test_bitarray.py | 3 +- .../tests/test_bounding_volume_hierarchy.py | 8 +- .../lib/tests/test_element_mappings.py | 24 ++-- yt/utilities/lib/tests/test_fill_region.py | 1 - yt/utilities/lib/tests/test_geometry_utils.py | 20 ++-- yt/utilities/lib/tests/test_nn.py | 11 +- yt/utilities/lib/tests/test_ragged_arrays.py | 5 +- yt/utilities/lib/tests/test_sample.py | 4 +- yt/utilities/linear_interpolators.py | 3 +- yt/utilities/load_sample.py | 4 +- yt/utilities/lodgeit.py | 1 + yt/utilities/logger.py | 1 + yt/utilities/lru_cache.py | 1 - yt/utilities/math_utils.py | 7 +- yt/utilities/mesh_code_generation.py | 8 +- yt/utilities/minimal_representation.py | 22 ++-- yt/utilities/nodal_data_utils.py | 2 +- yt/utilities/on_demand_imports.py | 4 +- yt/utilities/operator_registry.py | 1 + yt/utilities/orientation.py | 1 + yt/utilities/parallel_tools/__init__.py | 1 - .../parallel_tools/controller_system.py | 5 +- yt/utilities/parallel_tools/io_runner.py | 14 +-- .../parallel_analysis_interface.py | 16 ++- yt/utilities/parallel_tools/task_queue.py | 12 +- yt/utilities/parameter_file_storage.py | 8 +- yt/utilities/particle_generator.py | 6 +- yt/utilities/performance_counters.py | 2 +- yt/utilities/periodic_table.py | 3 +- yt/utilities/physical_constants.py | 50 ++++---- yt/utilities/physical_ratios.py | 1 + yt/utilities/png_writer.py | 3 +- yt/utilities/poster/__init__.py | 3 +- yt/utilities/poster/encode.py | 5 +- yt/utilities/poster/streaminghttp.py | 3 +- yt/utilities/rpdb.py | 8 +- yt/utilities/sample_data.py | 4 +- yt/utilities/sdf.py | 4 +- yt/utilities/tests/test_amr_kdtree.py | 12 +- yt/utilities/tests/test_chemical_formulas.py | 2 +- yt/utilities/tests/test_config.py | 17 +-- .../tests/test_coordinate_conversions.py | 24 ++-- yt/utilities/tests/test_cosmology.py | 30 +++-- yt/utilities/tests/test_decompose.py | 3 +- .../tests/test_hierarchy_inspection.py | 3 +- yt/utilities/tests/test_interpolators.py | 10 +- yt/utilities/tests/test_load_sample.py | 1 - .../tests/test_minimal_representation.py | 4 +- yt/utilities/tests/test_particle_generator.py | 20 ++-- yt/utilities/tests/test_periodic_table.py | 1 + yt/utilities/tests/test_periodicity.py | 5 +- yt/utilities/tests/test_selectors.py | 4 +- yt/visualization/__init__.py | 1 - yt/visualization/_colormap_data.py | 1 + yt/visualization/_mpl_imports.py | 17 +-- yt/visualization/api.py | 94 ++++++--------- yt/visualization/base_plot_types.py | 20 ++-- yt/visualization/color_maps.py | 4 +- yt/visualization/eps_writer.py | 16 +-- yt/visualization/fits_image.py | 31 +++-- yt/visualization/fixed_resolution.py | 34 +++--- yt/visualization/fixed_resolution_filters.py | 3 +- yt/visualization/image_writer.py | 19 ++- yt/visualization/line_plot.py | 30 +++-- yt/visualization/mapserver/pannable_map.py | 11 +- yt/visualization/particle_plots.py | 19 +-- yt/visualization/plot_container.py | 44 +++---- yt/visualization/plot_modifications.py | 53 ++++----- yt/visualization/plot_window.py | 87 +++++++------- yt/visualization/profile_plotter.py | 41 +++---- yt/visualization/streamlines.py | 8 +- yt/visualization/tests/test_callbacks.py | 37 +++--- yt/visualization/tests/test_color_maps.py | 4 +- yt/visualization/tests/test_export_frb.py | 6 +- yt/visualization/tests/test_fits_image.py | 26 +++-- .../tests/test_geo_projections.py | 12 +- yt/visualization/tests/test_image_writer.py | 11 +- yt/visualization/tests/test_line_plots.py | 3 +- yt/visualization/tests/test_mesh_slices.py | 9 +- .../tests/test_offaxisprojection.py | 17 +-- yt/visualization/tests/test_particle_plot.py | 37 +++--- yt/visualization/tests/test_plotwindow.py | 47 +++++--- yt/visualization/tests/test_profile_plots.py | 29 ++--- .../tests/test_raw_field_slices.py | 10 +- yt/visualization/tests/test_splat.py | 7 +- yt/visualization/volume_rendering/__init__.py | 1 - yt/visualization/volume_rendering/api.py | 34 +++--- yt/visualization/volume_rendering/blenders.py | 2 +- yt/visualization/volume_rendering/camera.py | 22 ++-- .../volume_rendering/camera_path.py | 4 +- .../volume_rendering/create_spline.py | 5 +- .../volume_rendering/glfw_inputhook.py | 3 +- .../volume_rendering/image_handling.py | 3 +- .../volume_rendering/input_events.py | 14 +-- .../volume_rendering/interactive_loop.py | 6 +- .../volume_rendering/interactive_vr.py | 28 ++--- .../interactive_vr_helpers.py | 4 +- yt/visualization/volume_rendering/lens.py | 16 +-- .../volume_rendering/off_axis_projection.py | 22 ++-- .../volume_rendering/old_camera.py | 54 ++++----- .../volume_rendering/render_source.py | 42 ++++--- yt/visualization/volume_rendering/scene.py | 46 ++++---- .../volume_rendering/shader_objects.py | 14 ++- .../tests/test_camera_attributes.py | 11 +- .../volume_rendering/tests/test_composite.py | 21 ++-- .../volume_rendering/tests/test_lenses.py | 9 +- .../tests/test_mesh_render.py | 29 ++--- .../tests/test_off_axis_SPH.py | 12 +- .../volume_rendering/tests/test_points.py | 13 +-- .../volume_rendering/tests/test_scene.py | 20 ++-- .../volume_rendering/tests/test_sigma_clip.py | 6 +- .../volume_rendering/tests/test_simple_vr.py | 5 +- .../volume_rendering/tests/test_varia.py | 9 +- .../volume_rendering/tests/test_vr_cameras.py | 26 +++-- .../tests/test_vr_orientation.py | 19 +-- .../volume_rendering/tests/test_zbuff.py | 20 ++-- .../transfer_function_helper.py | 11 +- .../volume_rendering/transfer_functions.py | 6 +- yt/visualization/volume_rendering/utils.py | 14 ++- .../volume_rendering/volume_rendering.py | 8 +- 541 files changed, 3431 insertions(+), 4225 deletions(-) diff --git a/conftest.py b/conftest.py index 4bf55b5f8e0..ba16c9be9db 100644 --- a/conftest.py +++ b/conftest.py @@ -18,7 +18,6 @@ from yt.config import ytcfg from yt.utilities.answer_testing import utils - # Global variables can be added to the pytest namespace answer_files = {} diff --git a/scripts/iyt b/scripts/iyt index 0c230574ca8..d00b60c7dd7 100755 --- a/scripts/iyt +++ b/scripts/iyt @@ -1,9 +1,14 @@ #!python from __future__ import print_function + import os import re -from yt.mods import * + +from IPython.terminal.interactiveshell import TerminalInteractiveShell + from yt.data_objects.data_containers import YTDataContainer +from yt.mods import * + namespace = locals().copy() namespace.pop("__builtins__", None) @@ -24,7 +29,6 @@ except ImportError: code.interact(doc, None, namespace) sys.exit() -from IPython.terminal.interactiveshell import TerminalInteractiveShell ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc, display_banner = True) if "DISPLAY" in os.environ: diff --git a/scripts/pr_backport.py b/scripts/pr_backport.py index b3f521f5b11..0203c5beb35 100644 --- a/scripts/pr_backport.py +++ b/scripts/pr_backport.py @@ -1,8 +1,9 @@ +import shutil +import tempfile + import dateutil.parser import git import requests -import shutil -import tempfile API_URL = 'https://api.github.com/graphql' diff --git a/setup.py b/setup.py index cedd01cddc9..c2deeb6457c 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,24 @@ +import glob import os import platform -from concurrent.futures import ThreadPoolExecutor as Pool -import glob import sys +from concurrent.futures import ThreadPoolExecutor as Pool +from distutils.ccompiler import CCompiler +from distutils.version import LooseVersion from sys import platform as _platform -from setuptools import setup, find_packages -from setuptools.extension import Extension + +import pkg_resources +from setuptools import find_packages, setup from setuptools.command.build_ext import build_ext as _build_ext from setuptools.command.sdist import sdist as _sdist -from setupext import \ - check_for_openmp, \ - check_for_pyembree, \ - read_embree_location, \ - in_conda_env -from distutils.version import LooseVersion -from distutils.ccompiler import CCompiler -import pkg_resources +from setuptools.extension import Extension + +from setupext import ( + check_for_openmp, + check_for_pyembree, + in_conda_env, + read_embree_location, +) def _get_cpu_count(): diff --git a/setupext.py b/setupext.py index 92c456babe0..0b66aaefa1c 100644 --- a/setupext.py +++ b/setupext.py @@ -5,14 +5,13 @@ import subprocess import sys import tempfile - from distutils import log from distutils.ccompiler import new_compiler -from distutils.sysconfig import customize_compiler from distutils.errors import CompileError, LinkError -from pkg_resources import resource_filename -from subprocess import Popen, PIPE +from distutils.sysconfig import customize_compiler +from subprocess import PIPE, Popen +from pkg_resources import resource_filename CCODE = """ #include diff --git a/tests/nose_runner.py b/tests/nose_runner.py index 0ec1e0d52f2..681e170a465 100644 --- a/tests/nose_runner.py +++ b/tests/nose_runner.py @@ -1,18 +1,20 @@ -import sys -import os -import yaml import multiprocessing -import nose +import os +import sys +from io import StringIO +import nose +import numpy +import yaml from coverage import Coverage + +from yt.config import ytcfg +from yt.utilities.answer_testing.framework import AnswerTesting + cov = Coverage(config_file=".coveragerc", branch=True, auto_data=True, concurrency="multiprocessing") cov.start() -from io import StringIO -from yt.config import ytcfg -from yt.utilities.answer_testing.framework import AnswerTesting -import numpy numpy.set_printoptions(threshold=5, edgeitems=1, precision=4) class NoseWorker(multiprocessing.Process): diff --git a/tests/report_failed_answers.py b/tests/report_failed_answers.py index 59ceab60bb3..5a3f9f45c1a 100644 --- a/tests/report_failed_answers.py +++ b/tests/report_failed_answers.py @@ -21,6 +21,7 @@ import nose import numpy import requests + from yt.config import ytcfg from yt.utilities.answer_testing.framework import AnswerTesting from yt.utilities.command_line import FileStreamer diff --git a/yt/analysis_modules/absorption_spectrum/api.py b/yt/analysis_modules/absorption_spectrum/api.py index bb66b6f4b45..fef030c4a9d 100644 --- a/yt/analysis_modules/absorption_spectrum/api.py +++ b/yt/analysis_modules/absorption_spectrum/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "AbsorptionSpectrum", diff --git a/yt/analysis_modules/cosmological_observation/api.py b/yt/analysis_modules/cosmological_observation/api.py index da1df1ec4b7..6aef8c09554 100644 --- a/yt/analysis_modules/cosmological_observation/api.py +++ b/yt/analysis_modules/cosmological_observation/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "CosmologySplice and LightCone", diff --git a/yt/analysis_modules/halo_analysis/api.py b/yt/analysis_modules/halo_analysis/api.py index e9eb1f054ad..d9bda9bf991 100644 --- a/yt/analysis_modules/halo_analysis/api.py +++ b/yt/analysis_modules/halo_analysis/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "halo_analysis", diff --git a/yt/analysis_modules/halo_finding/api.py b/yt/analysis_modules/halo_finding/api.py index c0db4ee5e0c..04ea8fe0f8a 100644 --- a/yt/analysis_modules/halo_finding/api.py +++ b/yt/analysis_modules/halo_finding/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "halo_finding", diff --git a/yt/analysis_modules/halo_mass_function/api.py b/yt/analysis_modules/halo_mass_function/api.py index b978be38cc8..7b885c34a6e 100644 --- a/yt/analysis_modules/halo_mass_function/api.py +++ b/yt/analysis_modules/halo_mass_function/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "halo_mass_function", diff --git a/yt/analysis_modules/photon_simulator/api.py b/yt/analysis_modules/photon_simulator/api.py index ed738750d0e..b5be89bdd4a 100644 --- a/yt/analysis_modules/photon_simulator/api.py +++ b/yt/analysis_modules/photon_simulator/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "photon_simulator", diff --git a/yt/analysis_modules/ppv_cube/api.py b/yt/analysis_modules/ppv_cube/api.py index 26012b96fcb..3c5510cd900 100644 --- a/yt/analysis_modules/ppv_cube/api.py +++ b/yt/analysis_modules/ppv_cube/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "PPVCube", diff --git a/yt/analysis_modules/radmc3d_export/api.py b/yt/analysis_modules/radmc3d_export/api.py index e1d0478f3ea..a0841e1cf5c 100644 --- a/yt/analysis_modules/radmc3d_export/api.py +++ b/yt/analysis_modules/radmc3d_export/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "radmc3d_export", diff --git a/yt/analysis_modules/star_analysis/api.py b/yt/analysis_modules/star_analysis/api.py index bc4d7cf5dff..c9a6f8fa523 100644 --- a/yt/analysis_modules/star_analysis/api.py +++ b/yt/analysis_modules/star_analysis/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "star_analysis", diff --git a/yt/analysis_modules/sunrise_export/api.py b/yt/analysis_modules/sunrise_export/api.py index 2e69ffab1c3..bdac8165aad 100644 --- a/yt/analysis_modules/sunrise_export/api.py +++ b/yt/analysis_modules/sunrise_export/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "sunrise_export", diff --git a/yt/analysis_modules/sunyaev_zeldovich/api.py b/yt/analysis_modules/sunyaev_zeldovich/api.py index e32ec19a91b..eef2607fa49 100644 --- a/yt/analysis_modules/sunyaev_zeldovich/api.py +++ b/yt/analysis_modules/sunyaev_zeldovich/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "sunyaev_zeldovich", diff --git a/yt/analysis_modules/two_point_functions/api.py b/yt/analysis_modules/two_point_functions/api.py index 6346eb057a6..8d8ee99a90d 100644 --- a/yt/analysis_modules/two_point_functions/api.py +++ b/yt/analysis_modules/two_point_functions/api.py @@ -1,5 +1,4 @@ -from yt.utilities.exceptions import \ - YTModuleRemoved +from yt.utilities.exceptions import YTModuleRemoved raise YTModuleRemoved( "two_point_functions", diff --git a/yt/api.py b/yt/api.py index d9ec8215162..5ac3ae5ca86 100644 --- a/yt/api.py +++ b/yt/api.py @@ -4,4 +4,3 @@ """ - diff --git a/yt/config.py b/yt/config.py index 4657478749f..52a7a727caf 100644 --- a/yt/config.py +++ b/yt/config.py @@ -1,6 +1,6 @@ +import configparser import os import warnings -import configparser ytcfg_defaults = dict( serialize = 'False', diff --git a/yt/convenience.py b/yt/convenience.py index 2b5423905ed..c1f6038b32e 100644 --- a/yt/convenience.py +++ b/yt/convenience.py @@ -3,14 +3,14 @@ # Named imports from yt.config import ytcfg from yt.funcs import mylog -from yt.utilities.parameter_file_storage import \ - output_type_registry, \ - simulation_time_series_registry, \ - EnzoRunDatabase -from yt.utilities.exceptions import \ - YTOutputNotIdentified, \ - YTSimulationNotIdentified +from yt.utilities.exceptions import YTOutputNotIdentified, YTSimulationNotIdentified from yt.utilities.hierarchy_inspection import find_lowest_subclasses +from yt.utilities.parameter_file_storage import ( + EnzoRunDatabase, + output_type_registry, + simulation_time_series_registry, +) + def _sanitize_load_args(*args): """Filter out non-pathlike arguments, ensure list form, and expand '~' tokens""" diff --git a/yt/data_objects/api.py b/yt/data_objects/api.py index 003137181b6..4dca4a02880 100644 --- a/yt/data_objects/api.py +++ b/yt/data_objects/api.py @@ -1,35 +1,10 @@ -from .grid_patch import \ - AMRGridPatch - -from .octree_subset import \ - OctreeSubset - -from .static_output import \ - Dataset - -from .profiles import \ - create_profile, \ - Profile1D, \ - Profile2D, \ - Profile3D, \ - ParticleProfile - -from .time_series import \ - DatasetSeries, \ - DatasetSeriesObject - -from .analyzer_objects import \ - AnalysisTask, analysis_task - -from .data_containers import \ - data_object_registry - -from . import construction_data_containers as __cdc -from . import selection_data_containers as __sdc - -from .image_array import \ - ImageArray - -from .particle_filters import \ - particle_filter, \ - add_particle_filter +from . import construction_data_containers as __cdc, selection_data_containers as __sdc +from .analyzer_objects import AnalysisTask, analysis_task +from .data_containers import data_object_registry +from .grid_patch import AMRGridPatch +from .image_array import ImageArray +from .octree_subset import OctreeSubset +from .particle_filters import add_particle_filter, particle_filter +from .profiles import ParticleProfile, Profile1D, Profile2D, Profile3D, create_profile +from .static_output import Dataset +from .time_series import DatasetSeries, DatasetSeriesObject diff --git a/yt/data_objects/construction_data_containers.py b/yt/data_objects/construction_data_containers.py index a4eeec752cb..7073b22395b 100644 --- a/yt/data_objects/construction_data_containers.py +++ b/yt/data_objects/construction_data_containers.py @@ -1,62 +1,55 @@ -import numpy as np -from functools import wraps import fileinput import io -from re import finditer -from tempfile import NamedTemporaryFile, TemporaryFile import os import sys import zipfile +from functools import wraps +from re import finditer +from tempfile import NamedTemporaryFile, TemporaryFile + +import numpy as np -from yt.config import ytcfg -from yt.data_objects.data_containers import \ - YTSelectionContainer1D, \ - YTSelectionContainer2D, \ - YTSelectionContainer3D -from yt.data_objects.field_data import \ - YTFieldData -from yt.funcs import \ - ensure_list, \ - mylog, \ - get_memory_usage, \ - iterable, \ - only_on_root -from yt.utilities.exceptions import \ - YTParticleDepositionNotImplemented, \ - YTNoAPIKey, \ - YTTooManyVertices -from yt.fields.field_exceptions import \ - NeedsGridType -from yt.utilities.lib.quad_tree import \ - QuadTree -from yt.utilities.lib.interpolators import \ - ghost_zone_interpolate -from yt.utilities.lib.misc_utilities import \ - fill_region, fill_region_float -from yt.utilities.lib.marching_cubes import \ - march_cubes_grid, march_cubes_grid_flux -from yt.utilities.minimal_representation import \ - MinimalProjectionData -from yt.utilities.parallel_tools.parallel_analysis_interface import \ - parallel_objects, parallel_root_only, communication_system -from yt.units.unit_object import Unit -from yt.units.yt_array import uconcatenate import yt.geometry.particle_deposit as particle_deposit +from yt.config import ytcfg +from yt.data_objects.data_containers import ( + YTSelectionContainer1D, + YTSelectionContainer2D, + YTSelectionContainer3D, +) +from yt.data_objects.field_data import YTFieldData +from yt.extern.tqdm import tqdm +from yt.fields.field_exceptions import NeedsGridType, NeedsOriginalGrid +from yt.frontends.sph.data_structures import ParticleDataset +from yt.frontends.stream.api import load_uniform_grid +from yt.funcs import ensure_list, get_memory_usage, iterable, mylog, only_on_root from yt.geometry.coordinates.cartesian_coordinates import all_data +from yt.units.unit_object import Unit +from yt.units.yt_array import YTArray, uconcatenate +from yt.utilities.exceptions import ( + YTNoAPIKey, + YTParticleDepositionNotImplemented, + YTTooManyVertices, +) from yt.utilities.grid_data_format.writer import write_to_gdf -from yt.fields.field_exceptions import \ - NeedsOriginalGrid -from yt.frontends.stream.api import load_uniform_grid -from yt.frontends.sph.data_structures import ParticleDataset -from yt.units.yt_array import YTArray -from yt.utilities.lib.pixelization_routines import \ - pixelize_sph_kernel_arbitrary_grid, \ - interpolate_sph_grid_gather, \ - interpolate_sph_positions_gather, \ - normalization_3d_utility, \ - normalization_1d_utility -from yt.extern.tqdm import tqdm from yt.utilities.lib.cyoctree import CyOctree +from yt.utilities.lib.interpolators import ghost_zone_interpolate +from yt.utilities.lib.marching_cubes import march_cubes_grid, march_cubes_grid_flux +from yt.utilities.lib.misc_utilities import fill_region, fill_region_float +from yt.utilities.lib.pixelization_routines import ( + interpolate_sph_grid_gather, + interpolate_sph_positions_gather, + normalization_1d_utility, + normalization_3d_utility, + pixelize_sph_kernel_arbitrary_grid, +) +from yt.utilities.lib.quad_tree import QuadTree +from yt.utilities.minimal_representation import MinimalProjectionData +from yt.utilities.parallel_tools.parallel_analysis_interface import ( + communication_system, + parallel_objects, + parallel_root_only, +) + class YTStreamline(YTSelectionContainer1D): """ diff --git a/yt/data_objects/data_containers.py b/yt/data_objects/data_containers.py index ecf2f78934e..0baffffef05 100644 --- a/yt/data_objects/data_containers.py +++ b/yt/data_objects/data_containers.py @@ -1,62 +1,54 @@ import itertools -import uuid - import os -import numpy as np -import weakref import shelve - +import uuid +import weakref from collections import defaultdict from contextlib import contextmanager -from yt.fields.derived_field import \ - DerivedField -from yt.frontends.ytdata.utilities import \ - save_as_dataset -from yt.funcs import \ - get_output_filename, \ - mylog, \ - ensure_list, \ - fix_axis, \ - iterable, \ - validate_width_tuple -from yt.units.yt_array import \ - YTArray, \ - YTQuantity -import yt.units.dimensions as ytdims -from unyt.exceptions import \ - UnitConversionError, \ - UnitParseError -from yt.utilities.exceptions import \ - YTFieldUnitError, \ - YTFieldUnitParseError, \ - YTSpatialFieldUnitError, \ - YTCouldNotGenerateField, \ - YTFieldNotParseable, \ - YTFieldNotFound, \ - YTFieldTypeNotFound, \ - YTDataSelectorNotImplemented, \ - YTDimensionalityError, \ - YTNonIndexedDataContainer, \ - YTBooleanObjectError, \ - YTBooleanObjectsWrongDataset, YTException -from yt.utilities.lib.marching_cubes import \ - march_cubes_grid, march_cubes_grid_flux -from yt.utilities.parallel_tools.parallel_analysis_interface import \ - ParallelAnalysisInterface -from yt.utilities.parameter_file_storage import \ - ParameterFileStore -from yt.utilities.amr_kdtree.api import \ - AMRKDTree -from .derived_quantities import DerivedQuantityCollection -from yt.fields.field_exceptions import \ - NeedsGridType +import numpy as np +from unyt.exceptions import UnitConversionError, UnitParseError + import yt.geometry.selection_routines -from yt.geometry.selection_routines import \ - compose_selector -from yt.units.yt_array import uconcatenate +import yt.units.dimensions as ytdims from yt.data_objects.field_data import YTFieldData from yt.data_objects.profiles import create_profile +from yt.fields.derived_field import DerivedField +from yt.fields.field_exceptions import NeedsGridType +from yt.frontends.ytdata.utilities import save_as_dataset +from yt.funcs import ( + ensure_list, + fix_axis, + get_output_filename, + iterable, + mylog, + validate_width_tuple, +) +from yt.geometry.selection_routines import compose_selector +from yt.units.yt_array import YTArray, YTQuantity, uconcatenate +from yt.utilities.amr_kdtree.api import AMRKDTree +from yt.utilities.exceptions import ( + YTBooleanObjectError, + YTBooleanObjectsWrongDataset, + YTCouldNotGenerateField, + YTDataSelectorNotImplemented, + YTDimensionalityError, + YTException, + YTFieldNotFound, + YTFieldNotParseable, + YTFieldTypeNotFound, + YTFieldUnitError, + YTFieldUnitParseError, + YTNonIndexedDataContainer, + YTSpatialFieldUnitError, +) +from yt.utilities.lib.marching_cubes import march_cubes_grid, march_cubes_grid_flux +from yt.utilities.parallel_tools.parallel_analysis_interface import ( + ParallelAnalysisInterface, +) +from yt.utilities.parameter_file_storage import ParameterFileStore + +from .derived_quantities import DerivedQuantityCollection data_object_registry = {} diff --git a/yt/data_objects/derived_quantities.py b/yt/data_objects/derived_quantities.py index 5b90ecbbe50..b88814559c7 100644 --- a/yt/data_objects/derived_quantities.py +++ b/yt/data_objects/derived_quantities.py @@ -1,16 +1,14 @@ import numpy as np -from yt.funcs import \ - camelcase_to_underscore, \ - ensure_list +from yt.funcs import camelcase_to_underscore, ensure_list from yt.units.yt_array import array_like_field -from yt.utilities.parallel_tools.parallel_analysis_interface import \ - ParallelAnalysisInterface, parallel_objects -from yt.utilities.physical_constants import \ - gravitational_constant_cgs +from yt.utilities.exceptions import YTParticleTypeNotFound +from yt.utilities.parallel_tools.parallel_analysis_interface import ( + ParallelAnalysisInterface, + parallel_objects, +) +from yt.utilities.physical_constants import gravitational_constant_cgs from yt.utilities.physical_ratios import HUGE -from yt.utilities.exceptions import \ - YTParticleTypeNotFound derived_quantity_registry = {} diff --git a/yt/data_objects/grid_patch.py b/yt/data_objects/grid_patch.py index 7dd1e7d6719..55de59a3139 100644 --- a/yt/data_objects/grid_patch.py +++ b/yt/data_objects/grid_patch.py @@ -1,23 +1,21 @@ import warnings import weakref + import numpy as np +import yt.geometry.particle_deposit as particle_deposit from yt.config import ytcfg -from yt.data_objects.data_containers import \ - YTSelectionContainer +from yt.data_objects.data_containers import YTSelectionContainer from yt.funcs import iterable from yt.geometry.selection_routines import convert_mask_to_indices -import yt.geometry.particle_deposit as particle_deposit from yt.units.yt_array import YTArray -from yt.utilities.exceptions import \ - YTFieldTypeNotFound, \ - YTParticleDepositionNotImplemented -from yt.utilities.lib.interpolators import \ - ghost_zone_interpolate -from yt.utilities.lib.mesh_utilities import \ - clamp_edges -from yt.utilities.nodal_data_utils import \ - get_nodal_slices +from yt.utilities.exceptions import ( + YTFieldTypeNotFound, + YTParticleDepositionNotImplemented, +) +from yt.utilities.lib.interpolators import ghost_zone_interpolate +from yt.utilities.lib.mesh_utilities import clamp_edges +from yt.utilities.nodal_data_utils import get_nodal_slices RECONSTRUCT_INDEX = bool(ytcfg.get('yt', 'reconstruct_index')) diff --git a/yt/data_objects/image_array.py b/yt/data_objects/image_array.py index 02c33ecbf3f..5fdaa88149f 100644 --- a/yt/data_objects/image_array.py +++ b/yt/data_objects/image_array.py @@ -1,9 +1,10 @@ import warnings + import numpy as np -from yt.config import \ - ytcfg -from yt.visualization.image_writer import write_bitmap, write_image + +from yt.config import ytcfg from yt.units.yt_array import YTArray +from yt.visualization.image_writer import write_bitmap, write_image class ImageArray(YTArray): diff --git a/yt/data_objects/level_sets/api.py b/yt/data_objects/level_sets/api.py index c14ab973caf..609885e52cb 100644 --- a/yt/data_objects/level_sets/api.py +++ b/yt/data_objects/level_sets/api.py @@ -1,20 +1,11 @@ -from .contour_finder import \ - identify_contours - -from .clump_handling import \ - Clump, \ - find_clumps, \ - get_lowest_clumps - -from .clump_info_items import \ - add_clump_info - -from .clump_validators import \ - add_validator - -from .clump_tools import \ - recursive_all_clumps, \ - return_all_clumps, \ - return_bottom_clumps, \ - recursive_bottom_clumps, \ - clump_list_sort +from .clump_handling import Clump, find_clumps, get_lowest_clumps +from .clump_info_items import add_clump_info +from .clump_tools import ( + clump_list_sort, + recursive_all_clumps, + recursive_bottom_clumps, + return_all_clumps, + return_bottom_clumps, +) +from .clump_validators import add_validator +from .contour_finder import identify_contours diff --git a/yt/data_objects/level_sets/clump_handling.py b/yt/data_objects/level_sets/clump_handling.py index 920ee1c5d62..b2c01ba3701 100644 --- a/yt/data_objects/level_sets/clump_handling.py +++ b/yt/data_objects/level_sets/clump_handling.py @@ -1,23 +1,16 @@ -import numpy as np import uuid -from yt.fields.derived_field import \ - ValidateSpatial -from yt.frontends.ytdata.utilities import \ - save_as_dataset -from yt.funcs import \ - issue_deprecation_warning, \ - get_output_filename, \ - mylog -from yt.utilities.tree_container import \ - TreeContainer - -from .clump_info_items import \ - clump_info_registry -from .clump_validators import \ - clump_validator_registry -from .contour_finder import \ - identify_contours +import numpy as np + +from yt.fields.derived_field import ValidateSpatial +from yt.frontends.ytdata.utilities import save_as_dataset +from yt.funcs import get_output_filename, issue_deprecation_warning, mylog +from yt.utilities.tree_container import TreeContainer + +from .clump_info_items import clump_info_registry +from .clump_validators import clump_validator_registry +from .contour_finder import identify_contours + def add_contour_field(ds, contour_key): def _contours(field, data): diff --git a/yt/data_objects/level_sets/clump_info_items.py b/yt/data_objects/level_sets/clump_info_items.py index f0636b96fd5..d5631c9c8e0 100644 --- a/yt/data_objects/level_sets/clump_info_items.py +++ b/yt/data_objects/level_sets/clump_info_items.py @@ -1,7 +1,6 @@ import numpy as np -from yt.utilities.operator_registry import \ - OperatorRegistry +from yt.utilities.operator_registry import OperatorRegistry clump_info_registry = OperatorRegistry() diff --git a/yt/data_objects/level_sets/clump_tools.py b/yt/data_objects/level_sets/clump_tools.py index e037d35f1c9..d1d4ec446d9 100644 --- a/yt/data_objects/level_sets/clump_tools.py +++ b/yt/data_objects/level_sets/clump_tools.py @@ -1,4 +1,5 @@ import numpy as np + nar = np.array counter = 0 diff --git a/yt/data_objects/level_sets/clump_validators.py b/yt/data_objects/level_sets/clump_validators.py index b57be4ef69c..3cb9a1d17d1 100644 --- a/yt/data_objects/level_sets/clump_validators.py +++ b/yt/data_objects/level_sets/clump_validators.py @@ -1,11 +1,8 @@ import numpy as np -from yt.utilities.lib.misc_utilities import \ - gravitational_binding_energy -from yt.utilities.operator_registry import \ - OperatorRegistry -from yt.utilities.physical_constants import \ - gravitational_constant_cgs as G +from yt.utilities.lib.misc_utilities import gravitational_binding_energy +from yt.utilities.operator_registry import OperatorRegistry +from yt.utilities.physical_constants import gravitational_constant_cgs as G clump_validator_registry = OperatorRegistry() diff --git a/yt/data_objects/level_sets/contour_finder.py b/yt/data_objects/level_sets/contour_finder.py index b05bc12f8a1..31ebd6d8ae5 100644 --- a/yt/data_objects/level_sets/contour_finder.py +++ b/yt/data_objects/level_sets/contour_finder.py @@ -1,13 +1,16 @@ +from collections import defaultdict + import numpy as np -from collections import defaultdict +from yt.funcs import get_pbar, mylog +from yt.utilities.lib.contour_finding import ( + ContourTree, + TileContourTree, + link_node_contours, + update_joins, +) +from yt.utilities.lib.partitioned_grid import PartitionedGrid -from yt.funcs import mylog, get_pbar -from yt.utilities.lib.contour_finding import \ - ContourTree, TileContourTree, link_node_contours, \ - update_joins -from yt.utilities.lib.partitioned_grid import \ - PartitionedGrid def identify_contours(data_source, field, min_val, max_val, cached_fields=None): diff --git a/yt/data_objects/level_sets/tests/test_clump_finding.py b/yt/data_objects/level_sets/tests/test_clump_finding.py index b0a77b2e0b1..f58c04f4e32 100644 --- a/yt/data_objects/level_sets/tests/test_clump_finding.py +++ b/yt/data_objects/level_sets/tests/test_clump_finding.py @@ -1,26 +1,17 @@ -import numpy as np import os import shutil import tempfile +import numpy as np -from yt.data_objects.level_sets.api import \ - add_clump_info, \ - Clump, \ - find_clumps +from yt.convenience import load +from yt.data_objects.level_sets.api import Clump, add_clump_info, find_clumps from yt.data_objects.level_sets.clump_info_items import clump_info_registry -from yt.convenience import \ - load -from yt.fields.derived_field import \ - ValidateParameter -from yt.frontends.stream.api import \ - load_uniform_grid -from yt.testing import \ - assert_array_equal, \ - assert_equal, \ - requires_file -from yt.utilities.answer_testing.framework import \ - data_dir_load +from yt.fields.derived_field import ValidateParameter +from yt.frontends.stream.api import load_uniform_grid +from yt.testing import assert_array_equal, assert_equal, requires_file +from yt.utilities.answer_testing.framework import data_dir_load + def test_clump_finding(): n_c = 8 diff --git a/yt/data_objects/octree_subset.py b/yt/data_objects/octree_subset.py index d1a119b13f5..159c1e27a15 100644 --- a/yt/data_objects/octree_subset.py +++ b/yt/data_objects/octree_subset.py @@ -1,21 +1,21 @@ from contextlib import contextmanager + import numpy as np -from yt.data_objects.data_containers import \ - YTSelectionContainer import yt.geometry.particle_deposit as particle_deposit import yt.geometry.particle_smooth as particle_smooth - +from yt.data_objects.data_containers import YTSelectionContainer from yt.funcs import mylog -from yt.utilities.lib.geometry_utils import compute_morton -from yt.geometry.particle_oct_container import \ - ParticleOctreeContainer -from yt.units.yt_array import YTArray +from yt.geometry.particle_oct_container import ParticleOctreeContainer from yt.units.dimensions import length -from yt.utilities.exceptions import \ - YTInvalidPositionArray, \ - YTFieldTypeNotFound, \ - YTParticleDepositionNotImplemented +from yt.units.yt_array import YTArray +from yt.utilities.exceptions import ( + YTFieldTypeNotFound, + YTInvalidPositionArray, + YTParticleDepositionNotImplemented, +) +from yt.utilities.lib.geometry_utils import compute_morton + def cell_count_cache(func): def cc_cache_func(self, dobj): diff --git a/yt/data_objects/particle_container.py b/yt/data_objects/particle_container.py index e4c06662ef2..0541b18c6d6 100644 --- a/yt/data_objects/particle_container.py +++ b/yt/data_objects/particle_container.py @@ -1,13 +1,12 @@ import contextlib -from yt.data_objects.data_containers import \ - YTFieldData, \ - YTSelectionContainer -from yt.funcs import \ - ensure_list -from yt.utilities.exceptions import \ - YTNonIndexedDataContainer, \ - YTDataSelectorNotImplemented +from yt.data_objects.data_containers import YTFieldData, YTSelectionContainer +from yt.funcs import ensure_list +from yt.utilities.exceptions import ( + YTDataSelectorNotImplemented, + YTNonIndexedDataContainer, +) + def _non_indexed(name): def _func_non_indexed(self, *args, **kwargs): diff --git a/yt/data_objects/particle_filters.py b/yt/data_objects/particle_filters.py index 9e2e8ba3016..ba70994f5a7 100644 --- a/yt/data_objects/particle_filters.py +++ b/yt/data_objects/particle_filters.py @@ -1,8 +1,7 @@ import copy from contextlib import contextmanager -from yt.fields.field_info_container import \ - NullFunc, TranslationFunc +from yt.fields.field_info_container import NullFunc, TranslationFunc from yt.funcs import mylog from yt.utilities.exceptions import YTIllDefinedFilter diff --git a/yt/data_objects/particle_trajectories.py b/yt/data_objects/particle_trajectories.py index 94e83b21c2a..6c7a1a21f28 100644 --- a/yt/data_objects/particle_trajectories.py +++ b/yt/data_objects/particle_trajectories.py @@ -1,15 +1,16 @@ -from yt.data_objects.field_data import YTFieldData -from yt.utilities.lib.particle_mesh_operations import CICSample_3 -from yt.utilities.parallel_tools.parallel_analysis_interface import \ - parallel_root_only -from yt.funcs import mylog, get_pbar -from yt.units.yt_array import array_like_field -from yt.config import ytcfg -from yt.utilities.exceptions import YTIllDefinedParticleData from collections import OrderedDict import numpy as np + +from yt.config import ytcfg +from yt.data_objects.field_data import YTFieldData +from yt.funcs import get_pbar, mylog +from yt.units.yt_array import array_like_field +from yt.utilities.exceptions import YTIllDefinedParticleData +from yt.utilities.lib.particle_mesh_operations import CICSample_3 from yt.utilities.on_demand_imports import _h5py as h5py +from yt.utilities.parallel_tools.parallel_analysis_interface import parallel_root_only + class ParticleTrajectories: r"""A collection of particle trajectories in time over a series of diff --git a/yt/data_objects/particle_unions.py b/yt/data_objects/particle_unions.py index 1d1e0ca9964..770f11a8e32 100644 --- a/yt/data_objects/particle_unions.py +++ b/yt/data_objects/particle_unions.py @@ -1,5 +1,6 @@ from .unions import Union + class ParticleUnion(Union): _union_type = "particle" def __init__(self, name, sub_types): diff --git a/yt/data_objects/profiles.py b/yt/data_objects/profiles.py index 063f6ef5c78..7a4fa7139ef 100644 --- a/yt/data_objects/profiles.py +++ b/yt/data_objects/profiles.py @@ -1,32 +1,32 @@ import numpy as np +from yt.data_objects.field_data import YTFieldData from yt.fields.derived_field import DerivedField -from yt.frontends.ytdata.utilities import \ - save_as_dataset -from yt.funcs import \ - get_output_filename, \ - ensure_list, \ - iterable, \ - issue_deprecation_warning, \ - mylog -from yt.units.yt_array import \ - array_like_field, \ - YTQuantity +from yt.frontends.ytdata.utilities import save_as_dataset +from yt.funcs import ( + ensure_list, + get_output_filename, + issue_deprecation_warning, + iterable, + mylog, +) from yt.units.unit_object import Unit -from yt.data_objects.field_data import YTFieldData -from yt.utilities.exceptions import \ - YTIllDefinedProfile, \ - YTIllDefinedBounds, \ - YTProfileDataShape -from yt.utilities.lib.misc_utilities import \ - new_bin_profile1d, \ - new_bin_profile2d, \ - new_bin_profile3d -from yt.utilities.parallel_tools.parallel_analysis_interface import \ - ParallelAnalysisInterface, parallel_objects -from yt.utilities.lib.particle_mesh_operations import \ - CICDeposit_2, \ - NGPDeposit_2 +from yt.units.yt_array import YTQuantity, array_like_field +from yt.utilities.exceptions import ( + YTIllDefinedBounds, + YTIllDefinedProfile, + YTProfileDataShape, +) +from yt.utilities.lib.misc_utilities import ( + new_bin_profile1d, + new_bin_profile2d, + new_bin_profile3d, +) +from yt.utilities.lib.particle_mesh_operations import CICDeposit_2, NGPDeposit_2 +from yt.utilities.parallel_tools.parallel_analysis_interface import ( + ParallelAnalysisInterface, + parallel_objects, +) def _sanitize_min_max_units(amin, amax, finfo, registry): diff --git a/yt/data_objects/region_expression.py b/yt/data_objects/region_expression.py index 8ea527c8025..67ba3987b15 100644 --- a/yt/data_objects/region_expression.py +++ b/yt/data_objects/region_expression.py @@ -4,8 +4,10 @@ from yt.units.yt_array import YTQuantity from yt.utilities.exceptions import YTDimensionalityError from yt.visualization.line_plot import LineBuffer + from .data_containers import _get_ipython_key_completion + class RegionExpression: _all_data = None def __init__(self, ds): diff --git a/yt/data_objects/selection_data_containers.py b/yt/data_objects/selection_data_containers.py index 8a5c743feed..44f6e6b64d2 100644 --- a/yt/data_objects/selection_data_containers.py +++ b/yt/data_objects/selection_data_containers.py @@ -1,42 +1,41 @@ import numpy as np -from yt.data_objects.data_containers import \ - YTSelectionContainer0D, YTSelectionContainer1D, \ - YTSelectionContainer2D, YTSelectionContainer3D, YTSelectionContainer +from yt.data_objects.data_containers import ( + YTSelectionContainer, + YTSelectionContainer0D, + YTSelectionContainer1D, + YTSelectionContainer2D, + YTSelectionContainer3D, +) from yt.data_objects.static_output import Dataset -from yt.frontends.sph.data_structures import \ - SPHDataset -from yt.funcs import \ - ensure_list, \ - iterable, \ - validate_width_tuple, \ - fix_length, \ - fix_axis, \ - mylog, \ - validate_3d_array, \ - validate_float, \ - validate_iterable, \ - validate_object, \ - validate_axis, \ - validate_center -from yt.units.yt_array import \ - udot, \ - unorm, \ - YTArray, \ - YTQuantity -from yt.utilities.exceptions import \ - YTSphereTooSmall, \ - YTIllDefinedCutRegion, \ - YTEllipsoidOrdering, \ - YTException -from yt.utilities.lib.pixelization_routines import \ - SPHKernelInterpolationTable -from yt.utilities.minimal_representation import \ - MinimalSliceData +from yt.frontends.sph.data_structures import SPHDataset +from yt.funcs import ( + ensure_list, + fix_axis, + fix_length, + iterable, + mylog, + validate_3d_array, + validate_axis, + validate_center, + validate_float, + validate_iterable, + validate_object, + validate_width_tuple, +) +from yt.geometry.selection_routines import points_in_cells +from yt.units.yt_array import YTArray, YTQuantity, udot, unorm +from yt.utilities.exceptions import ( + YTEllipsoidOrdering, + YTException, + YTIllDefinedCutRegion, + YTSphereTooSmall, +) +from yt.utilities.lib.pixelization_routines import SPHKernelInterpolationTable from yt.utilities.math_utils import get_rotation_matrix +from yt.utilities.minimal_representation import MinimalSliceData +from yt.utilities.on_demand_imports import _miniball, _scipy from yt.utilities.orientation import Orientation -from yt.geometry.selection_routines import points_in_cells -from yt.utilities.on_demand_imports import _scipy, _miniball class YTPoint(YTSelectionContainer0D): diff --git a/yt/data_objects/static_output.py b/yt/data_objects/static_output.py index 9a74767393c..1e90612ffcc 100644 --- a/yt/data_objects/static_output.py +++ b/yt/data_objects/static_output.py @@ -1,76 +1,62 @@ import functools import itertools -import numpy as np import os -from stat import ST_CTIME +import pickle import time -import weakref import warnings - +import weakref from collections import defaultdict -import pickle +from stat import ST_CTIME + +import numpy as np from yt.config import ytcfg -from yt.fields.derived_field import \ - DerivedField -from yt.fields.field_type_container import \ - FieldTypeContainer -from yt.funcs import \ - mylog, \ - set_intersection, \ - ensure_list, \ - issue_deprecation_warning, \ - iterable, \ - setdefaultattr -from yt.utilities.cosmology import \ - Cosmology -from yt.utilities.exceptions import \ - YTObjectNotImplemented, \ - YTFieldNotFound, \ - YTGeometryNotSupported, \ - YTIllDefinedParticleFilter -from yt.utilities.parallel_tools.parallel_analysis_interface import \ - parallel_root_only -from yt.utilities.parameter_file_storage import \ - ParameterFileStore, \ - NoParameterShelf, \ - output_type_registry -from yt.units import UnitContainer +from yt.data_objects.data_containers import data_object_registry +from yt.data_objects.particle_filters import filter_registry +from yt.data_objects.particle_unions import ParticleUnion +from yt.data_objects.region_expression import RegionExpression +from yt.fields.derived_field import DerivedField, ValidateSpatial +from yt.fields.field_type_container import FieldTypeContainer +from yt.fields.fluid_fields import setup_gradient_fields +from yt.fields.particle_fields import DEP_MSG_SMOOTH_FIELD +from yt.funcs import ( + ensure_list, + issue_deprecation_warning, + iterable, + mylog, + set_intersection, + setdefaultattr, +) +from yt.geometry.coordinates.api import ( + CartesianCoordinateHandler, + CoordinateHandler, + CylindricalCoordinateHandler, + GeographicCoordinateHandler, + InternalGeographicCoordinateHandler, + PolarCoordinateHandler, + SpectralCubeCoordinateHandler, + SphericalCoordinateHandler, +) +from yt.units import UnitContainer, _wrap_display_ytarray from yt.units.dimensions import current_mks from yt.units.unit_object import Unit, define_unit -from yt.units.unit_systems import unit_system_registry from yt.units.unit_registry import UnitRegistry -from yt.fields.derived_field import \ - ValidateSpatial -from yt.fields.fluid_fields import \ - setup_gradient_fields -from yt.fields.particle_fields import \ - DEP_MSG_SMOOTH_FIELD -from yt.data_objects.particle_filters import \ - filter_registry -from yt.data_objects.particle_unions import \ - ParticleUnion -from yt.data_objects.data_containers import \ - data_object_registry -from yt.utilities.minimal_representation import \ - MinimalDataset -from yt.units.yt_array import \ - YTArray, \ - YTQuantity -from yt.units import \ - _wrap_display_ytarray -from yt.units.unit_systems import create_code_unit_system -from yt.data_objects.region_expression import \ - RegionExpression -from yt.geometry.coordinates.api import \ - CoordinateHandler, \ - CartesianCoordinateHandler, \ - PolarCoordinateHandler, \ - CylindricalCoordinateHandler, \ - SphericalCoordinateHandler, \ - GeographicCoordinateHandler, \ - SpectralCubeCoordinateHandler, \ - InternalGeographicCoordinateHandler +from yt.units.unit_systems import create_code_unit_system, unit_system_registry +from yt.units.yt_array import YTArray, YTQuantity +from yt.utilities.cosmology import Cosmology +from yt.utilities.exceptions import ( + YTFieldNotFound, + YTGeometryNotSupported, + YTIllDefinedParticleFilter, + YTObjectNotImplemented, +) +from yt.utilities.minimal_representation import MinimalDataset +from yt.utilities.parallel_tools.parallel_analysis_interface import parallel_root_only +from yt.utilities.parameter_file_storage import ( + NoParameterShelf, + ParameterFileStore, + output_type_registry, +) # We want to support the movie format in the future. # When such a thing comes to pass, I'll move all the stuff that is constant up diff --git a/yt/data_objects/tests/test_bbox.py b/yt/data_objects/tests/test_bbox.py index 005e12f98c5..878e4b8adda 100644 --- a/yt/data_objects/tests/test_bbox.py +++ b/yt/data_objects/tests/test_bbox.py @@ -2,10 +2,7 @@ import numpy as np -from yt.testing import \ - fake_amr_ds, \ - assert_equal, \ - assert_allclose_units +from yt.testing import assert_allclose_units, assert_equal, fake_amr_ds def test_object_bbox(): diff --git a/yt/data_objects/tests/test_boolean_regions.py b/yt/data_objects/tests/test_boolean_regions.py index a4cca05b178..babf213933f 100644 --- a/yt/data_objects/tests/test_boolean_regions.py +++ b/yt/data_objects/tests/test_boolean_regions.py @@ -1,8 +1,7 @@ -from yt.testing import \ - fake_amr_ds, \ - assert_array_equal import numpy as np +from yt.testing import assert_array_equal, fake_amr_ds + # We use morton indices in this test because they are single floating point # values that uniquely identify each cell. That's a convenient way to compare # inclusion in set operations, since there are no duplicates. diff --git a/yt/data_objects/tests/test_chunking.py b/yt/data_objects/tests/test_chunking.py index 6ec67a96be2..f70673c94db 100644 --- a/yt/data_objects/tests/test_chunking.py +++ b/yt/data_objects/tests/test_chunking.py @@ -1,9 +1,6 @@ -from yt.testing import \ - fake_random_ds, \ - assert_equal, \ - assert_true -from yt.units.yt_array import \ - uconcatenate +from yt.testing import assert_equal, assert_true, fake_random_ds +from yt.units.yt_array import uconcatenate + def _get_dobjs(c): dobjs = [("sphere", ("center", (1.0, "unitary"))), diff --git a/yt/data_objects/tests/test_clone.py b/yt/data_objects/tests/test_clone.py index 8b3087b2b91..4c9339dc76b 100644 --- a/yt/data_objects/tests/test_clone.py +++ b/yt/data_objects/tests/test_clone.py @@ -1,7 +1,5 @@ -from yt.testing import \ - fake_random_ds, \ - assert_equal, \ - assert_array_equal +from yt.testing import assert_array_equal, assert_equal, fake_random_ds + def test_clone_sphere(): # Now we test that we can get different radial velocities based on field diff --git a/yt/data_objects/tests/test_compose.py b/yt/data_objects/tests/test_compose.py index c8a1ca66909..346d9ad9432 100644 --- a/yt/data_objects/tests/test_compose.py +++ b/yt/data_objects/tests/test_compose.py @@ -1,12 +1,8 @@ import numpy as np -from yt.testing import \ - assert_array_equal, \ - fake_amr_ds, \ - fake_random_ds -from yt.units.yt_array import \ - YTArray, \ - uintersect1d +from yt.testing import assert_array_equal, fake_amr_ds, fake_random_ds +from yt.units.yt_array import YTArray, uintersect1d + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_connected_sets.py b/yt/data_objects/tests/test_connected_sets.py index af5aa034b38..f8a4ceeb21b 100644 --- a/yt/data_objects/tests/test_connected_sets.py +++ b/yt/data_objects/tests/test_connected_sets.py @@ -1,6 +1,7 @@ from yt.testing import fake_random_ds from yt.utilities.answer_testing.level_sets_tests import ExtractConnectedSetsTest + def test_connected_sets(): ds = fake_random_ds(16, nprocs=8, particles=16**3) data_source = ds.disk([0.5, 0.5, 0.5], [0., 0., 1.], (8, 'kpc'), (1, 'kpc')) diff --git a/yt/data_objects/tests/test_covering_grid.py b/yt/data_objects/tests/test_covering_grid.py index 6738980dafd..a7624320a69 100644 --- a/yt/data_objects/tests/test_covering_grid.py +++ b/yt/data_objects/tests/test_covering_grid.py @@ -1,19 +1,23 @@ import numpy as np -from yt.fields.derived_field import \ - ValidateParameter -from yt.frontends.stream.data_structures import load_particles -from yt.testing import fake_random_ds, assert_equal, assert_almost_equal, \ - fake_octree_ds, requires_file, requires_module from yt.convenience import load -from yt.testing import \ - assert_array_equal +from yt.fields.derived_field import ValidateParameter +from yt.frontends.stream.data_structures import load_particles +from yt.testing import ( + assert_almost_equal, + assert_array_equal, + assert_equal, + fake_octree_ds, + fake_random_ds, + requires_file, + requires_module, +) +from yt.units import kpc # cylindrical data for covering_grid test cyl_2d = "WDMerger_hdf5_chk_1000/WDMerger_hdf5_chk_1000.hdf5" cyl_3d = "MHD_Cyl3d_hdf5_plt_cnt_0100/MHD_Cyl3d_hdf5_plt_cnt_0100.hdf5" -from yt.units import kpc def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_cutting_plane.py b/yt/data_objects/tests/test_cutting_plane.py index 7c938856aa6..a50a963ba27 100644 --- a/yt/data_objects/tests/test_cutting_plane.py +++ b/yt/data_objects/tests/test_cutting_plane.py @@ -1,8 +1,9 @@ -from yt.testing import assert_equal, fake_random_ds -from yt.units.unit_object import Unit import os import tempfile +from yt.testing import assert_equal, fake_random_ds +from yt.units.unit_object import Unit + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_data_collection.py b/yt/data_objects/tests/test_data_collection.py index 07ab66270d5..5a0ca998964 100644 --- a/yt/data_objects/tests/test_data_collection.py +++ b/yt/data_objects/tests/test_data_collection.py @@ -1,9 +1,7 @@ import numpy as np -from yt.testing import \ - fake_random_ds, \ - assert_equal, \ - assert_rel_equal +from yt.testing import assert_equal, assert_rel_equal, fake_random_ds + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_data_containers.py b/yt/data_objects/tests/test_data_containers.py index 328211fc380..0031a49359a 100644 --- a/yt/data_objects/tests/test_data_containers.py +++ b/yt/data_objects/tests/test_data_containers.py @@ -10,10 +10,16 @@ from yt.data_objects.data_containers import YTDataContainer from yt.data_objects.particle_filters import particle_filter -from yt.testing import assert_equal, fake_random_ds, fake_amr_ds,\ - fake_particle_ds, requires_module +from yt.testing import ( + assert_equal, + fake_amr_ds, + fake_particle_ds, + fake_random_ds, + requires_module, +) from yt.utilities.exceptions import YTFieldNotFound + class TestDataContainers(unittest.TestCase): @classmethod def setUpClass(cls): diff --git a/yt/data_objects/tests/test_dataset_access.py b/yt/data_objects/tests/test_dataset_access.py index 53aa828e2c5..3083d7b8245 100644 --- a/yt/data_objects/tests/test_dataset_access.py +++ b/yt/data_objects/tests/test_dataset_access.py @@ -1,13 +1,14 @@ import numpy as np from nose.tools import assert_raises -from yt.testing import \ - assert_equal, \ - assert_almost_equal, \ - fake_amr_ds, \ - fake_particle_ds, \ - fake_random_ds, \ - requires_file +from yt.testing import ( + assert_almost_equal, + assert_equal, + fake_amr_ds, + fake_particle_ds, + fake_random_ds, + requires_file, +) from yt.utilities.answer_testing.framework import data_dir_load from yt.utilities.exceptions import YTDimensionalityError from yt.visualization.line_plot import LineBuffer diff --git a/yt/data_objects/tests/test_derived_quantities.py b/yt/data_objects/tests/test_derived_quantities.py index c2566cca1ce..9007525c689 100644 --- a/yt/data_objects/tests/test_derived_quantities.py +++ b/yt/data_objects/tests/test_derived_quantities.py @@ -1,18 +1,19 @@ import numpy as np -import yt - -from yt.testing import \ - fake_random_ds, \ - fake_sph_orientation_ds, \ - fake_particle_ds, \ - assert_almost_equal, \ - assert_equal, \ - assert_rel_equal, \ - requires_file +import yt from yt import particle_filter +from yt.testing import ( + assert_almost_equal, + assert_equal, + assert_rel_equal, + fake_particle_ds, + fake_random_ds, + fake_sph_orientation_ds, + requires_file, +) + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_ellipsoid.py b/yt/data_objects/tests/test_ellipsoid.py index 53f3642a548..a3c2bc84b1a 100644 --- a/yt/data_objects/tests/test_ellipsoid.py +++ b/yt/data_objects/tests/test_ellipsoid.py @@ -1,8 +1,7 @@ import numpy as np -from yt.testing import \ - fake_random_ds, \ - assert_array_less +from yt.testing import assert_array_less, fake_random_ds + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_exclude_functions.py b/yt/data_objects/tests/test_exclude_functions.py index c16fff04b4f..af7b26d89a8 100644 --- a/yt/data_objects/tests/test_exclude_functions.py +++ b/yt/data_objects/tests/test_exclude_functions.py @@ -1,7 +1,7 @@ import numpy as np -from yt.testing import fake_random_ds, assert_equal from yt.frontends.stream.data_structures import load_uniform_grid +from yt.testing import assert_equal, fake_random_ds def test_exclude_above(): @@ -88,4 +88,3 @@ def test_inside_outside(): only_threes = ad.include_outside('density', 0.9e6, 2.1e6, 'g/m**3') assert np.all(only_threes['density'] == 3) assert len(only_threes['density']) == 10 - diff --git a/yt/data_objects/tests/test_extract_regions.py b/yt/data_objects/tests/test_extract_regions.py index a20ace79a53..02e3e2457aa 100644 --- a/yt/data_objects/tests/test_extract_regions.py +++ b/yt/data_objects/tests/test_extract_regions.py @@ -1,12 +1,14 @@ import numpy as np from yt.convenience import load -from yt.testing import \ - fake_random_ds, \ - fake_amr_ds, \ - assert_equal, \ - assert_almost_equal, \ - requires_file +from yt.testing import ( + assert_almost_equal, + assert_equal, + fake_amr_ds, + fake_random_ds, + requires_file, +) + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_firefly.py b/yt/data_objects/tests/test_firefly.py index 04f284a0e52..4fd396cf16e 100644 --- a/yt/data_objects/tests/test_firefly.py +++ b/yt/data_objects/tests/test_firefly.py @@ -1,6 +1,8 @@ -from yt.testing import fake_particle_ds, requires_module import tempfile +from yt.testing import fake_particle_ds, requires_module + + @requires_module('firefly_api') def test_firefly_JSON_object(): tmpdir = tempfile.mkdtemp() @@ -13,4 +15,3 @@ def test_firefly_JSON_object(): coordinate_units = 'cm', dataset_name='test') reader.dumpToJSON() - diff --git a/yt/data_objects/tests/test_fluxes.py b/yt/data_objects/tests/test_fluxes.py index 9843db17770..ae26154a4d8 100644 --- a/yt/data_objects/tests/test_fluxes.py +++ b/yt/data_objects/tests/test_fluxes.py @@ -1,12 +1,12 @@ import os import shutil import tempfile +from unittest import TestCase import numpy as np -from unittest import TestCase +from yt.testing import assert_almost_equal, assert_equal, fake_random_ds -from yt.testing import fake_random_ds, assert_almost_equal, assert_equal def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_glue.py b/yt/data_objects/tests/test_glue.py index 42484054c9c..9f19b6b38d6 100644 --- a/yt/data_objects/tests/test_glue.py +++ b/yt/data_objects/tests/test_glue.py @@ -3,6 +3,7 @@ from yt.config import ytcfg from yt.testing import fake_random_ds, requires_module + def setup_func(): ytcfg["yt", "__withintesting"] = "True" diff --git a/yt/data_objects/tests/test_image_array.py b/yt/data_objects/tests/test_image_array.py index f6bd81d8504..97f035ecd88 100644 --- a/yt/data_objects/tests/test_image_array.py +++ b/yt/data_objects/tests/test_image_array.py @@ -1,13 +1,13 @@ -import numpy as np import os -import tempfile import shutil +import tempfile import unittest import warnings + +import numpy as np + from yt.data_objects.image_array import ImageArray -from yt.testing import \ - assert_equal, \ - requires_module +from yt.testing import assert_equal, requires_module def setup(): diff --git a/yt/data_objects/tests/test_numpy_ops.py b/yt/data_objects/tests/test_numpy_ops.py index 4de052dbd83..3a989010378 100644 --- a/yt/data_objects/tests/test_numpy_ops.py +++ b/yt/data_objects/tests/test_numpy_ops.py @@ -1,6 +1,7 @@ -from yt.testing import fake_random_ds, fake_amr_ds, assert_equal import numpy as np +from yt.testing import assert_equal, fake_amr_ds, fake_random_ds + def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_octree.py b/yt/data_objects/tests/test_octree.py index 74d65d19965..2588fcee11c 100644 --- a/yt/data_objects/tests/test_octree.py +++ b/yt/data_objects/tests/test_octree.py @@ -1,11 +1,13 @@ -from yt.testing import \ - fake_sph_grid_ds, assert_almost_equal -from yt.data_objects.construction_data_containers import YTOctree -import tempfile import os import shutil +import tempfile + import numpy as np +from yt.data_objects.construction_data_containers import YTOctree +from yt.testing import assert_almost_equal, fake_sph_grid_ds + + def test_building_tree(): ''' Test function to build an octree and make sure correct number of particles diff --git a/yt/data_objects/tests/test_ortho_rays.py b/yt/data_objects/tests/test_ortho_rays.py index de5b808d1e3..0958d775871 100644 --- a/yt/data_objects/tests/test_ortho_rays.py +++ b/yt/data_objects/tests/test_ortho_rays.py @@ -1,8 +1,6 @@ import numpy as np -from yt.testing import \ - fake_random_ds, \ - assert_equal +from yt.testing import assert_equal, fake_random_ds def test_ortho_ray(): diff --git a/yt/data_objects/tests/test_particle_filter.py b/yt/data_objects/tests/test_particle_filter.py index 34f3364c090..62a6082d78b 100644 --- a/yt/data_objects/tests/test_particle_filter.py +++ b/yt/data_objects/tests/test_particle_filter.py @@ -1,17 +1,16 @@ -import numpy as np import os import shutil import tempfile +import numpy as np from nose.tools import assert_raises from yt.data_objects.particle_filters import add_particle_filter, particle_filter from yt.testing import assert_equal, fake_random_ds, fake_sph_grid_ds +from yt.utilities.exceptions import YTIllDefinedFilter, YTIllDefinedParticleFilter from yt.visualization.plot_window import ProjectionPlot -from yt.utilities.exceptions import YTIllDefinedFilter, \ - YTIllDefinedParticleFilter def test_add_particle_filter(): diff --git a/yt/data_objects/tests/test_particle_trajectories.py b/yt/data_objects/tests/test_particle_trajectories.py index 7c01380e8b1..d7f9f16073f 100644 --- a/yt/data_objects/tests/test_particle_trajectories.py +++ b/yt/data_objects/tests/test_particle_trajectories.py @@ -1,17 +1,15 @@ import glob import os + import numpy as np -from numpy.testing import \ - assert_raises +from numpy.testing import assert_raises from yt.config import ytcfg +from yt.data_objects.particle_filters import particle_filter from yt.data_objects.time_series import DatasetSeries -from yt.utilities.answer_testing.framework import \ - requires_ds, \ - GenericArrayTest from yt.testing import fake_particle_ds +from yt.utilities.answer_testing.framework import GenericArrayTest, requires_ds from yt.utilities.exceptions import YTIllDefinedParticleData -from yt.data_objects.particle_filters import particle_filter def setup(): diff --git a/yt/data_objects/tests/test_pickle.py b/yt/data_objects/tests/test_pickle.py index b1b53a7b9fa..0a88c3bfcc1 100644 --- a/yt/data_objects/tests/test_pickle.py +++ b/yt/data_objects/tests/test_pickle.py @@ -1,8 +1,8 @@ -import pickle import os +import pickle import tempfile -from yt.testing \ - import fake_random_ds, assert_equal + +from yt.testing import assert_equal, fake_random_ds def setup(): diff --git a/yt/data_objects/tests/test_points.py b/yt/data_objects/tests/test_points.py index caacb5221fc..4077120c61a 100644 --- a/yt/data_objects/tests/test_points.py +++ b/yt/data_objects/tests/test_points.py @@ -1,7 +1,8 @@ import numpy as np + import yt +from yt.testing import assert_equal, fake_random_ds -from yt.testing import fake_random_ds, assert_equal def setup(): from yt.config import ytcfg diff --git a/yt/data_objects/tests/test_profiles.py b/yt/data_objects/tests/test_profiles.py index 2ca61f49d25..2342a46a336 100644 --- a/yt/data_objects/tests/test_profiles.py +++ b/yt/data_objects/tests/test_profiles.py @@ -1,24 +1,23 @@ -import numpy as np import os import shutil import tempfile import unittest -import yt -from yt.utilities.exceptions import \ - YTProfileDataShape +import numpy as np + +import yt from yt.data_objects.particle_filters import add_particle_filter -from yt.data_objects.profiles import Profile1D, Profile2D, Profile3D,\ - create_profile -from yt.testing import \ - assert_equal, \ - assert_raises,\ - assert_rel_equal, \ - fake_random_ds, \ - fake_sph_orientation_ds, \ - requires_module -from yt.utilities.exceptions import YTIllDefinedProfile -from yt.visualization.profile_plotter import ProfilePlot, PhasePlot +from yt.data_objects.profiles import Profile1D, Profile2D, Profile3D, create_profile +from yt.testing import ( + assert_equal, + assert_raises, + assert_rel_equal, + fake_random_ds, + fake_sph_orientation_ds, + requires_module, +) +from yt.utilities.exceptions import YTIllDefinedProfile, YTProfileDataShape +from yt.visualization.profile_plotter import PhasePlot, ProfilePlot _fields = ("density", "temperature", "dinosaurs", "tribbles") _units = ("g/cm**3", "K", "dyne", "erg") diff --git a/yt/data_objects/tests/test_projection.py b/yt/data_objects/tests/test_projection.py index b54fd3b8679..73a4e6969b9 100644 --- a/yt/data_objects/tests/test_projection.py +++ b/yt/data_objects/tests/test_projection.py @@ -1,13 +1,11 @@ -import numpy as np -from yt.testing import \ - fake_random_ds, \ - assert_equal, \ - assert_rel_equal, \ - fake_amr_ds -from yt.units.unit_object import Unit import os import tempfile +import numpy as np + +from yt.testing import assert_equal, assert_rel_equal, fake_amr_ds, fake_random_ds +from yt.units.unit_object import Unit + LENGTH_UNIT = 2.0 diff --git a/yt/data_objects/tests/test_rays.py b/yt/data_objects/tests/test_rays.py index 756d62e0429..6ef502e1ddf 100644 --- a/yt/data_objects/tests/test_rays.py +++ b/yt/data_objects/tests/test_rays.py @@ -1,14 +1,9 @@ import numpy as np -from yt import \ - load -from yt.testing import \ - fake_random_ds, \ - assert_equal, \ - assert_rel_equal, \ - requires_file -from yt.units.yt_array import \ - uconcatenate +from yt import load +from yt.testing import assert_equal, assert_rel_equal, fake_random_ds, requires_file +from yt.units.yt_array import uconcatenate + def test_ray(): for nproc in [1, 2, 4, 8]: diff --git a/yt/data_objects/tests/test_refinement.py b/yt/data_objects/tests/test_refinement.py index 38966f20a50..ca5a2010f90 100644 --- a/yt/data_objects/tests/test_refinement.py +++ b/yt/data_objects/tests/test_refinement.py @@ -1,9 +1,9 @@ -from yt.testing import \ - assert_array_equal, \ - assert_equal -import yt import numpy as np +import yt +from yt.testing import assert_array_equal, assert_equal + + def setup_fake_refby(): refine_by=np.array([5, 1, 1]) top_grid_dim = [100, 10, 2] diff --git a/yt/data_objects/tests/test_regions.py b/yt/data_objects/tests/test_regions.py index ef6d69e369b..557396abe60 100644 --- a/yt/data_objects/tests/test_regions.py +++ b/yt/data_objects/tests/test_regions.py @@ -1,9 +1,7 @@ -from yt.testing import \ - assert_array_equal, \ - fake_amr_ds, \ - fake_random_ds +from yt.testing import assert_array_equal, fake_amr_ds, fake_random_ds from yt.units import cm + def test_box_creation(): # test that creating a region with left and right edge diff --git a/yt/data_objects/tests/test_slice.py b/yt/data_objects/tests/test_slice.py index 8e8a2e71c87..e7e3866d36b 100644 --- a/yt/data_objects/tests/test_slice.py +++ b/yt/data_objects/tests/test_slice.py @@ -1,8 +1,9 @@ import os -import numpy as np import tempfile -from yt.testing import \ - fake_random_ds, assert_equal + +import numpy as np + +from yt.testing import assert_equal, fake_random_ds from yt.units.unit_object import Unit diff --git a/yt/data_objects/tests/test_sph_data_objects.py b/yt/data_objects/tests/test_sph_data_objects.py index 1ba56a70f35..a00d1b355b4 100644 --- a/yt/data_objects/tests/test_sph_data_objects.py +++ b/yt/data_objects/tests/test_sph_data_objects.py @@ -1,9 +1,8 @@ import numpy as np -from yt.testing import \ - assert_equal, \ - fake_sph_orientation_ds, fake_sph_grid_ds from yt import SlicePlot +from yt.testing import assert_equal, fake_sph_grid_ds, fake_sph_orientation_ds + def test_point(): ds = fake_sph_orientation_ds() @@ -322,4 +321,3 @@ def test_covering_grid_gather(): cg_dens = cg[field].to('g*cm**-3').d assert_equal(ag_dens, cg_dens) - diff --git a/yt/data_objects/tests/test_spheres.py b/yt/data_objects/tests/test_spheres.py index 293fd29e52d..216300800c3 100644 --- a/yt/data_objects/tests/test_spheres.py +++ b/yt/data_objects/tests/test_spheres.py @@ -2,9 +2,13 @@ from numpy.testing import assert_array_equal from yt.data_objects.profiles import create_profile -from yt.testing import fake_random_ds, assert_equal, periodicity_cases, \ - assert_raises, requires_module - +from yt.testing import ( + assert_equal, + assert_raises, + fake_random_ds, + periodicity_cases, + requires_module, +) from yt.utilities.exceptions import YTException diff --git a/yt/data_objects/tests/test_streamlines.py b/yt/data_objects/tests/test_streamlines.py index 06baedc8f50..880624d7895 100644 --- a/yt/data_objects/tests/test_streamlines.py +++ b/yt/data_objects/tests/test_streamlines.py @@ -1,11 +1,9 @@ import numpy as np -from yt.testing import \ - fake_random_ds, \ - assert_rel_equal, \ - assert_equal +from yt.testing import assert_equal, assert_rel_equal, fake_random_ds from yt.visualization.streamlines import Streamlines + def setup(): from yt.config import ytcfg ytcfg["yt","__withintesting"] = "True" diff --git a/yt/data_objects/tests/test_time_series.py b/yt/data_objects/tests/test_time_series.py index 6d073657fef..0db603bc74f 100644 --- a/yt/data_objects/tests/test_time_series.py +++ b/yt/data_objects/tests/test_time_series.py @@ -1,10 +1,11 @@ -from yt.data_objects.time_series import get_filenames_from_glob_pattern - -from pathlib import Path import os import tempfile +from pathlib import Path + +from yt.data_objects.time_series import get_filenames_from_glob_pattern from yt.testing import assert_raises + def test_pattern_expansion(): file_list = ["fake_data_file_{}".format(str(i).zfill(4)) for i in range(10)] diff --git a/yt/data_objects/time_series.py b/yt/data_objects/time_series.py index 2c24290e582..7e08f1fafc4 100644 --- a/yt/data_objects/time_series.py +++ b/yt/data_objects/time_series.py @@ -1,37 +1,33 @@ -import inspect import functools import glob -import numpy as np +import inspect import os import weakref - from functools import wraps -from yt.convenience import load +import numpy as np + from yt.config import ytcfg +from yt.convenience import load +from yt.data_objects.analyzer_objects import ( + AnalysisTask, + analysis_task_registry, + create_quantity_proxy, +) from yt.data_objects.data_containers import data_object_registry -from yt.data_objects.derived_quantities import \ - derived_quantity_registry -from yt.data_objects.analyzer_objects import \ - create_quantity_proxy, \ - analysis_task_registry, \ - AnalysisTask -from yt.data_objects.particle_trajectories import \ - ParticleTrajectories -from yt.funcs import \ - iterable, \ - ensure_list, \ - mylog, \ - issue_deprecation_warning +from yt.data_objects.derived_quantities import derived_quantity_registry +from yt.data_objects.particle_trajectories import ParticleTrajectories +from yt.funcs import ensure_list, issue_deprecation_warning, iterable, mylog from yt.units.yt_array import YTArray, YTQuantity -from yt.utilities.exceptions import \ - YTException, \ - YTOutputNotIdentified -from yt.utilities.parallel_tools.parallel_analysis_interface \ - import parallel_objects, parallel_root_only, communication_system -from yt.utilities.parameter_file_storage import \ - simulation_time_series_registry - +from yt.utilities.exceptions import YTException, YTOutputNotIdentified +from yt.utilities.parallel_tools.parallel_analysis_interface import ( + communication_system, + parallel_objects, + parallel_root_only, +) +from yt.utilities.parameter_file_storage import simulation_time_series_registry + + class AnalysisTaskProxy: def __init__(self, time_series): self.time_series = time_series diff --git a/yt/data_objects/unions.py b/yt/data_objects/unions.py index 2feabf58397..43d39c2bb4b 100644 --- a/yt/data_objects/unions.py +++ b/yt/data_objects/unions.py @@ -1,5 +1,6 @@ from yt.funcs import ensure_list + class Union: _union_type = "" def __init__(self, name, sub_types): diff --git a/yt/data_objects/unstructured_mesh.py b/yt/data_objects/unstructured_mesh.py index 636f8f40100..9df16c82941 100644 --- a/yt/data_objects/unstructured_mesh.py +++ b/yt/data_objects/unstructured_mesh.py @@ -1,14 +1,11 @@ import numpy as np +import yt.geometry.particle_deposit as particle_deposit +from yt.data_objects.data_containers import YTSelectionContainer from yt.funcs import mylog -from yt.utilities.exceptions import \ - YTParticleDepositionNotImplemented -from yt.utilities.lib.mesh_utilities import \ - fill_fcoords, fill_fwidths +from yt.utilities.exceptions import YTParticleDepositionNotImplemented +from yt.utilities.lib.mesh_utilities import fill_fcoords, fill_fwidths -from yt.data_objects.data_containers import \ - YTSelectionContainer -import yt.geometry.particle_deposit as particle_deposit class UnstructuredMesh(YTSelectionContainer): # This is a base class, not meant to be used directly. @@ -214,4 +211,3 @@ def select(self, selector, source, dest, offset): # Note: this likely will not work with vector fields. dest[offset:offset+count] = source.flat[mask] return count - diff --git a/yt/exthook.py b/yt/exthook.py index a1c18368eba..f4ea3dfd586 100644 --- a/yt/exthook.py +++ b/yt/exthook.py @@ -22,7 +22,6 @@ # This source code was originally in flask/exthook.py import os import sys -import os class ExtensionImporter: diff --git a/yt/fields/angular_momentum.py b/yt/fields/angular_momentum.py index b94ee50e0dd..277f43abfa3 100644 --- a/yt/fields/angular_momentum.py +++ b/yt/fields/angular_momentum.py @@ -1,17 +1,14 @@ import numpy as np -from .derived_field import \ - ValidateParameter +from yt.utilities.lib.misc_utilities import ( + obtain_position_vector, + obtain_relative_velocity_vector, +) -from .field_plugin_registry import \ - register_field_plugin +from .derived_field import ValidateParameter +from .field_plugin_registry import register_field_plugin +from .vector_operations import create_magnitude_field -from .vector_operations import \ - create_magnitude_field - -from yt.utilities.lib.misc_utilities import \ - obtain_position_vector, \ - obtain_relative_velocity_vector @register_field_plugin def setup_angular_momentum(registry, ftype = "gas", slice_info = None): diff --git a/yt/fields/api.py b/yt/fields/api.py index 0819b2ba558..8ec272cb8df 100644 --- a/yt/fields/api.py +++ b/yt/fields/api.py @@ -1,33 +1,27 @@ -from .field_plugin_registry import \ - register_field_plugin, \ - field_plugins - -from . import angular_momentum -from . import astro_fields -from . import cosmology_fields -from . import fluid_fields -from . import fluid_vector_fields -from . import magnetic_field -from . import geometric_fields -from . import particle_fields #from . import species_fields -from . import vector_operations -from . import local_fields -from . import my_plugin_fields - +from . import ( + angular_momentum, + astro_fields, + cosmology_fields, + fluid_fields, + fluid_vector_fields, + geometric_fields, + local_fields, + magnetic_field, + my_plugin_fields, + particle_fields, + vector_operations, +) +from .derived_field import ( + DerivedField, + ValidateDataField, + ValidateGridType, + ValidateParameter, + ValidateProperty, + ValidateSpatial, +) +from .field_detector import FieldDetector +from .field_info_container import FieldInfoContainer +from .field_plugin_registry import field_plugins, register_field_plugin from .local_fields import add_field, derived_field - - -from .derived_field import \ - DerivedField, \ - ValidateParameter, \ - ValidateDataField, \ - ValidateProperty, \ - ValidateSpatial, \ - ValidateGridType -from .field_detector import \ - FieldDetector -from .field_info_container import \ - FieldInfoContainer -from .xray_emission_fields import \ - add_xray_emissivity_field \ No newline at end of file +from .xray_emission_fields import add_xray_emissivity_field diff --git a/yt/fields/astro_fields.py b/yt/fields/astro_fields.py index b9f0bf43b0d..17807e488f3 100644 --- a/yt/fields/astro_fields.py +++ b/yt/fields/astro_fields.py @@ -1,9 +1,7 @@ import numpy as np -from .derived_field import \ - ValidateParameter -from .field_plugin_registry import \ - register_field_plugin +from .derived_field import ValidateParameter +from .field_plugin_registry import register_field_plugin @register_field_plugin diff --git a/yt/fields/cosmology_fields.py b/yt/fields/cosmology_fields.py index bfaa998b49e..90296cbeedc 100644 --- a/yt/fields/cosmology_fields.py +++ b/yt/fields/cosmology_fields.py @@ -1,10 +1,7 @@ -from .derived_field import \ - ValidateParameter -from .field_exceptions import \ - NeedsConfiguration, \ - NeedsParameter -from .field_plugin_registry import \ - register_field_plugin +from .derived_field import ValidateParameter +from .field_exceptions import NeedsConfiguration, NeedsParameter +from .field_plugin_registry import register_field_plugin + @register_field_plugin def setup_cosmology_fields(registry, ftype = "gas", slice_info = None): diff --git a/yt/fields/derived_field.py b/yt/fields/derived_field.py index 216d28b85da..5236f6bc651 100644 --- a/yt/fields/derived_field.py +++ b/yt/fields/derived_field.py @@ -3,23 +3,20 @@ import re import warnings -from yt.funcs import \ - ensure_list, \ - VisibleDeprecationWarning -from .field_exceptions import \ - NeedsGridType, \ - NeedsOriginalGrid, \ - NeedsDataField, \ - NeedsProperty, \ - NeedsParameter, \ - FieldUnitsError -from .field_detector import \ - FieldDetector -from yt.units.unit_object import \ - Unit import yt.units.dimensions as ytdims -from yt.utilities.exceptions import \ - YTFieldNotFound +from yt.funcs import VisibleDeprecationWarning, ensure_list +from yt.units.unit_object import Unit +from yt.utilities.exceptions import YTFieldNotFound + +from .field_detector import FieldDetector +from .field_exceptions import ( + FieldUnitsError, + NeedsDataField, + NeedsGridType, + NeedsOriginalGrid, + NeedsParameter, + NeedsProperty, +) def TranslationFunc(field_name): diff --git a/yt/fields/domain_context.py b/yt/fields/domain_context.py index 16d36577ba9..6a6b69e46d6 100644 --- a/yt/fields/domain_context.py +++ b/yt/fields/domain_context.py @@ -11,4 +11,3 @@ def __init__(cls, name, b, d): def __init__(self, ds): self.ds = ds - diff --git a/yt/fields/field_detector.py b/yt/fields/field_detector.py index 128aca67eab..9bf71d0f073 100644 --- a/yt/fields/field_detector.py +++ b/yt/fields/field_detector.py @@ -1,8 +1,10 @@ -import numpy as np from collections import defaultdict + +import numpy as np + from yt.units.yt_array import YTArray -from .field_exceptions import \ - NeedsGridType + +from .field_exceptions import NeedsGridType fp_units = { 'bulk_velocity' : 'cm/s', @@ -279,4 +281,3 @@ def fwidth(self): if not self.flat: fw.shape = (self.nd, self.nd, self.nd, 3) return self.ds.arr(fw, units = "code_length") - diff --git a/yt/fields/field_exceptions.py b/yt/fields/field_exceptions.py index c5cdef171f1..b2970803316 100644 --- a/yt/fields/field_exceptions.py +++ b/yt/fields/field_exceptions.py @@ -40,4 +40,3 @@ def __str__(self): class FieldUnitsError(Exception): pass - diff --git a/yt/fields/field_functions.py b/yt/fields/field_functions.py index cfbe7a283fe..e1f53dd52c5 100644 --- a/yt/fields/field_functions.py +++ b/yt/fields/field_functions.py @@ -1,7 +1,7 @@ import numpy as np -from yt.utilities.lib.misc_utilities import \ - obtain_position_vector +from yt.utilities.lib.misc_utilities import obtain_position_vector + def get_radius(data, field_prefix, ftype): unit_system = data.ds.unit_system diff --git a/yt/fields/field_info_container.py b/yt/fields/field_info_container.py index e3c63b06124..3ebbed2da43 100644 --- a/yt/fields/field_info_container.py +++ b/yt/fields/field_info_container.py @@ -1,27 +1,25 @@ -import numpy as np -from numbers import Number as numeric_type import warnings +from numbers import Number as numeric_type + +import numpy as np from yt.funcs import mylog, only_on_root -from yt.geometry.geometry_handler import \ - is_curvilinear -from yt.units.unit_object import Unit +from yt.geometry.geometry_handler import is_curvilinear from yt.units.dimensions import dimensionless -from .derived_field import \ - DerivedField, \ - NullFunc, \ - TranslationFunc -from yt.utilities.exceptions import \ - YTFieldNotFound -from .field_plugin_registry import \ - field_plugins -from .particle_fields import \ - add_union_field, \ - particle_deposition_functions, \ - particle_vector_functions, \ - particle_scalar_functions, \ - standard_particle_fields, \ - sph_whitelist_fields +from yt.units.unit_object import Unit +from yt.utilities.exceptions import YTFieldNotFound + +from .derived_field import DerivedField, NullFunc, TranslationFunc +from .field_plugin_registry import field_plugins +from .particle_fields import ( + add_union_field, + particle_deposition_functions, + particle_scalar_functions, + particle_vector_functions, + sph_whitelist_fields, + standard_particle_fields, +) + def tupleize(inp): if isinstance(inp, tuple): diff --git a/yt/fields/field_type_container.py b/yt/fields/field_type_container.py index 31eee8db606..3f61d5df636 100644 --- a/yt/fields/field_type_container.py +++ b/yt/fields/field_type_container.py @@ -2,11 +2,12 @@ A proxy object for field descriptors, usually living as ds.fields. """ -import weakref -import textwrap import inspect -from yt.fields.derived_field import \ - DerivedField +import textwrap +import weakref + +from yt.fields.derived_field import DerivedField + def _fill_values(values): value = '