-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnhl.html
More file actions
245 lines (211 loc) · 13.7 KB
/
nhl.html
File metadata and controls
245 lines (211 loc) · 13.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>NHL module — LEDScoreboard alpha documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="NBA module" href="nba.html" />
<link rel="prev" title="utils.py" href="utils.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="nhl-module">
<h1>NHL module<a class="headerlink" href="#nhl-module" title="Permalink to this headline">¶</a></h1>
<section id="module-nhl">
<span id="init-py"></span><h2>__init__.py<a class="headerlink" href="#module-nhl" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt id="nhl.draw_board">
<code class="sig-prename descclassname"><span class="pre">nhl.</span></code><code class="sig-name descname"><span class="pre">draw_board</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> → <span class="pre">int</span><a class="reference internal" href="_modules/nhl.html#draw_board"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.draw_board" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw components of NHL game.</p>
<p>Firstly, creates a canvas for the LED matrix using various configurations.
Requests games for the day for NHL and draws various components of the game such as team logos, scores, period, and time.</p>
<p>Also, draws “SCORE!!!” animation for the game if there is an update in the score.</p>
<p>If button is pressed during the execution, it will load the next game. If the game is the last one for the day in NHL, then it will
go to the next league.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Return -1 if no favorite game.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>int</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-nhl.game">
<span id="game-py"></span><h2>game.py<a class="headerlink" href="#module-nhl.game" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt id="nhl.game.Game">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">nhl.game.</span></code><code class="sig-name descname"><span class="pre">Game</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">game_info</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">any</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/nhl/game.html#Game"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.game.Game" title="Permalink to this definition">¶</a></dt>
<dd><p>Represent a scheduled NHL game</p>
<p>Game object first parses the JSON dict information.
Also contains methods to check if the game is scheduled today and if the game is of a favorite team.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>game_info</strong> (<em>Dict</em><em>[</em><em>str</em><em>, </em><em>any</em><em>]</em>) – Dictionary generated from JSON object</p>
</dd>
</dl>
<dl class="py method">
<dt id="nhl.game.Game.get_matchup">
<code class="sig-name descname"><span class="pre">get_matchup</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> → <span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><a class="reference internal" href="_modules/nhl/game.html#Game.get_matchup"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.game.Game.get_matchup" title="Permalink to this definition">¶</a></dt>
<dd><p>Get information of a single game.</p>
<p>Simply game information into a dictionary to be used by the draw_board() function.
Returns a dictionary with names for home and away team, game stage, game status, game clock,
score. If the game stage is in progress and the status is live or pre, then also includes time and period fields.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Game information in a dictionary.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Dict[str, str]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="nhl.game.Game.is_favorite_match">
<code class="sig-name descname"><span class="pre">is_favorite_match</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> → <span class="pre">bool</span><a class="reference internal" href="_modules/nhl/game.html#Game.is_favorite_match"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.game.Game.is_favorite_match" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if game has a team favorited by the user.</p>
<p>Since only the games included in the favorite config are shown, this function checks that
either home or away team is a favorite.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>True if game if either home or away team is a favorite.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>bool</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="nhl.game.Game.is_scheduled_for_today">
<code class="sig-name descname"><span class="pre">is_scheduled_for_today</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> → <span class="pre">bool</span><a class="reference internal" href="_modules/nhl/game.html#Game.is_scheduled_for_today"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.game.Game.is_scheduled_for_today" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if game is scheduled for today.</p>
<p>The scoreboard is used to show only the games scheduled for the current day.
Since the NHL API returns a JSON with games for the entire week, this function is used to pick out the games
for the current day.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>True if game if scheduled for today.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>bool</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="nhl.game.Scores">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">nhl.game.</span></code><code class="sig-name descname"><span class="pre">Scores</span></code><a class="reference internal" href="_modules/nhl/game.html#Scores"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.game.Scores" title="Permalink to this definition">¶</a></dt>
<dd><p>Scores Class with static function to get scores for the leauge.</p>
<dl class="py method">
<dt id="nhl.game.Scores.get_scores">
<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">get_scores</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span> → <span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><a class="reference internal" href="_modules/nhl/game.html#Scores.get_scores"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.game.Scores.get_scores" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of favorite scores/games that are on-going or planned for the day.</p>
<p>First, calls for the request of JSON from NHL API and creates Game objects from the data.
Then, checks for the games scheduled for the day and if the games are favorites.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List of python dicts that contain information of today’s games. Empty list if no games fit the criteria.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>List[Tuple[str, str]]</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
<section id="module-nhl.fix_names">
<span id="fix-names-py"></span><h2>fix_names.py<a class="headerlink" href="#module-nhl.fix_names" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt id="nhl.fix_names.fix_name">
<code class="sig-prename descclassname"><span class="pre">nhl.fix_names.</span></code><code class="sig-name descname"><span class="pre">fix_name</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">team_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> → <span class="pre">str</span><a class="reference internal" href="_modules/nhl/fix_names.html#fix_name"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#nhl.fix_names.fix_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Expand some team names from the values in JSON.</p>
<p>Some of the names for NHL teams used in the API JSON are incorrect.
In the sense that they omit certain words of the team name. This function fixes that inconsistency.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>team_name</strong> (<em>str</em>) – Shortened name of the team</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Expanded name of the team (without city)</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-nhl.teams">
<span id="teams-py"></span><h2>teams.py<a class="headerlink" href="#module-nhl.teams" title="Permalink to this headline">¶</a></h2>
<p>Abbreviation information about NHL teams</p>
</section>
</section>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">LEDScoreboard</a></h1>
<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="config.html">config.py</a></li>
<li class="toctree-l1"><a class="reference internal" href="utils.html">utils.py</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">NHL module</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#module-nhl">__init__.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-nhl.game">game.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-nhl.fix_names">fix_names.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-nhl.teams">teams.py</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nba.html">NBA module</a></li>
<li class="toctree-l1"><a class="reference internal" href="mlb.html">MLB module</a></li>
<li class="toctree-l1"><a class="reference internal" href="laliga.html">LaLiga module</a></li>
<li class="toctree-l1"><a class="reference internal" href="other.html">Other files</a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="utils.html" title="previous chapter">utils.py</a></li>
<li>Next: <a href="nba.html" title="next chapter">NBA module</a></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 3.5.4</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
|
<a href="_sources/nhl.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>