Using simplejson and fixed some encodes and decodes
This commit is contained in:
parent
0fbf131df3
commit
c01716a6c0
26 changed files with 29 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import json
|
||||
import simplejson as json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import base58
|
||||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import binascii
|
||||
from collections import defaultdict
|
||||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
|
||||
from twisted.internet import threads, defer
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
from decimal import Decimal
|
||||
from twisted.internet import error, defer
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
from twisted.internet import defer
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import platform
|
||||
import json
|
||||
import simplejson as json
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import datetime
|
|||
import random
|
||||
import socket
|
||||
import string
|
||||
import json
|
||||
import simplejson as json
|
||||
import traceback
|
||||
import functools
|
||||
import logging
|
||||
|
|
|
@ -3,7 +3,7 @@ import mimetypes
|
|||
import os
|
||||
import requests
|
||||
import urllib
|
||||
import json
|
||||
import simplejson as json
|
||||
import textwrap
|
||||
import signal
|
||||
from binascii import hexlify, unhexlify, b2a_hex
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json
|
||||
import simplejson as json
|
||||
import os
|
||||
import sys
|
||||
import colorama
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import time
|
||||
import logging
|
||||
import json
|
||||
import simplejson as json
|
||||
|
||||
import treq
|
||||
from twisted.internet import defer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
import json
|
||||
import simplejson as json
|
||||
import urlparse
|
||||
import requests
|
||||
from requests.cookies import RequestsCookieJar
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
from six.moves.urllib import parse as urlparse
|
||||
import json
|
||||
import simplejson as json
|
||||
import inspect
|
||||
import signal
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import hmac
|
|||
import hashlib
|
||||
import yaml
|
||||
import os
|
||||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite3
|
||||
import os
|
||||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
from lbryschema.decode import smart_decode
|
||||
from lbrynet import conf
|
||||
|
|
|
@ -268,7 +268,7 @@ class SQLiteStorage(WalletDatabase):
|
|||
blob_hashes = yield self.run_and_return_list(
|
||||
"select blob_hash from blob where status='finished'"
|
||||
)
|
||||
defer.returnValue([blob_hash.decode('hex') for blob_hash in blob_hashes])
|
||||
defer.returnValue([bytes.fromhex(blob_hash).decode('latin-1') for blob_hash in blob_hashes])
|
||||
|
||||
def count_finished_blobs(self):
|
||||
return self.run_and_return_one_or_none(
|
||||
|
@ -492,7 +492,8 @@ class SQLiteStorage(WalletDatabase):
|
|||
@defer.inlineCallbacks
|
||||
def save_downloaded_file(self, stream_hash, file_name, download_directory, data_payment_rate):
|
||||
# touch the closest available file to the file name
|
||||
file_name = yield open_file_for_writing(download_directory.decode('hex'), file_name.decode('hex'))
|
||||
file_name = yield open_file_for_writing(bytes.fromhex(download_directory).decode(),
|
||||
bytes.fromhex(file_name).decode())
|
||||
result = yield self.save_published_file(
|
||||
stream_hash, file_name.encode('hex'), download_directory, data_payment_rate
|
||||
)
|
||||
|
|
|
@ -181,7 +181,7 @@ class EncryptedFileSaver(EncryptedFileDownloader):
|
|||
class EncryptedFileSaverFactory(EncryptedFileDownloaderFactory):
|
||||
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet, download_directory):
|
||||
EncryptedFileDownloaderFactory.__init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet)
|
||||
self.download_directory = binascii.hexlify(download_directory)
|
||||
self.download_directory = binascii.hexlify(download_directory.encode())
|
||||
|
||||
def _make_downloader(self, stream_hash, payment_rate_manager, stream_info):
|
||||
stream_name = stream_info.raw_info['stream_name']
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
|
||||
from twisted.protocols.basic import FileSender
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
|
||||
from twisted.internet.error import ConnectionRefusedError
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logging
|
||||
import json
|
||||
import simplejson as json
|
||||
from twisted.python import failure
|
||||
from twisted.internet import error, defer
|
||||
from twisted.internet.protocol import Protocol, ServerFactory
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""A test script that downloads blobs from a reflector server"""
|
||||
import argparse
|
||||
import itertools
|
||||
import json
|
||||
import simplejson as json
|
||||
import random
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import simplejson as json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ the new blobs to the manager.
|
|||
import argparse
|
||||
import binascii
|
||||
import logging
|
||||
import json
|
||||
import simplejson as json
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import struct
|
||||
import json
|
||||
import simplejson as json
|
||||
import logging
|
||||
import argparse
|
||||
import hashlib
|
||||
|
|
3
setup.py
3
setup.py
|
@ -35,7 +35,8 @@ requires = [
|
|||
'colorama==0.3.7',
|
||||
'six',
|
||||
'pyopenssl',
|
||||
'service-identity'
|
||||
'service-identity',
|
||||
'simplejson'
|
||||
]
|
||||
|
||||
console_scripts = [
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import mock
|
||||
import json
|
||||
import simplejson as json
|
||||
import random
|
||||
from os import path
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
import json
|
||||
import simplejson as json
|
||||
import sys
|
||||
import tempfile
|
||||
from unittest import skipIf
|
||||
|
|
Loading…
Reference in a new issue