14
14
)
15
15
from typing import (
16
16
Any ,
17
+ Optional ,
17
18
Type ,
18
19
Union ,
19
20
)
@@ -85,24 +86,26 @@ def reset(self) -> socket.socket:
85
86
return self .sock
86
87
87
88
88
- # type ignored b/c missing return statement is by design here
89
- def get_default_ipc_path () -> str : # type: ignore
89
+ def get_default_ipc_path () -> Optional [str ]:
90
90
if sys .platform == "darwin" :
91
91
ipc_path = os .path .expanduser (
92
92
os .path .join ("~" , "Library" , "Ethereum" , "geth.ipc" )
93
93
)
94
94
if os .path .exists (ipc_path ):
95
95
return ipc_path
96
+ return None
96
97
97
98
elif sys .platform .startswith ("linux" ) or sys .platform .startswith ("freebsd" ):
98
99
ipc_path = os .path .expanduser (os .path .join ("~" , ".ethereum" , "geth.ipc" ))
99
100
if os .path .exists (ipc_path ):
100
101
return ipc_path
102
+ return None
101
103
102
104
elif sys .platform == "win32" :
103
105
ipc_path = os .path .join ("\\ \\ " , "." , "pipe" , "geth.ipc" )
104
106
if os .path .exists (ipc_path ):
105
107
return ipc_path
108
+ return None
106
109
107
110
else :
108
111
raise ValueError (
@@ -111,22 +114,25 @@ def get_default_ipc_path() -> str: # type: ignore
111
114
)
112
115
113
116
114
- # type ignored b/c missing return statement is by design here
115
- def get_dev_ipc_path () -> str : # type: ignore
117
+ def get_dev_ipc_path () -> Optional [str ]:
116
118
if os .environ .get ("WEB3_PROVIDER_URI" , "" ):
117
119
ipc_path = os .environ .get ("WEB3_PROVIDER_URI" )
118
120
if os .path .exists (ipc_path ):
119
121
return ipc_path
122
+ return None
123
+
120
124
elif sys .platform == "darwin" :
121
125
tmpdir = os .environ .get ("TMPDIR" , "" )
122
126
ipc_path = os .path .expanduser (os .path .join (tmpdir , "geth.ipc" ))
123
127
if os .path .exists (ipc_path ):
124
128
return ipc_path
129
+ return None
125
130
126
131
elif sys .platform .startswith ("linux" ) or sys .platform .startswith ("freebsd" ):
127
132
ipc_path = os .path .expanduser (os .path .join ("/tmp" , "geth.ipc" ))
128
133
if os .path .exists (ipc_path ):
129
134
return ipc_path
135
+ return None
130
136
131
137
elif sys .platform == "win32" :
132
138
ipc_path = os .path .join ("\\ \\ " , "." , "pipe" , "geth.ipc" )
0 commit comments