Skip to content

Commit 88a3f85

Browse files
committed
🔥 Remove redundant code
1 parent b8cd0f0 commit 88a3f85

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/repl_python_wakatime/hooks/codestats.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def __init__(
7575
self,
7676
api_key: str,
7777
url: str = "https://codestats.net/api/my/pulses",
78-
language: str = "python",
79-
language_type: str = "Terminal (%s)",
78+
language_type: str = "Terminal (python)",
8079
) -> None:
8180
"""Init.
8281
@@ -92,7 +91,7 @@ def __init__(
9291
"""
9392
self.url = url
9493
self.api_key = api_key
95-
self.language_type = language_type % language
94+
self.language_type = language_type
9695
self.xp_dict = {language_type: 0}
9796

9897
self.sem = threading.Semaphore()
@@ -138,9 +137,10 @@ def send_xp(self) -> None:
138137

139138
# after lock is released we can send the payload
140139
utc_now = datetime.now().astimezone().isoformat()
141-
pulse_json = json.dumps(
142-
{"coded_at": "{0}".format(utc_now), "xps": xp_list}
143-
).encode("utf-8")
140+
pulse_json = json.dumps({
141+
"coded_at": "{0}".format(utc_now),
142+
"xps": xp_list,
143+
}).encode("utf-8")
144144
req = Request(url=self.url, data=pulse_json, headers=headers)
145145
error = ""
146146
try:
@@ -162,7 +162,8 @@ def send_xp(self) -> None:
162162
error = e
163163
except HTTPException as e:
164164
error = "HTTPException on send data. Msg: {0}\nDoc?:{1}".format(
165-
e.message, e.__doc__ # type: ignore
165+
e.message,
166+
e.__doc__, # type: ignore
166167
)
167168
if error:
168169
logger.error(error)

0 commit comments

Comments
 (0)