Skip to content

Commit

Permalink
filepath option added
Browse files Browse the repository at this point in the history
  • Loading branch information
dkundih committed Sep 14, 2022
1 parent 345dea9 commit efe4f91
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions _testenv/dualityapp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# makes multiple instances of the object available.
from importlib_metadata import re
from logistics.plugins.metaclass import Meta
from matplotlib.style import use

# set type of numpy array and pandas particles.
import numpy as np
Expand All @@ -15,7 +13,6 @@
Style,
init,
)
from sqlalchemy import types

init()

Expand Down Expand Up @@ -817,7 +814,7 @@ def _redefine(
for i in self.individual_dict[self.clone_dict]:
self.tmp_msg = self.overwrite_variable[self.clone_dict][i]
self.format = self.reset_dict[self.clone_dict][i]
if self.format != 'numlist' and self.format != 'strlist' and self.format != 'np.1darray' and self.format != 'np.2darray' and self.format != 'pd.df' and self.format != 'pd.columns':
if self.format != 'numlist' and self.format != 'strlist' and self.format != 'np.1darray' and self.format != 'np.2darray' and self.format != 'pd.df' and self.format != 'pd.columns' and self.format != 'path':
self.new_i = input(self.enter_message + paint_text(f'{self.tmp_msg}: ', color = self.colorset['enter_message'], print_trigger = False))
self.dtypes = {
'int': self._set_int,
Expand All @@ -828,7 +825,8 @@ def _redefine(
'np.1darray' : self._set_numpy_1darray,
'np.2darray' : self._set_numpy_2darray,
'pd.df' : self._set_pandas_df,
'pd.columns' : self._set_pandas_columns
'pd.columns' : self._set_pandas_columns,
'path' : self._set_path,
}
self.new_i = self.dtypes[self.format]()
self.individual_dict[self.clone_dict][i] = self.new_i
Expand Down Expand Up @@ -1078,6 +1076,20 @@ def _set_pandas_columns(self, loopbreak = 'dualityexit'):
raise Exception(self.dataframeerror)


# this is a help function, do not call it when using a package.
def _set_path(self):
self.filepathinput = paint_text('ENTER THE FILE PATH: ', self.colorset['display_message'], print_trigger = False)
self.filepatherror = paint_text('=== UNEXPECTED ERROR OCCURED WHILE LOCATING THE PATH. ===\n', self.colorset['warning'], print_trigger = False)

try:
file = input(self.filepathinput)
file = file.replace("'", '"').strip('"')
except:
raise Exception(self.filepatherror)

return file


# this is a help function, do not call it when using a package. (SCRIPT)
def _queue_handler(
self,
Expand Down Expand Up @@ -1211,7 +1223,6 @@ def _queue_break(


# dodaj svetu malo boje, a isto vredi i za primjenu paint_text u NEloop datatypeove.
# razmotriti varijacije int/str/float datatypeove za generičke liste, numpy array i pandas DF.
# handleati unos krivog tipa da ne baca odmah van, tipa int(x) provesti kroz while loop dok x ne bude == of type int.


Expand Down

0 comments on commit efe4f91

Please sign in to comment.