mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-16 09:11:00 +08:00
fix exit not found in ipython & fix re about provider_uri
This commit is contained in:
@@ -58,6 +58,7 @@ def init(default_conf="client", **kwargs):
|
|||||||
|
|
||||||
# check path if server/local
|
# check path if server/local
|
||||||
if C.get_uri_type() == QlibConfig.LOCAL_URI:
|
if C.get_uri_type() == QlibConfig.LOCAL_URI:
|
||||||
|
print("?")
|
||||||
if not os.path.exists(C["provider_uri"]):
|
if not os.path.exists(C["provider_uri"]):
|
||||||
if C["auto_mount"]:
|
if C["auto_mount"]:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
|
|||||||
@@ -211,12 +211,16 @@ class QlibConfig(Config):
|
|||||||
self["provider_uri"] = str(Path(self["provider_uri"]).expanduser().resolve())
|
self["provider_uri"] = str(Path(self["provider_uri"]).expanduser().resolve())
|
||||||
|
|
||||||
def get_uri_type(self):
|
def get_uri_type(self):
|
||||||
rm = re.match("^[^/ ]+:.+", self["provider_uri"])
|
win_rm = re.match("^[a-zA-Z]:.*", self["provider_uri"])
|
||||||
|
nfs_or_win_rm = re.match("^[^/]+:.+", self["provider_uri"])
|
||||||
# Windows path is "C:\\"
|
# Windows path is "C:\\"
|
||||||
if rm is None or Path(self["provider_uri"]).exists():
|
if win_rm is None:
|
||||||
return QlibConfig.LOCAL_URI
|
if nfs_or_win_rm is None:
|
||||||
|
return QlibConfig.LOCAL_URI
|
||||||
|
else:
|
||||||
|
return QlibConfig.NFS_URI
|
||||||
else:
|
else:
|
||||||
return QlibConfig.NFS_URI
|
return QlibConfig.LOCAL_URI
|
||||||
|
|
||||||
def get_data_path(self):
|
def get_data_path(self):
|
||||||
if self.get_uri_type() == QlibConfig.LOCAL_URI:
|
if self.get_uri_type() == QlibConfig.LOCAL_URI:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ try:
|
|||||||
except ImportError as err:
|
except ImportError as err:
|
||||||
print(err)
|
print(err)
|
||||||
print("Do not import qlib package in the repository directory")
|
print("Do not import qlib package in the repository directory")
|
||||||
exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"Ref",
|
"Ref",
|
||||||
|
|||||||
Reference in New Issue
Block a user