2222# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323# SOFTWARE.
2424
25- import os
25+ from pathlib import Path
2626import re
2727from warnings import warn
2828
@@ -134,11 +134,11 @@ def o_model_manager(self): # pragma: no cover
134134
135135 @property
136136 def _edb_folder (self ):
137- return os . path . join (self ._app .project_path , self ._app .project_name + ".aedb" )
137+ return Path (self ._app .project_path ) / ( self ._app .project_name + ".aedb" )
138138
139139 @property
140140 def _edb_file (self ):
141- return os . path . join (self ._edb_folder , "edb.def" )
141+ return Path (self ._edb_folder ) / "edb.def"
142142
143143 @property
144144 def edb (self ):
@@ -156,7 +156,7 @@ def edb(self):
156156 from pyedb import Edb
157157
158158 self ._edb = None
159- if os . path . exists (self ._edb_file ) or inside_desktop :
159+ if Path (self ._edb_file ). exists ( ) or inside_desktop :
160160 self ._edb = Edb (
161161 self ._edb_folder ,
162162 self ._app .design_name ,
@@ -519,7 +519,7 @@ def import_cadence_brd(self, input_file, output_dir=None, name=None):
519519 output_dir : str, optional
520520 Path where the EDB is to be created. The default is ``None``, in which
521521 case the project directory is used.
522- name : str, optional
522+ name : str or :class:`pathlib.Path` , optional
523523 Name of the EDB. The default is ``None``, in which
524524 case the board name is used.
525525
@@ -535,11 +535,11 @@ def import_cadence_brd(self, input_file, output_dir=None, name=None):
535535 if not output_dir :
536536 output_dir = self .projdir
537537 if not name :
538- name = os . path . basename (input_file )
539- name = os . path . splitext (name )[ 0 ]
538+ name = Path (input_file ). name
539+ name = Path (name ). stem
540540
541541 self ._oimportexport .ImportExtracta (
542- input_file , os . path . join ( output_dir , name + ".aedb" ), os . path . join ( output_dir , name + ".xml" )
542+ input_file , str ( Path ( output_dir ) / ( name + ".aedb" )), str ( Path ( output_dir ) / ( name + ".xml" ) )
543543 )
544544 self ._app .__init__ (self ._app .desktop_class .active_project ().GetName ())
545545 return True
@@ -572,7 +572,7 @@ def import_ipc2581(self, input_file, output_dir=None, name=None):
572572 output_dir : str, optional
573573 Path where the EDB is to be created. The default is ``None``, in which
574574 case the project directory is used.
575- name : str, optional
575+ name : str or :class:`pathlib.Path` , optional
576576 Name of the EDB. The default is ``None``, in which
577577 case the board name is used.
578578
@@ -588,11 +588,11 @@ def import_ipc2581(self, input_file, output_dir=None, name=None):
588588 if not output_dir :
589589 output_dir = self .projdir
590590 if not name :
591- name = os . path . basename (input_file )
592- name = os . path . splitext (name )[ 0 ]
591+ name = Path (input_file ). name
592+ name = Path (name ). stem
593593
594594 self ._oimportexport .ImportIPC (
595- input_file , os . path . join ( output_dir , name + ".aedb" ), os . path . join ( output_dir , name + ".xml" )
595+ input_file , str ( Pathn ( output_dir ) / ( name + ".aedb" )), str ( Path ( output_dir ) / ( name + ".xml" ) )
596596 )
597597 self ._app .__init__ (self ._app .desktop_class .active_project ().GetName ())
598598 return True
@@ -955,9 +955,9 @@ def set_touchstone_model(self, assignment, input_file, model_name=None):
955955 ----------
956956 assignment : str
957957 Name of the component.
958- input_file : str, optional
958+ input_file : str or :class:`pathlib.Path` , optional
959959 Full path to the model file. The default is ``None``.
960- model_name : str, optional
960+ model_name : str or :class:`pathlib.Path` , optional
961961 Name of the model. The default is ``None``, in which case the model name is the file name without an
962962 extension.
963963
@@ -977,12 +977,12 @@ def set_touchstone_model(self, assignment, input_file, model_name=None):
977977 """
978978
979979 if not model_name :
980- model_name = os . path . splitext ( os . path . basename (input_file ))[ 0 ]
980+ model_name = Path ( Path (input_file ). name ). stem
981981 if "." in model_name :
982982 model_name = model_name .replace ("." , "_" )
983983 if model_name in list (self .omodel_manager .GetNames ()):
984984 model_name = generate_unique_name (model_name , n = 2 )
985- num_terminal = int (os . path . splitext (input_file )[ 1 ] .lower ().strip (".sp" ))
985+ num_terminal = int (Path (input_file ). suffix .lower ().strip (".sp" ))
986986
987987 port_names = []
988988 with open_file (input_file , "r" ) as f :
@@ -1019,7 +1019,7 @@ def set_touchstone_model(self, assignment, input_file, model_name=None):
10191019 ["NAME:PortInfoBlk" ],
10201020 ["NAME:PortOrderBlk" ],
10211021 "filename:=" ,
1022- input_file ,
1022+ str ( input_file ) ,
10231023 "numberofports:=" ,
10241024 num_terminal ,
10251025 "sssfilename:=" ,
0 commit comments