예제 #1
0
    def __init__(self, file_path, is_new_file=False, old_file_path=None, predefined_scheme=None, fromversion=False,
                 configuration=Configuration(), ignored_errors=None, print_as_warnings=False, tag='master',
                 suppress_print: bool = False, branch_name='', json_file_path=None, skip_schema_check=False,
                 pykwalify_logs=False, quiet_bc=False):
        super().__init__(ignored_errors=ignored_errors, print_as_warnings=print_as_warnings,
                         suppress_print=suppress_print, json_file_path=json_file_path)
        self.is_valid = True
        self.valid_extensions = ['.yml', '.json', '.md', '.png']
        self.file_path = file_path.replace('\\', '/')
        self.skip_schema_check = skip_schema_check
        self.pykwalify_logs = pykwalify_logs
        self.quiet_bc = quiet_bc

        self.scheme_name = predefined_scheme or self.scheme_of_file_by_path()
        if isinstance(self.scheme_name, str):
            self.scheme_name = FileType(self.scheme_name)

        self.prev_ver = tag
        self.branch_name = branch_name
        self.file_type = self.get_file_type()
        self.current_file = self.load_data_from_file()
        self.fromversion = fromversion
        # If it is a newly added file or if it is a file outside the pack then we will not search for an old file
        if is_new_file or not is_file_path_in_pack(self.file_path):
            self.old_file = {}
        else:
            self.old_file = get_remote_file(old_file_path if old_file_path else file_path, tag=tag,
                                            suppress_print=suppress_print)
        self.configuration = configuration
예제 #2
0
    def __init__(self,
                 file_path,
                 is_new_file=False,
                 old_file_path=None,
                 predefined_scheme=None,
                 fromversion=False,
                 configuration=Configuration(),
                 ignored_errors=None,
                 print_as_warnings=False,
                 tag='master',
                 suppress_print: bool = False,
                 branch_name=''):
        super().__init__(ignored_errors=ignored_errors,
                         print_as_warnings=print_as_warnings,
                         suppress_print=suppress_print)
        self.is_valid = True
        self.valid_extensions = ['.yml', '.json', '.md', '.png']
        self.file_path = file_path.replace('\\', '/')

        self.scheme_name = predefined_scheme or self.scheme_of_file_by_path()
        if isinstance(self.scheme_name, str):
            self.scheme_name = FileType(self.scheme_name)

        self.prev_ver = tag
        self.branch_name = branch_name
        self.file_type = self.get_file_type()
        self.current_file = self.load_data_from_file()
        self.fromversion = fromversion
        if is_new_file or predefined_scheme:
            self.old_file = {}
        else:
            self.old_file = get_remote_file(
                old_file_path if old_file_path else file_path, tag=tag)
        self.configuration = configuration