ncdiff package¶
Subpackages¶
Submodules¶
ncdiff.comparator module¶
Compare cell contents by means of converter.
- since
2013-02-11
-
class
ncdiff.comparator.
StandardComparator
(target_configuration)¶ Bases:
object
Compare cell values after converting them to a common format.
-
COMPARISON_ORDER
= (<class 'int'>, <class 'float'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'bool'>, <class 'str'>)¶
-
compare
(comparison_type, old_value, new_value, absolute_tolerance, relative_tolerance)¶ Compare old and new value with comparison type.
- Parameter
comparison_type (
type
) – The type of comparison.old_value (
object
) – The converted value of the old cell.new_value (
object
) – The converted value of the new cell.absolute_tolerance (
float
) – The maximum absolute tolerance of the cells difference to be considered equal.relative_tolerance (
float
) – The maximum relative tolerance of the cells difference to be considered equal.
- Rückgabe
(equals, abs_diff, rel_diff)
- Rückgabetyp
tuple(bool, float, float)
-
compare_bool
(old_value, new_value)¶ Compare values simply with equality operator.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
str
:param new_value: The converted value of the new cell. :type new_value:str
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, str, str, bool)
-
compare_cells
(old_row, new_row, old_column_id, new_column_id)¶ Compare two cell values.
- Parameter
old_row (
list
) – The list of the old input cells in the particular row.new_row (
list
) – The list of the new input cells in the particular row.old_column_id (
int
) – The column number of the old input cell.new_column_id (
int
) – The column number of the new input cell.
- Rückgabe
(equals, comparisonType, abs_diff, rel_diff, becauseOfTolerance)
- Rückgabetyp
tuple(bool, type, float, float, bool)
-
compare_date
(old_value, new_value, absolute_tolerance)¶ Date comparison, absolute difference is in days.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
date
:param new_value: The converted value of the new cell. :type new_value:date
:param absolute_tolerance: The maximum absolute tolerance of the cells difference to be considered equal. :type absolute_tolerance:float
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, float, str, bool)
-
compare_date_time
(old_value, new_value, absolute_tolerance, scale_in_seconds=1.0)¶ Datetime comparison, absolute difference is in seconds divided by scale_in_seconds.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
datetime or date
:param new_value: The converted value of the new cell. :type new_value:datetime or date
:param absolute_tolerance: The maximum absolute tolerance of the cells difference to be considered equal. :type absolute_tolerance:float
:param scale_in_seconds: divisor for the absolute difference in seconds, before comparing with absolute_tolerance. :type scale_in_seconds:float
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, float, str, bool)
-
compare_float
(old_value, new_value, absolute_tolerance, relative_tolerance)¶ Compare numbers.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
int or float
:param new_value: The converted value of the new cell. :type new_value:int or float
:param absolute_tolerance: The maximum absolute tolerance of the cells difference to be considered equal. :type absolute_tolerance:float
:param relative_tolerance: The maximum relative tolerance of the cells difference to be considered equal. :type relative_tolerance:float
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, float, float or str, bool)
-
compare_int
(old_value, new_value, absolute_tolerance, relative_tolerance)¶ Compare numbers.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
int or float
:param new_value: The converted value of the new cell. :type new_value:int or float
:param absolute_tolerance: The maximum absolute tolerance of the cells difference to be considered equal. :type absolute_tolerance:float
:param relative_tolerance: The maximum relative tolerance of the cells difference to be considered equal. :type relative_tolerance:float
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, float, float or str, bool)
-
compare_str
(old_value, new_value)¶ Compare values simply with equality operator.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
str
:param new_value: The converted value of the new cell. :type new_value:str
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, str, str, bool)
-
compare_time
(old_value, new_value, absolute_tolerance)¶ Datetime comparison, absolute difference is in seconds.
Compare old_value and new_value and return equality, absolute difference and relative difference. :param old_value: The converted value of the old cell. :type old_value:
time
:param new_value: The converted value of the new cell. :type new_value:time
:param absolute_tolerance: The maximum absolute tolerance of the cells difference to be considered equal. :type absolute_tolerance:float
:return: (equals, abs_diff, rel_diff, becauseOfTolerance) :rtype:tuple(bool, float, str, bool)
-
-
ncdiff.comparator.
create_comparator
(target_configuration)¶ Create a comparator object that is able to compare two cell values based on the configured column type.
This comparator is used by the differ to compare all cell values. :param target_configuration: The configuration of the diff target. :type target_configuration:
TargetConfiguration
:return: A comparator object. :type: StandardComparator
ncdiff.configuration module¶
Config parser for the diff tool.
- since
2013-01-15
-
class
ncdiff.configuration.
BasicTargetConfiguration
(configuration_reader)¶ Bases:
ncdiff.configuration.GlobalConfiguration
Contains the getters for each configuration value in a format usable by ncdiff.
If a setting was missing it’s value is None. A BasicTargetConfiguration contains not all information to perform a successful diffing step it is only sufficient to for first validation steps.
-
property
absolute_columns_tolerances
¶ Absolute tolerances for columns.
-
property
absolute_tolerance
¶ Absolute tolerance.
-
property
comparator
¶ Return the comparator object.
-
property
configuration_file_name
¶ Name of the configuration file.
-
property
constraint_evaluator
¶ List of constraints for this configuration.
-
property
copy_input_files
¶ Copy the original input files to the output setting.
-
property
differ
¶ Return the differ object.
-
property
extension_modules
¶ List of extension modules.
-
get
(option, default=None)¶ Get the value for an option.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Type
default:
str
- Rückgabe
The value for option or default if option does not exist.
- Rückgabetyp
str
-
get_global
(option, default=None, section_name='GLOBAL')¶ Get the value of an configuration parameter.
This is very helpful in case of custom parameters that are not part of NCDiff core. This is a possibility to access those from within the different factory/hook modules. Per default this function retrieves configuration parameters stored in the GLOBAL section but since the section_name is an optional parameter it is also possible to access other specific TARGETS or the DEFAULT section.
- Parameter
option (
str
) – The name of the option to get the configuration value.default (if specified a class representing the option) – The default value if option does not exist. Default: None
section_name (
str
) – Optional name of the section that should be accessed Default: GLOBAL
- Rückgabe
The value for option or default if option does not exist. An additional value from the configuration reader from the target where no method was written for.
- Rückgabetyp
str
-
get_statistic_columns
(output_format)¶ Return the list of column names for the statistic report.
- Rückgabe
The list of column names for the statistic report.
- Rückgabetyp
list of str
-
property
global_option_names
¶ List of all available option names of the global section.
-
property
html_resources_directory
¶ Name of the HTML resources directory.
-
property
keep_temporary_files
¶ Keep temporary files.
-
property
map_column_ids
¶ Column id map.
-
property
map_column_names
¶ Column names map.
-
property
max_result_lines
¶ Return number of maximum result lines.
-
property
name
¶ Name of the target.
-
property
new_column_formats
¶ Return new column formats.
-
property
new_column_widths
¶ Return new column widths.
-
property
new_csv_delimiter
¶ Return new CSV delimiter.
-
property
new_csv_doublequote
¶ Return new CSV double quote.
-
property
new_csv_escapechar
¶ Return new CSV escape character.
-
property
new_csv_quotechar
¶ Return new CSV quoting character.
-
property
new_csv_quoting
¶ Return new CSV quoting.
-
property
new_csv_replace_delimiters
¶ Return new CSV replace delimiter.
-
property
new_directory
¶ Name of the directory of the new input files.
-
property
new_encoding
¶ Return the encoding of the new file.
-
property
new_file_name
¶ Old file name.
-
property
new_file_path
¶ Return new file path.
-
property
new_format
¶ Return new file format.
-
property
new_has_header
¶ Return new file has headers.
-
property
new_ignore_column_constraints
¶ Return new ignore column constraints.
-
property
new_ignore_columns
¶ Return new ignore columns.
-
property
new_key_columns
¶ Return new key columns.
-
property
new_label
¶ Label for the „new“ side in the output.
-
property
new_number_format
¶ Return new number format.
-
property
new_row_filters
¶ Return new row filters.
-
property
new_sql_connection
¶ Get the new sql connection string.
-
property
new_sql_driver
¶ Return new sql driver module name.
-
property
new_sql_fetch_size
¶ Get the old number of rows that should be fetched at once from the database.
-
property
new_sql_query
¶ Return the new sql query string.
-
property
new_xls_sheet_name
¶ Return new XLS sheet name.
-
property
old_column_formats
¶ Old column formats.
-
property
old_column_widths
¶ Old column widths.
-
property
old_csv_delimiter
¶ Old CSV delimiter.
-
property
old_csv_doublequote
¶ Old CSV double quote.
-
property
old_csv_escapechar
¶ Old CSV escape character.
-
property
old_csv_quotechar
¶ Old CSV quoting character.
-
property
old_csv_quoting
¶ Old CSV quoting.
-
property
old_csv_replace_delimiters
¶ Old CSV replace delimiter.
-
property
old_directory
¶ Name of the directory of the old input files.
-
property
old_encoding
¶ Return the encoding of the old file.
-
property
old_file_name
¶ Old file name.
-
property
old_file_path
¶ Old file path.
-
property
old_format
¶ Return new file format.
-
property
old_has_header
¶ Old file has headers.
-
property
old_ignore_column_constraints
¶ Old ignore column constraints.
-
property
old_ignore_columns
¶ Old ignore columns.
-
property
old_key_columns
¶ Old key columns.
-
property
old_label
¶ Label for the „old“ side in the output.
-
property
old_number_format
¶ Old number format.
-
property
old_row_filters
¶ Old row filters.
-
property
old_sql_connection
¶ Old sql connection string.
-
property
old_sql_driver
¶ Old sql driver module.
-
property
old_sql_fetch_size
¶ Get the old number of rows that should be fetched at once from the database.
-
property
old_sql_query
¶ Get the old sql query string.
-
property
old_xls_sheet_name
¶ Old XLS sheet name.
-
property
option_names
¶ List of all available option names.
-
property
relative_columns_tolerances
¶ Relative tolerance for columns.
-
property
relative_tolerance
¶ Relative tolerance.
-
property
result_directory
¶ Name of the result directory.
-
property
result_filter_directory
¶ Location of the directory where the ResultFilter Excel field can be found.
-
property
result_filter_empty_marker
¶ Get the empty marker for a result filter.
-
property
result_filter_file_path
¶ Return the result filter path.
Either the name of the file or the location relative to the path of ‚resultFilterDirectory‘ or new absolute path/location including the file name. In this case the ‚resultFilterDirectory‘ will be ignored
-
property
result_filter_xls_sheet_name
¶ Return the name of the Excel Sheet where all the ResultFilter information is stored.
-
property
result_formats
¶ List of result file formats to write.
-
property
result_number_format
¶ Format used for numbers in result files.
-
property
show_filtered_results
¶ Indicate if filtered results should be reported as differences (for debugging) or not.
-
property
show_input_filters
¶ Indicate if ResultFilter matches should be reported as differences (for debugging) or not.
-
property
show_result
¶ Flag to show the diff result in a document viewer.
-
property
show_tolerance_results
¶ Indicate if Tolerance matches should be reported as differences (for debugging) or not.
-
property
statistic_timestamp
¶ Timestamp for the statistics overview.
-
property
statistic_timestamp_format
¶ Timestamp format for the statistics overview.
-
property
stop_on_max_result_lines
¶ Stop diffing on maximum result line setting.
-
property
targets
¶ List of configured targets.
-
property
temp_directories
¶ List of temporary directories.
-
property
template_directory
¶ Name of the template directory.
-
property
xlsx_template
¶ Name of the XSLX templates directory.
-
property
-
class
ncdiff.configuration.
ConfigurationReader
(config_file, defaults={'HTMLResourcesDirectory': 'resources/html', 'XLSXTemplate': 'template_green-grey.xltx', 'absoluteTolerance': '0.0', 'bothCSVDelimiter': ';', 'bothCSVDoublequote': 'TRUE', 'bothCSVQuotechar': '"', 'bothCSVQuoting': 'QUOTE_MINIMAL', 'bothDirectory': './', 'bothHasHeader': 'TRUE', 'bothNumberFormat': 'DE', 'bothSQLDriver': 'pyodbc', 'bothSQLFetchSize': '500', 'copyInputFiles': 'FALSE', 'keepTempFiles': 'FALSE', 'maxResultLines': '1000', 'relativeTolerance': '0.0', 'resultFilterDirectory': './', 'resultFilterEmptyMarker': '<empty>', 'resultFilterXLSSheetName': 'ResultFilter', 'resultFormats': 'CSV, HTML, XLS', 'resultNumberFormat': 'DE', 'showFilteredResults': 'FALSE', 'showFilteredTolerances': 'FALSE', 'stopOnMaxResultLines': 'FALSE', 'templateDirectory': 'templates'}, global_options={'HTMLResourcesDirectory', 'XLSXTemplate', 'bothDirectory', 'configurations', 'extensionModules', 'newDirectory', 'newLabel', 'oldDirectory', 'oldLabel', 'resultDirectory', 'resultFilterDirectory', 'resultFormats', 'resultNumberFormat', 'showResult', 'statisticColumns_CL', 'statisticColumns_CSV', 'statisticColumns_HTML', 'statisticColumns_JUNIT', 'statisticColumns_XLSX', 'statisticColumns_XRAY', 'statisticTimeStampFormat', 'targets', 'tempDirectories', 'templateDirectory'}, cmd_line_arguments=None, separator=',', sub_separator=';', dict_separator=':', parsing_time=None)¶ Bases:
object
A configuration reader object.
- It contains
global values
the values of a section in a config file
the values of commandline arguments
The file format is the same as for ConfigParser.SafeConfigParser. Default values can be defined in the section [DEFAULT]. Global values can be defined in the section [GLOBAL]. Section names are case sensitive. Option names are case insensitive.
- This configuration provides the values in the following priority:
commandline arguments
section or global values
default values
None if the value is not present. (does not raise NoOptionError)
Newlines in configuration values are converted to spaces.
It is also possible to fetch the values for a certain data type. Already parsed results will be cached until an update to the config parser data occurs.
str, int, float, bool
tuple of str, tuple of int, tuple of float, tuple of bool
dict of str values, dict of int values, dict of float values, dict of bool values
-
LEVEL_COMMANDLINE
= 4¶
-
LEVEL_DEFAULT
= 1¶
-
LEVEL_DEFAULT_SECTION
= 2¶
-
LEVEL_SECTION
= 3¶
-
LEVEL_UNDEFINED
= 0¶
-
TRANSLATE_NEWLINE
= {10: None, 13: None}¶
-
property
configuration_file_name
¶ Return configuration file name.
-
get
(option, default=None)¶ Get the option value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default (
str
) – The default value if option does not exist.
- Rückgabe
The value for option or default if option does not exist.
- Rückgabetyp
str
-
get_boolean
(option, option2=None, option3=None, default=None, both=None)¶ Get boolean configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The boolean value for option or default if option does not exist.
- Rückgabetyp
bool
-
get_boolean_dict
(option, default=None, allow_empty_value=False)¶ Get a boolean dictionary configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
allow_empty_value – If True the conversion will not fail if there is no dict separator
in the string, instead it will use the string as key for the dictionary and the value is None. :type allow_empty_value:
bool
:return: The bool dict value for option or default if option does not exist. :rtype:dict of bool values
-
get_boolean_tuple
(option, default=None)¶ Get a boolean tuple configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The boolean tuple value for option or default if option does not exist.
- Rückgabetyp
list of bool
-
get_boolean_tuple_value_dict
(option, default=None)¶ Get a dictionary of boolean tuples from the configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The bool dict value for option or default if option does not exist.
- Rückgabetyp
dict of bool tuple
-
get_both
(option_both, option_new, option_old, default=None)¶ Get option value for configurations with old/new/both prefix.
- Parameter
option_both (
str
) – The name of the option that includes the both statement to get the configuration value.option_new (
str
) – The name of the option that includes the new statement to get the configuration value.option_both – The name of the option that includes the old statement to get the configuration value.
default – The default value if option does not exist.
- Rückgabe
The values for options new and old or default for the option that does not exist.
- Rückgabetyp
tuple(str, str)
-
get_dict
(option1, option2=None, option3=None, both=None, default=None, allow_empty_value=False)¶ Get a dictionary configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
allow_empty_value – If True the conversion will not fail if there is no dict separator
in the string, instead it will use the string as key for the dictionary and the value is None. :type allow_empty_value:
bool
:return: The str dict value for option or default if option does not exist. :rtype:dict of str values
-
get_float
(option, default=None)¶ Get float configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The float value for option or default if option does not exist.
- Rückgabetyp
float
-
get_float_dict
(option, default=None, allow_empty_value=False)¶ Get a float dictionary configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
allow_empty_value – If True the conversion will not fail if there is no dict separator
in the string, instead it will use the string as key for the dictionary and the value is None. :type allow_empty_value:
bool
:return: The float dict value for option or default if option does not exist. :rtype:dict of float values
-
get_float_tuple
(option, default=None)¶ Get a float tuple configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The float tuple value for option or default if option does not exist.
- Rückgabetyp
tuple of float
-
get_float_tuple_value_dict
(option, default=None)¶ Get a dictionary of float tuples from the configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The float dict value for option or default if option does not exist.
- Rückgabetyp
dict of float tuple
-
get_int
(option, option2=None, option3=None, default=None, both=None)¶ Get integer configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The int value for option or default if option does not exist.
- Rückgabetyp
int
-
get_int_dict
(option, default=None, allow_empty_value=False)¶ Get a integer dictionary configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
allow_empty_value – If True the conversion will not fail if there is no dict separator
in the string, instead it will use the string as key for the dictionary and the value is None. :type allow_empty_value:
bool
:return: The int dict value for option or default if option does not exist. :rtype:dict of int values
-
get_int_tuple
(option, option2, option3, default=None, both=None)¶ Get integer tuple configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The int tuple value for option or default if option does not exist.
- Rückgabetyp
tuple of int
-
get_int_tuple_value_dict
(option, default=None)¶ Get a dictionary of integer tuples from the configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The int dict value for option or default if option does not exist.
- Rückgabetyp
dict of int tuple values
-
get_option_names
()¶ Get a list of all available option names in lowercase letters.
- Rückgabe
A list of all available option names in lowercase letters.
- Rückgabetyp
list of str
-
get_tuple
(option, option2=None, option3=None, both=None, default=None)¶ Get a tuple configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The str tuple value for option or default if option does not exist.
- Rückgabetyp
tuple of str
-
get_tuple_value_dict
(option, option2=None, option3=None, both=None, default=None)¶ Get a dictionary of tuples from the configuration value.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Rückgabe
The str dict value for option or default if option does not exist.
- Rückgabetyp
dict of str tuple values
-
property
global_option_names
¶ List of all available option names of the global section.
-
property
parsing_timestamp
¶ Parse time stamp of the configuration file.
-
property
section_name
¶ Return currently selected section or
None
.
-
property
section_names
¶ List of section names in the configuration file.
-
select_section
(section_name)¶ Before calling get or set methods a section must be selected.
- Parameter
section_name (
str
) – The name of the configuration section to fetch the values from.
-
set
(option, value, remove_cmd_line_argument=True)¶ Set an option value to the section or as GLOBAL value.
- Parameter
option (
str
) – The name of the option to set.value (
str
) – The string value to set.remove_cmd_line_argument (
bool
) – The default is True, which has the meaning that the commandline argument for the option will be removed, so that the setting becomes visible. If False the commandline argument will continue to override the new setting.
-
class
ncdiff.configuration.
GlobalConfiguration
(configuration_reader)¶ Bases:
object
Contains the getters for each configuration value in a format usable by NCDiff.
If a setting was missing it’s value is None. A GlobalConfiguration contains the configuration of the global parameters.
-
property
configuration_file_name
¶ Name of the configuration file.
-
property
constraint_evaluator
¶ List of constraints for this configuration.
-
property
extension_modules
¶ List of extension modules.
-
get_global
(option, default=None, section_name='GLOBAL')¶ Get the value of an configuration parameter.
This is very helpful in case of custom parameters that are not part of NCDiff core. This is a possibility to access those from within the different factory/hook modules. Per default this function retrieves configuration parameters stored in the GLOBAL section but since the section_name is an optional parameter it is also possible to access other specific TARGETS or the DEFAULT section.
- Parameter
option (
str
) – The name of the option to get the configuration value.default (if specified a class representing the option) – The default value if option does not exist. Default: None
section_name (
str
) – Optional name of the section that should be accessed Default: GLOBAL
- Rückgabe
The value for option or default if option does not exist. An additional value from the configuration reader from the target where no method was written for.
- Rückgabetyp
str
-
get_statistic_columns
(output_format)¶ Return the list of column names for the statistic report.
- Rückgabe
The list of column names for the statistic report.
- Rückgabetyp
list of str
-
property
global_option_names
¶ List of all available option names of the global section.
-
property
html_resources_directory
¶ Name of the HTML resources directory.
-
property
new_directory
¶ Name of the directory of the new input files.
-
property
new_label
¶ Label for the „new“ side in the output.
-
property
old_directory
¶ Name of the directory of the old input files.
-
property
old_label
¶ Label for the „old“ side in the output.
-
property
result_directory
¶ Name of the result directory.
-
property
result_filter_directory
¶ Location of the directory where the ResultFilter Excel field can be found.
-
property
result_formats
¶ List of result file formats to write.
-
property
result_number_format
¶ Format used for numbers in result files.
-
property
show_result
¶ Flag to show the diff result in a document viewer.
-
property
statistic_timestamp
¶ Timestamp for the statistics overview.
-
property
statistic_timestamp_format
¶ Timestamp format for the statistics overview.
-
property
targets
¶ List of configured targets.
-
property
temp_directories
¶ List of temporary directories.
-
property
template_directory
¶ Name of the template directory.
-
property
xlsx_template
¶ Name of the XSLX templates directory.
-
property
-
class
ncdiff.configuration.
TargetConfiguration
(basic_target_configuration)¶ Bases:
ncdiff.configuration.BasicTargetConfiguration
Contains the getters for each configuration value in a format usable by ncdiff.
If a setting was missing it’s value is None. All „enhanced“ information that has to be created by factories or requires an input file to be analysed will be done in a TargetConfiguration. Each diff target configuration MUST contain all the information to create a diff of the target!
-
property
absolute_columns_tolerance_functions
¶ Return the function to evaluate absolute column tolerance constraints.
-
property
absolute_columns_tolerances
¶ Absolute tolerances for columns.
-
property
absolute_tolerance
¶ Absolute tolerance.
-
property
comparator
¶ Return the comparator object.
-
property
configuration_file_name
¶ Name of the configuration file.
-
property
constraint_evaluator
¶ List of constraints for this configuration.
-
property
copied_result_filter_file_path
¶ Return the file name of the copied result filter file in in the result directory.
-
property
copy_input_files
¶ Copy the original input files to the output setting.
-
property
diff_column_map
¶ Column map.
-
property
differ
¶ Return the differ object.
-
property
extension_modules
¶ List of extension modules.
-
get
(option, default=None)¶ Get the value for an option.
- Parameter
option (
str
) – The name of the option to get the configuration value.default – The default value if option does not exist.
- Type
default:
str
- Rückgabe
The value for option or default if option does not exist.
- Rückgabetyp
str
-
get_global
(option, default=None, section_name='GLOBAL')¶ Get the value of an configuration parameter.
This is very helpful in case of custom parameters that are not part of NCDiff core. This is a possibility to access those from within the different factory/hook modules. Per default this function retrieves configuration parameters stored in the GLOBAL section but since the section_name is an optional parameter it is also possible to access other specific TARGETS or the DEFAULT section.
- Parameter
option (
str
) – The name of the option to get the configuration value.default (if specified a class representing the option) – The default value if option does not exist. Default: None
section_name (
str
) – Optional name of the section that should be accessed Default: GLOBAL
- Rückgabe
The value for option or default if option does not exist. An additional value from the configuration reader from the target where no method was written for.
- Rückgabetyp
str
-
get_statistic_columns
(output_format)¶ Return the list of column names for the statistic report.
- Rückgabe
The list of column names for the statistic report.
- Rückgabetyp
list of str
-
property
global_option_names
¶ List of all available option names of the global section.
-
property
html_resources_directory
¶ Name of the HTML resources directory.
-
property
keep_temporary_files
¶ Keep temporary files.
-
property
map_column_ids
¶ Column id map.
-
property
map_column_names
¶ Column names map.
-
property
max_result_lines
¶ Return number of maximum result lines.
-
property
name
¶ Name of the target.
-
property
new_column_count
¶ Return the new column count.
-
property
new_column_formats
¶ Return new column formats.
-
property
new_column_names
¶ Return the new column names.
-
property
new_column_widths
¶ Return new column widths.
-
property
new_copied_file_name
¶ Return the file name of the new copied file.
-
property
new_copied_file_path
¶ Return the file path of the new copied file.
-
property
new_csv_delimiter
¶ Return new CSV delimiter.
-
property
new_csv_doublequote
¶ Return new CSV double quote.
-
property
new_csv_escapechar
¶ Return new CSV escape character.
-
property
new_csv_quotechar
¶ Return new CSV quoting character.
-
property
new_csv_quoting
¶ Return new CSV quoting.
-
property
new_csv_replace_delimiters
¶ Return new CSV replace delimiter.
-
property
new_directory
¶ Name of the directory of the new input files.
-
property
new_encoding
¶ Return the encoding of the new file.
-
property
new_file_name
¶ Old file name.
-
property
new_file_path
¶ Return new file path.
-
property
new_format
¶ Return new file format.
-
property
new_has_header
¶ Return new file has headers.
-
property
new_ignore_column_constraints
¶ Return new ignore column constraints.
-
property
new_ignore_column_constraints_functions
¶ Return the function to evaluate ignore column constraints.
-
property
new_ignore_columns
¶ Return new ignore columns.
-
property
new_key_columns
¶ Return new key columns.
-
property
new_label
¶ Label for the „new“ side in the output.
-
property
new_number_format
¶ Return new number format.
-
property
new_reader
¶ Return the reader for the new file.
-
property
new_row_filter_function
¶ Return the function to evaluate row filter constraints.
-
property
new_row_filters
¶ Return new row filters.
-
property
new_size
¶ Old file size.
-
property
new_sorted_file_path
¶ Return the file path of the new sorted file.
-
property
new_sql_connection
¶ Get the new sql connection string.
-
property
new_sql_driver
¶ Return new sql driver module name.
-
property
new_sql_fetch_size
¶ Get the old number of rows that should be fetched at once from the database.
-
property
new_sql_query
¶ Return the new sql query string.
-
property
new_xls_sheet_name
¶ Return new XLS sheet name.
-
property
old_column_count
¶ Old column count.
-
property
old_column_formats
¶ Old column formats.
-
property
old_column_names
¶ Old column names.
-
property
old_column_widths
¶ Old column widths.
-
property
old_copied_file_name
¶ Return the file name of the old copied file.
-
property
old_copied_file_path
¶ Return the file path of the old copied file.
-
property
old_csv_delimiter
¶ Old CSV delimiter.
-
property
old_csv_doublequote
¶ Old CSV double quote.
-
property
old_csv_escapechar
¶ Old CSV escape character.
-
property
old_csv_quotechar
¶ Old CSV quoting character.
-
property
old_csv_quoting
¶ Old CSV quoting.
-
property
old_csv_replace_delimiters
¶ Old CSV replace delimiter.
-
property
old_directory
¶ Name of the directory of the old input files.
-
property
old_encoding
¶ Return the encoding of the old file.
-
property
old_file_name
¶ Old file name.
-
property
old_file_path
¶ Old file path.
-
property
old_format
¶ Return new file format.
-
property
old_has_header
¶ Old file has headers.
-
property
old_ignore_column_constraints
¶ Old ignore column constraints.
-
property
old_ignore_column_constraints_functions
¶ Return the function to evaluate ignore column constraints.
-
property
old_ignore_columns
¶ Old ignore columns.
-
property
old_key_columns
¶ Old key columns.
-
property
old_label
¶ Label for the „old“ side in the output.
-
property
old_number_format
¶ Old number format.
-
property
old_reader
¶ Return the reader for the old file.
-
property
old_row_filter_function
¶ Return the function to evaluate row filter constraints.
-
property
old_row_filters
¶ Old row filters.
-
property
old_size
¶ Old file size.
-
property
old_sorted_file_path
¶ Return the file path of the old sorted file.
-
property
old_sql_connection
¶ Old sql connection string.
-
property
old_sql_driver
¶ Old sql driver module.
-
property
old_sql_fetch_size
¶ Get the old number of rows that should be fetched at once from the database.
-
property
old_sql_query
¶ Get the old sql query string.
-
property
old_xls_sheet_name
¶ Old XLS sheet name.
-
property
option_names
¶ List of all available option names.
-
property
relative_columns_tolerance_functions
¶ Return the function to evaluate relative column tolerance constraints.
-
property
relative_columns_tolerances
¶ Relative tolerance for columns.
-
property
relative_tolerance
¶ Relative tolerance.
-
property
result_directory
¶ Name of the result directory.
-
property
result_file_name
¶ Return the result file name without extension.
-
property
result_file_path
¶ Return the result file path for the passed format.
-
property
result_filter_directory
¶ Location of the directory where the ResultFilter Excel field can be found.
-
property
result_filter_empty_marker
¶ Get the empty marker for a result filter.
-
property
result_filter_file_path
¶ Return the result filter path.
Either the name of the file or the location relative to the path of ‚resultFilterDirectory‘ or new absolute path/location including the file name. In this case the ‚resultFilterDirectory‘ will be ignored
-
property
result_filter_xls_sheet_name
¶ Return the name of the Excel Sheet where all the ResultFilter information is stored.
-
property
result_formats
¶ List of result file formats to write.
-
property
result_number_format
¶ Format used for numbers in result files.
-
property
show_filtered_results
¶ Indicate if filtered results should be reported as differences (for debugging) or not.
-
property
show_input_filters
¶ Indicate if ResultFilter matches should be reported as differences (for debugging) or not.
-
property
show_result
¶ Flag to show the diff result in a document viewer.
-
property
show_tolerance_results
¶ Indicate if Tolerance matches should be reported as differences (for debugging) or not.
-
property
statistic_timestamp
¶ Timestamp for the statistics overview.
-
property
statistic_timestamp_format
¶ Timestamp format for the statistics overview.
-
property
stop_on_max_result_lines
¶ Stop diffing on maximum result line setting.
-
property
targets
¶ List of configured targets.
-
property
temp_directories
¶ List of temporary directories.
-
property
template_directory
¶ Name of the template directory.
-
property
xlsx_template
¶ Name of the XSLX templates directory.
-
property
-
ncdiff.configuration.
create_basic_target_configuration
(configuration_reader, target_name)¶ Create basic_target_configuration objects for each of the configuration targets in configuration_reader.
(Factory function)If the –targets commandline switch was used, the configurations will only be created for the specified targets. :param configuration_reader: A configuration reader object that has read a configuration file. :type configuration_reader:
ConfigurationReader
:param target_name: The name of the diff target (also the name of the configuration section). If the target_name is None, the global configuration will be returned only. :type target_name:str
:return: A basic target configuration containing the parsed configuration results of a single diff target. :rtype:BasicTargetConfiguration
-
ncdiff.configuration.
create_global_configuration
(configuration_reader)¶ Create a configuration for the global parameters.
- Parameter
configuration_reader (
ConfigurationReader
) – A configuration reader object that has read a configuration file.- Rückgabe
A global configuration containing the parsed configuration results of the global parameters.
- Rückgabetyp
-
ncdiff.configuration.
create_target_configuration
(basic_target_configuration)¶ Create a configuration suitable for diff runs from a basic target configuration.
- Parameter
basic_target_configuration (
BasicTargetConfiguration
) – A configuration for a target containing the parsed configuration results.- Rückgabe
A target configuration usable for diff runs.
- Rückgabetyp
ncdiff.constants module¶
Diff tool constants.
- since
2012-02-10
-
class
ncdiff.constants.
CLMN_REPORT
¶ Bases:
object
Column names for diff report to be written.
-
ABS_DIFFERENCE
= 'Absolute Difference'¶
-
CMT
= 'Comment'¶
-
COMPARISON_TYPE
= 'Comparison Type'¶
-
CSV
= ['Key', 'Old Row', 'Old Field', 'Old Value', 'New Value', 'New Field', 'New Row', 'Absolute Difference', 'Relative Difference', 'Comparison Type', 'Status', 'Review Status', 'Comment']¶
-
HTML
= ['Key', 'Old Row', 'Old Field', 'Old Value', 'New Value', 'New Field', 'New Row', 'Absolute Difference', 'Relative Difference', 'Comparison Type', 'Status']¶
-
KEY
= 'Key'¶
-
NEW_FIELD_NAME
= 'New Field'¶
-
NEW_FIELD_VAL
= 'New Value'¶
-
NEW_ROW_NUMBER
= 'New Row'¶
-
OLD_FIELD_NAME
= 'Old Field'¶
-
OLD_FIELD_VAL
= 'Old Value'¶
-
OLD_ROW_NUMBER
= 'Old Row'¶
-
REL_DIFFERENCE
= 'Relative Difference'¶
-
REV_STATUS
= 'Review Status'¶
-
ROW_NUMBER
= 'Row'¶
-
STATUS
= 'Status'¶
-
XLSX
= ['Key', 'Old Row', 'Old Field', 'Old Value', 'New Value', 'New Field', 'New Row', 'Absolute Difference', 'Relative Difference', 'Comparison Type', 'Status', 'Review Status', 'Comment']¶
-
-
class
ncdiff.constants.
CLMN_STAT
¶ Bases:
object
Column names for the statistic file.
-
CELLS_NEW
= 'New Cells'¶
-
CELLS_OLD
= 'Old Cells'¶
-
CL
= ['Diff Target', 'Status', 'Matched Lines %', 'Differences', 'Missing in Old', 'Missing in New', 'Duplicate Keys', 'Start Time', 'Duration']¶
-
COMMENT
= 'Comment'¶
-
CSV
= ['Diff Target', 'Status', 'Matched Lines %', 'Differences', 'Missing in Old', 'Missing in New', 'Duplicate Keys', 'Start Time', 'Duration']¶
-
DIFFERENCES_FILTERED
= 'Differences Filtered'¶
-
DIFFERENCES_TOLERANCED
= 'Differences Toleranced'¶
-
DIFFS
= 'Differences'¶
-
DUPLICATE
= 'Duplicate Keys'¶
-
DURATION
= 'Duration'¶
-
HTML
= ['Diff Target', 'Status', 'Matched Lines %', 'Differences', 'Missing in Old', 'Missing in New', 'Duplicate Keys', 'Duration']¶
-
JUNIT
= ['Diff Target', 'Status', 'Matched Lines %', 'Differences', 'Missing in Old', 'Missing in New', 'Duplicate Keys', 'Start Time', 'Duration']¶
-
LINES_NEW
= 'New Lines'¶
-
LINES_OLD
= 'Old Lines'¶
-
LINK_NAME
= 'Target Link Name'¶
-
MATCHED_CELLS
= 'Matched Cells'¶
-
MATCHED_CELLS_PERCENTAGE
= 'Matched Cells %'¶
-
MATCHED_LINES
= 'Matched Lines'¶
-
MATCHED_LINES_PERCENTAGE
= 'Matched Lines %'¶
-
MISSING_NEW
= 'Missing in New'¶
-
MISSING_OLD
= 'Missing in Old'¶
-
NAME
= 'Diff Target'¶
-
START
= 'Start Time'¶
-
STATUS
= 'Status'¶
-
STOP
= 'Stop Time'¶
-
XLSX
= ['Diff Target', 'Status', 'Matched Lines %', 'Differences', 'Missing in Old', 'Missing in New', 'Duplicate Keys', 'Comment', 'Start Time', 'Duration']¶
-
XRAY
= ['Diff Target', 'Status', 'Matched Lines %', 'Differences', 'Missing in Old', 'Missing in New', 'Duplicate Keys', 'Start Time', 'Duration']¶
-
-
class
ncdiff.constants.
FILTER_MODE
¶ Bases:
object
Enum for the filter mode.
-
INVERSE
= 1¶
-
NORMAL
= 0¶
-
ncdiff.constraint module¶
Unified constraint handling that replaces column constraints and row filters.
Each filter class implements a check method. This method will then be called when evaluating the code object of a filter expression. The code object is obtained by translating the ncdiff Excel like filter language to compiled python code.
- since
2014-05-03
-
class
ncdiff.constraint.
AbsDiffConstraint
¶ Bases:
ncdiff.constraint.ResultContextConstraint
Check an absolut value.
- Check if the absolute values of an difference either
exactly match a given value (abs_diff(#) or
if the absolute difference is between a range of values (abs_diff(#;#))
-
CONSTRAINT_NAME
= 'abs_diff'¶
-
CONTEXT_CLASS
¶ Alias von
ResultContext
-
classmethod
call
(ctx, first_value, second_value=None)¶ Check if the constraint matches.
- Parameter
ctx (
ResultContext
) – The context for this function.first_value (
float
) – Either the value that has to be exactly matched or the lower part of the rangesecond_value (
float
) – The upper part of the range.
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
class
ncdiff.constraint.
BaseConstraint
¶ Bases:
object
Abstract class.
Base class for all constraints. Serves as namespace for constraint functions. A constraint function implements a feature in the constraint language.
-
CONSTRAINT_NAME
= None¶
-
CONTEXT_CLASS
= None¶
-
classmethod
call
(*args)¶ Abstract method: must be implemented in a subclass.
Implements the constraint function. :param args: The function arguments. If getContextName() returns the name of a context (is not None) the first argument of the function call will be the context, the other arguments will follow. :type args:
list
:return: The value of the constraint function. :rtype:object
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
BaseContext
¶ Bases:
object
Abstract class.
Context classes provide data as attributes that are required by the constraint functions. Each constraint context provides the context for a specific function call and is passed to the function as first argument. Each function context is initialized by the constructor and provides access to it’s elements via public properties.
-
classmethod
get_context_name
()¶ Return context name.
-
classmethod
-
class
ncdiff.constraint.
CellValueConstraint
¶ Bases:
ncdiff.constraint.RowContextConstraint
The constraint returns the value of a cell, this is the implementation of the @ operator.
The default is that @ behaves like old@.
-
CONSTRAINT_NAME
= 'cell_value'¶
-
CONTEXT_CLASS
¶ Alias von
RowContext
-
classmethod
call
(ctx, col_id, row_type='old')¶ Check if the constraint matches.
- Parameter
ctx (
RowContext
) – The context for this function.col_id (
str
) – The column id which value should be obtained.row_type (
str, int or float
) – The type of the row, can be None, „old“ or „new.
- Rückgabe
The value of the cell. If the row_type does not match the context
an empty string will be returned. :rtype:
str
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
ConstraintEvaluator
(constraints)¶ Bases:
object
Namespace for constraint evaluation methods.
- Supports
reader row constraints
comparator column constraints
writer
-
compile_expression_to_function
(expression, is_boolean_expression=True)¶ Get an evaluation function that is able to evaluate a piece of compiled constraint language.
(Curried version of _evalConstraintExpr(code, …)) :param expression: A string that will be compiled to a python code object. :type expression:
str
:param is_boolean_expression: If True the compiled expression can only return boolean values (the default). If False then if expressions are possible and literal values will be returned. :type is_boolean_expression:bool
:return: An evaluation function including the context of the constraint language. An evaluation function expects two arguments:contexts: A list of context objects required by the constraint classes.
default: A default return value if some part of the expression is undefined.
- Rückgabetyp
function
-
class
ncdiff.constraint.
ContainsConstraint
¶ Bases:
ncdiff.constraint.BaseConstraint
The constraint is True if a search string is part of the cell.
-
CONSTRAINT_NAME
= 'contains'¶
-
CONTEXT_CLASS
= None¶
-
classmethod
call
(data, search_value)¶ Check if the constraint matches.
- Parameter
data (
str
) – The data to scan for a match.search_value (
str, int or float
) – The search string.
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
DiffConstraint
¶ Bases:
ncdiff.constraint.ResultContextConstraint
Class checks if it is a difference.
-
CONSTRAINT_NAME
= 'diff'¶
-
CONTEXT_CLASS
¶ Alias von
ResultContext
-
NON_DIFFERENCE_COMPARISON_TYPES
= frozenset({'duplicate', 'missing'})¶
-
classmethod
call
(ctx)¶ Call a function.
- Parameter
ctx (
ResultContext
) – The context for this function.- Rückgabe
True if the result is a difference
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
DuplicateConstraint
¶ Bases:
ncdiff.constraint.ResultContextConstraint
Class checks if it is a duplicate.
-
CONSTRAINT_NAME
= 'duplicate'¶
-
CONTEXT_CLASS
¶ Alias von
ResultContext
-
classmethod
call
(ctx, old_or_new=None)¶ Call function.
- Parameter
ctx (
ResultContext
) – The context for this function.old_or_new (
str
) – The restrict the check to the „old“ or the „new“ row.
- Rückgabe
True if the result is a duplicate.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
EndsWithConstraint
¶ Bases:
ncdiff.constraint.BaseConstraint
The constraint is True if the cell value ends on a search string.
-
CONSTRAINT_NAME
= 'endswith'¶
-
CONTEXT_CLASS
= None¶
-
classmethod
call
(data, search_value)¶ Check if the constraint matches.
- Parameter
data (
str
) – The data to scan for a match.search_value (
str, int or float
) – The search string.
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
EqualsConstraint
¶ Bases:
ncdiff.constraint.BaseConstraint
The constraint is True if a search string equals the data.
-
CONSTRAINT_NAME
= 'equals'¶
-
CONTEXT_CLASS
= None¶
-
classmethod
call
(data, search_value)¶ Check if the constraint matches.
- Parameter
data (
str
) – The data to scan for a match.search_value (
str, int or float
) – The search string.
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
MissingConstraint
¶ Bases:
ncdiff.constraint.ResultContextConstraint
Class checks if it is missing in any file.
-
CONSTRAINT_NAME
= 'missing'¶
-
CONTEXT_CLASS
¶ Alias von
ResultContext
-
classmethod
call
(ctx, old_or_new=None)¶ Call function.
- Parameter
ctx (
ResultContext
) – The context for this function.old_or_new (
str
) – The restrict the check to the „old“ or the „new“ row.
- Rückgabe
True if the result is missing.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
RelDiffConstraint
¶ Bases:
ncdiff.constraint.ResultContextConstraint
Check relative values.
- Checking if the relative values of an difference either
exactly match a given value (rel_diff(#) or
if the absolute difference is between a range of values (rel_diff(#;#))
-
CONSTRAINT_NAME
= 'rel_diff'¶
-
CONTEXT_CLASS
¶ Alias von
ResultContext
-
classmethod
call
(ctx, first_value, second_value=None)¶ Check if the constraint matches.
- Parameter
ctx (
ResultContext
) – The context for this function.first_value (
float
) – Either the value that has to be exactly matched or the lower part of the rangesecond_value (
float
) – The upper part of the range.
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
class
ncdiff.constraint.
ResultContext
(comparison_type=None, abs_diff=None, rel_diff=None, is_old_row=None)¶ Bases:
ncdiff.constraint.BaseContext
Provides a context for functions that may require access to diff result.
-
classmethod
get_context_name
()¶ Return context name.
-
classmethod
-
class
ncdiff.constraint.
ResultContextConstraint
¶ Bases:
ncdiff.constraint.BaseConstraint
Base class for constraints using a ResultContext in function calls.
-
CONSTRAINT_NAME
= None¶
-
CONTEXT_CLASS
¶ Alias von
ResultContext
-
classmethod
call
(*args)¶ Abstract method: must be implemented in a subclass.
Implements the constraint function. :param args: The function arguments. If getContextName() returns the name of a context (is not None) the first argument of the function call will be the context, the other arguments will follow. :type args:
list
:return: The value of the constraint function. :rtype:object
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
RowContext
(row, column_names, row_nr=1, row_new=None, column_names_new=None, row_nr_new=1)¶ Bases:
ncdiff.constraint.BaseContext
Provides a context for functions that may require access to a row.
-
classmethod
get_context_name
()¶ Return context name.
-
classmethod
-
class
ncdiff.constraint.
RowContextConstraint
¶ Bases:
ncdiff.constraint.BaseConstraint
Base class for constraints using a RowContext in function calls.
-
CONSTRAINT_NAME
= None¶
-
CONTEXT_CLASS
¶ Alias von
RowContext
-
classmethod
call
(*args)¶ Abstract method: must be implemented in a subclass.
Implements the constraint function. :param args: The function arguments. If getContextName() returns the name of a context (is not None) the first argument of the function call will be the context, the other arguments will follow. :type args:
list
:return: The value of the constraint function. :rtype:object
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
RowEmptyConstraint
¶ Bases:
ncdiff.constraint.RowContextConstraint
This constraint is True if the row consists of empty cells, regardless how many cells were in there.
-
CONSTRAINT_NAME
= 'row_empty'¶
-
CONTEXT_CLASS
¶ Alias von
RowContext
-
classmethod
call
(ctx)¶ Check if the constraint matches.
- Parameter
ctx (
RowContext
) – The context for this function.- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
RowRangeConstraint
¶ Bases:
ncdiff.constraint.RowContextConstraint
The constraint is True if startRow <= rowNr <= endRow.
-
CONSTRAINT_NAME
= 'row_range'¶
-
CONTEXT_CLASS
¶ Alias von
RowContext
-
classmethod
call
(ctx, start_row_nr, end_row_nr=None)¶ Call a function.
- Parameter
ctx (
RowContext
) – The context for this function.start_row_nr (
int
) – Start row number, the first rowNr is 1end_row_nr (
int
) – End row number (optional)
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
class
ncdiff.constraint.
StartsWithConstraint
¶ Bases:
ncdiff.constraint.BaseConstraint
The constraint is True if the data starts with a search string.
-
CONSTRAINT_NAME
= 'startswith'¶
-
CONTEXT_CLASS
= None¶
-
classmethod
call
(data, search_value)¶ Check if the constraint matches.
- Parameter
data (
str
) – The data to scan for a match.search_value (
str, int or float
) – The search string.
- Rückgabe
True if the constraint matches, False otherwise.
- Rückgabetyp
bool
-
classmethod
call_with_context
(context_map, *args)¶ Call function with context.
- Parameter
context_map (
dict
) – A map from a context name to a function context object.args (
list
) – Additional function arguments.
-
classmethod
get_constraint_name
()¶ Return constraint name.
- Rückgabe
The name of the constraint function.
- Rückgabetyp
str
-
classmethod
get_context_name
()¶ Return context name.
- Rückgabe
The class of the constraint context that can be used with the call function.
- Rückgabetyp
str
-
-
ncdiff.constraint.
get_constraints
(global_configuration)¶ Return all available constraint classes.
A customer implementation will extend the available constraint list. :param global_configuration: The configuration of the diff target. :type global_configuration:
GlobalConfiguration
:return: A list of constraint classes. :rtype:list of class
ncdiff.constraint_translator module¶
A parser translator for the constraint framework.
This module uses pyparsing to parse the formulas with a supplied grammar and implements parse actions to convert them to python code.
The framework supports constraints based on cell contents and row contents. Each constraint function follows the pattern: constraint_name(arg1; arg2, arg3; …).
The syntax is similar to german Excel formulas, but uses english words only.
- Literal values:
INT
FLOAT
STRING
- Functions:
not(BOOL_EXPR)
or(BOOL_EXPR; BOOL_EXPR; BOOL_EXPR; …)
and(BOOL_EXPR; BOOL_EXPR; BOOL_EXPR; …)
if(BOOL_EXPR; TRUE_EXPR)
if(BOOL_EXPR; TRUE_EXPR; FALSE_EXPR)
function( … )
- Column value access via @, where COLID can be a positive integer, a string or a xls column name
- For example:
0.5
12
‚single quoted string‘
„double quoted string“
or(row_empty(); and(contains(@5, ‚GBP‘); cell_contains(@‘Acquirer‘, ‚Deutsche Bank‘); row_contrains(@‘Counterparty‘, ‚RBS‘))
if(contains(@A; ‚3472‘); 0.5; 5.0)
Expressions can be nested.
The result of a compile method is a compiled python code object of the formula that can be used with eval:
result = eval(codeObject, globalsDict, localsDict).
The globalsDict should contain „static“ information like supported builtin functions or the constraint functions. The localsDict should contain information required for evaluation of changing information. The variable default contains the default value that is returned as value of not fully specified if functions.
- Example::
- globalsDict = { # select specific python built-in functions
„__builtins__“: {„max“: max, „min“: min, „bool“: bool}, # constraint functions „contains“: a reference to a constraint method evalCheck, „row_empty“: a reference to a constraint method evalCheck
}
- localsDict = { # the default value of incomplete if functions
„default“: None, # the row to check „row“: None, „rowNr“: None, „colNr“: None
}
-
class
ncdiff.constraint_translator.
ConstraintTranslator
(tests=False)¶ Bases:
object
Create a parser translator for a set of column names.
The result of the compile methods is a python code object suitable for use with eval(codeObj, globalDict, localDict). The row constraint and column constraint functions must be provided in the globalDict.
-
static
add_bool
(strg, locn, toks)¶ Wrap the expression in a call to bool.
-
static
add_context_map_argument
(strg, locn, toks)¶ Add a contextMap argument as first argument to a cell or row constraint function.
-
static
add_quotes
(strg, locn, toks)¶ Wrap the expression in a call to bool.
-
static
bool_func_rewrite
(strg, locn, toks)¶ Rewrite the boolean functions or/and to max/min with argument conversions to bool.
- The token list looks like::
[‚min‘, ‚(‚, ‚)‘]
- or::
[‚min‘, ‚(‚, BOOL_EXPR, … ‚)‘]
- rewrite these to::
[False]
- and::
[‚min‘(‚, ‚bool‘, ‚(‚, ‚BOOL_EXPR, ‚)‘, … ‚)‘]
-
static
cell_value_rewrite
(strg, locn, toks)¶ Convert the @ operator to cell_value(contextMap, COLUMN, ROW_TYPE) function calls.
-
compile_bool_expression
(constraint_expression)¶ Compile a constraint expression to python code.
The result of a boolean expression is always True or False. :param constraint_expression: The constraint expression to translate. :type constraint_expression:
str
:return: A python code object that can be used with eval. :rtype:code
:raises:ValidationError
if the python code object cannot be created
-
compile_expression
(constraint_expression)¶ Compile a constraint expression to python code.
- Parameter
constraint_expression (
str
) – The constraint expression to translate.- Rückgabe
A python code object that can be used with eval.
- Rückgabetyp
code
- Raises
ValidationError
if the python code object cannot be created
-
static
if_func_rewrite
(strg, locn, toks)¶ Rewrite the if function into a python if expression.
- The token list looks like::
[‚if‘, ‚(‚, BOOL_EXPR, ‚,‘, TRUE_EXPR, ‚)‘]
- or::
[‚if‘, ‚(‚, BOOL_EXPR, ‚,‘, TRUE_EXPR, ‚,‘, FALSE_EXPR, ‚)‘]
- rewrite these to::
[‚(‚, TRUE_EXPR, ‚) if ‚, BOOL_EXPR, ‚ else default‘]
- and::
[‚(‚, TRUE_EXPR, ‚) if ‚, BOOL_EXPR, ‚ else (‚, FALSE_EXPR, ‚)‘]
If an if expression is incomplete the value of the python variable default will be returned.
-
static
translate
(parser_element, constraint_expression)¶ Parse the constraintExpression by means of the parserElement translate it into python and compile the code.
- Parameter
parser_element (
ParserElement
) – The parser element defined in the grammar.constraint_expression (
str
) – The constraint expression to translate.
- Rückgabe
The translated python code of the constraint_expression and
a python code object suitable for use with eval(). :rtype:
str, code
:raises:ValidationError
if the python code object cannot be created
-
static
ncdiff.converter module¶
Conversion of strings into column data types.
If no type for a column is given an integer and float conversion will be attempted.
- since
2013-02-11
-
class
ncdiff.converter.
BaseConverter
¶ Bases:
object
Abstract interface, does nothing.
Each converter exists once per input file and column.
-
CONVERSIONS
= frozenset({<class 'str'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
UnsupportedTypeConversionError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
BooleanConverter
¶ Bases:
ncdiff.converter.BaseConverter
Convert a string to a boolean value.
-
CONVERSIONS
= frozenset({<class 'bool'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
DateConverter
(date_format)¶ Bases:
ncdiff.converter.BaseConverter
Convert a string to a date value.
-
CONVERSIONS
= frozenset({<class 'datetime.date'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
DateTimeConverter
(date_time_format)¶ Bases:
ncdiff.converter.BaseConverter
Convert a string to a datetime, date or time value.
-
CONVERSIONS
= frozenset({<class 'datetime.time'>, <class 'datetime.date'>, <class 'datetime.datetime'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
FloatConverter
(number_format)¶ Bases:
ncdiff.converter.BaseConverter
Convert to float.
-
CONVERSIONS
= frozenset({<class 'float'>})¶
-
TRANSLATE_CH
= {32: None, 39: None, 44: '.', 8201: None, 8217: None, 8239: None}¶
-
TRANSLATE_DE
= {32: None, 44: '.', 46: None, 8201: None, 8239: None}¶
-
TRANSLATE_EN
= {32: None, 44: None, 8201: None, 8239: None}¶
-
TRANSLATE_US
= {32: None, 40: None, 41: None, 44: None, 8201: None, 8239: None}¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
IntConverter
(number_format)¶ Bases:
ncdiff.converter.FloatConverter
Convert to int with fallback to float.
-
CONVERSIONS
= frozenset({<class 'float'>, <class 'int'>})¶
-
TRANSLATE_CH
= {32: None, 39: None, 44: '.', 8201: None, 8217: None, 8239: None}¶
-
TRANSLATE_DE
= {32: None, 8201: None, 8239: None}¶
-
TRANSLATE_EN
= {32: None, 44: None, 8201: None, 8239: None}¶
-
TRANSLATE_US
= {32: None, 40: None, 41: None, 8201: None, 8239: None}¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
ModIntConverter
¶ Bases:
ncdiff.converter.BaseConverter
Class for modint to integer conversion and comparison (00000000094155-).
-
CONVERSIONS
= frozenset({<class 'int'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
StringConverter
(string_modifier)¶ Bases:
ncdiff.converter.BaseConverter
Convert to string.
This is only needed if explicitly requested when a modifier is needed, e.g. compare with ignore case.
-
CONVERSIONS
= frozenset({<class 'str'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
UnsupportedTypeConversionError – If to_type is a type other than advertised in the conversions list.
-
-
class
ncdiff.converter.
TimeConverter
(time_format)¶ Bases:
ncdiff.converter.BaseConverter
Convert a string to a date value.
-
CONVERSIONS
= frozenset({<class 'datetime.time'>})¶
-
classmethod
conversions
()¶ Return supported type conversions.
- Rückgabe
A frozenset of supported type conversions of the convert method.
- Rückgabetyp
frozenset of type
-
convert
(str_value, to_type)¶ Convert string values to one of the advertised types in the conversion list.
- Parameter
str_value (
str
) – A string value.- Rückgabe
The value as the requested type.
- Rückgabetyp
object
- Verursacht
Exception – If the conversion to type fails.
ValueError – If to_type is a type other than advertised in the conversions list.
-
-
exception
ncdiff.converter.
UnsupportedTypeConversionError
¶ Bases:
ValueError
Raised if a type conversion is not supported.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
ncdiff.converter.
create_converter
(target_configuration, col_format, *col_format_args)¶ Create a converter for a dataType used in cell comparison by the comparator.
- Parameter
target_configuration (
TargetConfiguration
) – The configuration of the diff target.col_format (
str
) – string of the column format.*col_format_args –
- Rückgabe
A converter object.
- Rückgabetyp
-
ncdiff.converter.
create_new_column_converters
(target_configuration)¶ Create all column converters for the new input file.
- Parameter
target_configuration (
TargetConfiguration
) – The configuration of the diff target.- Rückgabe
A list of column converters, one for each column of the input file.
- Rückgabetyp
list of BaseConverter
-
ncdiff.converter.
create_old_column_converters
(target_configuration)¶ Create all column converters for the old input file.
- Parameter
target_configuration (
TargetConfiguration
) – The configuration of the diff target.- Rückgabe
A list of column converters, one for each column of the input file.
- Rückgabetyp
list of BaseConverter
ncdiff.diff_value module¶
DiffValue classes which contain the result data for diffs, missing rows or duplicates.
- since
2015-02-04
-
class
ncdiff.diff_value.
DiffValue
(old_header, old_row, new_header, new_row, target_config)¶ Bases:
ncdiff.diff_value.DiffValueBase
The standard class to contain diffs between two or more cells of two lines.
-
STATUS_DIFF
= 'difference'¶
-
STATUS_DIFF_FILTERED
= 'difference (filtered)'¶
-
STATUS_DIFF_TOLERANCE
= 'difference (tolerance)'¶
-
STATUS_DUPLICATE_FILTERED
= 'duplicate (filtered)'¶
-
STATUS_MISSING_FILTERED
= 'missing (filtered)'¶
-
add_diff_value
(col_key, old_col_position, new_col_position, difference)¶ Adding a difference for a certain cell within the given/current row.
- Parameter
col_key (
str
) – The primary key that uniquely identifies the column of the differenceold_col_position (
int
) – The column index within the old rownew_col_position (
int
) – The column index within the new rowdifference (
differ.Difference
) – The difference information object.
-
get_diff_values
()¶ Return the list of all the collected cell differences.
- Rückgabe
The list containing all the difference that have been found for the given/current row
- Rückgabetyp
list
-
have_rows_diff_values
()¶ Return
True
if diffs were added to the object.- Rückgabe
True
if diffs were added to the object,False
otherwise.- Rückgabetyp
bool
-
-
class
ncdiff.diff_value.
DiffValueBase
(old_header, old_row, new_header, new_row, target_config)¶ Bases:
object
The base class to implement difference values containers to hold all output relevant information of diffs.
There exists a L(DiffValue) for each row where at least one difference was found. If there are multiple difference within a certain row all those differences will be collected within the _diffs list of the respecting DiffValue object.
The DiffValue object forms the primary interface for passing information to the writers that are responsible for persisting all the information about found differences
-
get_diff_values
()¶ Return the list of all the collected cell differences.
- Rückgabe
The list containing all the difference that have been found for the given/current row
- Rückgabetyp
list
-
-
class
ncdiff.diff_value.
DiffValueDuplicate
(old_header, old_row, new_header, new_row, target_config, col_key, is_ignorable, last_line_number, line_number)¶ Bases:
ncdiff.diff_value.DiffValueBase
Class to represent duplicate lines in the input file.
-
get_diff_values
()¶ Return the list of all the collected cell differences.
- Rückgabe
The list containing all the difference that have been found for the given/current row
- Rückgabetyp
list
-
-
class
ncdiff.diff_value.
DiffValueMissing
(old_header, old_row, new_header, new_row, target_config, col_key, is_ignorable)¶ Bases:
ncdiff.diff_value.DiffValueBase
Class to represent if a whole line is missing in one of the two files to compare.
-
get_diff_values
()¶ Return the list of all the collected cell differences.
- Rückgabe
The list containing all the difference that have been found for the given/current row
- Rückgabetyp
list
-
ncdiff.differ module¶
Diff tool classes for comparing report files of different data types.
- since
2012-02-10
-
class
ncdiff.differ.
Difference
(is_val_different, comparison_type, absolute_diff, relative_diff, because_of_filter, because_of_tolerance)¶ Bases:
tuple
-
property
absolute_diff
¶ Alias for field number 2
-
property
because_of_filter
¶ Alias for field number 4
-
property
because_of_tolerance
¶ Alias for field number 5
-
property
comparison_type
¶ Alias for field number 1
-
count
()¶ Return number of occurrences of value.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
property
is_val_different
¶ Alias for field number 0
-
property
relative_diff
¶ Alias for field number 3
-
property
-
class
ncdiff.differ.
StandardDiffer
(target_config)¶ Bases:
object
The standard implementation for creating diff results.
This class creates rows containing the columns from the „column names for statistic file“ section in constants.
-
diff
()¶ Diff specified reports.
- Rückgabe
statistics collected during the diff run.
- Rückgabetyp
dict
-
-
ncdiff.differ.
create_differ
(target_configuration)¶ Create the differ for a given configuration.
- Parameter
target_configuration (
TargetConfiguration
) – The configuration of the diff target.- Rückgabe
An implementation for a differ.
- Rückgabetyp
ncdiff.history module¶
History tool for NCDiff to generate a HTML report over past runs.
The tool scans an NCDiff result directory and gathers statistical information of every run to generate a HTML report containing graphs for:
Matched Lines: shows the percentage of matched lines over time and an additional graph of the last NCDiff run.
Detected Issues: shows a stacked graph of the various types of issues found over time and a bar chart of the
Issues found in the last NCDiff run. - Processed Targets: shows the number of targets in a NCDiff run over time and a chart for the last NCDiff run.
The report is stored in the result directory. :since: 2017-02-21
-
class
ncdiff.history.
MissingData
(name, data)¶ Bases:
tuple
-
count
()¶ Return number of occurrences of value.
-
property
data
¶ Alias for field number 1
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
property
name
¶ Alias for field number 0
-
-
class
ncdiff.history.
NCDiffHistory
(options)¶ Bases:
object
Generates the history report for NCDiff runs.
-
MAX_RUNS_TO_SHOW
= 30¶
-
get_statistic
()¶ Get the statistic items to show in the report.
-
history
()¶ Get statistics from NCDiff runs and create history report.
-
is_statistic_stored
(result_dir)¶ Check if the statistic for the NCDiff run is already stored.
- Parameter
result_dir (
str
) – The result directory of an particular NCDiff run.- Rückgabe
Returns
true
if the statistical data for this run is already stored in the history tool.- Rückgabetyp
bool
-
parse_log
(result_dir)¶ Parse the log to find statistic information.
- Parameter
result_dir (
str
) – The result directory of an particular NCDiff run.- Rückgabe
The parsed statistical information of the NCDiff run.
- Rückgabetyp
-
store_statistic
(statistic)¶ Store the statistic in internal database.
- Parameter
statistic (
NCDiffStatistic
) – The statistical data of a NCDiff run to store.
-
write_report
(result_dir, statistic, name)¶ Write the HTML histor report to the NCDiff result base directory.
- Parameter
result_dir (
str
) – The result directory of the NCDiff runs.statistic (
list of NCDiffStatistic
) – A chronological sorted list of the statistical data of NCDiff runs.name (
str
) – The name of the report.
-
-
class
ncdiff.history.
NCDiffStatistic
(name, time_stamp, missing1_key, missing2_key, summary, data, comment)¶ Bases:
tuple
-
property
comment
¶ Alias for field number 6
-
count
()¶ Return number of occurrences of value.
-
property
data
¶ Alias for field number 5
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
property
missing1_key
¶ Alias for field number 2
-
property
missing2_key
¶ Alias for field number 3
-
property
name
¶ Alias for field number 0
-
property
summary
¶ Alias for field number 4
-
property
time_stamp
¶ Alias for field number 1
-
property
-
class
ncdiff.history.
PARAMS
¶ Bases:
object
Enum defining the commandline parameters.
-
ALL_PARAM
= ('resultDirectory', 'name', 'maxRuns')¶
-
ALL_REQUIRED
= frozenset({'resultDirectory'})¶
-
ALL_SWITCH
= ('showReport',)¶
-
MAX_RUNS
= 'maxRuns'¶
-
NAME
= 'name'¶
-
RESULT_DIR
= 'resultDirectory'¶
-
SHOW_REPORT
= 'showReport'¶
-
-
class
ncdiff.history.
StatusSummary
(ok, diff, error)¶ Bases:
tuple
-
count
()¶ Return number of occurrences of value.
-
property
diff
¶ Alias for field number 1
-
property
error
¶ Alias for field number 2
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
property
ok
¶ Alias for field number 0
-
-
ncdiff.history.
main
(calling_params)¶ Start the creation of the history report.
- Parameter
calling_params (
dict str:str
) – The command line parameters.
ncdiff.launcher module¶
NCDiff tool launcher GUI written in TK to run NCDiff targets from configuration files.
- since
2014-07-28
-
class
ncdiff.launcher.
FileChooser
(parent, directory_mode, file_types=None, **options)¶ Bases:
tkinter.ttk.Frame
Directory chooser tk widget.
-
after
(ms, func=None, *args)¶ Call function once after given time.
MS specifies the time in milliseconds. FUNC gives the function which shall be called. Additional parameters are given as parameters to the function call. Return identifier to cancel scheduling with after_cancel.
-
after_cancel
(id)¶ Cancel scheduling of function identified with ID.
Identifier returned by after or after_idle must be given as first parameter.
-
after_idle
(func, *args)¶ Call FUNC once if the Tcl main loop has no event to process.
Return an identifier to cancel the scheduling with after_cancel.
-
anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
bell
(displayof=0)¶ Ring a display’s bell.
-
bind
(func)¶ Overwrite the bind function of the tk frame to bind the passed function to the internal widgets events.
This way the callback function will be called if the user enters a file/directory in the input field or selects the directory by the dialog. :param func: The callback function to bind. :type func:
function
-
bind_all
(sequence=None, func=None, add=None)¶ Bind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
-
bind_class
(className, sequence=None, func=None, add=None)¶ Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
Set or get the list of bindtags for this widget.
With no argument return the list of all bindtags associated with this widget. With a list of strings as argument the bindtags are set to this list. The bindtags determine in which order events are processed (see bind).
-
cget
(key)¶ Return the resource value for a KEY given as string.
-
choose_file
()¶ Choose a file after „…“ button of the chooser was pushed.
Opens the systems file/directory chooser dialog and after the users selects a file/directory an event is fired to all listeners.
-
clipboard_append
(string, **kw)¶ Append STRING to the Tk clipboard.
A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.
-
clipboard_clear
(**kw)¶ Clear the data in the Tk clipboard.
A widget specified for the optional displayof keyword argument specifies the target display.
-
clipboard_get
(**kw)¶ Retrieve data from the clipboard on window’s display.
The window keyword defaults to the root window of the Tkinter application.
The type keyword specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING, except on X11, where the default is to try UTF8_STRING and fall back to STRING.
This command is equivalent to:
selection_get(CLIPBOARD)
-
columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
config
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
configure
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
deletecommand
(name)¶ Internal function.
Delete the Tcl command provided in NAME.
-
destroy
()¶ Destroy this and all descendants widgets.
-
event_add
(virtual, *sequences)¶ Bind a virtual event VIRTUAL (of the form <<Name>>) to an event SEQUENCE such that the virtual event is triggered whenever SEQUENCE occurs.
-
event_delete
(virtual, *sequences)¶ Unbind a virtual event VIRTUAL from SEQUENCE.
-
event_generate
(sequence, **kw)¶ Generate an event SEQUENCE. Additional keyword arguments specify parameter of the event (e.g. x, y, rootx, rooty).
-
event_info
(virtual=None)¶ Return a list of all virtual events or the information about the SEQUENCE bound to the virtual event VIRTUAL.
-
focus
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
focus_displayof
()¶ Return the widget which has currently the focus on the display where this widget is located.
Return None if the application does not have the focus.
-
focus_force
()¶ Direct input focus to this widget even if the application does not have the focus. Use with caution!
-
focus_get
()¶ Return the widget which has currently the focus in the application.
Use focus_displayof to allow working with several displays. Return None if application does not have the focus.
-
focus_lastfor
()¶ Return the widget which would have the focus if top level for this widget gets the focus from the window manager.
-
focus_set
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
forget
()¶ Unmap this widget and do not use it for the packing order.
-
get
()¶ Return the chosen file/directory.
- Rückgabe
the chosen file/directory.
- Rückgabetyp
str
-
get_file
()¶ Return the chosen file/directory.
- Rückgabe
the chosen file/directory.
- Rückgabetyp
str
-
getboolean
(s)¶ Return a boolean value for Tcl boolean values true and false given as parameter.
-
getdouble
(s)¶
-
getint
(s)¶
-
getvar
(name='PY_VAR')¶ Return value of Tcl variable NAME.
-
grab_current
()¶ Return widget which has currently the grab in this application or None.
-
grab_release
()¶ Release grab for this widget if currently set.
-
grab_set
()¶ Set grab for this widget.
A grab directs all events to this and descendant widgets in the application.
-
grab_set_global
()¶ Set global grab for this widget.
A global grab directs all events to this and descendant widgets on the display. Use with caution - other applications do not get events anymore.
-
grab_status
()¶ Return None, „local“ or „global“ if this widget has no, a local or a global grab.
-
grid
(cnf={}, **kw)¶ Position a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary
-
grid_anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
grid_bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
grid_columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
grid_configure
(cnf={}, **kw)¶ Position a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary
-
grid_forget
()¶ Unmap this widget.
-
grid_info
()¶ Return information about the options for positioning this widget in a grid.
-
grid_location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
grid_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned.
-
grid_remove
()¶ Unmap this widget but remember the grid options.
-
grid_rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
grid_size
()¶ Return a tuple of the number of column and rows in the grid.
-
grid_slaves
(row=None, column=None)¶ Return a list of all slaves of this widget in its packing order.
-
identify
(x, y)¶ Returns the name of the element at position x, y, or the empty string if the point does not lie within any element.
x and y are pixel coordinates relative to the widget.
-
image_names
()¶ Return a list of all existing image names.
-
image_types
()¶ Return a list of all available image types (e.g. photo bitmap).
-
info
()¶ Return information about the packing options for this widget.
-
initialize
()¶ Create the directory chooser widgets.
-
instate
(statespec, callback=None, *args, **kw)¶ Test the widget’s state.
If callback is not specified, returns True if the widget state matches statespec and False otherwise. If callback is specified, then it will be invoked with *args, **kw if the widget state matches statespec. statespec is expected to be a sequence.
-
keys
()¶ Return a list of all resource names of this widget.
-
lift
(aboveThis=None)¶ Raise this widget in the stacking order.
-
location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
lower
(belowThis=None)¶ Lower this widget in the stacking order.
-
mainloop
(n=0)¶ Call the mainloop of Tk.
-
nametowidget
(name)¶ Return the Tkinter instance of a widget identified by its Tcl name NAME.
-
option_add
(pattern, value, priority=None)¶ Set a VALUE (second parameter) for an option PATTERN (first parameter).
An optional third parameter gives the numeric priority (defaults to 80).
-
option_clear
()¶ Clear the option database.
It will be reloaded if option_add is called.
-
option_get
(name, className)¶ Return the value for an option NAME for this widget with CLASSNAME.
Values with higher priority override lower values.
-
option_readfile
(fileName, priority=None)¶ Read file FILENAME into the option database.
An optional second parameter gives the numeric priority.
-
pack
(cnf={}, **kw)¶ Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
-
pack_configure
(cnf={}, **kw)¶ Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
-
pack_forget
()¶ Unmap this widget and do not use it for the packing order.
-
pack_info
()¶ Return information about the packing options for this widget.
-
pack_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
pack_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
place
(cnf={}, **kw)¶ Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see ‚in‘ option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
- rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width as the master)
- relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same height as the master)
- bordermode=“inside“ or „outside“ - whether to take border width of
master widget into account
-
place_configure
(cnf={}, **kw)¶ Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see ‚in‘ option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
- rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width as the master)
- relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same height as the master)
- bordermode=“inside“ or „outside“ - whether to take border width of
master widget into account
-
place_forget
()¶ Unmap this widget.
-
place_info
()¶ Return information about the placing options for this widget.
-
place_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
quit
()¶ Quit the Tcl interpreter. All widgets will be destroyed.
-
register
(func, subst=None, needcleanup=1)¶ Return a newly created Tcl function. If this function is called, the Python function FUNC will be executed. An optional function SUBST can be given which will be executed before FUNC.
-
rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
selection_clear
(**kw)¶ Clear the current X selection.
-
selection_get
(**kw)¶ Return the contents of the current X selection.
A keyword parameter selection specifies the name of the selection and defaults to PRIMARY. A keyword parameter displayof specifies a widget on the display to use. A keyword parameter type specifies the form of data to be fetched, defaulting to STRING except on X11, where UTF8_STRING is tried before STRING.
-
selection_handle
(command, **kw)¶ Specify a function COMMAND to call if the X selection owned by this widget is queried by another application.
This function must return the contents of the selection. The function will be called with the arguments OFFSET and LENGTH which allows the chunking of very long selections. The following keyword parameters can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
selection_own
(**kw)¶ Become owner of X selection.
A keyword parameter selection specifies the name of the selection (default PRIMARY).
-
selection_own_get
(**kw)¶ Return owner of X selection.
The following keyword parameter can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
send
(interp, cmd, *args)¶ Send Tcl command CMD to different interpreter INTERP to be executed.
-
set
(file_or_directory)¶ Set the text of the input field of the widget to the passed file/directory name.
- Parameter
file_or_directory (
str
) – The file/directory to set.
-
set_file
(file_or_directory)¶ Set the text of the input field of the widget to the passed file/directory name.
- Parameter
file_or_directory (
str
) – The file/directory to set.
-
setvar
(name='PY_VAR', value='1')¶ Set Tcl variable NAME to VALUE.
-
size
()¶ Return a tuple of the number of column and rows in the grid.
-
slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
state
(statespec=None)¶ Modify or inquire widget state.
Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed. statespec is expected to be a sequence.
-
tk_bisque
()¶ Change the color scheme to light brown as used in Tk 3.6 and before.
-
tk_focusFollowsMouse
()¶ The widget under mouse will get automatically focus. Can not be disabled easily.
-
tk_focusNext
()¶ Return the next widget in the focus order which follows widget which has currently the focus.
The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.
-
tk_focusPrev
()¶ Return previous widget in the focus order. See tk_focusNext for details.
-
tk_setPalette
(*args, **kw)¶ Set a new color scheme for all widget elements.
A single color as argument will cause that all colors of Tk widget elements are derived from this. Alternatively several keyword parameters and its associated colors can be given. The following keywords are valid: activeBackground, foreground, selectColor, activeForeground, highlightBackground, selectBackground, background, highlightColor, selectForeground, disabledForeground, insertBackground, troughColor.
-
tk_strictMotif
(boolean=None)¶ Set Tcl internal variable, whether the look and feel should adhere to Motif.
A parameter of 1 means adhere to Motif (e.g. no color change if mouse passes over slider). Returns the set value.
-
tkraise
(aboveThis=None)¶ Raise this widget in the stacking order.
-
unbind
(sequence, funcid=None)¶ Unbind for this widget for event SEQUENCE the function identified with FUNCID.
-
unbind_all
(sequence)¶ Unbind for all widgets for event SEQUENCE all functions.
-
unbind_class
(className, sequence)¶ Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE all functions.
-
update
()¶ Enter event loop until all pending events have been processed by Tcl.
-
update_idletasks
()¶ Enter event loop until all idle callbacks have been called. This will update the display of windows but not process events caused by the user.
-
wait_variable
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
wait_visibility
(window=None)¶ Wait until the visibility of a WIDGET changes (e.g. it appears).
If no parameter is given self is used.
-
wait_window
(window=None)¶ Wait until a WIDGET is destroyed.
If no parameter is given self is used.
-
waitvar
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
winfo_atom
(name, displayof=0)¶ Return integer which represents atom NAME.
-
winfo_atomname
(id, displayof=0)¶ Return name of atom with identifier ID.
-
winfo_cells
()¶ Return number of cells in the colormap for this widget.
-
winfo_children
()¶ Return a list of all widgets which are children of this widget.
-
winfo_class
()¶ Return window class name of this widget.
-
winfo_colormapfull
()¶ Return True if at the last color request the colormap was full.
-
winfo_containing
(rootX, rootY, displayof=0)¶ Return the widget which is at the root coordinates ROOTX, ROOTY.
-
winfo_depth
()¶ Return the number of bits per pixel.
-
winfo_exists
()¶ Return true if this widget exists.
-
winfo_fpixels
(number)¶ Return the number of pixels for the given distance NUMBER (e.g. „3c“) as float.
-
winfo_geometry
()¶ Return geometry string for this widget in the form „widthxheight+X+Y“.
-
winfo_height
()¶ Return height of this widget.
-
winfo_id
()¶ Return identifier ID for this widget.
-
winfo_interps
(displayof=0)¶ Return the name of all Tcl interpreters for this display.
-
winfo_ismapped
()¶ Return true if this widget is mapped.
-
winfo_manager
()¶ Return the window manager name for this widget.
-
winfo_name
()¶ Return the name of this widget.
-
winfo_parent
()¶ Return the name of the parent of this widget.
-
winfo_pathname
(id, displayof=0)¶ Return the pathname of the widget given by ID.
-
winfo_pixels
(number)¶ Rounded integer value of winfo_fpixels.
-
winfo_pointerx
()¶ Return the x coordinate of the pointer on the root window.
-
winfo_pointerxy
()¶ Return a tuple of x and y coordinates of the pointer on the root window.
-
winfo_pointery
()¶ Return the y coordinate of the pointer on the root window.
-
winfo_reqheight
()¶ Return requested height of this widget.
-
winfo_reqwidth
()¶ Return requested width of this widget.
-
winfo_rgb
(color)¶ Return tuple of decimal values for red, green, blue for COLOR in this widget.
-
winfo_rootx
()¶ Return x coordinate of upper left corner of this widget on the root window.
-
winfo_rooty
()¶ Return y coordinate of upper left corner of this widget on the root window.
-
winfo_screen
()¶ Return the screen name of this widget.
-
winfo_screencells
()¶ Return the number of the cells in the colormap of the screen of this widget.
-
winfo_screendepth
()¶ Return the number of bits per pixel of the root window of the screen of this widget.
-
winfo_screenheight
()¶ Return the number of pixels of the height of the screen of this widget in pixel.
-
winfo_screenmmheight
()¶ Return the number of pixels of the height of the screen of this widget in mm.
-
winfo_screenmmwidth
()¶ Return the number of pixels of the width of the screen of this widget in mm.
-
winfo_screenvisual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the default colormodel of this screen.
-
winfo_screenwidth
()¶ Return the number of pixels of the width of the screen of this widget in pixel.
-
winfo_server
()¶ Return information of the X-Server of the screen of this widget in the form „XmajorRminor vendor vendorVersion“.
-
winfo_toplevel
()¶ Return the toplevel widget of this widget.
-
winfo_viewable
()¶ Return true if the widget and all its higher ancestors are mapped.
-
winfo_visual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.
-
winfo_visualid
()¶ Return the X identifier for the visual for this widget.
-
winfo_visualsavailable
(includeids=False)¶ Return a list of all visuals available for the screen of this widget.
Each item in the list consists of a visual name (see winfo_visual), a depth and if includeids is true is given also the X identifier.
-
winfo_vrootheight
()¶ Return the height of the virtual root window associated with this widget in pixels. If there is no virtual root window return the height of the screen.
-
winfo_vrootwidth
()¶ Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.
-
winfo_vrootx
()¶ Return the x offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_vrooty
()¶ Return the y offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_width
()¶ Return the width of this widget.
-
winfo_x
()¶ Return the x coordinate of the upper left corner of this widget in the parent.
-
winfo_y
()¶ Return the y coordinate of the upper left corner of this widget in the parent.
-
-
class
ncdiff.launcher.
Launcher
(parent=None)¶ Bases:
tkinter.ttk.Frame
The main NCDiff launcher window.
-
advanced_closed
()¶ Advanced dialog is closed via button so save parameters and destroy dialog.
-
advanced_destroy
(event)¶ Advanced dialog is being destroyed - so save parameter settings.
- Parameter
event (
tk.Event
) – The event of the tk framework generated on config dir changes.
-
advanced_selected
()¶ Show the advanced dialog if the „Advanced…“ button was pushed.
-
after
(ms, func=None, *args)¶ Call function once after given time.
MS specifies the time in milliseconds. FUNC gives the function which shall be called. Additional parameters are given as parameters to the function call. Return identifier to cancel scheduling with after_cancel.
-
after_cancel
(id)¶ Cancel scheduling of function identified with ID.
Identifier returned by after or after_idle must be given as first parameter.
-
after_idle
(func, *args)¶ Call FUNC once if the Tcl main loop has no event to process.
Return an identifier to cancel the scheduling with after_cancel.
-
anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
bell
(displayof=0)¶ Ring a display’s bell.
-
bind
(sequence=None, func=None, add=None)¶ Bind to this widget at event SEQUENCE a call to function FUNC.
SEQUENCE is a string of concatenated event patterns. An event pattern is of the form <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, B3, Alt, Button4, B4, Double, Button5, B5 Triple, Mod1, M1. TYPE is one of Activate, Enter, Map, ButtonPress, Button, Expose, Motion, ButtonRelease FocusIn, MouseWheel, Circulate, FocusOut, Property, Colormap, Gravity Reparent, Configure, KeyPress, Key, Unmap, Deactivate, KeyRelease Visibility, Destroy, Leave and DETAIL is the button number for ButtonPress, ButtonRelease and DETAIL is the Keysym for KeyPress and KeyRelease. Examples are <Control-Button-1> for pressing Control and mouse button 1 or <Alt-A> for pressing A and the Alt key (KeyPress can be omitted). An event pattern can also be a virtual event of the form <<AString>> where AString can be arbitrary. This event can be generated by event_generate. If events are concatenated they must appear shortly after each other.
FUNC will be called if the event sequence occurs with an instance of Event as argument. If the return value of FUNC is „break“ no further bound function is invoked.
An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function.
Bind will return an identifier to allow deletion of the bound function with unbind without memory leak.
If FUNC or SEQUENCE is omitted the bound function or list of bound events are returned.
-
bind_all
(sequence=None, func=None, add=None)¶ Bind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
-
bind_class
(className, sequence=None, func=None, add=None)¶ Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
Set or get the list of bindtags for this widget.
With no argument return the list of all bindtags associated with this widget. With a list of strings as argument the bindtags are set to this list. The bindtags determine in which order events are processed (see bind).
-
cget
(key)¶ Return the resource value for a KEY given as string.
-
clipboard_append
(string, **kw)¶ Append STRING to the Tk clipboard.
A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.
-
clipboard_clear
(**kw)¶ Clear the data in the Tk clipboard.
A widget specified for the optional displayof keyword argument specifies the target display.
-
clipboard_get
(**kw)¶ Retrieve data from the clipboard on window’s display.
The window keyword defaults to the root window of the Tkinter application.
The type keyword specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING, except on X11, where the default is to try UTF8_STRING and fall back to STRING.
This command is equivalent to:
selection_get(CLIPBOARD)
-
columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
config
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
config_dir_changed
(event)¶ Change the configuration directory.
The configurations found in the selected directory will be displayed in the list box and and target list and run button will be updated to the new state. :param event: The event of the tk framework generated on config dir changes. :type event:
tk.Event
-
configuration_edit
(event)¶ Double clicking a configuration in the configuration list box the system editor is used to open the file.
- Parameter
event – The event of the tk framework generated on double clicking an item of the list box.
- Rückgabe
tk.Event
-
configurations_selected
(event)¶ Refresh UI after configurations list box selection changes.
For the selected configurations the targets list box will be filled and the status of the list box and the run button will be updated accordingly. :param event: The event of the tk framework generated on selection changes of the list box. :type event:
tk.Event
-
configure
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
deletecommand
(name)¶ Internal function.
Delete the Tcl command provided in NAME.
-
destroy
()¶ Destroy this and all descendants widgets.
-
event_add
(virtual, *sequences)¶ Bind a virtual event VIRTUAL (of the form <<Name>>) to an event SEQUENCE such that the virtual event is triggered whenever SEQUENCE occurs.
-
event_delete
(virtual, *sequences)¶ Unbind a virtual event VIRTUAL from SEQUENCE.
-
event_generate
(sequence, **kw)¶ Generate an event SEQUENCE. Additional keyword arguments specify parameter of the event (e.g. x, y, rootx, rooty).
-
event_info
(virtual=None)¶ Return a list of all virtual events or the information about the SEQUENCE bound to the virtual event VIRTUAL.
-
focus
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
focus_displayof
()¶ Return the widget which has currently the focus on the display where this widget is located.
Return None if the application does not have the focus.
-
focus_force
()¶ Direct input focus to this widget even if the application does not have the focus. Use with caution!
-
focus_get
()¶ Return the widget which has currently the focus in the application.
Use focus_displayof to allow working with several displays. Return None if application does not have the focus.
-
focus_lastfor
()¶ Return the widget which would have the focus if top level for this widget gets the focus from the window manager.
-
focus_set
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
forget
()¶ Unmap this widget and do not use it for the packing order.
-
getboolean
(s)¶ Return a boolean value for Tcl boolean values true and false given as parameter.
-
getdouble
(s)¶
-
getint
(s)¶
-
getvar
(name='PY_VAR')¶ Return value of Tcl variable NAME.
-
grab_current
()¶ Return widget which has currently the grab in this application or None.
-
grab_release
()¶ Release grab for this widget if currently set.
-
grab_set
()¶ Set grab for this widget.
A grab directs all events to this and descendant widgets in the application.
-
grab_set_global
()¶ Set global grab for this widget.
A global grab directs all events to this and descendant widgets on the display. Use with caution - other applications do not get events anymore.
-
grab_status
()¶ Return None, „local“ or „global“ if this widget has no, a local or a global grab.
-
grid
(cnf={}, **kw)¶ Position a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary
-
grid_anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
grid_bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
grid_columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
grid_configure
(cnf={}, **kw)¶ Position a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary
-
grid_forget
()¶ Unmap this widget.
-
grid_info
()¶ Return information about the options for positioning this widget in a grid.
-
grid_location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
grid_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned.
-
grid_remove
()¶ Unmap this widget but remember the grid options.
-
grid_rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
grid_size
()¶ Return a tuple of the number of column and rows in the grid.
-
grid_slaves
(row=None, column=None)¶ Return a list of all slaves of this widget in its packing order.
-
identify
(x, y)¶ Returns the name of the element at position x, y, or the empty string if the point does not lie within any element.
x and y are pixel coordinates relative to the widget.
-
image_names
()¶ Return a list of all existing image names.
-
image_types
()¶ Return a list of all available image types (e.g. photo bitmap).
-
info
()¶ Return information about the packing options for this widget.
-
initialize
()¶ Initialize the window widgets and layout.
-
initialize_advanced_dialog
()¶ Initialize the advanced dialog an keep it hidden until the user pushes the „Advanced…“ button.
Initialize the button frame at the bottom of the window.
- Parameter
parent (
tk widget
) – The parent tk widget.
-
initialize_configurations_targets
(parent)¶ Initialize the list boxes for configuration and target selection.
- Parameter
parent (
tk widget
) – The parent tk widget.
-
initialize_parameter_override
(parent)¶ Initialize the form elements to override NCDiff start parameters.
- Parameter
parent (
tk widget
) – The parent tk widget.
-
instate
(statespec, callback=None, *args, **kw)¶ Test the widget’s state.
If callback is not specified, returns True if the widget state matches statespec and False otherwise. If callback is specified, then it will be invoked with *args, **kw if the widget state matches statespec. statespec is expected to be a sequence.
-
keys
()¶ Return a list of all resource names of this widget.
-
launcher_closed
()¶ Launcher dialog is closed via button so save parameters and destroy dialog.
-
launcher_destroy
(event)¶ Launcher dialog is being destroyed - so save parameter settings.
- Parameter
event (
tk.Event
) – The event of the tk framework generated on config dir changes.
-
lift
(aboveThis=None)¶ Raise this widget in the stacking order.
-
location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
lower
(belowThis=None)¶ Lower this widget in the stacking order.
-
mainloop
(n=0)¶ Call the mainloop of Tk.
-
nametowidget
(name)¶ Return the Tkinter instance of a widget identified by its Tcl name NAME.
-
option_add
(pattern, value, priority=None)¶ Set a VALUE (second parameter) for an option PATTERN (first parameter).
An optional third parameter gives the numeric priority (defaults to 80).
-
option_clear
()¶ Clear the option database.
It will be reloaded if option_add is called.
-
option_get
(name, className)¶ Return the value for an option NAME for this widget with CLASSNAME.
Values with higher priority override lower values.
-
option_readfile
(fileName, priority=None)¶ Read file FILENAME into the option database.
An optional second parameter gives the numeric priority.
-
pack
(cnf={}, **kw)¶ Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
-
pack_configure
(cnf={}, **kw)¶ Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
-
pack_forget
()¶ Unmap this widget and do not use it for the packing order.
-
pack_info
()¶ Return information about the packing options for this widget.
-
pack_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
pack_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
place
(cnf={}, **kw)¶ Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see ‚in‘ option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
- rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width as the master)
- relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same height as the master)
- bordermode=“inside“ or „outside“ - whether to take border width of
master widget into account
-
place_configure
(cnf={}, **kw)¶ Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see ‚in‘ option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
- rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width as the master)
- relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same height as the master)
- bordermode=“inside“ or „outside“ - whether to take border width of
master widget into account
-
place_forget
()¶ Unmap this widget.
-
place_info
()¶ Return information about the placing options for this widget.
-
place_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
quit
()¶ Quit the Tcl interpreter. All widgets will be destroyed.
-
register
(func, subst=None, needcleanup=1)¶ Return a newly created Tcl function. If this function is called, the Python function FUNC will be executed. An optional function SUBST can be given which will be executed before FUNC.
-
rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
run_ncdiff
()¶ Run ncdiff after the run button was pushed.
The current parameter settings are stored and the command line call is generated. After that the command is passed to the run window class to execute the command and display the console log.
-
select_all_targets_changed
()¶ Select all targets automatically for the selected configurations.
Selects or deselects all targets depending on the checkbox state. If targets are selected also the run button will be enabled.
-
selection_clear
(**kw)¶ Clear the current X selection.
-
selection_get
(**kw)¶ Return the contents of the current X selection.
A keyword parameter selection specifies the name of the selection and defaults to PRIMARY. A keyword parameter displayof specifies a widget on the display to use. A keyword parameter type specifies the form of data to be fetched, defaulting to STRING except on X11, where UTF8_STRING is tried before STRING.
-
selection_handle
(command, **kw)¶ Specify a function COMMAND to call if the X selection owned by this widget is queried by another application.
This function must return the contents of the selection. The function will be called with the arguments OFFSET and LENGTH which allows the chunking of very long selections. The following keyword parameters can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
selection_own
(**kw)¶ Become owner of X selection.
A keyword parameter selection specifies the name of the selection (default PRIMARY).
-
selection_own_get
(**kw)¶ Return owner of X selection.
The following keyword parameter can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
send
(interp, cmd, *args)¶ Send Tcl command CMD to different interpreter INTERP to be executed.
-
setvar
(name='PY_VAR', value='1')¶ Set Tcl variable NAME to VALUE.
-
size
()¶ Return a tuple of the number of column and rows in the grid.
-
slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
state
(statespec=None)¶ Modify or inquire widget state.
Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed. statespec is expected to be a sequence.
-
targets_selected
(event)¶ Update the run button after a target was selected.
The button is enabled only if a target is selected. :param event: The event of the tk framework generated on selection changes of the list box. :type event:
tk.Event
-
tk_bisque
()¶ Change the color scheme to light brown as used in Tk 3.6 and before.
-
tk_focusFollowsMouse
()¶ The widget under mouse will get automatically focus. Can not be disabled easily.
-
tk_focusNext
()¶ Return the next widget in the focus order which follows widget which has currently the focus.
The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.
-
tk_focusPrev
()¶ Return previous widget in the focus order. See tk_focusNext for details.
-
tk_setPalette
(*args, **kw)¶ Set a new color scheme for all widget elements.
A single color as argument will cause that all colors of Tk widget elements are derived from this. Alternatively several keyword parameters and its associated colors can be given. The following keywords are valid: activeBackground, foreground, selectColor, activeForeground, highlightBackground, selectBackground, background, highlightColor, selectForeground, disabledForeground, insertBackground, troughColor.
-
tk_strictMotif
(boolean=None)¶ Set Tcl internal variable, whether the look and feel should adhere to Motif.
A parameter of 1 means adhere to Motif (e.g. no color change if mouse passes over slider). Returns the set value.
-
tkraise
(aboveThis=None)¶ Raise this widget in the stacking order.
-
unbind
(sequence, funcid=None)¶ Unbind for this widget for event SEQUENCE the function identified with FUNCID.
-
unbind_all
(sequence)¶ Unbind for all widgets for event SEQUENCE all functions.
-
unbind_class
(className, sequence)¶ Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE all functions.
-
update
()¶ Enter event loop until all pending events have been processed by Tcl.
-
update_idletasks
()¶ Enter event loop until all idle callbacks have been called. This will update the display of windows but not process events caused by the user.
-
wait_variable
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
wait_visibility
(window=None)¶ Wait until the visibility of a WIDGET changes (e.g. it appears).
If no parameter is given self is used.
-
wait_window
(window=None)¶ Wait until a WIDGET is destroyed.
If no parameter is given self is used.
-
waitvar
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
winfo_atom
(name, displayof=0)¶ Return integer which represents atom NAME.
-
winfo_atomname
(id, displayof=0)¶ Return name of atom with identifier ID.
-
winfo_cells
()¶ Return number of cells in the colormap for this widget.
-
winfo_children
()¶ Return a list of all widgets which are children of this widget.
-
winfo_class
()¶ Return window class name of this widget.
-
winfo_colormapfull
()¶ Return True if at the last color request the colormap was full.
-
winfo_containing
(rootX, rootY, displayof=0)¶ Return the widget which is at the root coordinates ROOTX, ROOTY.
-
winfo_depth
()¶ Return the number of bits per pixel.
-
winfo_exists
()¶ Return true if this widget exists.
-
winfo_fpixels
(number)¶ Return the number of pixels for the given distance NUMBER (e.g. „3c“) as float.
-
winfo_geometry
()¶ Return geometry string for this widget in the form „widthxheight+X+Y“.
-
winfo_height
()¶ Return height of this widget.
-
winfo_id
()¶ Return identifier ID for this widget.
-
winfo_interps
(displayof=0)¶ Return the name of all Tcl interpreters for this display.
-
winfo_ismapped
()¶ Return true if this widget is mapped.
-
winfo_manager
()¶ Return the window manager name for this widget.
-
winfo_name
()¶ Return the name of this widget.
-
winfo_parent
()¶ Return the name of the parent of this widget.
-
winfo_pathname
(id, displayof=0)¶ Return the pathname of the widget given by ID.
-
winfo_pixels
(number)¶ Rounded integer value of winfo_fpixels.
-
winfo_pointerx
()¶ Return the x coordinate of the pointer on the root window.
-
winfo_pointerxy
()¶ Return a tuple of x and y coordinates of the pointer on the root window.
-
winfo_pointery
()¶ Return the y coordinate of the pointer on the root window.
-
winfo_reqheight
()¶ Return requested height of this widget.
-
winfo_reqwidth
()¶ Return requested width of this widget.
-
winfo_rgb
(color)¶ Return tuple of decimal values for red, green, blue for COLOR in this widget.
-
winfo_rootx
()¶ Return x coordinate of upper left corner of this widget on the root window.
-
winfo_rooty
()¶ Return y coordinate of upper left corner of this widget on the root window.
-
winfo_screen
()¶ Return the screen name of this widget.
-
winfo_screencells
()¶ Return the number of the cells in the colormap of the screen of this widget.
-
winfo_screendepth
()¶ Return the number of bits per pixel of the root window of the screen of this widget.
-
winfo_screenheight
()¶ Return the number of pixels of the height of the screen of this widget in pixel.
-
winfo_screenmmheight
()¶ Return the number of pixels of the height of the screen of this widget in mm.
-
winfo_screenmmwidth
()¶ Return the number of pixels of the width of the screen of this widget in mm.
-
winfo_screenvisual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the default colormodel of this screen.
-
winfo_screenwidth
()¶ Return the number of pixels of the width of the screen of this widget in pixel.
-
winfo_server
()¶ Return information of the X-Server of the screen of this widget in the form „XmajorRminor vendor vendorVersion“.
-
winfo_toplevel
()¶ Return the toplevel widget of this widget.
-
winfo_viewable
()¶ Return true if the widget and all its higher ancestors are mapped.
-
winfo_visual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.
-
winfo_visualid
()¶ Return the X identifier for the visual for this widget.
-
winfo_visualsavailable
(includeids=False)¶ Return a list of all visuals available for the screen of this widget.
Each item in the list consists of a visual name (see winfo_visual), a depth and if includeids is true is given also the X identifier.
-
winfo_vrootheight
()¶ Return the height of the virtual root window associated with this widget in pixels. If there is no virtual root window return the height of the screen.
-
winfo_vrootwidth
()¶ Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.
-
winfo_vrootx
()¶ Return the x offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_vrooty
()¶ Return the y offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_width
()¶ Return the width of this widget.
-
winfo_x
()¶ Return the x coordinate of the upper left corner of this widget in the parent.
-
winfo_y
()¶ Return the y coordinate of the upper left corner of this widget in the parent.
-
-
class
ncdiff.launcher.
LauncherParameterManager
(parameters_map)¶ Bases:
object
Class to manage the parameters, i.e. the currently set form values, of the GUI.
-
MANAGER_FILE
= 'ncdiff-launcher'¶
-
PARAM_CONFIG_DIR
= 'configurationDir'¶
-
PARAM_PROFILE
= 'profile'¶
-
PARAM_SELECT_ALL_TARGETS
= 'selectAllTargets'¶
-
SECTION_LAST
= 'LAST_LAUNCH'¶
-
get_command_parameters
()¶ Get the parameter values for the command line.
Boolean parameters with „False“ as value and empty strings are removed. Since these are the defualt values for the command line parameters. :return: The dictionary with the red parameters. :rtype:
dict
-
load_parameters
(parameters_map)¶ Apply the parameters for the last session (stored in a configuration file) to the form fields of the GUI.
If the advanced dialog is used this method re-loads the file stored and already altered GUI values (from a previously opened advanced dialog) to the TK fields defined in the passed parameters map. :param parameters_map: Map containing the name of the widget as key and a tuple of tk-widget and data type. :type parameters_map:
dict str -> tuple of tk.widget, type
-
save_parameters
()¶ Save the parameters set in the window to a configuration file.
-
update_parameters_map
(parameters_map)¶ Update parameter mapping to tk widgets.
Needed after re-init of widgets is done, e.g. sub dialog closed and is opened again, thus new widgets are created. :param parameters_map: Map containing the name of the widget as key and a tuple of tk-widget and data type. :return:
dict str -> tuple of tk.widget, type
-
-
class
ncdiff.launcher.
Listbox
(parent, value_list=None, **options)¶ Bases:
tkinter.ttk.Frame
Custom list box widget with scroll bars and alternating coloring of the list elements.
-
after
(ms, func=None, *args)¶ Call function once after given time.
MS specifies the time in milliseconds. FUNC gives the function which shall be called. Additional parameters are given as parameters to the function call. Return identifier to cancel scheduling with after_cancel.
-
after_cancel
(id)¶ Cancel scheduling of function identified with ID.
Identifier returned by after or after_idle must be given as first parameter.
-
after_idle
(func, *args)¶ Call FUNC once if the Tcl main loop has no event to process.
Return an identifier to cancel the scheduling with after_cancel.
-
anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
bell
(displayof=0)¶ Ring a display’s bell.
-
bind
(func)¶ Overwrite the bind function of the tk frame to bind the passed function to the internal widgets events.
This way the callback function will be called if the user changes the selected list elements by mouse or keyboard. :param func: The callback function to bind. :type func:
function
-
bind_all
(sequence=None, func=None, add=None)¶ Bind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
-
bind_class
(className, sequence=None, func=None, add=None)¶ Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
-
bind_edit
(func)¶ Bind a callback when double clicking the list.
Can be used to open the list item in an editor for instance. :param func: The callback function to bind. :type func:
function
Set or get the list of bindtags for this widget.
With no argument return the list of all bindtags associated with this widget. With a list of strings as argument the bindtags are set to this list. The bindtags determine in which order events are processed (see bind).
-
cget
(key)¶ Return the resource value for a KEY given as string.
-
clipboard_append
(string, **kw)¶ Append STRING to the Tk clipboard.
A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.
-
clipboard_clear
(**kw)¶ Clear the data in the Tk clipboard.
A widget specified for the optional displayof keyword argument specifies the target display.
-
clipboard_get
(**kw)¶ Retrieve data from the clipboard on window’s display.
The window keyword defaults to the root window of the Tkinter application.
The type keyword specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING, except on X11, where the default is to try UTF8_STRING and fall back to STRING.
This command is equivalent to:
selection_get(CLIPBOARD)
-
columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
config
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
configure
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
deletecommand
(name)¶ Internal function.
Delete the Tcl command provided in NAME.
-
destroy
()¶ Destroy this and all descendants widgets.
-
event_add
(virtual, *sequences)¶ Bind a virtual event VIRTUAL (of the form <<Name>>) to an event SEQUENCE such that the virtual event is triggered whenever SEQUENCE occurs.
-
event_delete
(virtual, *sequences)¶ Unbind a virtual event VIRTUAL from SEQUENCE.
-
event_generate
(sequence, **kw)¶ Generate an event SEQUENCE. Additional keyword arguments specify parameter of the event (e.g. x, y, rootx, rooty).
-
event_info
(virtual=None)¶ Return a list of all virtual events or the information about the SEQUENCE bound to the virtual event VIRTUAL.
-
focus
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
focus_displayof
()¶ Return the widget which has currently the focus on the display where this widget is located.
Return None if the application does not have the focus.
-
focus_force
()¶ Direct input focus to this widget even if the application does not have the focus. Use with caution!
-
focus_get
()¶ Return the widget which has currently the focus in the application.
Use focus_displayof to allow working with several displays. Return None if application does not have the focus.
-
focus_lastfor
()¶ Return the widget which would have the focus if top level for this widget gets the focus from the window manager.
-
focus_set
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
forget
()¶ Unmap this widget and do not use it for the packing order.
-
get_value_list
()¶ Return the selected values of the list box.
- Rückgabe
the selected values of the list box.
- Type
list
-
getboolean
(s)¶ Return a boolean value for Tcl boolean values true and false given as parameter.
-
getdouble
(s)¶
-
getint
(s)¶
-
getvar
(name='PY_VAR')¶ Return value of Tcl variable NAME.
-
grab_current
()¶ Return widget which has currently the grab in this application or None.
-
grab_release
()¶ Release grab for this widget if currently set.
-
grab_set
()¶ Set grab for this widget.
A grab directs all events to this and descendant widgets in the application.
-
grab_set_global
()¶ Set global grab for this widget.
A global grab directs all events to this and descendant widgets on the display. Use with caution - other applications do not get events anymore.
-
grab_status
()¶ Return None, „local“ or „global“ if this widget has no, a local or a global grab.
-
grid
(cnf={}, **kw)¶ Position a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary
-
grid_anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
grid_bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
grid_columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
grid_configure
(cnf={}, **kw)¶ Position a widget in the parent widget in a grid. Use as options: column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction row=number - use cell identified with given row (starting with 0) rowspan=number - this widget will span several rows sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary
-
grid_forget
()¶ Unmap this widget.
-
grid_info
()¶ Return information about the options for positioning this widget in a grid.
-
grid_location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
grid_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned.
-
grid_remove
()¶ Unmap this widget but remember the grid options.
-
grid_rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
grid_size
()¶ Return a tuple of the number of column and rows in the grid.
-
grid_slaves
(row=None, column=None)¶ Return a list of all slaves of this widget in its packing order.
-
identify
(x, y)¶ Returns the name of the element at position x, y, or the empty string if the point does not lie within any element.
x and y are pixel coordinates relative to the widget.
-
image_names
()¶ Return a list of all existing image names.
-
image_types
()¶ Return a list of all available image types (e.g. photo bitmap).
-
info
()¶ Return information about the packing options for this widget.
-
initialize
(value_list)¶ Initialize the internal widget components.
- Parameter
value_list (
list
) – The initial list values of the list box.
-
instate
(statespec, callback=None, *args, **kw)¶ Test the widget’s state.
If callback is not specified, returns True if the widget state matches statespec and False otherwise. If callback is specified, then it will be invoked with *args, **kw if the widget state matches statespec. statespec is expected to be a sequence.
-
keys
()¶ Return a list of all resource names of this widget.
-
lift
(aboveThis=None)¶ Raise this widget in the stacking order.
-
location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
lower
(belowThis=None)¶ Lower this widget in the stacking order.
-
mainloop
(n=0)¶ Call the mainloop of Tk.
-
nametowidget
(name)¶ Return the Tkinter instance of a widget identified by its Tcl name NAME.
-
option_add
(pattern, value, priority=None)¶ Set a VALUE (second parameter) for an option PATTERN (first parameter).
An optional third parameter gives the numeric priority (defaults to 80).
-
option_clear
()¶ Clear the option database.
It will be reloaded if option_add is called.
-
option_get
(name, className)¶ Return the value for an option NAME for this widget with CLASSNAME.
Values with higher priority override lower values.
-
option_readfile
(fileName, priority=None)¶ Read file FILENAME into the option database.
An optional second parameter gives the numeric priority.
-
pack
(cnf={}, **kw)¶ Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
-
pack_configure
(cnf={}, **kw)¶ Pack a widget in the parent widget. Use as options: after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget in_=master - see ‚in‘ option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction pady=amount - add padding in y direction side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
-
pack_forget
()¶ Unmap this widget and do not use it for the packing order.
-
pack_info
()¶ Return information about the packing options for this widget.
-
pack_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
pack_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
place
(cnf={}, **kw)¶ Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see ‚in‘ option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
- rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width as the master)
- relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same height as the master)
- bordermode=“inside“ or „outside“ - whether to take border width of
master widget into account
-
place_configure
(cnf={}, **kw)¶ Place a widget in the parent widget. Use as options: in=master - master relative to which the widget is placed in_=master - see ‚in‘ option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
- rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width as the master)
- relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same height as the master)
- bordermode=“inside“ or „outside“ - whether to take border width of
master widget into account
-
place_forget
()¶ Unmap this widget.
-
place_info
()¶ Return information about the placing options for this widget.
-
place_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
quit
()¶ Quit the Tcl interpreter. All widgets will be destroyed.
-
register
(func, subst=None, needcleanup=1)¶ Return a newly created Tcl function. If this function is called, the Python function FUNC will be executed. An optional function SUBST can be given which will be executed before FUNC.
-
rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
select_all
()¶ Select all list box values.
-
select_clear
()¶ Deselect all list box values.
-
selection_clear
(**kw)¶ Clear the current X selection.
-
selection_get
(**kw)¶ Return the contents of the current X selection.
A keyword parameter selection specifies the name of the selection and defaults to PRIMARY. A keyword parameter displayof specifies a widget on the display to use. A keyword parameter type specifies the form of data to be fetched, defaulting to STRING except on X11, where UTF8_STRING is tried before STRING.
-
selection_handle
(command, **kw)¶ Specify a function COMMAND to call if the X selection owned by this widget is queried by another application.
This function must return the contents of the selection. The function will be called with the arguments OFFSET and LENGTH which allows the chunking of very long selections. The following keyword parameters can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
selection_own
(**kw)¶ Become owner of X selection.
A keyword parameter selection specifies the name of the selection (default PRIMARY).
-
selection_own_get
(**kw)¶ Return owner of X selection.
The following keyword parameter can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
send
(interp, cmd, *args)¶ Send Tcl command CMD to different interpreter INTERP to be executed.
-
set_value_list
(value_list)¶ Set the values of the list box to the passed list of values.
- Parameter
value_list (
list
) – The list of values for the list box.
-
setvar
(name='PY_VAR', value='1')¶ Set Tcl variable NAME to VALUE.
-
size
()¶ Return a tuple of the number of column and rows in the grid.
-
slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
state
(statespec=None)¶ Modify or inquire widget state.
Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed. statespec is expected to be a sequence.
-
tk_bisque
()¶ Change the color scheme to light brown as used in Tk 3.6 and before.
-
tk_focusFollowsMouse
()¶ The widget under mouse will get automatically focus. Can not be disabled easily.
-
tk_focusNext
()¶ Return the next widget in the focus order which follows widget which has currently the focus.
The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.
-
tk_focusPrev
()¶ Return previous widget in the focus order. See tk_focusNext for details.
-
tk_setPalette
(*args, **kw)¶ Set a new color scheme for all widget elements.
A single color as argument will cause that all colors of Tk widget elements are derived from this. Alternatively several keyword parameters and its associated colors can be given. The following keywords are valid: activeBackground, foreground, selectColor, activeForeground, highlightBackground, selectBackground, background, highlightColor, selectForeground, disabledForeground, insertBackground, troughColor.
-
tk_strictMotif
(boolean=None)¶ Set Tcl internal variable, whether the look and feel should adhere to Motif.
A parameter of 1 means adhere to Motif (e.g. no color change if mouse passes over slider). Returns the set value.
-
tkraise
(aboveThis=None)¶ Raise this widget in the stacking order.
-
unbind
(sequence, funcid=None)¶ Unbind for this widget for event SEQUENCE the function identified with FUNCID.
-
unbind_all
(sequence)¶ Unbind for all widgets for event SEQUENCE all functions.
-
unbind_class
(className, sequence)¶ Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE all functions.
-
update
()¶ Enter event loop until all pending events have been processed by Tcl.
-
update_idletasks
()¶ Enter event loop until all idle callbacks have been called. This will update the display of windows but not process events caused by the user.
-
wait_variable
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
wait_visibility
(window=None)¶ Wait until the visibility of a WIDGET changes (e.g. it appears).
If no parameter is given self is used.
-
wait_window
(window=None)¶ Wait until a WIDGET is destroyed.
If no parameter is given self is used.
-
waitvar
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
winfo_atom
(name, displayof=0)¶ Return integer which represents atom NAME.
-
winfo_atomname
(id, displayof=0)¶ Return name of atom with identifier ID.
-
winfo_cells
()¶ Return number of cells in the colormap for this widget.
-
winfo_children
()¶ Return a list of all widgets which are children of this widget.
-
winfo_class
()¶ Return window class name of this widget.
-
winfo_colormapfull
()¶ Return True if at the last color request the colormap was full.
-
winfo_containing
(rootX, rootY, displayof=0)¶ Return the widget which is at the root coordinates ROOTX, ROOTY.
-
winfo_depth
()¶ Return the number of bits per pixel.
-
winfo_exists
()¶ Return true if this widget exists.
-
winfo_fpixels
(number)¶ Return the number of pixels for the given distance NUMBER (e.g. „3c“) as float.
-
winfo_geometry
()¶ Return geometry string for this widget in the form „widthxheight+X+Y“.
-
winfo_height
()¶ Return height of this widget.
-
winfo_id
()¶ Return identifier ID for this widget.
-
winfo_interps
(displayof=0)¶ Return the name of all Tcl interpreters for this display.
-
winfo_ismapped
()¶ Return true if this widget is mapped.
-
winfo_manager
()¶ Return the window manager name for this widget.
-
winfo_name
()¶ Return the name of this widget.
-
winfo_parent
()¶ Return the name of the parent of this widget.
-
winfo_pathname
(id, displayof=0)¶ Return the pathname of the widget given by ID.
-
winfo_pixels
(number)¶ Rounded integer value of winfo_fpixels.
-
winfo_pointerx
()¶ Return the x coordinate of the pointer on the root window.
-
winfo_pointerxy
()¶ Return a tuple of x and y coordinates of the pointer on the root window.
-
winfo_pointery
()¶ Return the y coordinate of the pointer on the root window.
-
winfo_reqheight
()¶ Return requested height of this widget.
-
winfo_reqwidth
()¶ Return requested width of this widget.
-
winfo_rgb
(color)¶ Return tuple of decimal values for red, green, blue for COLOR in this widget.
-
winfo_rootx
()¶ Return x coordinate of upper left corner of this widget on the root window.
-
winfo_rooty
()¶ Return y coordinate of upper left corner of this widget on the root window.
-
winfo_screen
()¶ Return the screen name of this widget.
-
winfo_screencells
()¶ Return the number of the cells in the colormap of the screen of this widget.
-
winfo_screendepth
()¶ Return the number of bits per pixel of the root window of the screen of this widget.
-
winfo_screenheight
()¶ Return the number of pixels of the height of the screen of this widget in pixel.
-
winfo_screenmmheight
()¶ Return the number of pixels of the height of the screen of this widget in mm.
-
winfo_screenmmwidth
()¶ Return the number of pixels of the width of the screen of this widget in mm.
-
winfo_screenvisual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the default colormodel of this screen.
-
winfo_screenwidth
()¶ Return the number of pixels of the width of the screen of this widget in pixel.
-
winfo_server
()¶ Return information of the X-Server of the screen of this widget in the form „XmajorRminor vendor vendorVersion“.
-
winfo_toplevel
()¶ Return the toplevel widget of this widget.
-
winfo_viewable
()¶ Return true if the widget and all its higher ancestors are mapped.
-
winfo_visual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.
-
winfo_visualid
()¶ Return the X identifier for the visual for this widget.
-
winfo_visualsavailable
(includeids=False)¶ Return a list of all visuals available for the screen of this widget.
Each item in the list consists of a visual name (see winfo_visual), a depth and if includeids is true is given also the X identifier.
-
winfo_vrootheight
()¶ Return the height of the virtual root window associated with this widget in pixels. If there is no virtual root window return the height of the screen.
-
winfo_vrootwidth
()¶ Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.
-
winfo_vrootx
()¶ Return the x offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_vrooty
()¶ Return the y offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_width
()¶ Return the width of this widget.
-
winfo_x
()¶ Return the x coordinate of the upper left corner of this widget in the parent.
-
winfo_y
()¶ Return the y coordinate of the upper left corner of this widget in the parent.
-
-
class
ncdiff.launcher.
RunWindow
(config_dir, result_dir)¶ Bases:
tkinter.Toplevel
The window to execute the NCDiff command and display the console output.
The class uses a separate thread to write the command output to the window, otherwise the GUI would be blocked.
-
EOP
= <object object>¶
-
after
(ms, func=None, *args)¶ Call function once after given time.
MS specifies the time in milliseconds. FUNC gives the function which shall be called. Additional parameters are given as parameters to the function call. Return identifier to cancel scheduling with after_cancel.
-
after_cancel
(id)¶ Cancel scheduling of function identified with ID.
Identifier returned by after or after_idle must be given as first parameter.
-
after_idle
(func, *args)¶ Call FUNC once if the Tcl main loop has no event to process.
Return an identifier to cancel the scheduling with after_cancel.
-
anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
aspect
(minNumer=None, minDenom=None, maxNumer=None, maxDenom=None)¶ Instruct the window manager to set the aspect ratio (width/height) of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple of the actual values if no argument is given.
-
attributes
(*args)¶ This subcommand returns or sets platform specific attributes
The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows:
On Windows, -disabled gets or sets whether the window is in a disabled state. -toolwindow gets or sets the style of the window to toolwindow (as defined in the MSDN). -topmost gets or sets whether this is a topmost window (displays above all other windows).
On Macintosh, XXXXX
On Unix, there are currently no special attribute values.
-
bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
bell
(displayof=0)¶ Ring a display’s bell.
-
bind
(sequence=None, func=None, add=None)¶ Bind to this widget at event SEQUENCE a call to function FUNC.
SEQUENCE is a string of concatenated event patterns. An event pattern is of the form <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, B3, Alt, Button4, B4, Double, Button5, B5 Triple, Mod1, M1. TYPE is one of Activate, Enter, Map, ButtonPress, Button, Expose, Motion, ButtonRelease FocusIn, MouseWheel, Circulate, FocusOut, Property, Colormap, Gravity Reparent, Configure, KeyPress, Key, Unmap, Deactivate, KeyRelease Visibility, Destroy, Leave and DETAIL is the button number for ButtonPress, ButtonRelease and DETAIL is the Keysym for KeyPress and KeyRelease. Examples are <Control-Button-1> for pressing Control and mouse button 1 or <Alt-A> for pressing A and the Alt key (KeyPress can be omitted). An event pattern can also be a virtual event of the form <<AString>> where AString can be arbitrary. This event can be generated by event_generate. If events are concatenated they must appear shortly after each other.
FUNC will be called if the event sequence occurs with an instance of Event as argument. If the return value of FUNC is „break“ no further bound function is invoked.
An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function.
Bind will return an identifier to allow deletion of the bound function with unbind without memory leak.
If FUNC or SEQUENCE is omitted the bound function or list of bound events are returned.
-
bind_all
(sequence=None, func=None, add=None)¶ Bind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
-
bind_class
(className, sequence=None, func=None, add=None)¶ Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
Set or get the list of bindtags for this widget.
With no argument return the list of all bindtags associated with this widget. With a list of strings as argument the bindtags are set to this list. The bindtags determine in which order events are processed (see bind).
-
cget
(key)¶ Return the resource value for a KEY given as string.
-
client
(name=None)¶ Store NAME in WM_CLIENT_MACHINE property of this widget. Return current value.
-
clipboard_append
(string, **kw)¶ Append STRING to the Tk clipboard.
A widget specified at the optional displayof keyword argument specifies the target display. The clipboard can be retrieved with selection_get.
-
clipboard_clear
(**kw)¶ Clear the data in the Tk clipboard.
A widget specified for the optional displayof keyword argument specifies the target display.
-
clipboard_get
(**kw)¶ Retrieve data from the clipboard on window’s display.
The window keyword defaults to the root window of the Tkinter application.
The type keyword specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING, except on X11, where the default is to try UTF8_STRING and fall back to STRING.
This command is equivalent to:
selection_get(CLIPBOARD)
-
colormapwindows
(*wlist)¶ Store list of window names (WLIST) into WM_COLORMAPWINDOWS property of this widget. This list contains windows whose colormaps differ from their parents. Return current list of widgets if WLIST is empty.
-
columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
command
(value=None)¶ Store VALUE in WM_COMMAND property. It is the command which shall be used to invoke the application. Return current command if VALUE is None.
-
config
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
configure
(cnf=None, **kw)¶ Configure resources of a widget.
The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
-
deiconify
()¶ Deiconify this widget. If it was never mapped it will not be mapped. On Windows it will raise this widget and give it the focus.
-
deletecommand
(name)¶ Internal function.
Delete the Tcl command provided in NAME.
-
destroy
()¶ Destroy this and all descendants widgets.
-
display_command_output
(queue)¶ Display the command output by reading the text from a queue.
- Parameter
queue (
queue.Queue
) – The queue containing the output lines from the executed command.
-
event_add
(virtual, *sequences)¶ Bind a virtual event VIRTUAL (of the form <<Name>>) to an event SEQUENCE such that the virtual event is triggered whenever SEQUENCE occurs.
-
event_delete
(virtual, *sequences)¶ Unbind a virtual event VIRTUAL from SEQUENCE.
-
event_generate
(sequence, **kw)¶ Generate an event SEQUENCE. Additional keyword arguments specify parameter of the event (e.g. x, y, rootx, rooty).
-
event_info
(virtual=None)¶ Return a list of all virtual events or the information about the SEQUENCE bound to the virtual event VIRTUAL.
-
execute
()¶ Execute the command and display the output in the text control.
-
focus
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
focus_displayof
()¶ Return the widget which has currently the focus on the display where this widget is located.
Return None if the application does not have the focus.
-
focus_force
()¶ Direct input focus to this widget even if the application does not have the focus. Use with caution!
-
focus_get
()¶ Return the widget which has currently the focus in the application.
Use focus_displayof to allow working with several displays. Return None if application does not have the focus.
-
focus_lastfor
()¶ Return the widget which would have the focus if top level for this widget gets the focus from the window manager.
-
focus_set
()¶ Direct input focus to this widget.
If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
-
focusmodel
(model=None)¶ Set focus model to MODEL. „active“ means that this widget will claim the focus itself, „passive“ means that the window manager shall give the focus. Return current focus model if MODEL is None.
-
forget
(window)¶ The window will be unmapped from the screen and will no longer be managed by wm. toplevel windows will be treated like frame windows once they are no longer managed by wm, however, the menu option configuration will be remembered and the menus will return once the widget is managed again.
-
frame
()¶ Return identifier for decorative frame of this widget if present.
-
geometry
(newGeometry=None)¶ Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return current value if None is given.
-
get_statistic_file
()¶ Get the the absolute path to the statistic file if it is available.
The method checks for the statistics file in following order HTML, XLSX, XLS and CSV and returns the first found.
-
getboolean
(s)¶ Return a boolean value for Tcl boolean values true and false given as parameter.
-
getdouble
(s)¶
-
getint
(s)¶
-
getvar
(name='PY_VAR')¶ Return value of Tcl variable NAME.
-
grab_current
()¶ Return widget which has currently the grab in this application or None.
-
grab_release
()¶ Release grab for this widget if currently set.
-
grab_set
()¶ Set grab for this widget.
A grab directs all events to this and descendant widgets in the application.
-
grab_set_global
()¶ Set global grab for this widget.
A global grab directs all events to this and descendant widgets on the display. Use with caution - other applications do not get events anymore.
-
grab_status
()¶ Return None, „local“ or „global“ if this widget has no, a local or a global grab.
-
grid
(baseWidth=None, baseHeight=None, widthInc=None, heightInc=None)¶ Instruct the window manager that this widget shall only be resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the number of grid units requested in Tk_GeometryRequest.
-
grid_anchor
(anchor=None)¶ The anchor value controls how to place the grid within the master when no row/column has any weight.
The default anchor is nw.
-
grid_bbox
(column=None, row=None, col2=None, row2=None)¶ Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from the cell with row and column 0 to the specified cell. If COL2 and ROW2 are given the bounding box starts at that cell.
The returned integers specify the offset of the upper left corner in the master widget and the width and height.
-
grid_columnconfigure
(index, cnf={}, **kw)¶ Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column), weight (how much does additional space propagate to this column) and pad (how much space to let additionally).
-
grid_location
(x, y)¶ Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.
-
grid_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned.
-
grid_rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
grid_size
()¶ Return a tuple of the number of column and rows in the grid.
-
grid_slaves
(row=None, column=None)¶ Return a list of all slaves of this widget in its packing order.
-
group
(pathName=None)¶ Set the group leader widgets for related widgets to PATHNAME. Return the group leader of this widget if None is given.
-
iconbitmap
(bitmap=None, default=None)¶ Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.
Under Windows, the DEFAULT parameter can be used to set the icon for the widget and any descendents that don’t have an icon set explicitly. DEFAULT can be the relative path to a .ico file (example: root.iconbitmap(default=‘myicon.ico‘) ). See Tk documentation for more information.
-
iconify
()¶ Display widget as icon.
-
iconmask
(bitmap=None)¶ Set mask for the icon bitmap of this widget. Return the mask if None is given.
-
iconname
(newName=None)¶ Set the name of the icon for this widget. Return the name if None is given.
-
iconphoto
(default=False, *args)¶ Sets the titlebar icon for this window based on the named photo images passed through args. If default is True, this is applied to all future created toplevels as well.
The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not reflected to the titlebar icons. Multiple images are accepted to allow different images sizes to be provided. The window manager may scale provided icons to an appropriate size.
On Windows, the images are packed into a Windows icon structure. This will override an icon specified to wm_iconbitmap, and vice versa.
On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. An icon specified by wm_iconbitmap may exist simultaneously.
On Macintosh, this currently does nothing.
-
iconposition
(x=None, y=None)¶ Set the position of the icon of this widget to X and Y. Return a tuple of the current values of X and X if None is given.
-
iconwindow
(pathName=None)¶ Set widget PATHNAME to be displayed instead of icon. Return the current value if None is given.
-
image_names
()¶ Return a list of all existing image names.
-
image_types
()¶ Return a list of all available image types (e.g. photo bitmap).
-
initialize
()¶ Initialize the run windows GUI components.
-
keys
()¶ Return a list of all resource names of this widget.
-
lift
(aboveThis=None)¶ Raise this widget in the stacking order.
-
lower
(belowThis=None)¶ Lower this widget in the stacking order.
-
mainloop
(n=0)¶ Call the mainloop of Tk.
-
manage
(widget)¶ The widget specified will become a stand alone top-level window. The window will be decorated with the window managers title bar, etc.
-
maxsize
(width=None, height=None)¶ Set max WIDTH and HEIGHT for this widget. If the window is gridded the values are given in grid units. Return the current values if None is given.
-
minsize
(width=None, height=None)¶ Set min WIDTH and HEIGHT for this widget. If the window is gridded the values are given in grid units. Return the current values if None is given.
-
nametowidget
(name)¶ Return the Tkinter instance of a widget identified by its Tcl name NAME.
-
option_add
(pattern, value, priority=None)¶ Set a VALUE (second parameter) for an option PATTERN (first parameter).
An optional third parameter gives the numeric priority (defaults to 80).
-
option_clear
()¶ Clear the option database.
It will be reloaded if option_add is called.
-
option_get
(name, className)¶ Return the value for an option NAME for this widget with CLASSNAME.
Values with higher priority override lower values.
-
option_readfile
(fileName, priority=None)¶ Read file FILENAME into the option database.
An optional second parameter gives the numeric priority.
-
overrideredirect
(boolean=None)¶ Instruct the window manager to ignore this widget if BOOLEAN is given with 1. Return the current value if None is given.
-
pack_propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
pack_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
place_slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
positionfrom
(who=None)¶ Instruct the window manager that the position of this widget shall be defined by the user if WHO is „user“, and by its own policy if WHO is „program“.
-
propagate
(flag=['_noarg_'])¶ Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given the current setting will be returned.
-
protocol
(name=None, func=None)¶ Bind function FUNC to command NAME for this widget. Return the function bound to NAME if None is given. NAME could be e.g. „WM_SAVE_YOURSELF“ or „WM_DELETE_WINDOW“.
-
quit
()¶ Quit the Tcl interpreter. All widgets will be destroyed.
-
re_run_command
()¶ Start the diff once again after re-run button was pushed.
-
reader_thread
(queue)¶ Read subprocess output in an separate thread and put it into the queue.
- Parameter
queue (
queue.Queue
) – The queue to write the console output of the executed command to.
-
register
(func, subst=None, needcleanup=1)¶ Return a newly created Tcl function. If this function is called, the Python function FUNC will be executed. An optional function SUBST can be given which will be executed before FUNC.
-
resizable
(width=None, height=None)¶ Instruct the window manager whether this width can be resized in WIDTH or HEIGHT. Both values are boolean values.
-
rowconfigure
(index, cnf={}, **kw)¶ Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row), weight (how much does additional space propagate to this row) and pad (how much space to let additionally).
-
run_command
(command)¶ Run the passed command and display the console output.
- Parameter
command (
str
) – The command to execute.
-
selection_clear
(**kw)¶ Clear the current X selection.
-
selection_get
(**kw)¶ Return the contents of the current X selection.
A keyword parameter selection specifies the name of the selection and defaults to PRIMARY. A keyword parameter displayof specifies a widget on the display to use. A keyword parameter type specifies the form of data to be fetched, defaulting to STRING except on X11, where UTF8_STRING is tried before STRING.
-
selection_handle
(command, **kw)¶ Specify a function COMMAND to call if the X selection owned by this widget is queried by another application.
This function must return the contents of the selection. The function will be called with the arguments OFFSET and LENGTH which allows the chunking of very long selections. The following keyword parameters can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
selection_own
(**kw)¶ Become owner of X selection.
A keyword parameter selection specifies the name of the selection (default PRIMARY).
-
selection_own_get
(**kw)¶ Return owner of X selection.
The following keyword parameter can be provided: selection - name of the selection (default PRIMARY), type - type of the selection (e.g. STRING, FILE_NAME).
-
send
(interp, cmd, *args)¶ Send Tcl command CMD to different interpreter INTERP to be executed.
-
set_focus
(event)¶ Explicitly set focus, so user can select and copy text.
- Parameter
event (
tk.Event
) – The event of the tk framework generated on mouse button click on the Text widget.
-
setvar
(name='PY_VAR', value='1')¶ Set Tcl variable NAME to VALUE.
-
show_result
()¶ Show the result of the NCDiff run with the system configured application.
-
size
()¶ Return a tuple of the number of column and rows in the grid.
-
sizefrom
(who=None)¶ Instruct the window manager that the size of this widget shall be defined by the user if WHO is „user“, and by its own policy if WHO is „program“.
-
slaves
()¶ Return a list of all slaves of this widget in its packing order.
-
state
(newstate=None)¶ Query or set the state of this widget as one of normal, icon, iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).
-
stop
()¶ Stop subprocess and quit GUI.
-
title
(string=None)¶ Set the title of this widget.
-
tk_bisque
()¶ Change the color scheme to light brown as used in Tk 3.6 and before.
-
tk_focusFollowsMouse
()¶ The widget under mouse will get automatically focus. Can not be disabled easily.
-
tk_focusNext
()¶ Return the next widget in the focus order which follows widget which has currently the focus.
The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.
-
tk_focusPrev
()¶ Return previous widget in the focus order. See tk_focusNext for details.
-
tk_setPalette
(*args, **kw)¶ Set a new color scheme for all widget elements.
A single color as argument will cause that all colors of Tk widget elements are derived from this. Alternatively several keyword parameters and its associated colors can be given. The following keywords are valid: activeBackground, foreground, selectColor, activeForeground, highlightBackground, selectBackground, background, highlightColor, selectForeground, disabledForeground, insertBackground, troughColor.
-
tk_strictMotif
(boolean=None)¶ Set Tcl internal variable, whether the look and feel should adhere to Motif.
A parameter of 1 means adhere to Motif (e.g. no color change if mouse passes over slider). Returns the set value.
-
tkraise
(aboveThis=None)¶ Raise this widget in the stacking order.
-
transient
(master=None)¶ Instruct the window manager that this widget is transient with regard to widget MASTER.
-
unbind
(sequence, funcid=None)¶ Unbind for this widget for event SEQUENCE the function identified with FUNCID.
-
unbind_all
(sequence)¶ Unbind for all widgets for event SEQUENCE all functions.
-
unbind_class
(className, sequence)¶ Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE all functions.
-
update
()¶ Enter event loop until all pending events have been processed by Tcl.
-
update_idletasks
()¶ Enter event loop until all idle callbacks have been called. This will update the display of windows but not process events caused by the user.
-
wait_variable
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
wait_visibility
(window=None)¶ Wait until the visibility of a WIDGET changes (e.g. it appears).
If no parameter is given self is used.
-
wait_window
(window=None)¶ Wait until a WIDGET is destroyed.
If no parameter is given self is used.
-
waitvar
(name='PY_VAR')¶ Wait until the variable is modified.
A parameter of type IntVar, StringVar, DoubleVar or BooleanVar must be given.
-
winfo_atom
(name, displayof=0)¶ Return integer which represents atom NAME.
-
winfo_atomname
(id, displayof=0)¶ Return name of atom with identifier ID.
-
winfo_cells
()¶ Return number of cells in the colormap for this widget.
-
winfo_children
()¶ Return a list of all widgets which are children of this widget.
-
winfo_class
()¶ Return window class name of this widget.
-
winfo_colormapfull
()¶ Return True if at the last color request the colormap was full.
-
winfo_containing
(rootX, rootY, displayof=0)¶ Return the widget which is at the root coordinates ROOTX, ROOTY.
-
winfo_depth
()¶ Return the number of bits per pixel.
-
winfo_exists
()¶ Return true if this widget exists.
-
winfo_fpixels
(number)¶ Return the number of pixels for the given distance NUMBER (e.g. „3c“) as float.
-
winfo_geometry
()¶ Return geometry string for this widget in the form „widthxheight+X+Y“.
-
winfo_height
()¶ Return height of this widget.
-
winfo_id
()¶ Return identifier ID for this widget.
-
winfo_interps
(displayof=0)¶ Return the name of all Tcl interpreters for this display.
-
winfo_ismapped
()¶ Return true if this widget is mapped.
-
winfo_manager
()¶ Return the window manager name for this widget.
-
winfo_name
()¶ Return the name of this widget.
-
winfo_parent
()¶ Return the name of the parent of this widget.
-
winfo_pathname
(id, displayof=0)¶ Return the pathname of the widget given by ID.
-
winfo_pixels
(number)¶ Rounded integer value of winfo_fpixels.
-
winfo_pointerx
()¶ Return the x coordinate of the pointer on the root window.
-
winfo_pointerxy
()¶ Return a tuple of x and y coordinates of the pointer on the root window.
-
winfo_pointery
()¶ Return the y coordinate of the pointer on the root window.
-
winfo_reqheight
()¶ Return requested height of this widget.
-
winfo_reqwidth
()¶ Return requested width of this widget.
-
winfo_rgb
(color)¶ Return tuple of decimal values for red, green, blue for COLOR in this widget.
-
winfo_rootx
()¶ Return x coordinate of upper left corner of this widget on the root window.
-
winfo_rooty
()¶ Return y coordinate of upper left corner of this widget on the root window.
-
winfo_screen
()¶ Return the screen name of this widget.
-
winfo_screencells
()¶ Return the number of the cells in the colormap of the screen of this widget.
-
winfo_screendepth
()¶ Return the number of bits per pixel of the root window of the screen of this widget.
-
winfo_screenheight
()¶ Return the number of pixels of the height of the screen of this widget in pixel.
-
winfo_screenmmheight
()¶ Return the number of pixels of the height of the screen of this widget in mm.
-
winfo_screenmmwidth
()¶ Return the number of pixels of the width of the screen of this widget in mm.
-
winfo_screenvisual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the default colormodel of this screen.
-
winfo_screenwidth
()¶ Return the number of pixels of the width of the screen of this widget in pixel.
-
winfo_server
()¶ Return information of the X-Server of the screen of this widget in the form „XmajorRminor vendor vendorVersion“.
-
winfo_toplevel
()¶ Return the toplevel widget of this widget.
-
winfo_viewable
()¶ Return true if the widget and all its higher ancestors are mapped.
-
winfo_visual
()¶ Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.
-
winfo_visualid
()¶ Return the X identifier for the visual for this widget.
-
winfo_visualsavailable
(includeids=False)¶ Return a list of all visuals available for the screen of this widget.
Each item in the list consists of a visual name (see winfo_visual), a depth and if includeids is true is given also the X identifier.
-
winfo_vrootheight
()¶ Return the height of the virtual root window associated with this widget in pixels. If there is no virtual root window return the height of the screen.
-
winfo_vrootwidth
()¶ Return the width of the virtual root window associated with this widget in pixel. If there is no virtual root window return the width of the screen.
-
winfo_vrootx
()¶ Return the x offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_vrooty
()¶ Return the y offset of the virtual root relative to the root window of the screen of this widget.
-
winfo_width
()¶ Return the width of this widget.
-
winfo_x
()¶ Return the x coordinate of the upper left corner of this widget in the parent.
-
winfo_y
()¶ Return the y coordinate of the upper left corner of this widget in the parent.
-
withdraw
()¶ Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. Re-draw it with wm_deiconify.
-
wm_aspect
(minNumer=None, minDenom=None, maxNumer=None, maxDenom=None)¶ Instruct the window manager to set the aspect ratio (width/height) of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple of the actual values if no argument is given.
-
wm_attributes
(*args)¶ This subcommand returns or sets platform specific attributes
The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows:
On Windows, -disabled gets or sets whether the window is in a disabled state. -toolwindow gets or sets the style of the window to toolwindow (as defined in the MSDN). -topmost gets or sets whether this is a topmost window (displays above all other windows).
On Macintosh, XXXXX
On Unix, there are currently no special attribute values.
-
wm_client
(name=None)¶ Store NAME in WM_CLIENT_MACHINE property of this widget. Return current value.
-
wm_colormapwindows
(*wlist)¶ Store list of window names (WLIST) into WM_COLORMAPWINDOWS property of this widget. This list contains windows whose colormaps differ from their parents. Return current list of widgets if WLIST is empty.
-
wm_command
(value=None)¶ Store VALUE in WM_COMMAND property. It is the command which shall be used to invoke the application. Return current command if VALUE is None.
-
wm_deiconify
()¶ Deiconify this widget. If it was never mapped it will not be mapped. On Windows it will raise this widget and give it the focus.
-
wm_focusmodel
(model=None)¶ Set focus model to MODEL. „active“ means that this widget will claim the focus itself, „passive“ means that the window manager shall give the focus. Return current focus model if MODEL is None.
-
wm_forget
(window)¶ The window will be unmapped from the screen and will no longer be managed by wm. toplevel windows will be treated like frame windows once they are no longer managed by wm, however, the menu option configuration will be remembered and the menus will return once the widget is managed again.
-
wm_frame
()¶ Return identifier for decorative frame of this widget if present.
-
wm_geometry
(newGeometry=None)¶ Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return current value if None is given.
-
wm_grid
(baseWidth=None, baseHeight=None, widthInc=None, heightInc=None)¶ Instruct the window manager that this widget shall only be resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the number of grid units requested in Tk_GeometryRequest.
-
wm_group
(pathName=None)¶ Set the group leader widgets for related widgets to PATHNAME. Return the group leader of this widget if None is given.
-
wm_iconbitmap
(bitmap=None, default=None)¶ Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.
Under Windows, the DEFAULT parameter can be used to set the icon for the widget and any descendents that don’t have an icon set explicitly. DEFAULT can be the relative path to a .ico file (example: root.iconbitmap(default=‘myicon.ico‘) ). See Tk documentation for more information.
-
wm_iconify
()¶ Display widget as icon.
-
wm_iconmask
(bitmap=None)¶ Set mask for the icon bitmap of this widget. Return the mask if None is given.
-
wm_iconname
(newName=None)¶ Set the name of the icon for this widget. Return the name if None is given.
-
wm_iconphoto
(default=False, *args)¶ Sets the titlebar icon for this window based on the named photo images passed through args. If default is True, this is applied to all future created toplevels as well.
The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not reflected to the titlebar icons. Multiple images are accepted to allow different images sizes to be provided. The window manager may scale provided icons to an appropriate size.
On Windows, the images are packed into a Windows icon structure. This will override an icon specified to wm_iconbitmap, and vice versa.
On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. An icon specified by wm_iconbitmap may exist simultaneously.
On Macintosh, this currently does nothing.
-
wm_iconposition
(x=None, y=None)¶ Set the position of the icon of this widget to X and Y. Return a tuple of the current values of X and X if None is given.
-
wm_iconwindow
(pathName=None)¶ Set widget PATHNAME to be displayed instead of icon. Return the current value if None is given.
-
wm_manage
(widget)¶ The widget specified will become a stand alone top-level window. The window will be decorated with the window managers title bar, etc.
-
wm_maxsize
(width=None, height=None)¶ Set max WIDTH and HEIGHT for this widget. If the window is gridded the values are given in grid units. Return the current values if None is given.
-
wm_minsize
(width=None, height=None)¶ Set min WIDTH and HEIGHT for this widget. If the window is gridded the values are given in grid units. Return the current values if None is given.
-
wm_overrideredirect
(boolean=None)¶ Instruct the window manager to ignore this widget if BOOLEAN is given with 1. Return the current value if None is given.
-
wm_positionfrom
(who=None)¶ Instruct the window manager that the position of this widget shall be defined by the user if WHO is „user“, and by its own policy if WHO is „program“.
-
wm_protocol
(name=None, func=None)¶ Bind function FUNC to command NAME for this widget. Return the function bound to NAME if None is given. NAME could be e.g. „WM_SAVE_YOURSELF“ or „WM_DELETE_WINDOW“.
-
wm_resizable
(width=None, height=None)¶ Instruct the window manager whether this width can be resized in WIDTH or HEIGHT. Both values are boolean values.
-
wm_sizefrom
(who=None)¶ Instruct the window manager that the size of this widget shall be defined by the user if WHO is „user“, and by its own policy if WHO is „program“.
-
wm_state
(newstate=None)¶ Query or set the state of this widget as one of normal, icon, iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).
-
wm_title
(string=None)¶ Set the title of this widget.
-
wm_transient
(master=None)¶ Instruct the window manager that this widget is transient with regard to widget MASTER.
-
wm_withdraw
()¶ Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. Re-draw it with wm_deiconify.
-
-
ncdiff.launcher.
iter_except
(function, exception)¶ Work like builtin 2-argument iter(), but stops on exception.
-
ncdiff.launcher.
main
()¶ Start the GUI.
ncdiff.licenses module¶
Licence text for the various libraries.
- since
2012-02-10
-
ncdiff.licenses.
display_licenses
()¶ Display all necessary libraries and their authors.
This is needed because of several 3rd party imports and their license conditions.
ncdiff.main module¶
Diff tool for comparing report files.
- since
2012-02-10
-
class
ncdiff.main.
ConfigurationLocator
(reference_file, test_file)¶ Bases:
object
Main purpose of this class is to act as a kind of wrapper around the original NCDiff starting functionality.
Originally the starting procedure required to define a –configuration commandline parameter to let NCDiff know where to get all the necessary parameters for the comparison operations.
This class now tries to give the user another starting possibility. Instead of having to specifying the configuration file this starting mechanism tries to find the (maybe not known) configuration file based on the two files that are supposed to be compared. Commandline call:
ncdiff <referenceFilePath> <testFilePath>
B{NOTE}: this functionality only works when 2 requirements are met:
the environment variable NCDIFF_CFG_HOME has to point to a (root) directory where all the configuration files are located. Configuration files can be located in subdirectories. Configuration files have to have the ‚*.cfg‘ extension
the names of the files that have to be compared have to match the <old|new>FilePath specification within a TARGET. The search algorithm itself is completely based on file_name matching. There is support for know <old|new>FilePath features like placeholder, environment-variables, wildcards, … but there is no logic what so every that tries to use/interpret/match the content of the given files against a TARGET specification.
IF the file names DO NOT MATCH this FEATURE DOES NOT WORK !!!
If a matching TARGET within a configuration file was found the original starting functionality is implicitly called by simulating the commandline call:
ncdiff --configurations <found-configuration-file> --targets <found-matching-target>
In case there are multiple matching TARGETs only the very first one that matches will be called.
Another important fact is that this starting functionality has NO SUPPORT for any other commandline parameters except the two files!
-
reADJUSTMENT_PATTERN
= re.compile('(.+)!([+-]?\\d+)([smhdbwy])')¶
-
reCONFIG_FILES_EXTENSION
= '(?s:.*\\.cfg)\\Z'¶
-
reDATE_PATTERN
= re.compile('\\{(.+?)\\}')¶
-
sDATETIME_PLACEHOLDER
= '?'¶
-
sREGEX_ADJUSTMENT_PATTERN
= '(.+)!([+-]?\\d+)([smhdbwy])'¶
-
sREGEX_DATETIME_LENGTH
= '%s[\\w\\-]{%s}%s'¶
-
sREGEX_DATE_PATTERN
= '\\{(.+?)\\}'¶
-
start_ncdiff
()¶ Start the proceedings.
- Rückgabe
True .. in case a match was found and a Diff run was started False .. (Default) in case no match was found
- Rückgabetyp
bool
-
class
ncdiff.main.
NCDiff
¶ Bases:
object
The main class of the diff tool to read the configuration and start the diffing process.
-
static
create_log_handler
(directory)¶ Create a log handler that logs to the directory.
- Parameter
directory (
str
) – The target directory where the log file should be written to.- Rückgabe
The created log handler.
- Rückgabetyp
logging.LogHandler
-
static
find_configurations
(configurations_parameter)¶ Find all configurations which match the given pattern.
- Parameter
configurations_parameter (
list
) – given parameter ‚options[NCC.PARAM_CONFIGURATIONS]‘- Rückgabe
List with found configurations
- Rückgabetyp
list
-
static
pretty_print_error
(exception)¶ Pretty print an error message.
- Parameter
exception (
Error
) – The exception describing which part of validation went wrong.
-
static
process_target
(configuration_reader, target_name)¶ Perform the diff process of a single target.
This method is static to ensure that the process logic is only dependent on the configuration. :param configuration_reader: A configuration reader object that has read a configuration file. :type configuration_reader: configuration_reader :param target_name: The name for a target. :type target_name:
str
:return: dictionary with statistic data :rtype:dictionary str->int
-
start_diff
(options)¶ Start the diffing process.
- Parameter
options (
dict str->object
) – dictionary of given command line parameters.
-
static
-
ncdiff.main.
main
(calling_params, file_name)¶ Run the diff tool.
- Parameter
calling_params (
list of str
) – list of given command line parameters (from sys.argv)file_name (
str
) – file name to call the program
ncdiff.postprocessing module¶
Postprocessor step of the diff tool to do abitrary processing.
- since
2016-10-12
-
class
ncdiff.postprocessing.
StandardPostProcessor
(target_config)¶ Bases:
object
Default post processor which does no processing at all.
-
post_process
()¶ Post processing before a target, ocnfiguration or execution.
-
-
ncdiff.postprocessing.
create_configuration_postprocessor
(global_configuration)¶ Create the post processor for a given configuration.
- Parameter
global_configuration (
GlobalConfiguration
) – The global configuration of a configuration file.- Rückgabe
An implementation for a post processor.
- Rückgabetyp
-
ncdiff.postprocessing.
create_execution_postprocessor
(global_configuration)¶ Create the post processor for the whole diff execution.
- Parameter
global_configuration (
GlobalConfiguration
) – The global configuration of a configuration file.- Rückgabe
An implementation for a post processor.
- Rückgabetyp
-
ncdiff.postprocessing.
create_target_postprocessor
(target_configuration)¶ Create the post processor for a target.
- Parameter
target_configuration (
TargetConfiguration
) – The configuration of the diff target.- Rückgabe
An implementation for a post processor.
- Rückgabetyp
ncdiff.preprocessing module¶
Preprocessor step of the diff tool to do abitrary processing on targets or diff runs.
- since
2013-09-16
-
class
ncdiff.preprocessing.
StandardPreProcessor
(target_config)¶ Bases:
object
Default pre processor which does no processing at all.
-
pre_process
()¶ Pre processing before a target, ocnfiguration or execution.
-
-
ncdiff.preprocessing.
create_configuration_preprocessor
(global_configuration)¶ Create the pre processor for a given configuration.
- Parameter
global_configuration (
GlobalConfiguration
) – The global configuration of a configuration file.- Rückgabe
An implementation for a pre processor.
- Rückgabetyp
-
ncdiff.preprocessing.
create_execution_preprocessor
(global_configuration)¶ Create the pre processor for the whole diff execution.
- Parameter
global_configuration (
GlobalConfiguration
) – The global configuration of a configuration file.- Rückgabe
An implementation for a pre processor.
- Rückgabetyp
-
ncdiff.preprocessing.
create_target_preprocessor
(target_configuration)¶ Create the pre processor for a target.
- Parameter
target_configuration (
TargetConfiguration
) – The configuration of the diff target.- Rückgabe
An implementation for a pre processor.
- Rückgabetyp
ncdiff.result_filter module¶
Diff tool classes for filtering known differences, missing rows and found duplicated rows.
- since
10.04.2014
-
class
ncdiff.result_filter.
StandardResultInterpreter
(target_config)¶ Bases:
object
Default implementation of a class providing the functionality to filter all found differences of a diff-run.
Per design the so called „White-list“ of „Known differences“ is stored in an XLS file within the „ResultFilter“ worksheet. The file format of the XLS file, that is supported by the
StandardResultInterpreter
has to follow the following convention.The very first row is the header row:
[identification columns] - Column [1]: oldKey The unique key that identifies a row within the old row - Column [2]: newKey The unique key that identifies a new within the old row - Column [3]: oldColumnID The ID/Name of the column within the old row that should be affected by this filter - Column [4]: newColumnID The ID/Name of the column within the new row that should be affected by this filter - Column [5]: oldValue The value of that column within the old row - Column [6]: newValue The value of that column within the new row
All those identification columns can be specified on an optional basis. By specifying a more detailed identification criteria fewer specific differences might be affected. It is also possible to specify multiple different filter criteria onto the same sequence of keys/identification columns:
[filter columns] - Column [7]: diff() filter all differences regardless of their absolute or relative values abs_diff(value) filter only in case the specified value matches exactly the absolute difference abs_diff(low;high) filter only in case the found difference is within the absolute range of both specified value rel_diff(value) filter only in case the specified value matches exactly the relative difference rel_diff(low;high) filter only in case the found difference is within the relative range of both specified value Filtering of duplicate rows duplicate() filter all found duplicates regardless if they are found within new or old duplicate('new') filter only duplicates found within new duplicate('old') filter only duplicates found within old Filtering of missing rows missing() filter all found missings regardless if they are missing within new or old missing('new') filter all differences where there exists an old record but NO new one missing('old') filter all differences where there exists an new record but NO old one Filtering on cell values of the old an new input file contains(colRef;string) Value of the given cell contains the given string startswith(colRef;string) Value of the given cell starts with the given string endswith(colRef;string) Value of the given cell ends with the given string equals(colRef;string) Value of the given cell matches exactly the given string The column reference (colRef) can be old@colID new@colID The column id (colID) can be A column number. 1 is the first column. An XLS column name, like A, BA or similar. A string using the column name of the input file, like 'My Column'.
This White-list file can be specified with the „resultFilterFilePath“ configuration parameter on each configuration target
-
is_valid_difference
(key, old_col_position, new_col_position, comparison_type, abs_diff, rel_diff, old_row, new_row)¶ Functionality that checks if a found difference should be filtered (and therefore not presented to the user).
- Parameter
key (
str
) – unique key of both rowsold_col_position (
int
) – position/index of the row-column within the complete list of old columnsnew_col_position (
int
) – position/index of the row-column within the complete list of new columnscomparison_type (
str
) – String representing the comparison type that was performed to evaluate the difference.abs_diff (
float
) – number representing the absolute difference between the old and the new valuerel_diff (
float
) – number representing the relative difference between the old and the new valueold_row (
list
) – a list representing all the values of the current old rownew_row (
list
) – a list representing all the values of the current new row
- Rückgabe
A flag that indicates if the difference should be filtered or not True .. (Default) in case no or no matching filter was found False .. in case a matching ResultFilter was found
- Rückgabetyp
bool
-
is_valid_duplicate
(key, is_old_row, row)¶ Check if a found duplicate difference should be filtered from the results or not.
- Parameter
key (
str
) – unique key of both rowsrow (
list
) – a list representing all the values of the current old rowis_old_row (
bool
) – flag indicating if the missing difference was found either in the old row or in the new one
- Rückgabe
A flag that indicates if the duplicate difference should be filtered or not True .. (Default) and in case no or no matching filter was found False .. in case a matching DuplicateFilter was found
- Rückgabetyp
bool
-
is_valid_missing
(key, is_old_row, row, old_column_position=None, new_column_position=None)¶ Check if a found missing difference should be filtered from the results or not.
- Parameter
key (
str
) – unique key of both rowsis_old_row (
bool
) – flag indicating if the missing difference was found either in the old row or in the new onerow (
list
) – a list representing all the values of the current rowold_column_position (
int
) – position/index of the row-column within the complete list of old columnsnew_column_position (
int
) – position/index of the row-column within the complete list of new columns
- Rückgabe
A flag that indicates if the missing difference should be filtered or not True .. (Default) and in case no or no matching filter was found False .. in case a matching MissingFilter was found
- Rückgabetyp
bool
-
show_filtered_results
()¶ Return flag if filtered results should be displayed.
An indicator that returns the value of the „show_filtered_results“ configuration file setting belonging to the current target configuration. :return: flag indicating if result should be filtered at all
True .. in case results should be filtered False .. in case results should NOT be filtered
- Rückgabetyp
bool
-
-
class
ncdiff.result_filter.
StandardResultInterpreterReader
(has_header, input_path, worksheet_name=None, row_filter=None, append_row_nr=False)¶ Bases:
ncdiff.reader.xls.XLSReader
Default implementation of a ResultInterpreterReader that basically uses the default XLS Reader.
-
close
()¶ Free the worksheet.
-
get_information
()¶ Get XLS information.
Note: The dictionary values may be None if the file is empty or has no header. :return: A dictionary containing the column names, the number of columns
- and the size of the input file in bytes.
‚column_names‘: None
‚columnCount‘ : 11
‚size‘ : 123456
- Rückgabetyp
dict
-
has_header
()¶ Check if data has a header line.
- Rückgabe
True if the first line of a reader is a header.
- Rückgabetyp
bool
-
open
()¶ Open the xls file for reading.
-
reader
()¶ Iterate through the passed worksheet file and returns a single line for every calling.
- Rückgabe
iterable with column entries
- Rückgabetyp
array
-
-
ncdiff.result_filter.
create_result_interpreter
(target_configuration)¶ Create the ResultInterpreter for a given configuration.
The result interpreter is used to filter the diff result. As for all factory functions per default there is the lookup for a potential extension module implementation first and only in case nothing could be found the default implementation is used :param target_configuration: The configuration of the diff target. :type target_configuration:
TargetConfiguration
:return: An implementation for a ResultInterpreter orNone .. (Default) in case no ResultInterpreter is needed
- Rückgabetyp
- Verursacht
RuntimeError – In case target_configuration is not specified.
-
ncdiff.result_filter.
create_result_interpreter_reader
(target_configuration)¶ Create the ResultInterpreterReader.
The result interpreter reader reads the file containing the result filter rules. As for all factory functions per default there is the lookup for a potential extension module implementation first and only in case nothing could be found the default implementation is used :param target_configuration: The configuration of the diff target. :type target_configuration:
TargetConfiguration
:return: A reader instance to read the result filter input file. :rtype:BaseReader
:raise RuntimeException: In case the target_configuration is None
ncdiff.sorter module¶
File based merge sort, for huge files.
This code is based on the Python code recipe: http://code.activestate.com/recipes/576755-sorting-big-files-the-python-26-way/ :since: 2012-11-19
-
class
ncdiff.sorter.
BaseSorter
(input_reader, output_path, key_columns, csv_delimiter=';')¶ Bases:
object
Sort the input data and write it to an output file.
- Any sorter supports the context manager protocol, but does not support the iterator protocol. Example usage::
- with SomeSorter(….) as sorter:
sorter.sort()
-
close
()¶ Close all resources in use.
-
open
()¶ Open the output file for writing.
-
sort
()¶ Sort the lines received from reader and write them to the output file.
-
class
ncdiff.sorter.
FileBasedMergeSorter
(input_reader, output_path, key_columns, csv_delimiter=';', temp_dirs=None, chunk_num_lines=50000)¶ Bases:
ncdiff.sorter.BaseSorter
Sort the input file via file based merge sort.
Note: This sorter ist suitable for big input files, but slower, because the data is written and read twice.
Based on code posted by Scott David Daniels in c.l.p. http://groups.google.com/group/comp.lang.python/msg/484f01f1ea3c832d
-
close
()¶ Close the output file, close and remove the temporary files.
-
open
()¶ Open the output file for writing.
-
sort
()¶ Sort the lines received from reader and write them to the output file.
-
-
class
ncdiff.sorter.
InMemorySorter
(input_reader, output_path, key_columns, csv_delimiter=';')¶ Bases:
ncdiff.sorter.BaseSorter
Sort the input file in-memory.
Note: With huge files the sorter may run out of memory, because it needs to keep all rows in memory.
-
close
()¶ Close all resources in use.
-
open
()¶ Open the output file for writing.
-
sort
()¶ Sort the lines received from reader and write them to the output file.
-
-
ncdiff.sorter.
create_new_sorter
(target_configuration)¶ Create a sorter operating on the new input file.
- Parameter
target_configuration (configuration.TargetConfiguration) – The configuration for the diff target.
- Rückgabe
A sorter.
- Rückgabetyp
-
ncdiff.sorter.
create_old_sorter
(target_configuration)¶ Create a sorter operating on the old input file.
- Parameter
target_configuration (configuration.TargetConfiguration) – The configuration for the diff target.
- Rückgabe
A sorter.
- Rückgabetyp
-
ncdiff.sorter.
sort_new_input_file
(target_configuration)¶ Sort the new input file.
-
ncdiff.sorter.
sort_old_input_file
(target_configuration)¶ Sort the old input file.
ncdiff.statistics module¶
Diff tool statistic classes.
- since
2013-02-26
-
class
ncdiff.statistics.
OverallDiffStatistic
(whole_start_time)¶ Bases:
ncdiff.statistics.TargetStatistic
A statistics object to collect statistics of a complete diff run with multiple targets.
-
add_target_statistic
(target_statistic)¶ Add the statistics values of a target to the overall statistics.
- Parameter
target_statistic (
TargetStatistic
) – object of TargetStatistic with run information
-
property
diffs
¶ Get the differences counter property.
- Rückgabe
The differences count.
- Rückgabetyp
int
-
property
duplicate
¶ Get the duplicate counter property.
- Rückgabe
The missing in new file count.
- Rückgabetyp
int
-
get_matched_cells_percentage
()¶ Get the percentage of the matched cells for the target.
- Rückgabe
the percentage of the matched cells for the target.
- Rückgabetyp
float
-
get_matched_lines_percentage
()¶ Get the percentage of the matched lines for the target.
- Rückgabe
the percentage of the matched lines for the target.
- Rückgabetyp
float
-
get_statistic_values
()¶ Return the overall statistic values.
- Rückgabe
The statistic values for the target
- Rückgabetyp
list of dict
-
get_target_statistics
()¶ Return the target statistic values.
- Rückgabe
List of target statistic objects.
- Rückgabetyp
list of L{TargetStatistic
}
-
property
missing_new
¶ Get the missing in new file counter property.
- Rückgabe
The missing in new file count.
- Rückgabetyp
int
-
property
missing_old
¶ Get the missing in old file counter property.
- Rückgabe
The missing in old file count.
- Rückgabetyp
int
-
set_run_as_failed
()¶ Set the statistic values for a failed diff target run.
-
-
class
ncdiff.statistics.
TargetStatistic
(target)¶ Bases:
object
A statistic object to collect statistics per diff target.
-
property
diffs
¶ Get the differences counter property.
- Rückgabe
The differences count.
- Rückgabetyp
int
-
property
duplicate
¶ Get the duplicate counter property.
- Rückgabe
The missing in new file count.
- Rückgabetyp
int
-
get_matched_cells_percentage
()¶ Get the percentage of the matched cells for the target.
- Rückgabe
the percentage of the matched cells for the target.
- Rückgabetyp
float
-
get_matched_lines_percentage
()¶ Get the percentage of the matched lines for the target.
- Rückgabe
the percentage of the matched lines for the target.
- Rückgabetyp
float
-
get_statistic_values
()¶ Return the statistic values for the target.
- Rückgabe
The statistic values for the target
- Rückgabetyp
dict
-
property
missing_new
¶ Get the missing in new file counter property.
- Rückgabe
The missing in new file count.
- Rückgabetyp
int
-
property
missing_old
¶ Get the missing in old file counter property.
- Rückgabe
The missing in old file count.
- Rückgabetyp
int
-
set_run_as_failed
()¶ Set the statistic values for a failed diff target run.
-
property
ncdiff.utils module¶
Diff tool utility classes for various topics.
- Following Utility classes are available:
Date/Time handling
File handling
Column handling (Excel, index or name column convertions)
Special collections
- since
2012-08-12
-
class
ncdiff.utils.
CollectionUtils
¶ Bases:
object
Collection of useful function regarding to collections, storage, etc.
-
class
MultiKeyValueStorage
(key_names)¶ Bases:
object
A multi key storage.
- Purpose of this class is to provide an easy interface to a class that provides the following functionality:
- define a fixed set of keys (e.g: „A“,“B“,“C“)
the sequence of definition (within constructor) is the same sequence as specified in add() and get()
add payloads to the collection where parts of the fixed length keys may be None (e.g: A:1, B:2, C:None)
get payloads again by specifying the same keys, but also all the payloads that have equivalent lesser keys:
- e.g: add-> Payload1A:1, B:2, C:3
add-> Payload2 : A:2, B:None, C:None add-> Payload3 : A:None, B:2, C:None add-> Payload4 : A:1, B:2, C:None
get_cascade -> B:2 : Payload3 get_cascade -> A:1, B:2, C:3 : Payload1, Payload3 get_cascade -> A:1, B:2 : Payload4, Payload3
Currently there is no need for further manipulating functionality except initial add of payloads
-
class
Payload
(key_names, *args)¶ Bases:
object
Class the acts as an container for one or multiple values that are represented by a unique key-sequence.
Its main purpose is to provide the location where to store the actual values and act as an identification/key object within the MultiKeyValueStorage.
-
add_value
(value_)¶ Add a value to the payload.
- Parameter
value – an object representing a value that belongs to the key sequence represented by this
payload. :type value_:
object
-
get_values
()¶ Return the list of values belonging to this payload.
- Rückgabe
list of values
- Rückgabetyp
list
-
matches_key
(*args)¶ Check if the given key-sequence matches exactly the payloads key.
- Parameter
args – a list of objects representing the multi-key-sequence.
NOTE: the sequence has to match the sequence specified in the constructor! :type args: any type of object :return: True .. in case the payload matches the key,
False .. (Default) in case it doesn’t
- Rückgabetyp
bool
-
matches_key_part
(key_name, key_value)¶ Check if a part of the key-sequence matches.
- Parameter
key_name (
str
) – name of the key-part.key_value (
object
) – value that represents the key-parts value
- Rückgabe
True .. in case the payload matches the key, False .. (Default) in case it doesn’t
- Rückgabetyp
bool
-
matches_key_partially
(*args)¶ Evaluate the given key-sequence if it (at least) partially match the key of this payload.
If that is the case we consider this payload as valid in case of a cascading search :param args: a list of objects representing the multi-key-sequence NOTE: the sequence has to match the sequence specified in the constructor! :type args: any type of object :return: True .. in case the payload partially matches the key,
False .. (Default) in case it doesn’t
- Rückgabetyp
bool
-
-
add
(value_, *args)¶ Add a payload for a given key value sequence.
- Parameter
value (
object
) – an object that acts as the value of a multi-key/value combinationargs – a list of objects representing the multi-key-sequence.
NOTE: the sequence has to match the sequence specified in the constructor! :type args:
object
:return: integer representing the return code:0 .. (Default) success -1 .. amount of key parameters given to the function do not match the amount of keys or is empty -2 .. payload is none
- Rückgabetyp
int
-
get
(*args)¶ Get EXACTLY the payload object that represents the given key sequence.
- Parameter
args – list of parameters representing the multi-key-sequence that should be considered
NOTE: the sequence has to match the sequence specified in the constructor! :type args:
list of any kind of hashable object
:return: two-parts return value:[0] the payload object itself (if it was found) or None in case it was not found [1] return code (int) representing the success of the evaluation: 0 .. success -1 .. amount of key parameters given to the function do not match the amount of keys -2 .. no payload present for the given key
- Rückgabetyp
tuple of object, int
-
get_cascade
(*args)¶ Get all the CASCADING payloads represented by the given sequence of keys.
- Parameter
args – list of parameters representing the multi-key-sequence that should be considered.
NOTE: the sequence has to match the sequence specified in the constructor! :type args: list of any kind of hashable object :return: two-parts return value:
[0] the list of payloads that match the criteria or None in case there was a problem [1] return code (int) representing the success of the evaluation: 0 .. success -1 .. amount of key parameters given to the function do not match the amount of keys -2 .. no payload present for the given key
- Rückgabetyp
tuple of list of payload objects, int
-
class
-
class
ncdiff.utils.
ColumnUtils
¶ Bases:
object
Fun with column numbers.
-
static
column_id_to_number
(col_id, column_names)¶ Convert a column ID to a column number starting from 0.
- Parameter
col_id (
str
) – A string representing a number starting from 1 or an excel column name.column_names (
list of str
) – Names of the columns.
- Rückgabe
The column number as integer starting from 0.
- Rückgabetyp
int
-
static
excel_column_name_to_number
(col_name)¶ Convert an MS Excel column name to a number.
- Parameter
col_name (
str
) – An excel column name.- Rückgabe
The column number, starting from 0.
- Rückgabetyp
int
-
static
number_to_excel_column_name
(col_nr)¶ Convert a column number to an MS Excel column name.
- Parameter
col_nr (
int
) – The column number, starting from 0.- Rückgabe
An excel column name.
- Rückgabetyp
str
-
static
pf_col_nr
(col_nr)¶ Pretty format a column number.
- Parameter
col_nr (
int
) – The column number starting from 0.- Rückgabe
A string „ColumnNr[ExcelColumnName]“, for example: 3[C]
- Rückgabetyp
str
-
static
-
class
ncdiff.utils.
DateUtils
¶ Bases:
object
Date handling utility methods.
-
static
adjust_date_time
(datetime_, offset, scale)¶ Adjust the date and time by offset and scale.
- Parameter
datetime (
datetime
) – The datetime object which should be adjusted.offset (
int
) – the amount of the scale adjustmentscale (
char
) –s: the offset counts seconds
m: the offset counts minutes
h: the offset counts hours
d: the offset counts days
b: the offset counts simplified business days (only Mo-Fr)
w: the offset counts weeks
y: the offset counts years
- Rückgabe
The datetime object adjusted by offset and scale.
- Rückgabetyp
datetime
-
classmethod
format_date
(date_time, str_format='%Y-%m-%d')¶ Format a
datetime
object as string and returns it.- Parameter
date_time (
datetime
) – The date object.str_format (
str
) – The format string to convert the datetime to.
- Rückgabe
Returns a formatted
datetime
object as string.- Rückgabetyp
str
-
classmethod
format_time_delta
(time_delta)¶ Format a time delta.
- Rückgabe
A format string of time_delta objects in the form of: HH:MM:SS
- Rückgabetyp
str
-
classmethod
mk_date_time
(date_string, str_format='%Y-%m-%d')¶ Expect „YYYY-MM-DD“ string and generates a
datetime
object.- Parameter
date_string (
str
) – A date in string form.str_format (
str
) – The format string of the passed date.
- Rückgabe
A datetime object.
- Rückgabetyp
datetime
-
classmethod
mk_first_of_month
(date_time)¶ Return the first day of the current month as
datetime
object.- Parameter
date_time (
datetime
) – The current date.- Rückgabe
The date of the first day in the given month.
- Rückgabetyp
datetime
-
classmethod
mk_last_of_month
(date_time)¶ Return the last day of the current month as
datetime
object.- Parameter
date_time (
datetime
) – The current date.- Rückgabe
The date of the last day in the given month.
- Rückgabetyp
datetime
-
classmethod
reformat_date
(date_string, old_str_format='%Y-%m-%d', new_str_format='%Y-%m-%d')¶ Format a date string to another format.
- Parameter
date_string (
str
/datetime
) – A date in string form or from date_string type.old_str_format (
str
) – The format string of the passed date.new_str_format (
str
) – The format string of the output date.
- Rückgabe
returns a formatted
datetime
object as string.- Rückgabetyp
str
-
static
-
class
ncdiff.utils.
FileUtils
¶ Bases:
object
Utils class containing some helper methods for file manipulation.
-
class
FileInfo
(file_object=None, recursion_depth=- 1, base_directory=None)¶ Bases:
object
Class/Wrapper for providing information about a filesystem object.
There are lots of useful functions within this class that makes the info retrieval from files easier. There is currently NO file-manipulation capability implemented. Its main purpose is info retrieval. Furthermore a FileInfo object is on its own, it has no information/relations to other FileInfo objects. All functionality with filesystem objects relations have to be made externally Useful features:
it provide functions for calculating hashes of the files content
POSIX style permission string (‚xrwxrw—‘)
relative paths according to a specified base directory (that does need to be the root directory)
possibility to get the hierarchical level within a tree
datetime in ISO format (NDiffConstant.DEFAULT_DATETIME_FORMAT)
-
class
Type
¶ Bases:
object
Little helper class for distinguishing difference filesystem object types.
-
DIRECTORY
= 'Directory'¶
-
FILE
= 'File'¶
-
LINK
= 'Link'¶
-
-
get_abs_path
()¶ Get the absolute (full) path of the filesystem object within the filesystem.
- Rückgabe
Absolute path of the
FileInfo
object- Rückgabetyp
str
-
get_access_time
(dt_format='%Y-%m-%d %H:%M:%S')¶ Get the timestamp when the filesystem object was accessed the last time.
- Parameter
dt_format (
str
) – The optional timestamp format of the resulting string- Rückgabe
A string representing the filesystem objects last access time.
- Rückgabetyp
str
-
get_creation_time
(dt_format='%Y-%m-%d %H:%M:%S')¶ Get the timestamp when the filesystem object was created.
- Parameter
dt_format (
str
) – The optional timestamp format of the resulting string- Rückgabe
A string representing the filesystem objects creation time
- Rückgabetyp
str
-
get_depth
()¶ Get the depth of the filesystem object relative to the BaseDirectory.
- Rückgabe
A number representing the depth level relative to the root/BaseDirectory
- Rückgabetyp
int
-
get_extension
()¶ Get the files extension.
All the characters right to the very last dot ‚.‘ within the files base name. :return: Files extension :rtype:
str
-
get_group
()¶ Get the id of the users group owning the file system object.
- Rückgabe
Id of the group that owns the file
- Rückgabetyp
int
-
get_hash_value
()¶ Get the hashdigest representing the hash value of the filesystem object.
- Rückgabe
A string representing the hashdigest
- Rückgabetyp
str
-
get_mode
()¶ Get the file system permissions bits.
- Rückgabe
File system permission info.
- Rückgabetyp
int
-
get_modification_time
(dt_format='%Y-%m-%d %H:%M:%S')¶ Get the timestamp when the filesystem object was modified the last time.
- Parameter
dt_format (
str
) – The optional timestamp format of the resulting string.- Rückgabe
A string representing the filesystem objects last modification time.
- Rückgabetyp
str
-
get_name
()¶ Return the basename of the filesystem object.
- Rückgabe
Basename of the
FileInfo
object- Rückgabetyp
str
-
get_permissions
()¶ Get a string representing the file permissions in unix format „rwx-r-x–x“.
- Rückgabe
a string that represents the file permission in POSIX format.
- Rückgabetyp
str
-
get_rel_path
()¶ Get the path of the filesystem object relative to the given BaseDirecotry.
- Rückgabe
Relative path of the
FileInfo
object- Rückgabetyp
str
-
get_size
()¶ Get the size of the file.
- Rückgabe
Size of the file
- Rückgabetyp
int
-
get_type
()¶ Get the file system object type this object represents.
- Rückgabe
The type of filesystem object
- Rückgabetyp
FileInfo.Type
-
get_user
()¶ Get the id of the user owning the file system object.
- Rückgabe
Id of the user that owns the file.
- Rückgabetyp
int
-
is_directory
()¶ Check if this
FileInfo
is a directory.- Rückgabe
An indicator in case this is a directory True .. in case the
FileInfo
represents a directory False .. in all other cases- Rückgabetyp
bool
-
is_file
()¶ Check if this
FileInfo
is a file.- Rückgabe
An indicator in case this is a file True .. in case the
FileInfo
represents a file False .. in all other cases- Rückgabetyp
bool
-
is_link
()¶ Check if this
FileInfo
is a link.- Rückgabe
An indicator in case this is a link True .. in case the
FileInfo
represents a link False .. in all other cases- Rückgabetyp
bool
-
set_access_time
(access_time)¶ Set the last accessed time of the file system object.
- Parameter
access_time (
datetime
) – The creation timestamp of the filesystem object
-
set_creation_time
(creation_time)¶ Set the creation time of the file system object.
- Parameter
creation_time (
datetime
) – The creation timestamp of the filesystem object
-
set_depth
(depth)¶ Set the depth of the filesystem object relative to the BaseDirectory specified in the constructor.
- Parameter
depth (
int
) – The depth/level of the filesystem objects relative to the root/BaseDirectory
-
set_file_system_object
(file_system_object, base_directory=None)¶ File information initialization function.
This function tries to get all possible information about a given filesystem object. :param file_system_object: The location/path of the file system object :type file_system_object:
str
:param base_directory: Path of a base directory. All relative paths will be based on this instead of the real root directory. :type base_directory:str
-
set_group
(group_id)¶ Set the id of the group the owner belongs to.
- Parameter
group_id (
int
) – The group id within the filesystem.
-
set_hash_value
(hash_value)¶ Set the hashdigest that represents this
FileInfo
object.- Parameter
hash_value (
str
) – A string preferably extracted withFileUtils.calc_hash
-
set_mode
(mode)¶ Set the file system permissions bits of the current filesystem object.
- Parameter
mode (
int
) – File system permission
-
set_modification_time
(modification_time)¶ Set the last modification time of the file system object.
- Parameter
modification_time (
datetime
) – The creation timestamp of the filesystem object.
-
set_name
(file_path, base_directory=None)¶ Retrie the Name, AbsPath, RelPath and Extension of a filesystem object.
- Parameter
file_path (
str
) – The location/path of the file system objectbase_directory – Path of a base directory. All relative paths will be based on this instead of the
real root directory. :type base_directory:
str
-
set_size
(size)¶ Set the size of the file.
- Parameter
size (
int
) – Size of the filesystem object
-
set_type
(type_)¶ Set the type of the file system object this
FileInfo
object represents. File, Directory or Link.- Parameter
type (
FileInfo.Type
) – Type of the FileInfo object
-
set_user
(user_id)¶ Set the id of the user that owns the filesystem object.
- Parameter
user_id (
int
) – The users id within the filesystem.
-
static
calc_hash
(hash_lib_name, hash_block_size, file_object=None, file_path=None)¶ Calculate the hash value of a given file system object.
- Parameter
hash_lib_name (
str
) – Name of the hashlib that should be used (md5, sha1, sha512, … )hash_block_size (
int
) – Size of the blocks the file should be readfile_object (
file
) – File handlefile_path (
str
) – in case file_object is None at least the path to the file to read has to be provided.
- Rückgabe
The hexdigest of the files hash in case a valid file location was provide None … (Default) in case file location was not available
- Rückgabetyp
str
-
static
copy_input_files
(target_configuration)¶ Copy the input files of a target to the result directory.
- Parameter
target_configuration (
configuration.TargetConfiguration
) – The configuration of the target.
-
static
copy_result_filter
(target_configuration)¶ Copy the result filter of a target to the result directory.
- Parameter
target_configuration (
configuration.TargetConfiguration
) – The configuration of the target.
-
static
delete_new_sorted_input_file
(target_configuration)¶ Sort the new sorted input file.
-
static
delete_old_sorted_input_file
(target_configuration)¶ Sort the old sorted input file.
-
classmethod
ensure_directory
(file_name)¶ Ensure that the directories on the passed file path exist.
- Parameter
file_name (
str
) – A file name with an absolute path.
-
classmethod
format_size
(size_in_bytes)¶ Format the size in bytes.
- Rückgabe
A formatted size in human readable format.
- Rückgabetyp
str
-
classmethod
replace_place_holders
(value, now=None)¶ Replace the placeholders in a file path.
Following placeholders are supported: Datetime pattern:
{GENERIC_strftime_PATTERN}
{GENERIC_strftime_PATTERN!OFFSET}
where GENERIC_strftime_PATTERN is any pattern allowed for datetime.datetime.strftime(…) and OFFSET must match [+-]NUMBER[smhdbwy]: - the sign is optional - s: the NUMBER counts seconds - m: the NUMBER counts minutes - h: the NUMBER counts hours - d: the NUMBER counts days - b: the NUMBER counts simplified business days (only Mo-Fr) - w: the NUMBER counts weeks - y: the NUMBER counts years - ~/, ~username/: replaced/expanded by OS function - Environment variables like ${name} is replaced by OS function
Note: Patterns of the form { …. { …. } … } are not supported. :param value: The text which contains placeholders to replace. :type value:
str
:param now: The date and time considered as now. :type now:datetime
:return The passes string with the replaced tokens. :rtype:str
-
class
-
ncdiff.utils.
get_statistic_file
(result_dir: str) → Optional[str]¶ Search in the result directory for the statistic file.
It searches in following order HTML, XLSX, CSV, JUNIT and XRAY and returns the first found. :param result_dir: The result directory where the diff ans statistics files are. :return: The statistics file in the result directory.
-
ncdiff.utils.
open_file_viewer
(file_name: str) → None¶ Open the operation systems default viewer for the given file. :param file_name: The absolute file name of the file to open.
-
ncdiff.utils.
search_for_customer_implementation
(module_names, callable_name, *args, **kwargs)¶ Search for a callable in a list of customer module names that returns not None.
- Parameter
module_names (
list of str
) – A list of module names.callable_name (
str
) – The name of a callable object/function to look for.args (
list
) – Arguments passed to callable.kwargs (
dict
) – Keyword arguments passed to callable.
- Rückgabe
The first result from a callable with callable_name that was found in a list of module names
that is not None. :rtype:
object
-
ncdiff.utils.
unicode_escape
(text: str) → str¶ Escape a text with unicode. :param text: The text to escape. :return: The escaped text.
ncdiff.validator module¶
Module for validation of critical user input.
This logic simplifies the identification of wrong configurations by meaningful output to the logger. :since: 2012-09-04
-
class
ncdiff.validator.
BaseValidator
(**kwargs)¶ Bases:
object
Base class of all validators.
Each validation class follows the naming convention jobValidation provides a validate method.
-
validate
()¶ Validate the information.
- Verursacht
ValidationException – if the validation fails, if no ValidationException is raised
the validation is considered to be successful.
-
-
class
ncdiff.validator.
BasicTargetConfigurationValidator
(target_configuration)¶ Bases:
ncdiff.validator.BaseValidator
The class responsible for validating basic target configurations for a diff run.
-
validate
()¶ Call the different validation processes.
Once for the old and once for the new file and passes through all individual parameters as required.
-
-
class
ncdiff.validator.
ConfigurationExistsValidator
(configuration_location)¶ Bases:
ncdiff.validator.BaseValidator
Validate if a configuration location exists.
-
validate
()¶ Test if the configuration location exists.
- Verursacht
ValidationException – if the validation fails, if no ValidationException is raised
the validation is considered to be successful.
-
-
class
ncdiff.validator.
ConfigurationGlobalValidator
(global_configuration)¶ Bases:
ncdiff.validator.BaseValidator
The class responsible for validating basic target configurations for a diff run.
-
validate
()¶ Call the different validations to validate the global configuration.
-
-
class
ncdiff.validator.
ConfigurationsEqualValidator
(global_configs)¶ Bases:
ncdiff.validator.BaseValidator
Validate if the configurations are equal.
Equal means they have the same result formats and result directory configured.
-
validate
()¶ Test if the configurations have the same result formats and result directory.
- Verursacht
ValidationException – if the validation fails, if no ValidationException is raised
the validation is considered to be successful.
-
-
class
ncdiff.validator.
ConfigurationsFoundValidator
(configurations_pattern)¶ Bases:
ncdiff.validator.BaseValidator
Validate that glob find configurations for a given pattern (e.g. ‚ncdiff_*.cfg).
-
validate
()¶ Test if there are any files matching the given pattern.
- Verursacht
ValidationException – if the validation fails, if no ValidationException is raised
the validation is considered to be successful.
-
-
exception
ncdiff.validator.
IgnoreTargetError
(target_name, message)¶ Bases:
ncdiff.validator.ValidationError
Custom exception to show higher level that validated target should be ignored.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
ncdiff.validator.
TargetConfigurationValidator
(target_configuration)¶ Bases:
ncdiff.validator.BaseValidator
The class responsible for validating user configurations for a diff run.
-
validate
()¶ Call the different validation processes.
Once for the old and once for the new file and passes through all individual parameters as required.
-
-
exception
ncdiff.validator.
ValidationError
(error_type, *args, **kwargs)¶ Bases:
Exception
Custom exceptions class for handling of validation errors.
In addition to the error message this exception provides an errorType attribute.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
ncdiff.validator.
create_basic_target_configuration_validator
(target_configuration)¶ Create a validator that can verify that the configuration target is valid and can be used to create a diff.
- Parameter
target_configuration (
configuration.TargetConfiguration
) – The configuration of a diff target.- Rückgabe
The validator object.
- Rückgabetyp
-
ncdiff.validator.
create_configuration_exists_validator
(configuration_location)¶ Create a validator that can verify that the configuration exists at the configuration_location.
- Parameter
configuration_location – The location of the configuration.
Usually this will be the path to the configuration file. :type configuration_location:
str
:return: The validator object. :rtype:ConfigurationExistsValidator
-
ncdiff.validator.
create_configuration_global_validator
(global_configs)¶ Create a validator that can verify that the global section conatins only valid parameters.
- Parameter
global_configs (list of
configuration.GlobalConfiguration
) – The list of global configurations.- Rückgabe
The validator object.
- Rückgabetyp
-
ncdiff.validator.
create_configurations_equal_validator
(global_configs)¶ Create a validator that can verify that the configurations share the same basic configuration.
- Parameter
global_configs (list of
configuration.GlobalConfiguration
) – The list of global configurations.- Rückgabe
The validator object.
- Rückgabetyp
-
ncdiff.validator.
create_configurations_found_validator
(configurations_pattern)¶ Create a validator that can verify that glob find configurations for a given pattern (e.g. ‚ncdiff_*.cfg).
- Parameter
configurations_pattern – matching pattern for configurations
Usually this will be the pattern for configurations files. :type configurations_pattern:
str
:return: The validator object. :rtype:ConfigurationExistsValidator
-
ncdiff.validator.
create_target_configuration_validator
(target_configuration)¶ Create a validator that can verify that the configuration target is valid and can be used to create a diff.
- Parameter
target_configuration (
configuration.TargetConfiguration
) – The configuration of a diff target.- Rückgabe
The validator object.
- Rückgabetyp
Module contents¶
The ncdiff tool.