mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-06 04:20:57 +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
|
||||
if C.get_uri_type() == QlibConfig.LOCAL_URI:
|
||||
print("?")
|
||||
if not os.path.exists(C["provider_uri"]):
|
||||
if C["auto_mount"]:
|
||||
LOG.error(
|
||||
|
||||
@@ -211,12 +211,16 @@ class QlibConfig(Config):
|
||||
self["provider_uri"] = str(Path(self["provider_uri"]).expanduser().resolve())
|
||||
|
||||
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:\\"
|
||||
if rm is None or Path(self["provider_uri"]).exists():
|
||||
return QlibConfig.LOCAL_URI
|
||||
if win_rm is None:
|
||||
if nfs_or_win_rm is None:
|
||||
return QlibConfig.LOCAL_URI
|
||||
else:
|
||||
return QlibConfig.NFS_URI
|
||||
else:
|
||||
return QlibConfig.NFS_URI
|
||||
return QlibConfig.LOCAL_URI
|
||||
|
||||
def get_data_path(self):
|
||||
if self.get_uri_type() == QlibConfig.LOCAL_URI:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
@@ -17,7 +18,7 @@ try:
|
||||
except ImportError as err:
|
||||
print(err)
|
||||
print("Do not import qlib package in the repository directory")
|
||||
exit(-1)
|
||||
sys.exit(-1)
|
||||
|
||||
__all__ = (
|
||||
"Ref",
|
||||
|
||||
Reference in New Issue
Block a user