-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from dvm-shlee/main
remove shleeh dependency v0.3.8
- Loading branch information
Showing
8 changed files
with
155 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ build | |
test | ||
test/* | ||
*.egg-info | ||
*.egg-info/* | ||
*.egg-info/* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from .lib import * | ||
|
||
__version__ = '0.3.8-rc1' | ||
__version__ = '0.3.8' | ||
__all__ = ['BrukerLoader', '__version__'] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import os | ||
|
||
|
||
def print_internal_error(io_handler=None): | ||
import traceback | ||
import sys | ||
if io_handler is None: | ||
io_handler = sys.stderr | ||
traceback.print_exception(*sys.exc_info(), | ||
file=io_handler) | ||
|
||
|
||
class Error(Exception): | ||
""" Base class for other custom exceptions """ | ||
message = None | ||
|
||
|
||
class FileNotValidError(Error): | ||
""" Raised when the file is not valid format """ | ||
|
||
def __init__(self, file_name=None, data_type=None): | ||
self.file_name = None | ||
self.data_type = None | ||
|
||
if file_name is not None: | ||
self.file_name = os.path.basename(file_name) | ||
if os.path.isdir(file_name): | ||
object_type = 'directory' | ||
else: | ||
object_type = 'file' | ||
if data_type is not None: | ||
self.data_type = data_type | ||
self.message = "The {} '{}' is not valid {}".format(object_type, | ||
self.file_name, | ||
self.data_type) | ||
else: | ||
self.message = "The {} '{}' is not valid".format(object_type, | ||
self.file_name) | ||
else: | ||
self.message = "The file is not valid" | ||
|
||
|
||
class ArchiveFailedError(Error): | ||
""" Raised when the archive process is failed [designed for brkraw module] """ | ||
file_name = None | ||
|
||
def __init__(self, file_name=None): | ||
if file_name is not None: | ||
self.file_name = os.path.basename(file_name) | ||
self.message = "The data '{}' is not archived".format( | ||
self.file_name) | ||
else: | ||
self.message = "Archive failed to execute" | ||
|
||
|
||
class RemoveFailedError(Error): | ||
""" Raise when the os.remove process is failed """ | ||
file_name = None | ||
|
||
def __init__(self, file_name=None): | ||
if file_name is not None: | ||
self.file_name = os.path.basename(file_name) | ||
self.message = "The file '{}' is not removed".format( | ||
self.file_name) | ||
else: | ||
self.message = "Remove failed to execute" | ||
|
||
|
||
class RenameFailedError(Error): | ||
""" Raised when the os.rename process is failed (OSError)""" | ||
file1_name = None | ||
file2_name = None | ||
|
||
def __init__(self, file1_name=None, file2_name=None): | ||
if file1_name is not None: | ||
self.file1_name = os.path.basename(file1_name) | ||
if file2_name is not None: | ||
self.file2_name = os.path.basename(file2_name) | ||
if (self.file1_name is not None) and (self.file2_name is not None): | ||
self.message = "Rename failed to execute from:'{}' to:'{}'".format(self.file1_name, | ||
self.file2_name) | ||
else: | ||
self.message = "Rename failed to execute" | ||
|
||
|
||
class UnexpectedError(Error): | ||
""" Raised when unexpected error occurred """ | ||
|
||
def __init__(self, message=None): | ||
print_internal_error() | ||
if message is None: | ||
self.message = "Unexpected error" | ||
else: | ||
self.message = message | ||
|
||
|
||
class ValueConflictInField(Error): | ||
""" Raised when input value was conflicted with other """ | ||
|
||
def __init__(self, message=None): | ||
if message is None: | ||
self.message = "The value is conflicted" | ||
else: | ||
self.message = message | ||
|
||
|
||
class InvalidValueInField(Error): | ||
""" Raise when the invalid value is detected in field """ | ||
|
||
def __init__(self, message=None): | ||
if message is None: | ||
self.message = "Invalid value is detected" | ||
else: | ||
self.message = message | ||
|
||
|
||
class InvalidApproach(Error): | ||
""" Raise when the user try invalid approach """ | ||
|
||
def __init__(self, message=None): | ||
print_internal_error() | ||
if message is None: | ||
self.message = "Invalid approach!" | ||
else: | ||
self.message = message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters