Skip to content

Commit

Permalink
Cleaning code.
Browse files Browse the repository at this point in the history
  • Loading branch information
avancinirodrigo committed Sep 11, 2019
1 parent 9994b0c commit bdb1938
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 68 deletions.
18 changes: 1 addition & 17 deletions ecolyzer/system/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,7 @@ def fullpath(self, fullpath):
if fullpath == None:
return
self._fullpath = None
path, file_with_ext = os.path.split(fullpath)
filename = ''
ext = ''
if '.' in file_with_ext:
split_list = file_with_ext.split('.')
if len(split_list) > 2:
ext = split_list.pop()
filename = '.'.join(split_list)
else:
if file_with_ext.startswith('.'):
filename = '.' + split_list[1]
else:
filename = split_list[0]
ext = split_list[1]
else:
filename = file_with_ext
path, filename, ext = File.Split(fullpath)
self.path = path
self.name = filename
self.ext = ext
Expand Down Expand Up @@ -99,7 +84,6 @@ def Extension(fullpath):
else:
if not file_with_ext.startswith('.'):
ext = split_list[1]

return ext

@staticmethod
Expand Down
25 changes: 0 additions & 25 deletions scripts/added_source_files.py

This file was deleted.

26 changes: 0 additions & 26 deletions scripts/added_source_files_todb.py

This file was deleted.

10 changes: 10 additions & 0 deletions tests/unit/file_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ def test_without_ext():

file2 = File('noextfile')
assert file2.fullpath == 'noextfile'

def test_extension():
assert File.Extension('some/path/file.ext') == 'ext'
assert File.Extension('file') == ''

def test_split():
path, name, ext = File.Split('some/path/file.ext')
assert path == 'some/path'
assert name == 'file'
assert ext == 'ext'

0 comments on commit bdb1938

Please sign in to comment.