Esempio n. 1
0
    def set_data(self, data):
        """
        Set model data.

        Parameters
        ----------
        data: dict
            Breakpoint data to use.
        """
        self._data = data
        self.breakpoints = []
        files = []
        # Generate list of filenames with active breakpoints
        for key in data:
            if data[key] and key not in files:
                files.append(key)

        # Insert items
        for key in files:
            for item in data[key]:
                # Store full file name in last position, which is not shown
                self.breakpoints.append(
                    (disambiguate_fname(files,
                                        key), item[0], item[1], "", key))
        self.reset()
Esempio n. 2
0
def test_disambiguate_fname():
    files_path_list = []
    if not os.name == 'nt':
        fname0 = os.path.join(*['','','documents','test','test.py'])
        files_path_list.append(fname0)
        fname1 = os.path.join(*['','','documents','projects','test','test.py'])
        files_path_list.append(fname1)
    else:
        fname0 = os.path.join(*['c:','','documents','test','test.py'])
        files_path_list.append(fname0)
        fname1 = os.path.join(*['c:','','documents','projects','test','test.py'])
        files_path_list.append(fname1)
    title0 = 'test.py - ' + os.path.join(*['test'])
    title1 = 'test.py - ' + os.path.join(*['projects','test'])
    assert sourcecode.disambiguate_fname(files_path_list, fname0) == title0
    assert sourcecode.disambiguate_fname(files_path_list, fname1) == title1
def test_disambiguate_fname():
    files_path_list = []
    if sys.platform.startswith('linux'):
        fname0 = os.path.join(*['', '', 'documents', 'test', 'lab_vif.py'])
        files_path_list.append(fname0)
        fname1 = os.path.join(
            *['', '', 'documents', 'projects', 'test', 'lab_vif.py'])
        files_path_list.append(fname1)
    else:
        fname0 = os.path.join(*['c:', '', 'documents', 'test', 'lab_vif.py'])
        files_path_list.append(fname0)
        fname1 = os.path.join(
            *['c:', '', 'documents', 'projects', 'test', 'lab_vif.py'])
        files_path_list.append(fname1)
    title0 = 'lab_vif.py - ' + os.path.join(*['test'])
    title1 = 'lab_vif.py - ' + os.path.join(*['projects', 'test'])
    assert sourcecode.disambiguate_fname(files_path_list, fname0) == title0
    assert sourcecode.disambiguate_fname(files_path_list, fname1) == title1
Esempio n. 4
0
def test_disambiguate_fname():
    files_path_list = []
    if not os.name == 'nt':
        fname0 = os.path.join(*['', '', 'documents', 'test', 'test.py'])
        files_path_list.append(fname0)
        fname1 = os.path.join(
            *['', '', 'documents', 'projects', 'test', 'test.py'])
        files_path_list.append(fname1)
    else:
        fname0 = os.path.join(*['c:', '', 'documents', 'test', 'test.py'])
        files_path_list.append(fname0)
        fname1 = os.path.join(
            *['c:', '', 'documents', 'projects', 'test', 'test.py'])
        files_path_list.append(fname1)
    title0 = 'test.py - ' + os.path.join(*['test'])
    title1 = 'test.py - ' + os.path.join(*['projects', 'test'])
    assert sourcecode.disambiguate_fname(files_path_list, fname0) == title0
    assert sourcecode.disambiguate_fname(files_path_list, fname1) == title1
Esempio n. 5
0
 def disambiguate_fname(self, fname):
     """Generate a file name without ambiguation."""
     files_path_list = [filename for filename in self.filenames if filename]
     return disambiguate_fname(files_path_list, fname)