diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab49aa32d237456b0dbd761d97ae1a4587927fa5..3bb99a7c8c35bae308594c98432bb2d2d2c56b08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,23 +20,13 @@ repos: grav_waves/run_population_scripts/run_PPISN_population.py| grav_waves/run_population_scripts/run_PPISN_population_new.py| )$ -- repo: https://github.com/pycqa/flake8 - rev: 5.0.4 - hooks: - - id: flake8 - args: ['--ignore=E129,E2,E501,W503,E722,binarycpython/tests/main.py,docs/source/examples/'] - exclude: | - (?x)^( - binarycpython/tests/main.py| - docs/source/examples/example_plotting_distributions.py - )$ -- repo: https://github.com/pycqa/isort - rev: 5.10.1 - hooks: - - id: isort - files: "\\.(py)$" - args: [--settings-path=pyproject.toml] +# - repo: https://github.com/pycqa/isort +# rev: 5.10.1 +# hooks: +# - id: isort +# files: "\\.(py)$" +# args: [--settings-path=pyproject.toml] - repo: https://github.com/hadialqattan/pycln rev: v2.1.1 # Possible releases: https://github.com/hadialqattan/pycln/releases @@ -49,3 +39,14 @@ repos: # hooks: # - id: pydocstyle # args: [--config=pyproject.toml] + +- repo: https://github.com/pycqa/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + args: ['--ignore=E129,E2,E501,W503,E722,binarycpython/tests/main.py,docs/source/examples/'] + exclude: | + (?x)^( + binarycpython/tests/main.py| + docs/source/examples/example_plotting_distributions.py + )$ diff --git a/binarycpython/tests/main.py b/binarycpython/tests/main.py index 7a099caa813f993915784aaf8256b893898d5797..a4ce3e7f37b3595a5fa357cf2b1c63cfb584db62 100755 --- a/binarycpython/tests/main.py +++ b/binarycpython/tests/main.py @@ -7,80 +7,162 @@ Main file for the tests. This file imports all the unit test functions from all import unittest -from binarycpython.tests.test_c_bindings import (test_ensemble_functions, - test_return_store_memaddr, - test_run_system) +from binarycpython.tests.test_c_bindings import ( + test_ensemble_functions, + test_return_store_memaddr, + test_run_system, +) from binarycpython.tests.test_custom_logging import ( - test_autogen_C_logging_code, test_binary_c_log_code, - test_binary_c_write_log_code, test_create_and_load_logging_function, - test_from_binary_c_config, test_return_compilation_dict) + test_autogen_C_logging_code, + test_binary_c_log_code, + test_binary_c_write_log_code, + test_create_and_load_logging_function, + test_from_binary_c_config, + test_return_compilation_dict, +) from binarycpython.tests.test_dicts import ( - test__nested_get, test_AutoVivicationDict, test_count_keys_recursive, - test_custom_sort_dict, test_filter_dict, test_filter_dict_through_values, - test_inspect_dict, test_keys_to_floats, test_merge_dicts, - test_multiply_float_values, test_multiply_values_dict, test_normalize_dict, - test_prepare_dict, test_recursive_change_key_to_float, - test_recursive_change_key_to_string, test_setopts, test_subtract_dicts, - test_update_dicts) + test__nested_get, + test_AutoVivicationDict, + test_count_keys_recursive, + test_custom_sort_dict, + test_filter_dict, + test_filter_dict_through_values, + test_inspect_dict, + test_keys_to_floats, + test_merge_dicts, + test_multiply_float_values, + test_multiply_values_dict, + test_normalize_dict, + test_prepare_dict, + test_recursive_change_key_to_float, + test_recursive_change_key_to_string, + test_setopts, + test_subtract_dicts, + test_update_dicts, +) from binarycpython.tests.test_ensemble import ( - test_binaryc_json_serializer, test_BinarycDecoder, test_BinarycEncoder, - test_ensemble_file_type, test_extract_ensemble_json_from_string, - test_handle_ensemble_string_to_json, test_load_ensemble, - test_open_ensemble) + test_binaryc_json_serializer, + test_BinarycDecoder, + test_BinarycEncoder, + test_ensemble_file_type, + test_extract_ensemble_json_from_string, + test_handle_ensemble_string_to_json, + test_load_ensemble, + test_open_ensemble, +) from binarycpython.tests.test_functions import ( - test_bin_data, test_create_arg_string, test_create_hdf5, - test_example_parse_output, test_get_arg_keys, test_get_defaults, - test_get_help, test_get_help_all, test_get_help_super, - test_make_build_text, test_output_lines, test_remove_file, test_temp_dir, - test_verbose_print, test_write_binary_c_parameter_descriptions_to_rst_file) -from binarycpython.tests.test_grid import (test__cleanup_defaults, - test__dict_from_line_source_file, - test__increment_count, - test__increment_probtot, - test__return_argline, test__setup, - test_cmdline, test_evolve_single, - test_export_all_info, - test_grid_evolve, test_resultdict, - test_return_all_info, - test_return_binary_c_defaults, - test_return_population_settings, - test_set) -from binarycpython.tests.test_plot_functions import (test_color_by_index, - test_plot_system) + test_bin_data, + test_create_arg_string, + test_create_hdf5, + test_example_parse_output, + test_get_arg_keys, + test_get_defaults, + test_get_help, + test_get_help_all, + test_get_help_super, + test_make_build_text, + test_output_lines, + test_remove_file, + test_temp_dir, + test_verbose_print, + test_write_binary_c_parameter_descriptions_to_rst_file, +) +from binarycpython.tests.test_grid import ( + test__cleanup_defaults, + test__dict_from_line_source_file, + test__increment_count, + test__increment_probtot, + test__return_argline, + test__setup, + test_cmdline, + test_evolve_single, + test_export_all_info, + test_grid_evolve, + test_resultdict, + test_return_all_info, + test_return_binary_c_defaults, + test_return_population_settings, + test_set, +) +from binarycpython.tests.test_plot_functions import ( + test_color_by_index, + test_plot_system, +) from binarycpython.tests.test_run_system_wrapper import * from binarycpython.tests.test_stellar_types import * -from binarycpython.tests.test_useful_funcs import (test_calc_period_from_sep, - test_calc_sep_from_period, - test_ragb, test_roche_lobe, - test_rzams, - test_zams_collission) +from binarycpython.tests.test_useful_funcs import ( + test_calc_period_from_sep, + test_calc_sep_from_period, + test_ragb, + test_roche_lobe, + test_rzams, + test_zams_collission, +) from binarycpython.tests.tests_population_extensions.test_condor import ( - test_condor_check_requirements, test_condor_dirs, test_condor_outfile, - test_condorID, test_get_condor_status, test_make_condor_dirs, - test_set_condor_status) + test_condor_check_requirements, + test_condor_dirs, + test_condor_outfile, + test_condorID, + test_get_condor_status, + test_make_condor_dirs, + test_set_condor_status, +) from binarycpython.tests.tests_population_extensions.test_distribution_functions import ( - test_Arenou2010_binary_fraction, test_const_distribution, - test_duquennoy1991, test_flat, test_flatsections, test_gaussian, - test_imf_chabrier2003, test_imf_scalo1986, test_imf_scalo1998, - test_imf_tinsley1980, test_Izzard2012_period_distribution, test_Kroupa2001, - test_ktg93, test_number, test_powerlaw, test_raghavan2010_binary_fraction, - test_sana12, test_three_part_power_law) + test_Arenou2010_binary_fraction, + test_const_distribution, + test_duquennoy1991, + test_flat, + test_flatsections, + test_gaussian, + test_imf_chabrier2003, + test_imf_scalo1986, + test_imf_scalo1998, + test_imf_tinsley1980, + test_Izzard2012_period_distribution, + test_Kroupa2001, + test_ktg93, + test_number, + test_powerlaw, + test_raghavan2010_binary_fraction, + test_sana12, + test_three_part_power_law, +) from binarycpython.tests.tests_population_extensions.test_grid_options_defaults import ( - test_grid_options_description_checker, test_grid_options_help, - test_write_grid_options_to_rst_file) -from binarycpython.tests.tests_population_extensions.test_gridcode import \ - test_add_grid_variable + test_grid_options_description_checker, + test_grid_options_help, + test_write_grid_options_to_rst_file, +) +from binarycpython.tests.tests_population_extensions.test_gridcode import ( + test_add_grid_variable, +) from binarycpython.tests.tests_population_extensions.test_HPC import ( - test_HPC_check_requirements, test_HPC_dir, test_HPC_dirs, - test_HPC_get_status, test_HPC_id_filename, test_HPC_id_from_dir, - test_HPC_job, test_HPC_job_task, test_HPC_job_type, test_HPC_jobID, - test_HPC_jobID_tuple, test_HPC_njobs, test_HPC_set_status) + test_HPC_check_requirements, + test_HPC_dir, + test_HPC_dirs, + test_HPC_get_status, + test_HPC_id_filename, + test_HPC_id_from_dir, + test_HPC_job, + test_HPC_job_task, + test_HPC_job_type, + test_HPC_jobID, + test_HPC_jobID_tuple, + test_HPC_njobs, + test_HPC_set_status, +) from binarycpython.tests.tests_population_extensions.test_slurm import ( - test_get_slurm_status, test_make_slurm_dirs, test_set_slurm_status, - test_slurm_check_requirements, test_slurm_dirs, test_slurm_outfile, - test_slurmID) + test_get_slurm_status, + test_make_slurm_dirs, + test_set_slurm_status, + test_slurm_check_requirements, + test_slurm_dirs, + test_slurm_outfile, + test_slurmID, +) from binarycpython.tests.tests_population_extensions.test_version_info import ( - test_parse_binary_c_version_info, test_return_binary_c_version_info) + test_parse_binary_c_version_info, + test_return_binary_c_version_info, +) # from binarycpython.tests.test_spacing_functions import * # from binarycpython.tests.test_grid_options_defaults import * diff --git a/binarycpython/tests/python_API_test.py b/binarycpython/tests/python_API_test.py index 8a08b20d4b0d727d53e25f2c5acd6e6692f7ac3b..036314895f807d016a1bc27d9fafcb8657df73fa 100755 --- a/binarycpython/tests/python_API_test.py +++ b/binarycpython/tests/python_API_test.py @@ -9,8 +9,10 @@ import textwrap from binarycpython import _binary_c_bindings from binarycpython.utils.custom_logging_functions import ( - autogen_C_logging_code, binary_c_log_code, - create_and_load_logging_function) + autogen_C_logging_code, + binary_c_log_code, + create_and_load_logging_function, +) from binarycpython.utils.functions import temp_dir ############################################################ diff --git a/binarycpython/tests/test_custom_logging.py b/binarycpython/tests/test_custom_logging.py index c0dc8f0b1e6048403e3084eaf82f29559a45921f..90756698b4084ea2dd1cccde61c7e5c979aa5beb 100644 --- a/binarycpython/tests/test_custom_logging.py +++ b/binarycpython/tests/test_custom_logging.py @@ -6,9 +6,13 @@ import os import unittest from binarycpython.utils.custom_logging_functions import ( - autogen_C_logging_code, binary_c_log_code, binary_c_write_log_code, - create_and_load_logging_function, from_binary_c_config, - return_compilation_dict) + autogen_C_logging_code, + binary_c_log_code, + binary_c_write_log_code, + create_and_load_logging_function, + from_binary_c_config, + return_compilation_dict, +) from binarycpython.utils.functions import Capturing, temp_dir TMP_DIR = temp_dir("tests", "test_custom_logging") diff --git a/binarycpython/tests/test_dicts.py b/binarycpython/tests/test_dicts.py index 8d7bae89e23e02658f89d7c480b514f825c7971b..a1bc4e71d3f7666ca33d2d68d6cd1e9fc67152ce 100644 --- a/binarycpython/tests/test_dicts.py +++ b/binarycpython/tests/test_dicts.py @@ -8,17 +8,27 @@ import os import unittest from collections import OrderedDict -from binarycpython.utils.dicts import (AutoVivificationDict, _nested_get, - _nested_set, count_keys_recursive, - custom_sort_dict, filter_dict, - filter_dict_through_values, - inspect_dict, keys_to_floats, - merge_dicts, multiply_float_values, - multiply_values_dict, normalize_dict, - prepare_dict, - recursive_change_key_to_float, - recursive_change_key_to_string, - set_opts, subtract_dicts, update_dicts) +from binarycpython.utils.dicts import ( + AutoVivificationDict, + _nested_get, + _nested_set, + count_keys_recursive, + custom_sort_dict, + filter_dict, + filter_dict_through_values, + inspect_dict, + keys_to_floats, + merge_dicts, + multiply_float_values, + multiply_values_dict, + normalize_dict, + prepare_dict, + recursive_change_key_to_float, + recursive_change_key_to_string, + set_opts, + subtract_dicts, + update_dicts, +) from binarycpython.utils.functions import Capturing, temp_dir TMP_DIR = temp_dir("tests", "test_dicts") diff --git a/binarycpython/tests/test_ensemble.py b/binarycpython/tests/test_ensemble.py index 6c3e1fa8f7c07fa5ea067da34fcbf784ce4b8dd1..05df93ac8ca2895fa4bf65baa89825538e629d97 100644 --- a/binarycpython/tests/test_ensemble.py +++ b/binarycpython/tests/test_ensemble.py @@ -9,12 +9,16 @@ import sys import unittest from io import StringIO -from binarycpython.utils.ensemble import (BinarycDecoder, BinarycEncoder, - binaryc_json_serializer, - ensemble_file_type, - extract_ensemble_json_from_string, - handle_ensemble_string_to_json, - load_ensemble, open_ensemble) +from binarycpython.utils.ensemble import ( + BinarycDecoder, + BinarycEncoder, + binaryc_json_serializer, + ensemble_file_type, + extract_ensemble_json_from_string, + handle_ensemble_string_to_json, + load_ensemble, + open_ensemble, +) from binarycpython.utils.functions import Capturing, temp_dir from binarycpython.utils.population_class import Population diff --git a/binarycpython/tests/test_functions.py b/binarycpython/tests/test_functions.py index 1a56e02cc7c705606b7a4c22d502e3476b39fde6..f9d3b828fffc6b51d061c10e8658826db1c9c749 100644 --- a/binarycpython/tests/test_functions.py +++ b/binarycpython/tests/test_functions.py @@ -32,10 +32,24 @@ import h5py from binarycpython.utils.custom_logging_functions import binary_c_log_code from binarycpython.utils.functions import ( - Capturing, bin_data, create_arg_string, create_hdf5, example_parse_output, - get_arg_keys, get_defaults, get_help, get_help_all, get_help_super, - get_username, make_build_text, output_lines, remove_file, temp_dir, - verbose_print, write_binary_c_parameter_descriptions_to_rst_file) + Capturing, + bin_data, + create_arg_string, + create_hdf5, + example_parse_output, + get_arg_keys, + get_defaults, + get_help, + get_help_all, + get_help_super, + get_username, + make_build_text, + output_lines, + remove_file, + temp_dir, + verbose_print, + write_binary_c_parameter_descriptions_to_rst_file, +) from binarycpython.utils.run_system_wrapper import run_system TMP_DIR = temp_dir("tests", "test_functions") diff --git a/binarycpython/tests/test_grid.py b/binarycpython/tests/test_grid.py index 415d047d7f556c0c5c78fa4c290d9b8aecad79c2..9509aa4e213c56b96f4e483ca28cda8012b55e08 100644 --- a/binarycpython/tests/test_grid.py +++ b/binarycpython/tests/test_grid.py @@ -33,8 +33,7 @@ import unittest import numpy as np from binarycpython.utils.dicts import merge_dicts -from binarycpython.utils.functions import (Capturing, bin_data, remove_file, - temp_dir) +from binarycpython.utils.functions import Capturing, bin_data, remove_file, temp_dir from binarycpython.utils.population_class import Population TMP_DIR = temp_dir("tests", "test_grid") diff --git a/binarycpython/tests/test_useful_funcs.py b/binarycpython/tests/test_useful_funcs.py index 560bea4774585f70b2196b1c63c463ff9ae88b5e..6e8ee16ed626b86a30e69287931dab7f0b530a8c 100644 --- a/binarycpython/tests/test_useful_funcs.py +++ b/binarycpython/tests/test_useful_funcs.py @@ -7,10 +7,14 @@ import unittest import numpy as np from binarycpython.utils.functions import Capturing -from binarycpython.utils.useful_funcs import (calc_period_from_sep, - calc_sep_from_period, ragb, - roche_lobe, rzams, - zams_collision) +from binarycpython.utils.useful_funcs import ( + calc_period_from_sep, + calc_sep_from_period, + ragb, + roche_lobe, + rzams, + zams_collision, +) class test_calc_period_from_sep(unittest.TestCase): diff --git a/binarycpython/utils/ensemble.py b/binarycpython/utils/ensemble.py index f707cb743f139a00469709a7679a359326f17690..281a67ab4925915a77d112f0210f1048919a899e 100644 --- a/binarycpython/utils/ensemble.py +++ b/binarycpython/utils/ensemble.py @@ -1,7 +1,6 @@ """ Module containing functions to interact with binary_c's population ensemble using the binarycpython package - """ import bz2 @@ -18,9 +17,12 @@ import py_rinterpolate import simplejson from halo import Halo -from binarycpython.utils.dicts import (custom_sort_dict, keys_to_floats, - recursive_change_key_to_float, - recursive_change_key_to_string) +from binarycpython.utils.dicts import ( + custom_sort_dict, + keys_to_floats, + recursive_change_key_to_float, + recursive_change_key_to_string, +) from binarycpython.utils.functions import verbose_print @@ -177,7 +179,7 @@ def load_ensemble( """ nonlocal _loaded - if _loaded is False: + if not _loaded: _loaded = True print( "\nLoaded {} data, now putting in a dictionary".format( @@ -194,7 +196,7 @@ def load_ensemble( # simplejson is faster than standard json and "just works" # on the big Moe set in 37s - if quiet == False: + if not quiet: data = simplejson.load(file_object, object_hook=_hook) else: data = simplejson.load(file_object) diff --git a/binarycpython/utils/population_class.py b/binarycpython/utils/population_class.py index 783b2e1f57aa5d6a2655c79624ff07fccc9e70a1..fa1e56b11171a893ef137f221ff2cf013f6a7daa 100644 --- a/binarycpython/utils/population_class.py +++ b/binarycpython/utils/population_class.py @@ -26,47 +26,62 @@ from colorama import init as colorama_init from binarycpython.utils.dicts import AutoVivificationDict from binarycpython.utils.ensemble import new_grid_ensemble_results -from binarycpython.utils.functions import (check_if_in_shell, filter_arg_dict, - get_ANSI_colours, get_defaults, - hostnames, mem_use) +from binarycpython.utils.functions import ( + check_if_in_shell, + filter_arg_dict, + get_ANSI_colours, + get_defaults, + hostnames, + mem_use, +) + # Class extensions from binarycpython.utils.population_extensions.analytics import analytics -from binarycpython.utils.population_extensions.argument_handling import \ - argument_handling +from binarycpython.utils.population_extensions.argument_handling import ( + argument_handling, +) from binarycpython.utils.population_extensions.cache import cache -from binarycpython.utils.population_extensions.custom_generator_sampling import \ - custom_generator_sampling +from binarycpython.utils.population_extensions.custom_generator_sampling import ( + custom_generator_sampling, +) from binarycpython.utils.population_extensions.dataIO import dataIO -from binarycpython.utils.population_extensions.distribution_functions import \ - distribution_functions +from binarycpython.utils.population_extensions.distribution_functions import ( + distribution_functions, +) from binarycpython.utils.population_extensions.ensemble import ensemble -from binarycpython.utils.population_extensions.evolution_functions import \ - evolution_functions -from binarycpython.utils.population_extensions.failing_systems_functions import \ - failing_systems_functions +from binarycpython.utils.population_extensions.evolution_functions import ( + evolution_functions, +) +from binarycpython.utils.population_extensions.failing_systems_functions import ( + failing_systems_functions, +) from binarycpython.utils.population_extensions.grid_logging import grid_logging -from binarycpython.utils.population_extensions.grid_options_defaults import \ - grid_options_defaults -from binarycpython.utils.population_extensions.grid_sampling import \ - grid_sampling +from binarycpython.utils.population_extensions.grid_options_defaults import ( + grid_options_defaults, +) +from binarycpython.utils.population_extensions.grid_sampling import grid_sampling from binarycpython.utils.population_extensions.HPC import HPC from binarycpython.utils.population_extensions.metadata import metadata -from binarycpython.utils.population_extensions.miscellaneous_functions import \ - miscellaneous_functions -from binarycpython.utils.population_extensions.Moe_di_Stefano_2017 import \ - Moe_di_Stefano_2017 -from binarycpython.utils.population_extensions.monte_carlo_sampling import \ - monte_carlo_sampling -from binarycpython.utils.population_extensions.return_functions import \ - return_functions -from binarycpython.utils.population_extensions.signal_handling import \ - signal_handling -from binarycpython.utils.population_extensions.source_file_sampling import \ - source_file_sampling -from binarycpython.utils.population_extensions.spacing_functions import \ - spacing_functions -from binarycpython.utils.population_extensions.termination_functions import \ - termination_functions +from binarycpython.utils.population_extensions.miscellaneous_functions import ( + miscellaneous_functions, +) +from binarycpython.utils.population_extensions.Moe_di_Stefano_2017 import ( + Moe_di_Stefano_2017, +) +from binarycpython.utils.population_extensions.monte_carlo_sampling import ( + monte_carlo_sampling, +) +from binarycpython.utils.population_extensions.return_functions import return_functions +from binarycpython.utils.population_extensions.signal_handling import signal_handling +from binarycpython.utils.population_extensions.source_file_sampling import ( + source_file_sampling, +) +from binarycpython.utils.population_extensions.spacing_functions import ( + spacing_functions, +) +from binarycpython.utils.population_extensions.termination_functions import ( + termination_functions, +) from binarycpython.utils.population_extensions.version_info import version_info # Initialise colorama diff --git a/binarycpython/utils/population_extensions/Moe_di_Stefano_2017.py b/binarycpython/utils/population_extensions/Moe_di_Stefano_2017.py index ccde14c14892eb843a3d887799281bacf323b7d0..651931947b1c69b743418c32f9c228e15930b7b2 100644 --- a/binarycpython/utils/population_extensions/Moe_di_Stefano_2017.py +++ b/binarycpython/utils/population_extensions/Moe_di_Stefano_2017.py @@ -17,9 +17,12 @@ from binarycpython.utils import moe_di_stefano_2017_data from binarycpython.utils.dicts import normalize_dict, update_dicts from binarycpython.utils.functions import verbose_print from binarycpython.utils.population_extensions.distribution_functions import ( - LOG_LN_CONVERTER, Moecache) -from binarycpython.utils.population_extensions.grid_options_defaults import \ - _MOE2017_VERBOSITY_LEVEL + LOG_LN_CONVERTER, + Moecache, +) +from binarycpython.utils.population_extensions.grid_options_defaults import ( + _MOE2017_VERBOSITY_LEVEL, +) class Moe_di_Stefano_2017: diff --git a/binarycpython/utils/population_extensions/argument_handling.py b/binarycpython/utils/population_extensions/argument_handling.py index b4783aecf3fda73cc46a9d00f795502cc45fda02..646cdc6f18180a48d8a3d94f9aeb37b21ffe4ddd 100644 --- a/binarycpython/utils/population_extensions/argument_handling.py +++ b/binarycpython/utils/population_extensions/argument_handling.py @@ -279,7 +279,7 @@ class argument_handling: """ for key in full_system_dict.keys(): - if not key in self.available_keys: + if key not in self.available_keys: # Deal with special keys if not self._check_key_is_special_param(key): msg = "Error: Found a parameter unknown to binary_c: {}. Abort".format( diff --git a/binarycpython/utils/population_extensions/distribution_functions.py b/binarycpython/utils/population_extensions/distribution_functions.py index bed25df4b872c62692b4b3709f40e996772958ea..b023dcb87d29454c1591621a78d54025342d0aff 100644 --- a/binarycpython/utils/population_extensions/distribution_functions.py +++ b/binarycpython/utils/population_extensions/distribution_functions.py @@ -36,9 +36,10 @@ import py_rinterpolate from binarycpython.utils.dicts import prepare_dict from binarycpython.utils.functions import verbose_print from binarycpython.utils.population_extensions.grid_options_defaults import ( - _MOE2017_VERBOSITY_INTERPOLATOR_LEVEL, _MOE2017_VERBOSITY_LEVEL) -from binarycpython.utils.useful_funcs import (calc_period_from_sep, - calc_sep_from_period) + _MOE2017_VERBOSITY_INTERPOLATOR_LEVEL, + _MOE2017_VERBOSITY_LEVEL, +) +from binarycpython.utils.useful_funcs import calc_period_from_sep, calc_sep_from_period # Global dictinary to store values in Moecache = {} diff --git a/binarycpython/utils/population_extensions/evolution_functions.py b/binarycpython/utils/population_extensions/evolution_functions.py index a36bdff1ef8fbc732aa6770ff870af7e73566d05..6dd02f41ad7cb45c899aaf76949cc70b98de32ad 100644 --- a/binarycpython/utils/population_extensions/evolution_functions.py +++ b/binarycpython/utils/population_extensions/evolution_functions.py @@ -7,6 +7,7 @@ import functools import gc import json import multiprocessing + # pylint: disable=E1101 import os import queue @@ -21,8 +22,12 @@ import setproctitle from binarycpython import _binary_c_bindings from binarycpython.utils.dicts import keys_to_floats, merge_dicts from binarycpython.utils.ensemble import format_ensemble_results -from binarycpython.utils.functions import (calculate_total_mass_system, - mem_use, now, timedelta) +from binarycpython.utils.functions import ( + calculate_total_mass_system, + mem_use, + now, + timedelta, +) class evolution_functions: diff --git a/binarycpython/utils/population_extensions/grid_logging.py b/binarycpython/utils/population_extensions/grid_logging.py index 58b3369b270d51707ab1b84d6c4a8f43fe6a4bce..c629dac043eeb5762729f0ad45686d48886b77a6 100644 --- a/binarycpython/utils/population_extensions/grid_logging.py +++ b/binarycpython/utils/population_extensions/grid_logging.py @@ -13,12 +13,17 @@ import strip_ansi import binarycpython.utils.functions from binarycpython.utils.custom_logging_functions import ( - autogen_C_logging_code, binary_c_log_code, - create_and_load_logging_function) -from binarycpython.utils.functions import (format_number, remove_file, trem, - verbose_print) -from binarycpython.utils.population_extensions.grid_options_defaults import \ - secs_per_day + autogen_C_logging_code, + binary_c_log_code, + create_and_load_logging_function, +) +from binarycpython.utils.functions import ( + format_number, + remove_file, + trem, + verbose_print, +) +from binarycpython.utils.population_extensions.grid_options_defaults import secs_per_day class grid_logging: diff --git a/binarycpython/utils/population_extensions/monte_carlo_sampling.py b/binarycpython/utils/population_extensions/monte_carlo_sampling.py index 4cae8a51c7e3629f7c762181460a0769cc6b1e5e..9d56f983837e8733fbadb462accbecab16f1a393 100644 --- a/binarycpython/utils/population_extensions/monte_carlo_sampling.py +++ b/binarycpython/utils/population_extensions/monte_carlo_sampling.py @@ -4,6 +4,7 @@ Main script to provide the Monte-Carlo sampling class extensions import datetime import importlib + # pylint: disable=E1101 import os diff --git a/binarycpython/utils/population_extensions/return_functions.py b/binarycpython/utils/population_extensions/return_functions.py index f89f2b999cc0c630aa10711316863686aee8be4b..de611e4d7f33e15231af117fd1fc0494f83708e0 100644 --- a/binarycpython/utils/population_extensions/return_functions.py +++ b/binarycpython/utils/population_extensions/return_functions.py @@ -10,6 +10,7 @@ This consists of the following class methods: import copy import json + # pylint: disable=E1101 import os from typing import Union diff --git a/binarycpython/utils/run_system_wrapper.py b/binarycpython/utils/run_system_wrapper.py index 0b361f77f9be39cce25db5c113b1736dc38c5fb2..348c82360e61875743fd3b7799eef6b633905f20 100644 --- a/binarycpython/utils/run_system_wrapper.py +++ b/binarycpython/utils/run_system_wrapper.py @@ -4,10 +4,10 @@ which handles a lot of things by analysing the passed kwargs """ from binarycpython import _binary_c_bindings -from binarycpython.utils.custom_logging_functions import \ - create_and_load_logging_function -from binarycpython.utils.functions import (create_arg_string, get_arg_keys, - remove_file) +from binarycpython.utils.custom_logging_functions import ( + create_and_load_logging_function, +) +from binarycpython.utils.functions import create_arg_string, get_arg_keys, remove_file def run_system(**kwargs): diff --git a/docs/source/conf.py b/docs/source/conf.py index 92adb5663d112f3847c31412face826ce0b9923a..f211ec94f0c6ea7961968a078b5b94128bdd3ba5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,9 @@ import m2r2 from git import Repo from binarycpython.utils.functions import ( - call_binary_c_config, write_binary_c_parameter_descriptions_to_rst_file) + call_binary_c_config, + write_binary_c_parameter_descriptions_to_rst_file, +) from binarycpython.utils.grid import Population diff --git a/docs/source/examples/example_plotting_distributions.py b/docs/source/examples/example_plotting_distributions.py index 38988bb2303c603825e5e59b84f598e29476f35c..bee8f2c36a8758203429cbcae7c1584f16cb8d0d 100644 --- a/docs/source/examples/example_plotting_distributions.py +++ b/docs/source/examples/example_plotting_distributions.py @@ -4,10 +4,19 @@ import matplotlib.pyplot as plt import numpy as np from binarycpython.utils.distribution_functions import ( - Arenou2010_binary_fraction, Izzard2012_period_distribution, Kroupa2001, - duquennoy1991, flatsections, imf_chabrier2003, imf_scalo1986, - imf_scalo1998, imf_tinsley1980, raghavan2010_binary_fraction, sana12, - three_part_powerlaw) + Arenou2010_binary_fraction, + Izzard2012_period_distribution, + Kroupa2001, + duquennoy1991, + flatsections, + imf_chabrier2003, + imf_scalo1986, + imf_scalo1998, + imf_tinsley1980, + raghavan2010_binary_fraction, + sana12, + three_part_powerlaw, +) from binarycpython.utils.useful_funcs import calc_sep_from_period ################################################ diff --git a/examples/example_plotting_distributions.py b/examples/example_plotting_distributions.py index 67facf1bd34440936959fcbeb992c128143b70f6..2b36a0c37846e4ccce7b05b84a62e55bdf4f3463 100644 --- a/examples/example_plotting_distributions.py +++ b/examples/example_plotting_distributions.py @@ -4,6 +4,7 @@ import matplotlib.pyplot as plt import numpy as np from binarycpython import Population + # from binarycpython.utils.distribution_functions import ( # three_part_powerlaw, # Kroupa2001,