Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.fs_file_ids is None:
return
files = self.fs_file_ids
if type(files) != type([]):
files = [files]
for file in files:
filename = '{path}/{filename}.pt'.format(path=MINDSDB_STORAGE_PATH, filename=file)
try:
file_path = Path(filename)
if file_path.is_file():
os.remove(filename)
else:
log.warning('could not delete file {file} becasue it doesnt exist'.format(file=filename))
except OSError:
log.error('could not delete file {file}'.format(file=filename))
r = requests.get('http://mindsdb.com/updates/check/{extra}'.format(extra=extra), headers={'referer': 'http://check.mindsdb.com/?token={token}'.format(token=token)})
except:
log.warning('Could not check for updates')
return
try:
# TODO: Extract version, compare with version in version.py
ret = r.json()
if 'version' in ret and ret['version']!= __version__:
pass
#log.warning("There is a new version of MindsDB {version}, please do:\n pip3 uninstall mindsdb\n pip3 install mindsdb --user".format(version=ret['version']))
else:
log.debug('MindsDB is up to date!')
except:
log.warning('could not check for MindsDB updates')
def setLearningRateIndex(self, index):
"""
This updates the pointers in the learning rates
:param index: the index
:return:
"""
if index >= len(self.learning_rates):
index = len(self.learning_rates) -1
log.warning('Trying to set the learning rate on an index greater than learnign rates available')
self.current_learning_rate_index = index
self.total_epochs = self.learning_rates[self.current_learning_rate_index][EPOCHS_INDEX]
self.current_learning_rate = self.learning_rates[self.current_learning_rate_index][LEARNING_RATE_INDEX]
r = requests.get('http://mindsdb.com/updates/check/{extra}'.format(extra=extra), headers={'referer': 'http://check.mindsdb.com/?token={token}'.format(token=token)})
except:
log.warning('Could not check for updates')
return
try:
# TODO: Extract version, compare with version in version.py
ret = r.json()
if 'version' in ret and ret['version']!= __version__:
pass
#log.warning("There is a new version of MindsDB {version}, please do:\n pip3 uninstall mindsdb\n pip3 install mindsdb --user".format(version=ret['version']))
else:
log.debug('MindsDB is up to date!')
except:
log.warning('could not check for MindsDB updates')
def setLearningRateIndex(self, index):
"""
This updates the pointers in the learning rates
:param index: the index
:return:
"""
if index >= len(self.learning_rates):
index = len(self.learning_rates) -1
log.warning('Trying to set the learning rate on an index greater than learnign rates available')
self.current_learning_rate_index = index
self.total_epochs = self.learning_rates[self.current_learning_rate_index][EPOCHS_INDEX]
self.current_learning_rate = self.learning_rates[self.current_learning_rate_index][LEARNING_RATE_INDEX]
file_path = Path(mdb_file)
if file_path.is_file():
token = open(mdb_file).read()
else:
token = '{system}|{version}|{uid}'.format(system=platform.system(), version=__version__, uid=uuid_str)
try:
open(mdb_file,'w').write(token)
except:
log.warning('Cannot store token, Please add write permissions to file:'+mdb_file)
token = token+'.NO_WRITE'
extra = urllib.parse.quote_plus(token)
try:
r = requests.get('http://mindsdb.com/updates/check/{extra}'.format(extra=extra), headers={'referer': 'http://check.mindsdb.com/?token={token}'.format(token=token)})
except:
log.warning('Could not check for updates')
return
try:
# TODO: Extract version, compare with version in version.py
ret = r.json()
if 'version' in ret and ret['version']!= __version__:
pass
#log.warning("There is a new version of MindsDB {version}, please do:\n pip3 uninstall mindsdb\n pip3 install mindsdb --user".format(version=ret['version']))
else:
log.debug('MindsDB is up to date!')
except:
log.warning('could not check for MindsDB updates')
file_path = Path(mdb_file)
if file_path.is_file():
token = open(mdb_file).read()
else:
token = '{system}|{version}|{uid}'.format(system=platform.system(), version=__version__, uid=uuid_str)
try:
open(mdb_file,'w').write(token)
except:
log.warning('Cannot store token, Please add write permissions to file:'+mdb_file)
token = token+'.NO_WRITE'
extra = urllib.parse.quote_plus(token)
try:
r = requests.get('http://mindsdb.com/updates/check/{extra}'.format(extra=extra), headers={'referer': 'http://check.mindsdb.com/?token={token}'.format(token=token)})
except:
log.warning('Could not check for updates')
return
try:
# TODO: Extract version, compare with version in version.py
ret = r.json()
if 'version' in ret and ret['version']!= __version__:
pass
#log.warning("There is a new version of MindsDB {version}, please do:\n pip3 uninstall mindsdb\n pip3 install mindsdb --user".format(version=ret['version']))
else:
log.debug('MindsDB is up to date!')
except:
log.warning('could not check for MindsDB updates')