Skip to content

Commit

Permalink
Merge pull request #191 from KingsburyLab/bugfix
Browse files Browse the repository at this point in the history
modify pre-commit; run on all files
  • Loading branch information
rkingsbury authored Sep 25, 2024
2 parents df70991 + 0eaacb6 commit 2ff92ef
Show file tree
Hide file tree
Showing 15 changed files with 21,040 additions and 21,023 deletions.
12 changes: 8 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
# Run the linter. filters are to exclude .ipynb files
- id: ruff
args: [--fix, --ignore, "D,E501", "--show-fixes"]
types_or: [ python, pyi ]
args: [--fix, --ignore, "D,E501", --show-fixes]
# Run the formatter. This WILL run on .ipynb files
- id: ruff-format

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
Expand All @@ -41,8 +45,8 @@ repos:
exclude_types: [svg]
- id: trailing-whitespace
exclude_types: [svg]
- id: check-yaml
- id: check-json
- id: pretty-format-json
indent: 4
exclude_types: [jupyter]
- id: check-yaml
- id: check-toml
args: [--autofix, --indent=4]
46 changes: 23 additions & 23 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"creators": [
{
"orcid": "0000-0002-7168-3967",
"affiliation": "Princeton University",
"name": "Kingsbury, Ryan"
}
],
"rights": [
{
"description": {
"en": ""
},
"id": "lgpl-3.0-only",
"props": {
"scheme": "spdx",
"url": "https://www.gnu.org/licenses/lgpl-3.0-standalone.html"
},
"title": {
"en": "GNU Lesser General Public License v3.0 only"
}
}
],
"title": "pyEQL: A python library for water chemistry"
"creators": [
{
"affiliation": "Princeton University",
"name": "Kingsbury, Ryan",
"orcid": "0000-0002-7168-3967"
}
],
"rights": [
{
"description": {
"en": ""
},
"id": "lgpl-3.0-only",
"props": {
"scheme": "spdx",
"url": "https://www.gnu.org/licenses/lgpl-3.0-standalone.html"
},
"title": {
"en": "GNU Lesser General Public License v3.0 only"
}
}
],
"title": "pyEQL: A python library for water chemistry"
}
22 changes: 10 additions & 12 deletions docs/examples/.ipynb_checkpoints/pyEQL_demo_1-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"source": [
"import numpy as np\n",
"\n",
"array = np.array([[1,2,3,4,5], [6,7,8,9,10]])\n",
"array = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])\n",
"array"
]
},
Expand Down Expand Up @@ -145,9 +145,7 @@
"source": [
"from pyEQL import Solution\n",
"\n",
"s1 = Solution({\"Na+\": \"0.1 mol/L\",\n",
" \"Cl-\": \"0.1 mol/L\"\n",
" })"
"s1 = Solution({\"Na+\": \"0.1 mol/L\", \"Cl-\": \"0.1 mol/L\"})"
]
},
{
Expand Down Expand Up @@ -277,7 +275,7 @@
}
],
"source": [
"s1.get_activity('Na+')"
"s1.get_activity(\"Na+\")"
]
},
{
Expand All @@ -303,7 +301,7 @@
}
],
"source": [
"s1.get_amount('Na+', \"mol/kg\")"
"s1.get_amount(\"Na+\", \"mol/kg\")"
]
},
{
Expand All @@ -329,7 +327,7 @@
}
],
"source": [
"s1.get_amount('Na+', \"mol/L\")"
"s1.get_amount(\"Na+\", \"mol/L\")"
]
},
{
Expand All @@ -355,7 +353,7 @@
}
],
"source": [
"s1.get_amount('Na+', \"%\") #weight percent"
"s1.get_amount(\"Na+\", \"%\") # weight percent"
]
},
{
Expand All @@ -381,7 +379,7 @@
}
],
"source": [
"s1.get_amount('Na+', \"fraction\") # mole fraction"
"s1.get_amount(\"Na+\", \"fraction\") # mole fraction"
]
},
{
Expand Down Expand Up @@ -422,7 +420,7 @@
"source": [
"# native engine\n",
"s1 = Solution({\"Na+\": \"0.1 mol/L\", \"Cl-\": \"0.1 mol/L\"}, engine=\"native\")\n",
"s1.get_activity_coefficient('Na+', scale=\"molar\")"
"s1.get_activity_coefficient(\"Na+\", scale=\"molar\")"
]
},
{
Expand Down Expand Up @@ -450,7 +448,7 @@
"source": [
"# ideal engine\n",
"s1 = Solution([[\"Na+\", \"0.1 mol/L\"], [\"Cl-\", \"0.1 mol/L\"]], engine=\"native\")\n",
"s1.get_activity_coefficient('Na+', scale=\"molar\")"
"s1.get_activity_coefficient(\"Na+\", scale=\"molar\")"
]
},
{
Expand Down Expand Up @@ -479,7 +477,7 @@
"from pyEQL import Solution\n",
"\n",
"s1 = Solution({\"Na+\": \"0.1 mol/L\", \"Cl-\": \"0.1 mol/L\"}, engine=\"ideal\")\n",
"s1.get_activity_coefficient('Na+', scale=\"molar\")"
"s1.get_activity_coefficient(\"Na+\", scale=\"molar\")"
]
},
{
Expand Down
25 changes: 13 additions & 12 deletions docs/examples/.ipynb_checkpoints/pyeql_demo-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
}
],
"source": [
"s1 = Solution({\"Mg+2\": \"0.2 mol/L\", \"Cl-1\": \"0.4 mol/L\"}, temperature='20 degC')"
"s1 = Solution({\"Mg+2\": \"0.2 mol/L\", \"Cl-1\": \"0.4 mol/L\"}, temperature=\"20 degC\")"
]
},
{
Expand Down Expand Up @@ -409,7 +409,7 @@
}
],
"source": [
"s1.get_amount('Mg+2', 'M')"
"s1.get_amount(\"Mg+2\", \"M\")"
]
},
{
Expand All @@ -436,7 +436,7 @@
}
],
"source": [
"s1.get_amount('Cl-', '%')"
"s1.get_amount(\"Cl-\", \"%\")"
]
},
{
Expand All @@ -463,7 +463,7 @@
}
],
"source": [
"s1.get_amount('Mg+2', 'eq/L')"
"s1.get_amount(\"Mg+2\", \"eq/L\")"
]
},
{
Expand All @@ -490,7 +490,7 @@
}
],
"source": [
"s1.get_amount('Mg+2', 'ug/kg')"
"s1.get_amount(\"Mg+2\", \"ug/kg\")"
]
},
{
Expand Down Expand Up @@ -525,7 +525,7 @@
}
],
"source": [
"s1.get_transport_number('Na+')"
"s1.get_transport_number(\"Na+\")"
]
},
{
Expand All @@ -552,7 +552,7 @@
}
],
"source": [
"s1.get_transport_number('Mg+2')"
"s1.get_transport_number(\"Mg+2\")"
]
},
{
Expand All @@ -579,7 +579,7 @@
}
],
"source": [
"s1.get_transport_number('Cl-')"
"s1.get_transport_number(\"Cl-\")"
]
},
{
Expand Down Expand Up @@ -637,7 +637,8 @@
"outputs": [],
"source": [
"from monty.serialization import dumpfn\n",
"dumpfn(s1, 'test_solution.json')"
"\n",
"dumpfn(s1, \"test_solution.json\")"
]
},
{
Expand Down Expand Up @@ -727,7 +728,7 @@
}
],
"source": [
"s1.volume.to('mL')"
"s1.volume.to(\"mL\")"
]
},
{
Expand All @@ -754,7 +755,7 @@
}
],
"source": [
"s1.volume.to('gal')"
"s1.volume.to(\"gal\")"
]
},
{
Expand Down Expand Up @@ -783,7 +784,7 @@
}
],
"source": [
"s1.osmotic_pressure.to('bar').magnitude"
"s1.osmotic_pressure.to(\"bar\").magnitude"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
],
"source": [
"# a document with the formula \"Na[+1]\"\n",
"IonDB.query_one({\"formula\":'Na[+1]'})"
"IonDB.query_one({\"formula\": \"Na[+1]\"})"
]
},
{
Expand Down Expand Up @@ -277,7 +277,7 @@
],
"source": [
"# a document with the formula \"Na[+1]\", where we only want the formula, charge, and molecular_weight\n",
"IonDB.query_one({\"formula\":'Na[+1]'}, [\"formula\",\"charge\",\"molecular_weight\"])"
"IonDB.query_one({\"formula\": \"Na[+1]\"}, [\"formula\", \"charge\", \"molecular_weight\"])"
]
},
{
Expand All @@ -302,7 +302,7 @@
],
"source": [
"# a document with the charge -1, where we only want the formula, charge, and molecular_weight\n",
"IonDB.query_one({\"charge\":-1}, [\"formula\",\"charge\",\"molecular_weight\"])"
"IonDB.query_one({\"charge\": -1}, [\"formula\", \"charge\", \"molecular_weight\"])"
]
},
{
Expand All @@ -321,7 +321,7 @@
"outputs": [],
"source": [
"# a document with the charge -1, where we only want the formula, charge, and molecular_weight\n",
"IonDB.query_one({\"charge\":\"-1\"}, [\"formula\",\"charge\",\"molecular_weight\"])"
"IonDB.query_one({\"charge\": \"-1\"}, [\"formula\", \"charge\", \"molecular_weight\"])"
]
},
{
Expand Down Expand Up @@ -405,6 +405,7 @@
"source": [
"# pint Quantity\n",
"from pyEQL import ureg\n",
"\n",
"print(ureg.Quantity(\"2.27 Å\").magnitude)"
]
},
Expand Down Expand Up @@ -437,7 +438,7 @@
],
"source": [
"# all documents with a charge of +2, returning only the formulas\n",
"IonDB.query({\"charge\":2}, [\"formula\",\"molecular_weight\"])"
"IonDB.query({\"charge\": 2}, [\"formula\", \"molecular_weight\"])"
]
},
{
Expand Down Expand Up @@ -577,7 +578,7 @@
],
"source": [
"# using list()\n",
"list(IonDB.query({\"charge\":2}, [\"formula\",\"molecular_weight\"]))"
"list(IonDB.query({\"charge\": 2}, [\"formula\", \"molecular_weight\"]))"
]
},
{
Expand Down Expand Up @@ -709,7 +710,7 @@
],
"source": [
"# using a comprehension\n",
"[doc for doc in IonDB.query({\"charge\":2}, [\"formula\",\"molecular_weight\"])]"
"[doc for doc in IonDB.query({\"charge\": 2}, [\"formula\", \"molecular_weight\"])]"
]
},
{
Expand Down Expand Up @@ -810,10 +811,7 @@
],
"source": [
"# all alkali cations\n",
"IonDB.count({\"formula\":\n",
" {\"$in\": [\"Li[+1]\", \"Na[+1]\", \"K[+1]\", \"Rb[+1]\", \"Cs[+1]\"]}\n",
" }\n",
" )"
"IonDB.count({\"formula\": {\"$in\": [\"Li[+1]\", \"Na[+1]\", \"K[+1]\", \"Rb[+1]\", \"Cs[+1]\"]}})"
]
},
{
Expand Down Expand Up @@ -845,10 +843,7 @@
],
"source": [
"# all solutes with a charge less than 0\n",
"IonDB.count({\"charge\":\n",
" {\"$lt\": 0}\n",
" }\n",
" )"
"IonDB.count({\"charge\": {\"$lt\": 0}})"
]
},
{
Expand All @@ -870,10 +865,7 @@
],
"source": [
"# all solutes with a charge greater than or equal to 1\n",
"IonDB.count({\"charge\":\n",
" {\"$gte\": 1}\n",
" }\n",
" )"
"IonDB.count({\"charge\": {\"$gte\": 1}})"
]
},
{
Expand Down Expand Up @@ -1250,7 +1242,7 @@
],
"source": [
"# list of all unique `formula`\n",
"IonDB.distinct('formula')"
"IonDB.distinct(\"formula\")"
]
}
],
Expand Down
Loading

0 comments on commit 2ff92ef

Please sign in to comment.