Repository: ethereum/py-geth

Issue:
`DevGethProcess` starts with 2 accounts that are the same
### What happened?

From @kclowes 

Running through the README examples, when I ask the `DevGethProcess` for accounts, I get a double of the same address:
```
>>> from geth import DevGethProcess
>>> g = DevGethProcess()
>>> g.accounts
('0xa95c66bff0c92edecb365c23d86f687026b48d79',
 '0xa95c66bff0c92edecb365c23d86f687026b48d79')
```

Occurs in v4.4.0

### Code that produced the error

_No response_

### Full error output

_No response_

### Fill this section in if you know how this could or should be fixed

Figure out why they're duplicated and fix it.

### py-geth Version

4.4.0

### Python Version

_No response_

### Operating System

_No response_

### Output from `pip freeze`

_No response_

Discussion:

Patch:
diff --git a/geth/accounts.py b/geth/accounts.py
index 30b3a64..0bf1357 100644
--- a/geth/accounts.py
+++ b/geth/accounts.py
@@ -197,4 +197,5 @@ def ensure_account_exists(**geth_kwargs: Unpack[GethKwargsTypedDict]) -> str:
 
 def parse_geth_accounts(raw_accounts_output: bytes) -> tuple[str, ...]:
     accounts = account_regex.findall(raw_accounts_output)
-    return tuple("0x" + account.decode() for account in accounts)
+    accounts_set = set(accounts)  # remove duplicates
+    return tuple("0x" + account.decode() for account in accounts_set)
diff --git a/newsfragments/219.bugfix.rst b/newsfragments/219.bugfix.rst
new file mode 100644
index 0000000..c8bffa4
--- /dev/null
+++ b/newsfragments/219.bugfix.rst
@@ -0,0 +1,1 @@
+Remove duplicates from dev mode account parsing for ``get_accounts()``.


Test patch:
diff --git a/tests/core/accounts/test_account_list_parsing.py b/tests/core/accounts/test_account_list_parsing.py
index 7597c72..20ac13c 100644
--- a/tests/core/accounts/test_account_list_parsing.py
+++ b/tests/core/accounts/test_account_list_parsing.py
@@ -2,13 +2,19 @@ from geth.accounts import (
     parse_geth_accounts,
 )
 
-raw_accounts = b"""Account #0: {d3cda913deb6f67967b99d67acdfa1712c293601}
-Account #1: {6f137a71a6f197df2cbbf010dcbd3c444ef5c925}\n"""
+raw_accounts = b"""Account #0: {8c28b76a845f525a7f91149864574d3a4986e693}
+keystore:///private/tmp/pytest-of-pygeth/pytest-1/test_with_no_overrides0/base-dir
+/testing/keystore/UTC--2024-06-19T20-40-51.284430000Z
+--8c28b76a845f525a7f91149864574d3a4986e693\n
+Account #1: {6f137a71a6f197df2cbbf010dcbd3c444ef5c925} keystore:///private/tmp
+/pytest-of-pygeth/pytest-1/test_with_no_overrides0/base-dir
+/testing/keystore/UTC--2024-06-19T20-40-51.284430000Z
+--6f137a71a6f197df2cbbf010dcbd3c444ef5c925\n"""
 accounts = (
-    "0xd3cda913deb6f67967b99d67acdfa1712c293601",
+    "0x8c28b76a845f525a7f91149864574d3a4986e693",
     "0x6f137a71a6f197df2cbbf010dcbd3c444ef5c925",
 )
 
 
 def test_parsing_accounts_output():
-    assert parse_geth_accounts(raw_accounts) == accounts
+    assert sorted(list(parse_geth_accounts(raw_accounts))) == sorted(list(accounts))