This repository has been archived by the owner on Aug 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from neubot/issue-3
six.py updated
- Loading branch information
Showing
8 changed files
with
958 additions
and
99 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
*.pyc | ||
*.swp |
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,38 @@ | ||
# | ||
# Buffer / memoryview, urlparse | ||
# Written by Simone Basso | ||
# | ||
|
||
import sys | ||
|
||
PY3 = sys.version_info[0] == 3 | ||
|
||
if PY3: | ||
def buff(string, offset, size=None): | ||
if not size: | ||
size = len(string) | ||
return memoryview(string)[offset:offset + size] | ||
|
||
import urllib.parse as urlparse | ||
from collections import OrderedDict | ||
|
||
def bytes_to_string(octets, encoding): | ||
return str(octets, encoding) | ||
|
||
def bytes_to_string_safe(octets, encoding): | ||
return str(octets, encoding, errors='ignore') | ||
|
||
else: | ||
def buff(string, offset, size=None): | ||
if not size: | ||
size = len(string) | ||
return buffer(string, offset, size) | ||
|
||
import urlparse | ||
from .third_party.ordered_dict import OrderedDict | ||
|
||
def bytes_to_string(octets, encoding): | ||
return octets | ||
|
||
def bytes_to_string_safe(octets, encoding): | ||
return octets |
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
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
Oops, something went wrong.