From 1d17cb05ed695294956dc892205eb451a3d1cd8e Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Sat, 30 May 2020 13:15:45 -0700 Subject: [PATCH 1/2] Remove TODO for refactoring. Done already. --- propka/calculations.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/propka/calculations.py b/propka/calculations.py index 915b713..1c48384 100644 --- a/propka/calculations.py +++ b/propka/calculations.py @@ -2,15 +2,6 @@ import math -# TODO - this file should be broken into three separate files: -# * calculations.py - includes basic functions for calculating distances, etc. -# * hydrogen.py - includes bonding and protonation functions -# * energy.py - includes energy functions (dependent on distance functions) - - -# TODO - the next set of functions form a distinct "module" for distance calculation - - # Maximum distance used to bound calculations of smallest distance MAX_DISTANCE = 1e6 From 7085271ad5d5b09ae0ecc53b729a6b01defc9837 Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Wed, 3 Jun 2020 17:49:19 -0700 Subject: [PATCH 2/2] Simplify with .writable() method. Addresses https://github.com/jensengroup/propka-3.1/pull/50#discussion_r434349737 --- propka/output.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/propka/output.py b/propka/output.py index 2ee5f89..7353779 100644 --- a/propka/output.py +++ b/propka/output.py @@ -13,8 +13,7 @@ def open_file_for_writing(input_file): then will attempt to get file mode. """ try: - mode = input_file.mode - if not ("w" in mode or "a" in mode or "+" in mode): + if not input_file.writable(): raise IOError("File/stream not open for writing") return input_file except AttributeError: