Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diceware-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drebs
diceware-debian
Commits
e80dc4a4
Commit
e80dc4a4
authored
9 years ago
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Do not use basestring.
We do not need `basestring` (or some Py3 equivalent) to check for strings.
parent
ed1ec856
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diceware/wordlist.py
+4
-8
4 additions, 8 deletions
diceware/wordlist.py
with
4 additions
and
8 deletions
diceware/wordlist.py
+
4
−
8
View file @
e80dc4a4
...
...
@@ -29,12 +29,6 @@ RE_WORDLIST_NAME = re.compile('^[a-zA-Z0-9_-]+$')
#: A regular expression matching numbered entries in wordlists.
RE_NUMBERED_WORDLIST_ENTRY
=
re
.
compile
(
'
^[0-9]+\s+([^\s]+)$
'
)
# A workaround to avoid `six` dependency.
try
:
basestring
except
NameError
:
# NOQA # pragma: no cover
basestring
=
str
def
get_wordlist_names
():
"""
Get a all names of wordlists stored locally.
...
...
@@ -96,7 +90,8 @@ class WordList(object):
"""
A word list contains words for building passphrases.
`path_or_filelike` is the path of the wordlist file or an already
opened file. Opened files must be open for reading, of course.
opened file. Opened files must be open for reading, of course. We
expect filelike objects to support at least `seek()`.
Please note that open file descriptors are not closed after reading.
...
...
@@ -118,7 +113,8 @@ class WordList(object):
"""
def
__init__
(
self
,
path_or_filelike
=
None
):
self
.
path
=
None
if
isinstance
(
path_or_filelike
,
basestring
):
if
not
hasattr
(
path_or_filelike
,
'
seek
'
):
# got a path, not a filelike object
self
.
path
=
path_or_filelike
self
.
fd
=
open
(
self
.
path
,
"
r
"
)
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment