Auto merge of #5058 - str4d:minor-cleanups, r=str4d

Minor cleanups
This commit is contained in:
Homu 2021-04-14 03:26:57 +00:00
commit 7279efdf55
9 changed files with 13 additions and 16 deletions

View File

@ -418,7 +418,7 @@ class RPCCoverage(object):
if not os.path.isfile(coverage_ref_filename):
raise RuntimeError("No coverage reference found")
with open(coverage_ref_filename, 'r') as f:
with open(coverage_ref_filename, 'r', encoding='utf8') as f:
all_cmds.update([i.strip() for i in f.readlines()])
for root, dirs, files in os.walk(self.dir):
@ -427,7 +427,7 @@ class RPCCoverage(object):
coverage_filenames.add(os.path.join(root, filename))
for filename in coverage_filenames:
with open(filename, 'r') as f:
with open(filename, 'r', encoding='utf8') as f:
covered_cmds.update([i.strip() for i in f.readlines()])
return all_cmds - covered_cmds

View File

@ -107,7 +107,7 @@ class GitHubToken:
def __init__(self):
token_path = os.path.join(SOURCE_ROOT, ".updatecheck-token")
try:
with open(token_path) as f:
with open(token_path, encoding='utf8') as f:
token = f.read().strip()
self._user = token.split(":")[0]
self._password = token.split(":")[1]

View File

@ -36,7 +36,7 @@ bool CBanDB::Write(const banmap_t& banSet)
ssBanlist << hash;
// open temp output file, and associate with CAutoFile
boost::filesystem::path pathTmp = GetDataDir() / tmpfn;
fs::path pathTmp = GetDataDir() / tmpfn;
FILE *file = fopen(pathTmp.string().c_str(), "wb");
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
if (fileout.IsNull())
@ -68,7 +68,7 @@ bool CBanDB::Read(banmap_t& banSet)
return error("%s: Failed to open file %s", __func__, pathBanlist.string());
// use file size to size memory buffer
uint64_t fileSize = boost::filesystem::file_size(pathBanlist);
uint64_t fileSize = fs::file_size(pathBanlist);
uint64_t dataSize = 0;
// Don't try to resize to a negative number if file is small
if (fileSize >= sizeof(uint256))

View File

@ -12,7 +12,6 @@
#include <string>
#include <map>
#include <boost/filesystem/path.hpp>
class CSubNet;
class CAddrMan;
@ -93,7 +92,7 @@ public:
class CBanDB
{
private:
boost::filesystem::path pathBanlist;
fs::path pathBanlist;
public:
CBanDB();
bool Write(const banmap_t& banSet);

View File

@ -8,7 +8,6 @@
#include "primitives/block.h"
#include <boost/shared_ptr.hpp>
#include <stdint.h>
#include <variant>

View File

@ -21,7 +21,6 @@
#include "primitives/transaction.h"
#include "scheduler.h"
#include "ui_interface.h"
#include "crypto/common.h"
#ifdef WIN32
#include <string.h>

View File

@ -3,8 +3,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
#ifndef BITCOIN_SCRIPT_ZCASHCONSENSUS_H
#define BITCOIN_SCRIPT_ZCASHCONSENSUS_H
#ifndef ZCASH_SCRIPT_ZCASH_SCRIPT_H
#define ZCASH_SCRIPT_ZCASH_SCRIPT_H
#include <stdint.h>
@ -107,4 +107,4 @@ EXPORT_SYMBOL unsigned int zcash_script_version();
#undef EXPORT_SYMBOL
#endif // BITCOIN_SCRIPT_ZCASHCONSENSUS_H
#endif // ZCASH_SCRIPT_ZCASH_SCRIPT_H

View File

@ -39,7 +39,7 @@ def bctest(testDir, testObj, exeext):
inputData = None
if "input" in testObj:
filename = testDir + "/" + testObj['input']
inputData = open(filename).read()
inputData = open(filename, encoding='utf8').read()
stdinCfg = subprocess.PIPE
# Read the expected output data (if there is any)
@ -49,7 +49,7 @@ def bctest(testDir, testObj, exeext):
outputFn = testObj['output_cmp']
outputType = os.path.splitext(outputFn)[1][1:] # output type from file extension (determines how to compare)
try:
outputData = open(testDir + "/" + outputFn).read()
outputData = open(testDir + "/" + outputFn, encoding='utf8').read()
except:
logging.error("Output file " + outputFn + " can not be opened")
raise
@ -105,7 +105,7 @@ def bctest(testDir, testObj, exeext):
def bctester(testDir, input_basename, buildenv):
""" Loads and parses the input file, runs all tests and reports results"""
input_filename = testDir + "/" + input_basename
raw_data = open(input_filename).read()
raw_data = open(input_filename, encoding='utf8').read()
input_data = json.loads(raw_data)
failed_testcases = []

View File

@ -98,7 +98,7 @@ rm -f src/secp256k1/src/stamp-h1
rm -f src/secp256k1/.so_locations
clean_exe src/secp256k1/tests
clean_exe src/secp256k1/exhaustive_tests
rm -f src/secp256k1/tests.log src/secp256k1/exhaustive-tests.log src/secp256k1/test-suite.log
rm -f src/secp256k1/tests.log src/secp256k1/exhaustive_tests.log src/secp256k1/test-suite.log
clean_dep src/univalue univalue-config.h.in
rm -f src/univalue/univalue-config.h