From 794fd4bdd57dc15e4488cb759877e91aaabd19fe Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 18 Nov 2024 01:03:56 +0900 Subject: [PATCH] Bump hacking hacking 3.0.x is too old. Bump it to the version currently used in mistral repo. Change-Id: I5483b461fe626f3dc2768ca0f8b78100c7e9c2a1 --- mistral_lib/utils/__init__.py | 32 ++++++++++++++++---------------- requirements.txt | 4 ---- test-requirements.txt | 6 +----- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/mistral_lib/utils/__init__.py b/mistral_lib/utils/__init__.py index 500e64b..f745222 100644 --- a/mistral_lib/utils/__init__.py +++ b/mistral_lib/utils/__init__.py @@ -180,7 +180,7 @@ def get_file_list(directory, package='mistral'): if path.isfile(path.join(base_path, f))] -def cut_dict(d, length=100): +def cut_dict(dict_data, length=100): """Removes dictionary entries according to the given length. This method removes a number of entries, if needed, so that a @@ -197,18 +197,18 @@ def cut_dict(d, length=100): be only approximately equal to the given value (up to around several chars difference). - :param d: A dictionary. + :param dict_data: A dictionary. :param length: A length limiting the dictionary string representation. :return: A dictionary which is a subset of the given dictionary. """ - if not isinstance(d, dict): - raise ValueError("A dictionary is expected, got: %s" % type(d)) + if not isinstance(dict_data, dict): + raise ValueError("A dictionary is expected, got: %s" % type(dict_data)) res = "{" idx = 0 - for key, value in d.items(): + for key, value in dict_data.items(): k = str(key) v = str(value) @@ -242,7 +242,7 @@ def cut_dict(d, length=100): else: res += "'%s'" % v if is_str else v - res += ', ' if idx < len(d) - 1 else '}' + res += ', ' if idx < len(dict_data) - 1 else '}' idx += 1 @@ -252,19 +252,19 @@ def cut_dict(d, length=100): return res -def cut_list(l, length=100): +def cut_list(list_data, length=100): """Truncates string representation of a list for a given length. - :param l: list to truncate + :param list_data: list to truncate :param length: amount of characters to truncate to :return: string containing given length of characters from the list """ - if not isinstance(l, list): - raise ValueError("A list is expected, got: %s" % type(l)) + if not isinstance(list_data, list): + raise ValueError("A list is expected, got: %s" % type(list_data)) res = '[' - for idx, item in enumerate(l): + for idx, item in enumerate(list_data): s = str(item) new_len = len(res) + len(s) @@ -279,7 +279,7 @@ def cut_list(l, length=100): break else: res += "'%s'" % s if is_str else s - res += ', ' if idx < len(l) - 1 else ']' + res += ', ' if idx < len(list_data) - 1 else ']' if 0 <= length <= len(res) and res[length - 1] != ']': res = res[:length - 3] + '...' @@ -287,17 +287,17 @@ def cut_list(l, length=100): return res -def cut_string(s, length=100): +def cut_string(str_data, length=100): """Truncates a string for a given length. :param s: string to truncate :param length: amount of characters to truncate to :return: string containing given length of characters """ - if 0 <= length < len(s): - return "%s..." % s[:length] + if 0 <= length < len(str_data): + return "%s..." % str_data[:length] - return s + return str_data def cut(data, length=100): diff --git a/requirements.txt b/requirements.txt index 0b1c906..b3503ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - eventlet!=0.20.1,>=0.20.0 # MIT oslo.log>=3.36.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index f9ee62f..f6935d8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,4 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 Pygments>=2.2.0 # BSD license coverage!=4.4,>=4.0 # Apache-2.0