Skip to content

Commit 74872bf

Browse files
authored
Eliminating warnings (#137)
* hnbrowser: eliminated unused import std/os issue #136 * hnloader: eliminated unused imports issue #136 * readability: eliminated unused imports issue #136 * readability: eliminated ResultShadowed warning issue #136 * readbilittypes: eliminated unused imports issue #136 * eliminated htmlparser Depracted warning * Eliminated unused imports from 20 files issue #136 * eliminated existsFile() Deprecated warning issue #136 * eliminated atomics Deprecated warning issue #136 * eliminated ImplicitTemplateRedefinition warning issue #136 * Eliminated UnnamedBreak issue #136 * Eliminated UnreachableCode warning issue #136
1 parent 8fd6cf9 commit 74872bf

27 files changed

+349
-412
lines changed

examples/hnbrowser.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import figuro/widgets/[button]
33
import figuro/widgets/[scrollpane, vertical, horizontal]
44
import figuro/widgets/[input]
55
import figuro
6-
import std/os
76
import cssgrid/prettyprints
87
import std/terminal
98

examples/webhelpers/hnloader.nim

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ import std/httpclient
33
import std/os
44
import std/sequtils
55
import std/strutils
6-
import std/sugar
7-
import std/osproc
8-
import std/streams
96
import std/hashes
107
# import chame/minidom
11-
import std/htmlparser
128
import std/xmltree
139
import std/strtabs
14-
15-
import pretty
10+
import pkg/htmlparser
1611

1712
type HtmlLoader* = ref object of Agent
1813

@@ -119,7 +114,7 @@ proc loadPage*(loader: HtmlLoader, url: string) {.slot.} =
119114
if "submission" in getAttr(elem, "class"):
120115
if sub != nil: subs.add(move sub)
121116
sub = TableSubmission(subTr: elem)
122-
117+
123118
if sub != nil and elem.attrs == nil:
124119
sub.subTextTr = elem
125120

@@ -166,7 +161,7 @@ proc loadPage*(loader: HtmlLoader, url: string) {.slot.} =
166161
submission.subText.comments = parseInt(txts[0])
167162

168163
submissions.add(submission)
169-
164+
170165
# for sub in submissions:
171166
# echo $sub
172167
emit loader.htmlDone(submissions)
@@ -192,7 +187,7 @@ proc loadPageMarkdown*(loader: HtmlLoader, url: string) {.slot.} =
192187
else:
193188
let client = newHttpClient(timeout=1_000)
194189
let res = client.get(url)
195-
190+
196191

197192
when true:
198193
let document = parseHTML(res.body)
@@ -208,11 +203,11 @@ proc loadPageMarkdown*(loader: HtmlLoader, url: string) {.slot.} =
208203
"html2markdown",
209204
options={poUsePath, poStdErrToStdOut}
210205
)
211-
206+
212207
# Write HTML to stdin of html2markdown
213208
process.inputStream.write(res.body)
214209
process.inputStream.close()
215-
210+
216211
# Read markdown from stdout
217212
markdown = process.outputStream.readAll()
218213
process.close()
@@ -221,7 +216,7 @@ proc loadPageMarkdown*(loader: HtmlLoader, url: string) {.slot.} =
221216
echo "error running html2markdown: ", $err.getStackTrace()
222217
markdown = "error running html2markdown:\n" & $err.msg
223218
markdown.add "try installing html2markdown: https://github.com/JohannesKaufmann/html-to-markdown"
224-
219+
225220
when isMainModule:
226221
echo "markdown:\n", markdown
227222

@@ -241,4 +236,3 @@ when isMainModule:
241236

242237
let m = HtmlLoader()
243238
m.loadPageMarkdown("https://example.com")
244-

0 commit comments

Comments
 (0)