diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-10-19 09:19:28 -0700 |
---|---|---|
committer | Paul McGuire <ptmcg@users.noreply.github.com> | 2019-10-19 11:19:27 -0500 |
commit | 69aea3980e2e3c848ae1c7b0ce7539bbdc8daf27 (patch) | |
tree | 3d7ddf5bce1982a4ed217dd5fbeaf59c08d74ad7 | |
parent | b268114a0da1dc306cdcb9359ffa5a09bd99089f (diff) | |
download | pyparsing-git-69aea3980e2e3c848ae1c7b0ce7539bbdc8daf27.tar.gz |
Remove unused imports (#147)
Discovered using the command:
flake8 --select F401 .
-rw-r--r-- | examples/SimpleCalc.py | 2 | ||||
-rw-r--r-- | examples/fourFn.py | 2 | ||||
-rw-r--r-- | examples/htmlStripper.py | 3 | ||||
-rw-r--r-- | examples/protobuf_parser.py | 2 | ||||
-rw-r--r-- | examples/sexpParser.py | 1 | ||||
-rw-r--r-- | examples/simpleSQL.py | 4 | ||||
-rw-r--r-- | examples/urlExtractorNew.py | 1 | ||||
-rw-r--r-- | pyparsing.py | 2 | ||||
-rw-r--r-- | unitTests.py | 4 |
9 files changed, 9 insertions, 12 deletions
diff --git a/examples/SimpleCalc.py b/examples/SimpleCalc.py index d52a20f..5e1d835 100644 --- a/examples/SimpleCalc.py +++ b/examples/SimpleCalc.py @@ -33,7 +33,7 @@ debug_flag=False variables = {} -from fourFn import BNF, exprStack, fn, opn, evaluate_stack +from fourFn import BNF, exprStack, evaluate_stack # from fourFn import BNF, exprStack, fn, opn # def evaluateStack( s ): diff --git a/examples/fourFn.py b/examples/fourFn.py index e07125f..e5be215 100644 --- a/examples/fourFn.py +++ b/examples/fourFn.py @@ -11,7 +11,7 @@ # Copyright 2003-2019 by Paul McGuire # from pyparsing import (Literal, Word, Group, Forward, alphas, alphanums, Regex, ParseException, - CaselessKeyword, Suppress, delimitedList, pyparsing_common as ppc, tokenMap) + CaselessKeyword, Suppress, delimitedList) import math import operator diff --git a/examples/htmlStripper.py b/examples/htmlStripper.py index eb35c70..bd99b77 100644 --- a/examples/htmlStripper.py +++ b/examples/htmlStripper.py @@ -6,10 +6,9 @@ # # Copyright (c) 2006, 2016, Paul McGuire # -import urllib.parse, urllib.error from urllib.request import urlopen from pyparsing import (makeHTMLTags, commonHTMLEntity, replaceHTMLEntity, - htmlComment, anyOpenTag, anyCloseTag, LineEnd, OneOrMore, replaceWith) + htmlComment, anyOpenTag, anyCloseTag, LineEnd, replaceWith) scriptOpen, scriptClose = makeHTMLTags("script") scriptBody = scriptOpen + scriptOpen.tag_body + scriptClose diff --git a/examples/protobuf_parser.py b/examples/protobuf_parser.py index 52ce434..e1657b4 100644 --- a/examples/protobuf_parser.py +++ b/examples/protobuf_parser.py @@ -6,7 +6,7 @@ # from pyparsing import (Word, alphas, alphanums, Regex, Suppress, Forward, - Keyword, Group, oneOf, ZeroOrMore, Optional, delimitedList, + Group, oneOf, ZeroOrMore, Optional, delimitedList, restOfLine, quotedString, Dict) ident = Word(alphas+"_",alphanums+"_").setName("identifier") diff --git a/examples/sexpParser.py b/examples/sexpParser.py index 0d006d2..f678d9a 100644 --- a/examples/sexpParser.py +++ b/examples/sexpParser.py @@ -45,7 +45,6 @@ BNF reference: http://theory.lcs.mit.edu/~rivest/sexp.txt import pyparsing as pp from base64 import b64decode -import pprint def verify_length(s, l, t): diff --git a/examples/simpleSQL.py b/examples/simpleSQL.py index ac4de17..60582cd 100644 --- a/examples/simpleSQL.py +++ b/examples/simpleSQL.py @@ -8,11 +8,11 @@ from pyparsing import Word, delimitedList, Optional, \ Group, alphas, alphanums, Forward, oneOf, quotedString, \ infixNotation, opAssoc, \ - ZeroOrMore, restOfLine, CaselessKeyword, pyparsing_common as ppc + restOfLine, CaselessKeyword, pyparsing_common as ppc # define SQL tokens selectStmt = Forward() -SELECT, FROM, WHERE, AND, OR, IN, IS, NOT, NULL = map(CaselessKeyword, +SELECT, FROM, WHERE, AND, OR, IN, IS, NOT, NULL = map(CaselessKeyword, "select from where and or in is not null".split()) NOT_NULL = NOT + NULL diff --git a/examples/urlExtractorNew.py b/examples/urlExtractorNew.py index 795322a..14f6eb1 100644 --- a/examples/urlExtractorNew.py +++ b/examples/urlExtractorNew.py @@ -1,7 +1,6 @@ # URL extractor # Copyright 2004, Paul McGuire from pyparsing import makeHTMLTags -import urllib.parse, urllib.error from urllib.request import urlopen import pprint diff --git a/pyparsing.py b/pyparsing.py index f4f0735..1a7a4e0 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -112,7 +112,7 @@ import pprint import traceback import types from datetime import datetime -from operator import itemgetter, attrgetter +from operator import itemgetter import itertools from functools import wraps from itertools import filterfalse diff --git a/unitTests.py b/unitTests.py index 7f516b1..f0a7ceb 100644 --- a/unitTests.py +++ b/unitTests.py @@ -1081,7 +1081,7 @@ class ReStringRangeTest(ParseTestCase): class SkipToParserTests(ParseTestCase): def runTest(self): - from pyparsing import Literal, SkipTo, cStyleComment, ParseBaseException, And, Word, alphas, nums, Optional, NotAny + from pyparsing import Literal, SkipTo, cStyleComment, ParseBaseException, And, Word, alphas, nums thingToFind = Literal('working') testExpr = SkipTo(Literal(';'), include=True, ignore=cStyleComment) + thingToFind @@ -1113,7 +1113,7 @@ class SkipToParserTests(ParseTestCase): result = expr.parseString(text) self.assertTrue(isinstance(result.prefix, str), "SkipTo created with wrong saveAsList attribute") - from pyparsing import Literal, And, Word, alphas, nums, Optional, NotAny + from pyparsing import Literal, And, Word, alphas, nums alpha_word = (~Literal("end") + Word(alphas, asKeyword=True)).setName("alpha") num_word = Word(nums, asKeyword=True).setName("int") |