Skip to content

Commit 10959a6

Browse files
committed
Remove name mangling
1 parent ebf2a37 commit 10959a6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

mystbin/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ async def close(self) -> None:
4646
4747
Closes the internal HTTP session and this client.
4848
"""
49-
if self.http.__session:
50-
await self.http.__session.close()
49+
if self.http._session:
50+
await self.http._session.close()
5151

5252
async def create_paste(
5353
self,

mystbin/http.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def __init__(self, verb: HTTPVerb, path: str, **params: Any) -> None:
128128

129129
class HTTPClient:
130130
__slots__ = (
131-
"__session",
131+
"_session",
132132
"_async",
133133
"_token",
134134
"_locks",
@@ -137,18 +137,18 @@ class HTTPClient:
137137

138138
def __init__(self, *, token: Optional[str], session: Optional[aiohttp.ClientSession] = None) -> None:
139139
self._token: Optional[str] = token
140-
self.__session: Optional[aiohttp.ClientSession] = session
140+
self._session: Optional[aiohttp.ClientSession] = session
141141
self._locks: weakref.WeakValueDictionary = weakref.WeakValueDictionary()
142142
user_agent = "mystbin.py (https://github.com/PythonistaGuild/mystbin.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}"
143143
self.user_agent: str = user_agent.format(__version__, sys.version_info, aiohttp.__version__)
144144

145145
async def _generate_session(self) -> aiohttp.ClientSession:
146-
self.__session = aiohttp.ClientSession()
147-
return self.__session
146+
self._session = aiohttp.ClientSession()
147+
return self._session
148148

149149
async def request(self, route: Route, **kwargs: Any) -> Any:
150-
if self.__session is None:
151-
self.__session = await self._generate_session()
150+
if self._session is None:
151+
self._session = await self._generate_session()
152152

153153
bucket = route.path
154154
lock = self._locks.get(bucket)
@@ -177,7 +177,7 @@ async def request(self, route: Route, **kwargs: Any) -> Any:
177177
with MaybeUnlock(lock) as maybe_lock:
178178
for tries in range(5):
179179
try:
180-
async with self.__session.request(route.verb, route.url, **kwargs) as response:
180+
async with self._session.request(route.verb, route.url, **kwargs) as response:
181181
# Requests remaining before ratelimit
182182
remaining = response.headers.get("x-ratelimit-remaining", None)
183183
LOGGER.debug("remaining is: %s", remaining)

0 commit comments

Comments
 (0)