Skip to content

Commit 20a5191

Browse files
nmodiclaude
andcommitted
fix: resolve ruff linting errors in live http refactor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d1e0b2b commit 20a5191

4 files changed

Lines changed: 89 additions & 112 deletions

File tree

src/nba_api/live/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from nba_api.library import http
22

3-
43
try:
54
from nba_api.library.debug.debug import STATS_HEADERS as _STATS_HEADERS
5+
66
_COMMON_HEADERS = _STATS_HEADERS
77
except ImportError:
88
_COMMON_HEADERS = {

src/nba_api/live/nba/library/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from nba_api.live.http import BaseLiveHTTP, _COMMON_HEADERS
1+
from nba_api.live.http import _COMMON_HEADERS, BaseLiveHTTP
22

33

44
class NBALiveHTTP(BaseLiveHTTP):

src/nba_api/live/wnba/library/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from nba_api.live.http import BaseLiveHTTP, _COMMON_HEADERS
1+
from nba_api.live.http import _COMMON_HEADERS, BaseLiveHTTP
22

33

44
class WNBALiveHTTP(BaseLiveHTTP):

tests/unit/test_live_boxscore_wnba.py

Lines changed: 86 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
import pytest
21
import json
2+
3+
import pytest
4+
35
from nba_api.library.http import NBAHTTP, NBAResponse
46
from nba_api.live.nba.endpoints import boxscore
57
from nba_api.live.wnba.library.http import WNBALiveHTTP
68

7-
89
content = {
910
"meta": {
1011
"version": 1,
1112
"code": 200,
1213
"request": "http://nba.cloud/games/1022500153/boxscore?Format=json",
13-
"time": "2025-07-24 23:07:22.884009"
14+
"time": "2025-07-24 23:07:22.884009",
1415
},
1516
"game": {
1617
"gameId": "1022500153",
@@ -34,7 +35,7 @@
3435
"arenaCity": "Indianapolis",
3536
"arenaState": "IN",
3637
"arenaCountry": "US",
37-
"arenaTimezone": "America/Indiana/Indianapolis"
38+
"arenaTimezone": "America/Indiana/Indianapolis",
3839
},
3940
"officials": [
4041
{
@@ -44,7 +45,7 @@
4445
"firstName": "Amy",
4546
"familyName": "Bonner",
4647
"jerseyNum": "31",
47-
"assignment": "OFFICIAL2"
48+
"assignment": "OFFICIAL2",
4849
},
4950
],
5051
"homeTeam": {
@@ -55,13 +56,7 @@
5556
"score": 80,
5657
"inBonus": "1",
5758
"timeoutsRemaining": 1,
58-
"periods": [
59-
{
60-
"period": 1,
61-
"periodType": "REGULAR",
62-
"score": 18
63-
}
64-
],
59+
"periods": [{"period": 1, "periodType": "REGULAR", "score": 18}],
6560
"players": [
6661
{
6762
"status": "ACTIVE",
@@ -105,12 +100,12 @@
105100
"turnovers": 0,
106101
"twoPointersAttempted": 1,
107102
"twoPointersMade": 1,
108-
"twoPointersPercentage": 1.0
103+
"twoPointersPercentage": 1.0,
109104
},
110105
"name": "Sophie Cunningham",
111106
"nameI": "S. Cunningham",
112107
"firstName": "Sophie",
113-
"familyName": "Cunningham"
108+
"familyName": "Cunningham",
114109
}
115110
],
116111
"statistics": {
@@ -175,8 +170,8 @@
175170
"turnoversTotal": 14,
176171
"twoPointersAttempted": 48,
177172
"twoPointersMade": 18,
178-
"twoPointersPercentage": 0.375
179-
}
173+
"twoPointersPercentage": 0.375,
174+
},
180175
},
181176
"awayTeam": {
182177
"teamId": 1611661319,
@@ -186,13 +181,7 @@
186181
"score": 70,
187182
"inBonus": "0",
188183
"timeoutsRemaining": 1,
189-
"periods": [
190-
{
191-
"period": 1,
192-
"periodType": "REGULAR",
193-
"score": 18
194-
}
195-
],
184+
"periods": [{"period": 1, "periodType": "REGULAR", "score": 18}],
196185
"players": [
197186
{
198187
"status": "ACTIVE",
@@ -236,80 +225,80 @@
236225
"turnovers": 1,
237226
"twoPointersAttempted": 10,
238227
"twoPointersMade": 7,
239-
"twoPointersPercentage": 0.7
228+
"twoPointersPercentage": 0.7,
240229
},
241230
"name": "Jackie Young",
242231
"nameI": "J. Young",
243232
"firstName": "Jackie",
244-
"familyName": "Young"
233+
"familyName": "Young",
245234
},
246235
],
247236
"statistics": {
248-
"assists": 12,
249-
"assistsTurnoverRatio": 0.857142857142857,
250-
"benchPoints": 4,
251-
"biggestLead": 8,
252-
"biggestLeadScore": "26-18",
253-
"biggestScoringRun": 14,
254-
"biggestScoringRunScore": "26-18",
255-
"blocks": 3,
256-
"blocksReceived": 1,
257-
"fastBreakPointsAttempted": 9,
258-
"fastBreakPointsMade": 1,
259-
"fastBreakPointsPercentage": 0.111111111111111,
260-
"fieldGoalsAttempted": 67,
261-
"fieldGoalsEffectiveAdjusted": 0.417910447761194,
262-
"fieldGoalsMade": 27,
263-
"fieldGoalsPercentage": 0.402985074626866,
264-
"foulsOffensive": 3,
265-
"foulsDrawn": 16,
266-
"foulsPersonal": 21,
267-
"foulsTeam": 18,
268-
"foulsTechnical": 0,
269-
"foulsTeamTechnical": 0,
270-
"freeThrowsAttempted": 17,
271-
"freeThrowsMade": 14,
272-
"freeThrowsPercentage": 0.823529411764706,
273-
"leadChanges": 11,
274-
"minutes": "PT200M00.00S",
275-
"minutesCalculated": "PT200M",
276-
"points": 70,
277-
"pointsAgainst": 80,
278-
"pointsFastBreak": 2,
279-
"pointsFromTurnovers": 16,
280-
"pointsInThePaint": 38,
281-
"pointsInThePaintAttempted": 40,
282-
"pointsInThePaintMade": 19,
283-
"pointsInThePaintPercentage": 0.475,
284-
"pointsSecondChance": 10,
285-
"reboundsDefensive": 28,
286-
"reboundsOffensive": 9,
287-
"reboundsPersonal": 37,
288-
"reboundsTeam": 5,
289-
"reboundsTeamDefensive": 1,
290-
"reboundsTeamOffensive": 4,
291-
"reboundsTotal": 42,
292-
"secondChancePointsAttempted": 8,
293-
"secondChancePointsMade": 5,
294-
"secondChancePointsPercentage": 0.625,
295-
"steals": 7,
296-
"teamFieldGoalAttempts": 0,
297-
"threePointersAttempted": 15,
298-
"threePointersMade": 2,
299-
"threePointersPercentage": 0.133333333333333,
300-
"timeLeading": "PT12M21.00S",
301-
"timesTied": 5,
302-
"trueShootingAttempts": 74.48,
303-
"trueShootingPercentage": 0.469924812030075,
304-
"turnovers": 14,
305-
"turnoversTeam": 0,
306-
"turnoversTotal": 14,
307-
"twoPointersAttempted": 52,
308-
"twoPointersMade": 25,
309-
"twoPointersPercentage": 0.480769230769231
310-
}
311-
}
312-
}
237+
"assists": 12,
238+
"assistsTurnoverRatio": 0.857142857142857,
239+
"benchPoints": 4,
240+
"biggestLead": 8,
241+
"biggestLeadScore": "26-18",
242+
"biggestScoringRun": 14,
243+
"biggestScoringRunScore": "26-18",
244+
"blocks": 3,
245+
"blocksReceived": 1,
246+
"fastBreakPointsAttempted": 9,
247+
"fastBreakPointsMade": 1,
248+
"fastBreakPointsPercentage": 0.111111111111111,
249+
"fieldGoalsAttempted": 67,
250+
"fieldGoalsEffectiveAdjusted": 0.417910447761194,
251+
"fieldGoalsMade": 27,
252+
"fieldGoalsPercentage": 0.402985074626866,
253+
"foulsOffensive": 3,
254+
"foulsDrawn": 16,
255+
"foulsPersonal": 21,
256+
"foulsTeam": 18,
257+
"foulsTechnical": 0,
258+
"foulsTeamTechnical": 0,
259+
"freeThrowsAttempted": 17,
260+
"freeThrowsMade": 14,
261+
"freeThrowsPercentage": 0.823529411764706,
262+
"leadChanges": 11,
263+
"minutes": "PT200M00.00S",
264+
"minutesCalculated": "PT200M",
265+
"points": 70,
266+
"pointsAgainst": 80,
267+
"pointsFastBreak": 2,
268+
"pointsFromTurnovers": 16,
269+
"pointsInThePaint": 38,
270+
"pointsInThePaintAttempted": 40,
271+
"pointsInThePaintMade": 19,
272+
"pointsInThePaintPercentage": 0.475,
273+
"pointsSecondChance": 10,
274+
"reboundsDefensive": 28,
275+
"reboundsOffensive": 9,
276+
"reboundsPersonal": 37,
277+
"reboundsTeam": 5,
278+
"reboundsTeamDefensive": 1,
279+
"reboundsTeamOffensive": 4,
280+
"reboundsTotal": 42,
281+
"secondChancePointsAttempted": 8,
282+
"secondChancePointsMade": 5,
283+
"secondChancePointsPercentage": 0.625,
284+
"steals": 7,
285+
"teamFieldGoalAttempts": 0,
286+
"threePointersAttempted": 15,
287+
"threePointersMade": 2,
288+
"threePointersPercentage": 0.133333333333333,
289+
"timeLeading": "PT12M21.00S",
290+
"timesTied": 5,
291+
"trueShootingAttempts": 74.48,
292+
"trueShootingPercentage": 0.469924812030075,
293+
"turnovers": 14,
294+
"turnoversTeam": 0,
295+
"turnoversTotal": 14,
296+
"twoPointersAttempted": 52,
297+
"twoPointersMade": 25,
298+
"twoPointersPercentage": 0.480769230769231,
299+
},
300+
},
301+
},
313302
}
314303
game_details = {
315304
"gameId": "1022500153",
@@ -336,13 +325,7 @@
336325
"score": 80,
337326
"inBonus": "1",
338327
"timeoutsRemaining": 1,
339-
"periods": [
340-
{
341-
"period": 1,
342-
"periodType": "REGULAR",
343-
"score": 18
344-
}
345-
],
328+
"periods": [{"period": 1, "periodType": "REGULAR", "score": 18}],
346329
"statistics": {
347330
"assists": 17,
348331
"assistsTurnoverRatio": 1.21428571428571,
@@ -405,8 +388,8 @@
405388
"turnoversTotal": 14,
406389
"twoPointersAttempted": 48,
407390
"twoPointersMade": 18,
408-
"twoPointersPercentage": 0.375
409-
}
391+
"twoPointersPercentage": 0.375,
392+
},
410393
}
411394
away_team_stats = {
412395
"teamId": 1611661319,
@@ -416,13 +399,7 @@
416399
"score": 70,
417400
"inBonus": "0",
418401
"timeoutsRemaining": 1,
419-
"periods": [
420-
{
421-
"period": 1,
422-
"periodType": "REGULAR",
423-
"score": 18
424-
}
425-
],
402+
"periods": [{"period": 1, "periodType": "REGULAR", "score": 18}],
426403
"statistics": {
427404
"assists": 12,
428405
"assistsTurnoverRatio": 0.857142857142857,
@@ -485,16 +462,16 @@
485462
"turnoversTotal": 14,
486463
"twoPointersAttempted": 52,
487464
"twoPointersMade": 25,
488-
"twoPointersPercentage": 0.480769230769231
489-
}
465+
"twoPointersPercentage": 0.480769230769231,
466+
},
490467
}
491468

492469
game_id = "1022500153"
493470

494471

495472
@pytest.fixture
496473
def nba_http_patch(monkeypatch):
497-
class MockResponse(object):
474+
class MockResponse:
498475
def __init__(*args, **kwargs):
499476
pass
500477

0 commit comments

Comments
 (0)