Skip to content

Commit 52af6fd

Browse files
committed
Fix houtianze#446 which is caused by wrong initilization sequences
1 parent da6e1e0 commit 52af6fd

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

HISTORY.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Version History:
22

3+
- 1.6.4: Fix `--move` argument causing exception
34
- 1.6.3: Change default timeout to 5 minutes
45
- 1.6.2: Properly handle (treat it as no error) error_code 31061 (file already exists) from PCS
56
- 1.6.1: Ensure cache loading/saving failures won't affect normal operations; Fix the bug that clean up code not called on exit

HISTORY.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Version History:
22
~~~~~~~~~~~~~~~~
33

4+
- 1.6.4: Fix ``--move`` argument causing exception
45
- 1.6.3: Change default timeout to 5 minutes
56
- 1.6.2: Properly handle (treat it as no error) error_code 31061 (file
67
already exists) from PCS

bypy/bypy.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,16 @@ def __init__(self,
310310
downloader_args = "",
311311
processes = const.DefaultProcessCount,
312312
secretkey = const.SecretKey):
313-
314313
super(ByPy, self).__init__()
315314
self.jsonq = deque(maxlen = 64)
316315

316+
# these two variables are without leading double underscore "__" as to export the as public,
317+
# so if any code using this class can check the current verbose / debug level
318+
cached.verbose = self.verbose = verbose
319+
cached.debug = self.debug = debug
320+
if not cached.usecache:
321+
pinfo("Forced hash recalculation, hash cache won't be used")
322+
317323
# declaration of myself
318324
global gbypyinst
319325
gbypyinst = self
@@ -377,13 +383,6 @@ def __init__(self,
377383
self.__verify = True
378384
self.processes = processes
379385

380-
# these two variables are without leadning double underscaore "__" as to export the as public,
381-
# so if any code using this class can check the current verbose / debug level
382-
cached.verbose = self.verbose = verbose
383-
cached.debug = self.debug = debug
384-
if not cached.usecache:
385-
pinfo("Forced hash recaculation, hash cache won't be used")
386-
387386
#TODO: SSL verification causes some much trouble for different Python version
388387
# I give up and disable it for good, or for bad
389388
checkssl = False
@@ -514,7 +513,7 @@ def pv(self, msg, **kwargs):
514513
pr(msg)
515514

516515
def pd(self, msg, level = 1, **kwargs):
517-
if self.debug >= level:
516+
if self.debug and self.debug >= level:
518517
pdbg(msg, kwargs)
519518

520519
def shalloverwrite(self, prompt):
@@ -1146,7 +1145,7 @@ def __remove_remote_on_success(self, remotepath):
11461145
def __remove_local_on_success(self, localpath):
11471146
if self.__deletesource:
11481147
self.pd("Removing local path '{}' after successful upload.".format(localpath))
1149-
result = cachedm.remove_path_and_cache(localpath)
1148+
result = cached.remove_path_and_cache(localpath)
11501149
if result == const.ENoError:
11511150
self.pd("Local path '{}' removed.".format(localpath))
11521151
else:

bypy/const.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# https://packaging.python.org/single_source_version/
1414
__title__ = 'bypy'
15-
__version__ = '1.6.3'
15+
__version__ = '1.6.4'
1616
__author__ = 'Hou Tianze'
1717
__license__ = 'MIT'
1818
__desc__ = 'Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端'
@@ -176,14 +176,14 @@
176176
Heroku1RedirectUrl = Heroku1Url + '/auth'
177177
Heroku1RefreshUrl = Heroku1Url + '/refresh'
178178
AuthServerList = [
179-
# url, rety?, message
179+
# url, retry?, message
180180
(OpenShiftRedirectUrl, False, "Authorizing/refreshing with the OpenShift server ..."),
181181
(HerokuRedirectUrl, False, "OpenShift server failed, authorizing/refreshing with the Heroku server ..."),
182182
(Heroku1RedirectUrl, False, "Heroku server failed, authorizing/refreshing with the Heroku1 server ..."),
183183
(GaeRedirectUrl, False, "Heroku1 server failed. Last resort: authorizing/refreshing with the GAE server ..."),
184184
]
185185
RefreshServerList = [
186-
# url, rety?, message
186+
# url, retry?, message
187187
(OpenShiftRefreshUrl, False, "Authorizing/refreshing with the OpenShift server ..."),
188188
(HerokuRefreshUrl, False, "OpenShift server failed, authorizing/refreshing with the Heroku server ..."),
189189
(Heroku1RefreshUrl, False, "Heroku server failed, authorizing/refreshing with the Heroku1 server ..."),

update/update.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"comment": "Update info",
3-
"recommendedVersion": "1.6.3",
3+
"recommendedVersion": "1.6.4",
44
"minimumRequiredVersion": "1.6.0"
55
}

0 commit comments

Comments
 (0)