This repository has been archived by the owner on Dec 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created unicode methods for the URLSet and Hyperlink classes, as well…
… as a new trick for Hyperlink. Fixes #16
- Loading branch information
Showing
4 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ include = | |
storytracker/analysis.py | ||
storytracker/files.py | ||
storytracker/get.py | ||
storytracker/toolbox.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python | ||
import six | ||
|
||
|
||
class UnicodeMixin(object): | ||
""" | ||
Mixin class to handle defining the proper __str__/__unicode__ | ||
methods in Python 2 or 3. | ||
""" | ||
# Python 3 | ||
if six.PY3: | ||
def __str__(self): | ||
return self.__unicode__() | ||
# Python 2 | ||
else: | ||
def __str__(self): | ||
return self.__unicode__().encode('utf8') | ||
|
||
def __repr__(self): | ||
return '<%s: %s>' % (self.__class__.__name__, self.__str__()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters